7 February 2011

How to find name of a database in Oracle

You can use any of these commands:
  • SQL> Select name from v$database;
  • SQL> select instance_name from v$instance;
  • SQL> select * from global_name;
  • SQL> SELECT VALUE FROM V$PARAMETER WHERE NAME='db_name';
  • SQL> select to_number(translate(substr(version,1,9),'1.$','1')) from v$instance;
  • SQL> select s.machine from v$session s where s.audsid userenv('sessionid');
  • SQL> select global_name from global_name;

No comments:

Post a Comment