OCM_Session1_4_Client-side Network configuration
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)
$ vi sqlnet.oraMES.DIRECTORY_PATH=(tnsnames, ezconnect)
~"sqlnet.ora" 1L, 41C written $
监听重启,验证: $ 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$ 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$ 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$ 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$
重新注册一下SQL> alter system register2;
System altered.
$ cat sqlnet.ora MES.DIRECTORY_PATH=(tnsnames, ezconnect)
验证easy 连接http://docs.oracle.com/cd/B19306_01/network.102/b14212/naming.htm#i498306CONNECT username/password@[//]host[:port]
验证,可以连接SQL> connect system/oracle@//ocm1.localdomain:1521/PRODConnected.
[*]4.1.1 The prod alias should connect to the PROD instance using the default listener and always use a dedicated server connection.
参考联机文档:Net Services Reference ==> 6 Local Naming Parameters (tnsnames.ora)http://docs.oracle.com/cd/B19306_01/network.102/b14213/tnsnames.htm#sthref649
Example 6-1 Basic Format of tnsnames.ora File
Example
net_service_name=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sales1-svr)(PORT=1521))(ADDRESS=(PROTOCOL=tcp)(HOST=sales2-svr)(PORT=1521))(CONNECT_DATA= (SERVICE_NAME=sales.us.acme.com)))
修改后:
$ vi tnsnames.oraprod=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521))(CONNECT_DATA= (SERVICE_NAME=PROD) (SERVER=dedicated)))~验证连接:SQL> conn system/oracle@prodConnected.可以连接
[*]4.1.2 The prod_s alias should connect to the PROD instance using LSNR2 and use a shared server connection.
向刚创建的 tnsnames.ora添加prod_s,端口1526,PROD,shared$ vi tnsnames.ora prod=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521))(CONNECT_DATA= (SERVICE_NAME=PROD) (SERVER=dedicated)))
prod_s=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526))(CONNECT_DATA= (SERVICE_NAME=PROD) (SERVER=shared)))~~"tnsnames.ora" 14L, 291C written $
验证连接,可以连接SQL> conn system/oracle@prod_sConnected.
可查看是否使用shared服务连接:Reference--》V$SESSIONhttp://docs.oracle.com/cd/B19306_01/server.102/b14237/dynviews_2088.htm#i1414383
SERVERVARCHAR2(9)Server type (DEDICATED| SHARED| PSEUDO| NONE)
SQL> conn system/oracle@prod_sConnected.SQL> select sid,server from v$session;
SID SERVER---------- --------- 280 DEDICATED 282 DEDICATED 285 DEDICATED 288 SHARED 290 DEDICATED 291 DEDICATED 292 DEDICATED 293 DEDICATED 294 DEDICATED 295 DEDICATED 296 DEDICATED
SID SERVER---------- --------- 297 DEDICATED 298 DEDICATED 299 DEDICATED 300 DEDICATED
15 rows selected.
SQL> conn system/oracle@prodConnected.SQL> select sid,server from v$session;
SID SERVER---------- --------- 280 DEDICATED 282 DEDICATED 285 DEDICATED 288 DEDICATED 290 DEDICATED 291 DEDICATED 292 DEDICATED 293 DEDICATED 294 DEDICATED 295 DEDICATED 296 DEDICATED
SID SERVER---------- --------- 297 DEDICATED 298 DEDICATED 299 DEDICATED 300 DEDICATED
15 rows selected.
SQL>
[*] 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
向刚创建的tnsnames.ora添加内容racdb,端口1521$ vi tnsnames.ora prod=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521))(CONNECT_DATA= (SERVICE_NAME=PROD) (SERVER=dedicated)))
prod_s=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526))(CONNECT_DATA= (SERVICE_NAME=PROD) (SERVER=shared)))
racdb=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521))(CONNECT_DATA= (SERVICE_NAME=RACDB) (SERVER=dedicated)))~~~~"tnsnames.ora" 22L, 440C written $
[*] 4.3 The emrep alias should connect to the EMREP instance (created later) wiht a dedicated server connection.
$ vi tnsnames.ora prod=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521))(CONNECT_DATA= (SERVICE_NAME=PROD) (SERVER=dedicated)))
prod_s=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526))(CONNECT_DATA= (SERVICE_NAME=PROD) (SERVER=shared)))
racdb=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521))(CONNECT_DATA= (SERVICE_NAME=RACDB) (SERVER=dedicated)))
emrep=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521))(CONNECT_DATA= (SERVICE_NAME=EMREP) (SERVER=dedicated)))"tnsnames.ora" 30L, 589C written $
版权声明:本文为博主原创文章,未经博主允许不得转载。
页:
[1]