|
oraenv的用法:
- [root@station90 桌面]# vim /etc/oratab
- [root@station90 桌面]# su - oracle
- [oracle@station90 ~]$ . oraenv
- ORACLE_SID = [orcl] ? rcat
- The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle
复制代码 监听器和pmon的关系:
- [oracle@station90 ~]$ ps aux | grep pmon
- oracle 1384 0.0 0.0 103304 2144 pts/3 S+ 19:59 0:00 grep pmon
- oracle 10691 0.0 0.2 478736 44016 ? Ss 19:20 0:00 asm_pmon_+ASM
- oracle 10858 0.0 0.3 6834040 48984 ? Ss 19:20 0:00 ora_pmon_orcl
- oracle 23180 0.0 0.3 1789856 49948 ? Ss 19:43 0:00 ora_pmon_rcat
- [oracle@station90 ~]$ lsnrctl services
- LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 14-NOV-2016 20:01:28
- Copyright (c) 1991, 2009, Oracle. All rights reserved.
- Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=station90.example.com)(PORT=1521)))
- Services Summary...
- Service "+ASM" has 1 instance(s).
- Instance "+ASM", status READY, has 1 handler(s) for this service...
- Handler(s):
- "DEDICATED" established:58 refused:0 state:ready
- LOCAL SERVER
- Service "orcl.example.com" has 1 instance(s).
- Instance "orcl", status READY, has 1 handler(s) for this service...
- Handler(s):
- "DEDICATED" established:53 refused:0 state:ready
- LOCAL SERVER
- Service "orclXDB.example.com" has 1 instance(s).
- Instance "orcl", status READY, has 1 handler(s) for this service...
- Handler(s):
- "D000" established:0 refused:0 current:0 max:1022 state:ready
- DISPATCHER <machine: station90.example.com, pid: 10896>
- (ADDRESS=(PROTOCOL=tcp)(HOST=station90.example.com)(PORT=26631))
- Service "rcat.example.com" has 1 instance(s).
- Instance "rcat", status READY, has 1 handler(s) for this service...
- Handler(s):
- "DEDICATED" established:0 refused:0 state:ready
- LOCAL SERVER
- Service "rcatXDB.example.com" has 1 instance(s).
- Instance "rcat", status READY, has 1 handler(s) for this service...
- Handler(s):
- "D000" established:0 refused:0 current:0 max:1022 state:ready
- DISPATCHER <machine: station90.example.com, pid: 23212>
- (ADDRESS=(PROTOCOL=tcp)(HOST=station90.example.com)(PORT=2751))
- The command completed successfully
复制代码 监听器的管理命令:
- [root@station90 桌面]# su - oracle
- [oracle@station90 ~]$ cd $TNS_ADMIN
- [oracle@station90 admin]$ pwd
- /u01/app/oracle/product/11.2.0/grid/network/admin
- [oracle@station90 admin]$ ls
- listener.ora listener.ora.bak.station90 samples shrept.lst
- [oracle@station90 admin]$ lsnrctl stop
- LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 14-NOV-2016 20:17:35
- Copyright (c) 1991, 2009, Oracle. All rights reserved.
- Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=station90.example.com)(PORT=1521)))
- The command completed successfully
- [oracle@station90 admin]$ crs_stat -t
- Name Type Target State Host
- ------------------------------------------------------------
- ora.DATA.dg ora....up.type ONLINE ONLINE station90
- ora.FRA.dg ora....up.type ONLINE ONLINE station90
- ora....ER.lsnr ora....er.type OFFLINE OFFLINE
- ora.asm ora.asm.type ONLINE ONLINE station90
- ora.cssd ora.cssd.type ONLINE ONLINE station90
- ora.diskmon ora....on.type ONLINE ONLINE station90
- ora.orcl.db ora....se.type ONLINE ONLINE station90
- [oracle@station90 admin]$ crs_stat -p | grep lsnr
- NAME=ora.LISTENER.lsnr
- [oracle@station90 admin]$ crsctl start res ora.LISTENER.lsnr
- CRS-2672: Attempting to start 'ora.LISTENER.lsnr' on 'station90'
- CRS-2676: Start of 'ora.LISTENER.lsnr' on 'station90' succeeded
- [oracle@station90 admin]$ lsnrctl services
- LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 14-NOV-2016 20:19:40
- Copyright (c) 1991, 2009, Oracle. All rights reserved.
- Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=station90.example.com)(PORT=1521)))
- Services Summary...
- Service "+ASM" has 1 instance(s).
- Instance "+ASM", status READY, has 1 handler(s) for this service...
- Handler(s):
- "DEDICATED" established:0 refused:0 state:ready
- LOCAL SERVER
- Service "orcl.example.com" has 1 instance(s).
- Instance "orcl", status READY, has 1 handler(s) for this service...
- Handler(s):
- "DEDICATED" established:0 refused:0 state:ready
- LOCAL SERVER
- Service "orclXDB.example.com" has 1 instance(s).
- Instance "orcl", status READY, has 1 handler(s) for this service...
- Handler(s):
- "D000" established:0 refused:0 current:0 max:1022 state:ready
- DISPATCHER <machine: station90.example.com, pid: 10896>
- (ADDRESS=(PROTOCOL=tcp)(HOST=station90.example.com)(PORT=26631))
- Service "rcat.example.com" has 1 instance(s).
- Instance "rcat", status READY, has 1 handler(s) for this service...
- Handler(s):
- "DEDICATED" established:0 refused:0 state:ready
- LOCAL SERVER
- Service "rcatXDB.example.com" has 1 instance(s).
- Instance "rcat", status READY, has 1 handler(s) for this service...
- Handler(s):
- "D000" established:0 refused:0 current:0 max:1022 state:ready
- DISPATCHER <machine: station90.example.com, pid: 23212>
- (ADDRESS=(PROTOCOL=tcp)(HOST=station90.example.com)(PORT=2751))
- The command completed successfully
- [oracle@station90 admin]$ srvctl stop listener
- [oracle@station90 admin]$ crs_stat -t
- Name Type Target State Host
- ------------------------------------------------------------
- ora.DATA.dg ora....up.type ONLINE ONLINE station90
- ora.FRA.dg ora....up.type ONLINE ONLINE station90
- ora....ER.lsnr ora....er.type OFFLINE OFFLINE
- ora.asm ora.asm.type ONLINE ONLINE station90
- ora.cssd ora.cssd.type ONLINE ONLINE station90
- ora.diskmon ora....on.type ONLINE ONLINE station90
- ora.orcl.db ora....se.type ONLINE ONLINE station90
- [oracle@station90 admin]$ srvctl start listener
- [oracle@station90 admin]$ crs_stat -t
- Name Type Target State Host
- ------------------------------------------------------------
- ora.DATA.dg ora....up.type ONLINE ONLINE station90
- ora.FRA.dg ora....up.type ONLINE ONLINE station90
- ora....ER.lsnr ora....er.type ONLINE ONLINE station90
- ora.asm ora.asm.type ONLINE ONLINE station90
- ora.cssd ora.cssd.type ONLINE ONLINE station90
- ora.diskmon ora....on.type ONLINE ONLINE station90
- ora.orcl.db ora....se.type ONLINE ONLINE station90
- [oracle@station90 admin]$ ls
- listener.ora listener.ora.bak.station90 samples shrept.lst
- [oracle@station90 admin]$ vim listener.ora
- [oracle@station90 admin]$ ls
- listener.ora listener.ora.bak.station90 samples shrept.lst
- [oracle@station90 admin]$ srvctl status listener
- 监听程序 LISTENER 已启用
- 监听程序 LISTENER 正在节点上运行: station90
- [oracle@station90 admin]$ srvctl stop listener
- [oracle@station90 admin]$ ls
- listener.ora listener.ora.bak.station90 samples shrept.lst
复制代码 交互式使用lsnrctl命令:
- LSNRCTL> help
- The following operations are available
- An asterisk (*) denotes a modifier or extended command:
- start stop status
- services version reload
- save_config trace spawn
- change_password quit exit
- set* show*
- LSNRCTL> set -h
- NL-00853: undefined set command "-h". Try "help set"
- LSNRCTL> help set
- The following operations are available after set
- An asterisk (*) denotes a modifier or extended command:
- password rawmode
- displaymode trc_file
- trc_directory trc_level
- log_file log_directory
- log_status current_listener
- inbound_connect_timeout startup_waittime
- save_config_on_stop dynamic_registration
- enable_global_dynamic_endpoint
- LSNRCTL> set current_listener l2
- Current Listener is l2
- LSNRCTL> status
- Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.90)(PORT=1522)))
- STATUS of the LISTENER
- ------------------------
- Alias L2
- Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
- Start Date 14-NOV-2016 21:16:17
- Uptime 0 days 0 hr. 12 min. 57 sec
- Trace Level off
- Security ON: Local OS Authentication
- SNMP OFF
- Listener Parameter File /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
- Listener Log File /u01/app/oracle/diag/tnslsnr/station90/l2/alert/log.xml
- Listening Endpoints Summary...
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.90)(PORT=1522)))
- Services Summary...
- Service "+ASM" has 1 instance(s).
- Instance "+ASM", status READY, has 1 handler(s) for this service...
- Service "orcl.example.com" has 2 instance(s).
- Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
- Instance "orcl", status READY, has 1 handler(s) for this service...
- Service "orclXDB.example.com" has 1 instance(s).
- Instance "orcl", status READY, has 1 handler(s) for this service...
- Service "rcat.example.com" has 2 instance(s).
- Instance "rcat", status UNKNOWN, has 1 handler(s) for this service...
- Instance "rcat", status READY, has 1 handler(s) for this service...
- Service "rcatXDB.example.com" has 1 instance(s).
- Instance "rcat", status READY, has 1 handler(s) for this service...
- The command completed successfully
- LSNRCTL> exit
复制代码 在演示环境中的网络配置文件:
listener.ora:
- # listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
- # Generated by Oracle configuration tools.
- L2 =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.90)(PORT = 1522))
- )
- SID_LIST_LISTENER =
- (SID_LIST =
- (SID_DESC =
- (GLOBAL_DBNAME = orcl.example.com)
- (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
- (SID_NAME = orcl)
- )
- (SID_DESC =
- (GLOBAL_DBNAME = rcat.example.com)
- (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
- (SID_NAME = rcat)
- )
- )
- ADR_BASE_L2 = /u01/app/oracle
- ENABLE_GLOBAL_DYNAMIC_ENDPOINT_L2 = ON
- LISTENER =
- (DESCRIPTION_LIST =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = IPC)(KEY = LISTENER))
- )
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.90)(PORT = 1521))
- )
- )
- ADR_BASE_LISTENER = /u01/app/oracle
- ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON
- SID_LIST_L2 =
- (SID_LIST =
- (SID_DESC =
- (GLOBAL_DBNAME = orcl.example.com)
- (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
- (SID_NAME = orcl)
- )
- (SID_DESC =
- (GLOBAL_DBNAME = rcat.example.com)
- (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
- (SID_NAME = rcat)
- )
- )
复制代码 服务器上的tnsnames.ora:
- # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/grid/network/admin/tnsnames.ora
- # Generated by Oracle configuration tools.
- RCAT =
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.90)(PORT = 1521))
- )
- (CONNECT_DATA =
- (SERVICE_NAME = rcat.example.com)
- )
- )
- ORCL =
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.90)(PORT = 1521))
- )
- (CONNECT_DATA =
- (SERVICE_NAME = orcl.example.com)
- )
- )
- fordb =
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.90)(PORT = 1521))
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.90)(PORT = 1522))
- )
- )
复制代码 windows上的tnsnames.ora:
- # tnsnames.ora Network Configuration File: C:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora
- # Generated by Oracle configuration tools.
- ORACLR_CONNECTION_DATA =
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
- )
- (CONNECT_DATA =
- (SID = CLRExtProc)
- (PRESENTATION = RO)
- )
- )
- DOG =
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.90)(PORT = 1521))
- )
- (CONNECT_DATA =
- (SERVICE_NAME = rcat.example.com)
- )
- )
- CAT =
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.90)(PORT = 1522))
- )
- (CONNECT_DATA =
- (SERVICE_NAME = orcl.example.com)
- )
- )
- WOLF =
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.90)(PORT = 1521))
- )
- (CONNECT_DATA =
- (SERVICE_NAME = orcl.example.com)
- )
- )
- TIGER =
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.90)(PORT = 1522))
- )
- (CONNECT_DATA =
- (SERVICE_NAME = rcat.example.com)
- )
- )
- UTFORCL =
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = station199)(PORT = 1521))
- )
- (CONNECT_DATA =
- (SERVER = DEDICATED)
- (SERVICE_NAME = utforcl.example.com)
- )
- )
- ORCL =
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = station199)(PORT = 1521))
- )
- (CONNECT_DATA =
- (SERVER = DEDICATED)
- (SERVICE_NAME = orcl.example.com)
- )
- )
复制代码 注册监听器到集群件:
- [oracle@station90 admin]$ srvctl add listener -l l2 -p TCP:1522
复制代码 注册数据库服务器到集群件:
- [oracle@station90 admin]$ srvctl add database -d rcat -o /u01/app/oracle/product/11.2.0/dbhome_1
复制代码 在演示环境中的实例参数设置:
rcat.example.com:
- SQL> alter system set local_listener=fordb;
- System altered.
复制代码 注册监听器到集群件:
- [oracle@station90 admin]$ srvctl add listener -l l2 -p TCP:1522
复制代码 注册数据库服务器到集群件:
- [oracle@station90 admin]$ srvctl add database -d rcat -o /u01/app/oracle/product/11.2.0/dbhome_1
复制代码 在演示环境中的实例参数设置:
rcat.example.com:
- SQL> alter system set local_listener=fordb;
- System altered.
复制代码 orcl.example.com:
- SQL> alter system set local_listener=fordb;
- System altered.
复制代码
|
|