当前位置:Gxlcms > 数据库问题 > ORACLE_SID、DB_NAME、INSTANCE_NAME、DB_DOMIAN、GLOBAL_NAME区分

ORACLE_SID、DB_NAME、INSTANCE_NAME、DB_DOMIAN、GLOBAL_NAME区分

时间:2021-07-01 10:21:17 帮助过:23人阅读

DB_NAMEINSTANCE_NAMEDB_DOMIANGLOBAL_NAMESOracle中几个重要的参数,而且也比较容易混淆,下面给出这些参数的具体描述。

   

一、SIDORACLE_SID

    SID的全称为site identifierOracle_SID则为Oracle site identifier.

    下面引用Tom(Thomas Kyte)的一段话来解释Oracle_SID

   

        If you’re unfamiliar with the term SID or ORACLE_SID, a full definition is called for. The SID is a site identifier. It and ORACLE_HOME (where the Oracle software is installed) are hashed together in UNIX to create a unique key name for attaching an SGA. If your ORACLE_SID or ORACLE_HOME is not set correctly, you’ll get the ORACLE NOT AVAILABLE error, since you can’t attach to a shared memory segment that is identified by    this unique key. On Windows, shared memory isn’t used in the same fashion as UNIX, but the SID is still  important. You can have more than one database on the same ORACLE_HOME, so you need a way to uniquely identify each one, along with their configuration files.

       

    即:在Unix系统中,SIDORACLE_HOME在一起哈希后得到一个唯一的值作为SGAkey

        oracle实例启动时,在操作系统上的fork进程则根据Oracle_SID来创建相关后台进程。

        Oracle 11g 支持Oracle_SID的长度为12位,db_name的长度为8

       

    作用:

        用于区别同一台主机上不同的Oracle实例

        决定实例所启动后台进程的名称。(实例由SGA和后台进程组成)

        决定了参数文件的名称。如spfile<ORACLE_SID>.ora,init<ORACLE_SID>.ora

        决定后台进程产生的相关跟踪文件、日志文件等。

alert_<ORACLE_SID>.log,<ORACLE_SID>_arc1_<spid>.trc,<SID>_ora_<SPID>.trc

        同一主机上不同的$ORACLE_HOME,可以创建相同的ORACLE_SID

        由此可以得出

            ORACLE_HOME相同时,可以使用不同的ORACLE_SID

            ORACLE_HOME不同时,可以使用相同的ORACLE_SID     

 

        [oracle@robinson ~]$ export ORACLE_SID=orcl   --设定ORACLE_SIDorcl

        [oracle@robinson ~]$ sqlplus / as sysdba;

 

        SQL*Plus: Release 10.2.0.1.0 - Production on Wed Sep 1 09:46:36 2010

 

        Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

        Connected to an idle instance.

 

        SQL> startup nomount;

        ORACLE instance started.

 

        Total System Global Area  469762048 bytes

        Fixed Size                  1220048 bytes

        Variable Size             117441072 bytes

        Database Buffers          348127232 bytes

        Redo Buffers                2973696 bytes

       

        SQL> ho ps -ef | grep oracle   --ORACLE_SID参与了后台进程命名

        oracle    3272     1  0 09:46 ?        00:00:00 ora_pmon_orcl

        oracle    3274     1  0 09:46 ?        00:00:00 ora_psp0_orcl

        oracle    3276     1  1 09:46 ?        00:00:00 ora_mman_orcl

        oracle    3278     1  0 09:46 ?        00:00:00 ora_dbw0_orcl

        oracle    3280     1  0 09:46 ?        00:00:00 ora_lgwr_orcl

        oracle    3282     1  0 09:46 ?        00:00:00 ora_ckpt_orcl

        oracle    3284     1  0 09:46 ?        00:00:00 ora_smon_orcl

        ---------............部分结果省略.............. --------------

 

