代码改变世界

Oracle: What is the ORACLE_SID and DB_NAME name ?

2011-08-11 15:35  Tracy.  阅读(289)  评论(0编辑  收藏  举报

Query the views v$database and v$thread.

    V$DATABASE gives DB_NAME
    V$THREAD gives ORACLE_SID

If ORACLE_SID = DB_SID and db_name = DBNAME:

To find the current value of ORACLE_SID:

    SVRMGR> select instance from v$thread;

    INSTANCE
    ----------------
    DB_SID

To find the current value of DB_NAME:

    SVRMGR> select name from v$database;

    NAME
    ---------
    DBNAME