博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
OCA读书笔记(6) - 配置Oracle网络环境
阅读量:6495 次
发布时间:2019-06-24

本文共 3680 字,大约阅读时间需要 12 分钟。

6.Configuring the Oracle Network Environment

su - grid

装grid时自动创建了监听
netca--创建新的监听

vi $ORACLE_HOME/network/admin/listener.ora

启动监听时会进行回环测试,如果注释掉127.0.0.1则不能启动监听。

服务:
动态配置服务
alter system set service_names='orcl','easthome';
alter system register;

静态配置服务

listener.ora
lsnrctl reload

客户端配置:

需要先安装oracle客户端
netca 配置连接方法
vi $ORACLE_HOME/network/admin/sqlnet.ora
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

netca 配置本地网络服务名

vi $ORACLE_HOME/network/admin/tnsnames.ora
CLIENT_SERVICE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.7)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.8)(PORT = 1521)) -- 故障转移
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)

tns ping不检测服务名,只验证ip和端口号。

一个单独的监听器可以服务于多个数据库实例以及成百上千个客户端连接。

Prompt syntax:

LSNRCTL> <command name>
LSNRCTL> start
LSNRCTL> stop
Command-line syntax:
$ lsnrctl <command name>
$ lsnrctl start
$ lsnrctl stop
$ lsnrctl status
SRVCTL syntax:
$ srvctl -h
$ srvctl start listener
$ srvctl stoplistener
$ srvctl start listener -l mylistener
$ srvctl status listener

Resolving connection Information

Easy connect naming: Uses a TCP/IP connect string
CONNECT username/password@host[:port][/service_name]
SQL> connect hr/hr@stu1:1521/db01

$ sqlplus scott/tiger@stu1:1521/db01

Local naming: Uses a local configuration file
stores connect descriptiors in tnsnames.ora
SQL> connect hr/hr@db01
Directory naming: Uses a centralized LDAP-compliant directory server
SQL> connect hr/hr@db01
External naming: Uses a supported non-oracle naming service
Testing Oracle Net Connectivity
Supports easy connect names resolution:
tnsping stu1:1521/db01
Supports local and directory naming:
tnsping db01

1) Server(Listener) configuration files:

listener.ora:
# listener.ora Network Configuration File: /u01/app/grid/product/11.2.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =

  (SID_LIST =
    (SID_DESC =
      (SID_NAME = db01)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db)
      (GLOBAL_DBNAME = orcl3) --静态配置的服务名
    )

    (SID_DESC =

      (SID_NAME = +ASM)
      (ORACLE_HOME = /u01/app/grid/product/11.2.0/grid)
      (GLOBAL_DBNAME = orcl4) --静态配置的服务名
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = stu1)(PORT = 1521))
    )
  )
ADR_BASE_LISTENER = /u01/app/grid
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON              # line added by Agent

动态配置 

sqlplus / as sysdba;

alter system set service_names='orcl','easthome','db01'

动态注册:

alter system register;立即出发PMON进程

或者等待PMON进程自动将service_name注册到监听

lsnrctl stop
lsnrctl start
如果还没有看到服务,说明PMON还没有到达其工作周期

静态配置

需要编辑配置文件
数据库关闭时只能静态注册。
动态注册可以实现基于服务的负载均衡,在RAC中。

sqlnet.ora:
# sqlnet.ora Network Configuration File: /u01/app/grid/product/11.2.0/grid/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
ADR_BASE = /u01/app/grid
2) Client configuration files:

tnsnames.ora:
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
DB01 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = stu1)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = db01)
    )
  )
3) CONNECT TO ANOTHER DATABASE
tnsnames.ora:
REMOTE_ORCL =
  (DESCRIPTION =
    (ADDRESS =
      (PROTOCOL = TCP)
      (HOST = host02.example.com)
      (PORT = 1521)
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl.example.com)
    )
  )
SQL*Plus:
CONNECT hr/hr@orcl;
CREATE DATABASE LINK remote
CONNECT TO HR IDENTIFIED BY HR
USING 'REMOTE_ORCL';
SELECT * FROM employees@remote;

4. Enterprise Management

$ emctl start dbconsole

https://stu1:1158/em

转载于:https://www.cnblogs.com/thlzhf/p/3357841.html

你可能感兴趣的文章
友盟自动更新
查看>>
OSD的主要实现方法和类型(转)
查看>>
JComboBox
查看>>
【转】Android下编译jni库的二种方法(含示例) -- 不错
查看>>
DoubleViewPager
查看>>
Android上成功实现了蓝牙的一些Profile
查看>>
基于jQuery图片自适应排列显示代码
查看>>
NEURAL NETWORKS, PART 1: BACKGROUND
查看>>
jquery对同级的td做radio限制
查看>>
Delphi XE5 常用功具与下载
查看>>
存储过程由结构表生成表
查看>>
C# 批处理制作静默安装程序包
查看>>
柯南君:看大数据时代下的IT架构(5)消息队列之RabbitMQ--案例(Work Queues起航)...
查看>>
2015 Multi-University Training Contest 2 1002 Buildings
查看>>
java 产生的固体物的基础上 增删改的SQL声明
查看>>
在自己的网站添加关注新浪关注按钮
查看>>
【MySQL笔记】mysql来源安装/配置步骤和支持中国gbk/gb2312编码配置
查看>>
一句话的设计模式(转)
查看>>
(剑指Offer)面试题54:表示数值的字符串
查看>>
Centos下安装mysql 总结
查看>>