I want to check SID and current database name.
I am using following query for checking oracle SID
select instance from v$thread;
bu
I presume SELECT user FROM dual; should give you the current user
SELECT user FROM dual;
and SELECT sys_context('userenv','instance_name') FROM dual; the name of the instance
SELECT sys_context('userenv','instance_name') FROM dual;
I believe you can get SID as SELECT sys_context('USERENV', 'SID') FROM DUAL;
SELECT sys_context('USERENV', 'SID') FROM DUAL;