4. Client-side Network configuration 4.1 Create the client-side network configuration files providing connect descriptors to your databases using local naming and easy connect methods. 4.1.1 The prod alias should connect to the PROD instance using the default listener andalways use a dedicated server connection. 4.1.2 The prod_s alias should connect to the PROD instance using LSNR2 and use a shared serverconnection. 4.2 The racdb alias should connect to the RACDB service (created later) with a dedicated server connection. 4.2.1 The RACDB service will be running on your RAC Cluster 4.3 The emrep alias should connect to the EMREP instance (created later) wiht a dedicated server connection.
4.1 Create the client-side network configuration files providing connect descriptors to your databases using local namingand easy connect methods.
参考联机文档:Net Services Reference ==>5 Profile Parameters (sqlnet.ora)http://docs.oracle.com/cd/B19306_01/network.102/b14213/sqlnet.htm#sthref370NAMES.DIRECTORY_PATH
Purpose
Use the parameter NAMES.DIRECTORY_PATH to specify the order of the naming methods used for client name resolution lookups.
Default
NAMES.DIRECTORY_PATH=(tnsnames, onames, hostname)Values
Table 5-1 NAMES.DIRECTORY_PATH Values
Naming Method ValueDescriptiontnsnames (local naming namingmethod)Set to resolve a net service name through the tnsnames.ora fileon the client. See Also: Oracle Database Net Services Administrator's Guide
ldap (directory naming naming method)Set to resolve a database service name, net service name, or net servicealias through a directory server. See Also: Oracle Database Net Services Administrator's Guide ezconnect or hostname (easyconnect naming or host naming method)Select to enable clients to use a TCP/IP connect identifier, consisting of a host name and optional port and service name. See Also: Oracle Database Net Services Administrator's Guide
cds (CDS external naming method)Set to resolve an Oracle database name in a Distributed Computing Environment (DCE) environment. See Also: Oracle Database Advanced Security Administrator's Guide
nis (Network Information Service (NIS) external namingmethod)Set to resolve service information through an existing NIS. See Also: Oracle Database Net Services Administrator's Guide
NAMES.DIRECTORY_PATH=(tnsnames, ezconnect)
创建 sqlnet.ora,内容如下:NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
[oracle@ocm1 admin]$ vi sqlnet.oraMES.DIRECTORY_PATH=(tnsnames, ezconnect)
~"sqlnet.ora" [New] 1L, 41C written [oracle@ocm1 admin]$
监听重启,验证: [oracle@ocm1 admin]$ lsnrctl stop
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-MAR-2014 13:40:48
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521)))The command completed successfully[oracle@ocm1 admin]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-MAR-2014 13:40:58
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - ProductionSystem parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.oraLog messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener.logListening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521)))Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521)))STATUS of the LISTENER------------------------Alias LISTENERVersion TNSLSNR for Linux: Version 10.2.0.1.0 - ProductionStart Date 18-MAR-2014 13:40:59Uptime 0 days 0 hr. 0 min. 0 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.oraListener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.logListening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))Services Summary...Service "EMREP" has 1 instance(s). Instance "EMREP", status UNKNOWN, has 1 handler(s) for this service...Service "PROD" has 1 instance(s). Instance "PROD", status UNKNOWN, has 1 handler(s) for this service...Service "plsextproc" has 1 instance(s). Instance "plsextproc", status UNKNOWN, has 1 handler(s) for this service...The command completed successfully[oracle@ocm1 admin]$ lsnrctl stop lsnr2
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-MAR-2014 13:41:07
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526)))The command completed successfully[oracle@ocm1 admin]$ lsnrctl start lsnr2
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-MAR-2014 13:41:21
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - ProductionSystem parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.oraLog messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/lsnr2.logListening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526)))Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc1)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526)))STATUS of the LISTENER------------------------Alias lsnr2Version TNSLSNR for Linux: Version 10.2.0.1.0 - ProductionStart Date 18-MAR-2014 13:41:21Uptime 0 days 0 hr. 0 min. 0 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.oraListener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/lsnr2.logListening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc1)))The listener supports no servicesThe command completed successfully[oracle@ocm1 admin]$
重新注册一下SQL> alter system register 2 ;
System altered.
[oracle@ocm1 admin]$ cat sqlnet.ora MES.DIRECTORY_PATH=(tnsnames, ezconnect)