概述
service_names参数可指定一个或者多个名称,中间用“,”分割,在监听中使用,对外提供服务
客户端连接数据库服务器时,可指定service_name
---------------实验过程如下---------------
[oracle@rac1 oracle]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 23 12:57:11 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL>
SQL>
SQL> show parameter service
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string oradb
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
[oracle@rac1 oracle]$ lsnrctl
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 23-JAN-2013 13:01:29
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> status
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER_RAC1
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 23-JAN-2013 09:47:13
Uptime 0 days 3 hr. 14 min. 17 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/ora102/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /home/oracle/ora102/product/10.2.0/db_1/network/log/listener_rac1.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=139.0.0.211)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=139.0.0.11)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status BLOCKED, has 1 handler(s) for this service...
Service "+ASM_XPT" has 1 instance(s).
Instance "+ASM1", status BLOCKED, has 1 handler(s) for this service...
Service "oradb" has 2 instance(s).
Instance "oradb1", status READY, has 2 handler(s) for this service...
Instance "oradb2", status READY, has 1 handler(s) for this service...
Service "oradb_XPT" has 2 instance(s).
Instance "oradb1", status READY, has 2 handler(s) for this service...
Instance "oradb2", status READY, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL> exit
[oracle@rac1 oracle]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 23 13:01:45 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL>
SQL> show parameter service
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string oradb
SQL> alter system set service_names=oradb,aaa scope=memory;
System altered.
SQL>
SQL>
SQL>
SQL> alter system register;
System altered.
SQL>
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
[oracle@rac1 oracle]$
[oracle@rac1 oracle]$
[oracle@rac1 oracle]$
[oracle@rac1 oracle]$ lsnrctl
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 23-JAN-2013 13:03:39
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> status
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER_RAC1
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 23-JAN-2013 09:47:13
Uptime 0 days 3 hr. 16 min. 27 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/ora102/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /home/oracle/ora102/product/10.2.0/db_1/network/log/listener_rac1.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=139.0.0.211)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=139.0.0.11)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status BLOCKED, has 1 handler(s) for this service...
Service "+ASM_XPT" has 1 instance(s).
Instance "+ASM1", status BLOCKED, has 1 handler(s) for this service...
Service "AAA" has 2 instance(s).
Instance "oradb1", status READY, has 2 handler(s) for this service...
Instance "oradb2", status READY, has 1 handler(s) for this service...
Service "oradb" has 2 instance(s).
Instance "oradb1", status READY, has 2 handler(s) for this service...
Instance "oradb2", status READY, has 1 handler(s) for this service...
Service "oradb_XPT" has 2 instance(s).
Instance "oradb1", status READY, has 2 handler(s) for this service...
Instance "oradb2", status READY, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL> restart
NL-00853: undefined command "restart". Try "help"
LSNRCTL> stop
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully
LSNRCTL> start
Starting /home/oracle/ora102/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /home/oracle/ora102/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /home/oracle/ora102/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1)(PORT=1521)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 23-JAN-2013 13:03:56
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/ora102/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /home/oracle/ora102/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1)(PORT=1521)))
The listener supports no services
The command completed successfully
LSNRCTL> exit
[oracle@rac1 oracle]$
[oracle@rac1 oracle]$
[oracle@rac1 oracle]$
[oracle@rac1 oracle]$ lsnrctl
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 23-JAN-2013 13:04:23
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> status
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 23-JAN-2013 13:03:56
Uptime 0 days 0 hr. 1 min. 47 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/ora102/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /home/oracle/ora102/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status BLOCKED, has 1 handler(s) for this service...
Service "+ASM_XPT" has 1 instance(s).
Instance "+ASM1", status BLOCKED, has 1 handler(s) for this service...
Service "AAA" has 2 instance(s).
Instance "oradb1", status READY, has 2 handler(s) for this service...
Instance "oradb2", status READY, has 1 handler(s) for this service...
Service "oradb" has 2 instance(s).
Instance "oradb1", status READY, has 2 handler(s) for this service...
Instance "oradb2", status READY, has 1 handler(s) for this service...
Service "oradb_XPT" has 2 instance(s).
Instance "oradb1", status READY, has 2 handler(s) for this service...
Instance "oradb2", status READY, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL>
------------------配置客户端tnsnames.ora-----------------------
AAA=
(DESCRIPTION=
(LOAD_BALANCE=yes)
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=rac1-vip)
(PORT=1521)
)
(ADDRESS=
(PROTOCOL=TCP)
(HOST=rac2-vip)
(PORT=1521)
)
)
(CONNECT_DATA=
(SERVER=dedicated)
(SERVICE_NAME=aaa)
)
)
------------------客户端连接测试-----------------------
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\Administrator>sqlplus system/password@aaa
SQL*Plus: Release 10.2.0.4.0 - Production on 星期三 1月 23 13:29:45 2013
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23382569/viewspace-753450/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/23382569/viewspace-753450/