Checking oracle sid and database name

前端 未结 6 1137
滥情空心
滥情空心 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:29

    If, like me, your goal is get the database host and SID to generate a Oracle JDBC url, as

    jdbc:oracle:thin:@:1521:
    

    the following commands will help:

    Oracle query command to check the SID (or instance name):

    select sys_context('userenv','instance_name') from dual; 
    

    Oracle query command to check database name (or server host):

    select sys_context('userenv', 'server_host') from dual;
    

    Att. Sergio Marcelo

提交回复
热议问题