Checking oracle sid and database name

前端 未结 6 1135
滥情空心
滥情空心 2020-12-07 09:07

I want to check SID and current database name.

I am using following query for checking oracle SID

select instance from v$thread;

bu

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-07 09:39

    Just for completeness, you can also use ORA_DATABASE_NAME.

    It might be worth noting that not all of the methods give you the same output:

    SQL> select sys_context('userenv','db_name') from dual;
    
    SYS_CONTEXT('USERENV','DB_NAME')
    --------------------------------------------------------------------------------
    orcl
    
    SQL> select ora_database_name from dual;
    
    ORA_DATABASE_NAME
    --------------------------------------------------------------------------------
    ORCL.XYZ.COM
    
    SQL> select * from global_name;
    
    GLOBAL_NAME
    --------------------------------------------------------------------------------
    ORCL.XYZ.COM
    

提交回复
热议问题