二、INSTANCE_NAME

    用于标识数据库实例的名称,缺省值通常为ORACLE_SID

    用于和操作系统之间联系,根据实例名产生的响应的实例来取得与数据库的交互

    初始化参数中INSTANCE_NAMEORACLE_SID可以不同

    不同的实例可以拥有相同的INSTANCE_NAME,只要ORACLE_SID不同,则与ORACLE_HOME哈希可以得到不同的值

    INSTANCE_NAME可以用于向监听器动态注册

 

    [oracle@robinson ~]$ cp $ORACLE_HOME/dbs/initorcl.ora $ORACLE_HOME/dbs/initscott.ora

    [oracle@robinson ~]$ export ORACLE_SID=scott           --设定ORACLE_SIDscott

    [oracle@robinson ~]$ env | grep ORA

    ORACLE_SID=scott

    ORACLE_BASE=/u01/app/oracle

    ORACLE_HOME=/u01/app/oracle/10g

    [oracle@robinson ~]$ sqlplus / as sysdba 

 

    SQL*Plus: Release 10.2.0.1.0 - Production on Wed Sep 1 10:04:59 2010

 

    Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

    Connected to an idle instance.

 

    SQL> startup nomount;                                 --启动实例scott

    ORACLE instance started.

 

    Total System Global Area  469762048 bytes

    Fixed Size                  1220048 bytes

    Variable Size             134218288 bytes

    Database Buffers          331350016 bytes

    Redo Buffers                2973696 bytes

   

    SQL> show parameter instance_name;                 

 

    NAME                                 TYPE        VALUE

    ------------------------------------ ----------- ------------------------------

    instance_name                        string      scott

 

    SQL> ho ps -ef | grep scott     --可以看到后台以scott命名的进程

    oracle    3489     1  0 10:05 ?        00:00:00 ora_pmon_scott

    oracle    3491     1  0 10:05 ?        00:00:00 ora_psp0_scott

    oracle    3493     1  0 10:05 ?        00:00:00 ora_mman_scott

    oracle    3495     1  0 10:05 ?        00:00:00 ora_dbw0_scott

    oracle    3497     1  0 10:05 ?        00:00:00 ora_lgwr_scott

    oracle    3499     1  0 10:05 ?        00:00:00 ora_ckpt_scott

    ---------............部分结果省略.............. --------------

 

    SQL> ho ps -ef | grep ora --此时可以看到后台启动了orclscott两个实例

    oracle    3445     1  0 10:01 ?        00:00:00 ora_pmon_orcl

    oracle    3447     1  0 10:01 ?        00:00:00 ora_psp0_orcl

    oracle    3449     1  0 10:01 ?        00:00:00 ora_mman_orcl

    oracle    3451     1  0 10:01 ?        00:00:00 ora_dbw0_orcl

    oracle    3453     1  0 10:01 ?        00:00:00 ora_lgwr_orcl

    oracle    3455     1  0 10:01 ?        00:00:00 ora_ckpt_orcl

    oracle    3457     1  0 10:01 ?        00:00:00 ora_smon_orcl

    oracle    3497     1  0 10:05 ?        00:00:00 ora_lgwr_scott

    oracle    3499     1  0 10:05 ?        00:00:00 ora_ckpt_scott

    oracle    3501     1  0 10:05 ?        00:00:00 ora_smon_scott

    oracle    3503     1  0 10:05 ?        00:00:00 ora_reco_scott

    oracle    3505     1  0 10:05 ?        00:00:00 ora_cjq0_scott

    oracle    3507     1  0 10:05 ?        00:00:00 ora_mmon_scott

    ---------............部分结果省略.............. --------------

 

    SQL>select*from dual;

 

    ADDR           INDX    INST_ID D

    -------- ---------- ---------- -

    0C4B2FD4          0          1 X

 

    --用于向监听器动态注册

    SQL> ho lsnrctl status

 

    LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 01-SEP-2010 12:30:13

    --------------------------部分省略---------------------------------------

    Listener Parameter File   /u01/app/oracle/10g/network/admin/listener.ora

    Listener Log File         /u01/app/oracle/10g/network/log/listener.log

    Listening Endpoints Summary...

      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))

      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=robinson.com)(PORT=1521)))

    Services Summary...

    Service "PLSExtProc" has 1 instance(s).--服务名PLSExtProc及实例名PLSExtProc

      Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

    Service "orcl" has 1 instance(s).

      Instance "orcl", status READY, has 1 handler(s) for this service...

    Service "orclXDB" has 1 instance(s).  --服务名orcl_XDB,实例名为orcl

      Instance "orcl", status READY, has 1 handler(s) for this service...

    Service "orcl_XPT" has 1 instance(s).--服务名orcl_XPT,实例名为orcl

      Instance "orcl", status READY, has 1 handler(s) for this service...

    The command completed successfully

 

三、DB_NAME

    数据库的唯一标识,是一个不超过8个字符的文本串

在创建数据库时定义,被记录在数据文件、控制文件和日志文件当中。

    用于实例与数据库的挂接,通常缺省的情况下,INSTANCE_NAME

人气教程排行