zoukankan      html  css  js  c++  java
  • 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 and always use a dedicated server connection.
      4.1.2 The prod_s alias should connect to the PROD instance using LSNR2 and use a shared server connection.
     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 naming and easy connect methods.
    参考联机文档:
    Net Services Reference ==>5 Profile Parameters (sqlnet.ora)

    NAMES.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 Value Description
    tnsnames (local naming naming method) Set to resolve a net service name through the tnsnames.ora file on 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 service alias through a directory server.

    See Also: Oracle Database Net Services Administrator's Guide

    ezconnect or hostname (easy connect 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 naming method) 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.ora
    MES.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 - Production
    System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
    Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
    Listening 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                     LISTENER
    Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
    Start Date                18-MAR-2014 13:40:59
    Uptime                    0 days 0 hr. 0 min. 0 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
    Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
    Listening 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 - Production
    System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
    Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/lsnr2.log
    Listening 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                     lsnr2
    Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
    Start Date                18-MAR-2014 13:41:21
    Uptime                    0 days 0 hr. 0 min. 0 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
    Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/lsnr2.log
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc1)))
    The listener supports no services
    The command completed successfully
    [oracle@ocm1 admin]$ 

    重新注册一下
    SQL> alter system register
      2  ;

    System altered.

    [oracle@ocm1 admin]$ cat sqlnet.ora 
    MES.DIRECTORY_PATH=(tnsnames, ezconnect)


    验证easy 连接
    CONNECT username/password@[//]host[:port][/service_name]

    验证,可以连接
    SQL> connect system/oracle@//ocm1.localdomain:1521/PROD
    Connected.

    •   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)

    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)))

    修改后:

    [oracle@ocm1 admin]$ vi tnsnames.ora
    prod=
    (DESCRIPTION=
      (ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521))
      (CONNECT_DATA=
       (SERVICE_NAME=PROD)
       (SERVER=dedicated)))
    ~
    验证连接:
    SQL> conn system/oracle@prod
    Connected.
    可以连接


    • 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
    [oracle@ocm1 admin]$ 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                                                                                                
    [oracle@ocm1 admin]$ 

    验证连接,可以连接
    SQL> conn system/oracle@prod_s
    Connected.

    可查看是否使用shared服务连接:
    Reference--》V$SESSION

    SERVER VARCHAR2(9) Server type (DEDICATED| SHARED| PSEUDO| NONE)

    SQL> conn system/oracle@prod_s
    Connected.
    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@prod
    Connected.
    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
    [oracle@ocm1 admin]$ 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                                                                                                
    [oracle@ocm1 admin]$ 


    •  4.3 The emrep alias should connect to the EMREP instance (created later) wiht a dedicated server connection. 

    [oracle@ocm1 admin]$ 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                                                                                                
    [oracle@ocm1 admin]$ 

  • 相关阅读:
    Unix命令大全
    vs2008 与 IE8出现的兼容性问题
    Java 创建文件、文件夹以及临时文件
    如何修改Wamp中mysql默认空密码
    PAT 乙级真题 1003.数素数
    Tags support in htmlText flash as3
    DelphiXE4 FireMonkey 试玩记录,开发IOS应用 还是移植
    10 Great iphone App Review sites to Promote your Apps!
    HTML tags in textfield
    Delphi XE4 IOS 开发, "No eligible applications were found“
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13315898.html
Copyright © 2011-2022 走看看