ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle *names

Oracle *names

原创 Linux操作系统 作者:ygzhou518 时间:2011-12-14 10:30:39 0 删除 编辑

GLOBAL_DBNAME 、DB_UNIQUE_NAME、DB_NAME、SERVICE_NAME、SERVICE_NAMES之間相互關系

當前環境:

  • ORACLE_SID=ygzhou
    [oracle@ygzhou518]$ env |grep ORA
    ORACLE_SID=ygzhou
    ORACLE_BASE=/u01/app/oracle
    ORACLE_HOSTNAME=ygzhou518
    ORACLE_TERM=xterm
    ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
  • INSTANCE_NAME=ygzhou
    SQL> select instance_name from v$instance;
          INSTANCE_NAME
    --------------------------
             ygzhou
  • DB_NAME=ygzhou
    SQL> select name from v$database;
             NAME
    --------------------------
            YGZHOU
  • DB_UNIQUE_NAME=ygzhou
    SQL> show parameter db_unique_name;
     NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ----------
    db_unique_name                       string      ygzhou
  • SERVICE_NAMES=ygzhou
    SQL> show parameter service_names;
     
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ----------
    service_names                        string      ygzhou    

[grid@ygzhou518 admin]$ strings listener.ora
# listener.ora Network Configuration File: /u01/app/grid/product/11.2.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = ygzhou518)(PORT = 2013))
    )
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = ygzhoudg)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
      (SID_NAME = ygzhou)
    )
ADR_BASE_LISTENER = /u01/app/grid
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON              # line added by Agent

[oracle@ygzhou518 admin]$ strings tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
YGZHOU =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ygzhou518)(PORT = 2013))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ygzhou)
    ))
YGZHOUDG =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ygzhou518)(PORT = 2013))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ygzhoudg)
    ))

1、GLOBAL_DBNAME、SERVICE_NAME and SERVICE_NAMES

[oracle@standbyDB admin]$ sqlplus system/system@ygzhou
 
SQL*Plus: Release 11.2.0.1.0 Production on Wed Dec 14 02:31:32 2011
 
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
 
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor

[oracle@standbyDB admin]$ sqlplus system/system@ygzhoudg
 
SQL*Plus: Release 11.2.0.1.0 Production on Wed Dec 14 02:31:49 2011
 
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
 
 
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
結論:GLOBAL_DBNAME、SERVICE_NAME 與SERVICE_NAMES沒有直接關系、只要保證listener.ora與tnsname.ora中的global_dbname=service_name;

2、DB_UNIQUE_NAME、DB_NAME AND SERVICE_NAMES

[grid@ygzhou518 admin]$ lsnrctl status
 LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 14-DEC-2011 02:37:38
 Copyright (c) 1991, 2009, Oracle.  All rights reserved.
 Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                14-DEC-2011 02:14:05
Uptime                    0 days 0 hr. 23 min. 33 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/grid/product/11.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/standbyDB/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ygzhou518)(PORT=2013)))
Services Summary...
Service "ygzhoudg" has 1 instance(s).
  Instance "ygzhou", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

SQL> alter system set db_unique_name=target scope=spfile;

[grid@ygzhou518 admin]$ lsnrctl status
 LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 14-DEC-2011 02:37:38
 Copyright (c) 1991, 2009, Oracle.  All rights reserved.
 Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                14-DEC-2011 02:14:05
Uptime                    0 days 0 hr. 23 min. 33 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/grid/product/11.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/standbyDB/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ygzhou518)(PORT=2013)))
Services Summary...
Service "ygzhoudg" has 1 instance(s).
  Instance "ygzhou", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

SQL> show parameter db_unique_name;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ----------------
db_unique_name                       string      TARGET
SQL>
SQL> show parameter service_name;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ----------------
service_names                        string      TARGET
SQL>

結論:service_names=db_unique_name

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24867586/viewspace-713273/,如需转载,请注明出处,否则将追究法律责任。

下一篇: RMAN Manager
请登录后发表评论 登录
全部评论

注册时间:2011-02-11

  • 博文量
    167
  • 访问量
    360204