Thursday, October 8, 2009

Display database name

-- This script will display database name, open mode and whether its configured in archivelog or noarchive log 

select name, open_mode, log_mode from v$database;

example o/p:
SQL> select name,open_mode,log_mode from v$database;

NAME      OPEN_MODE  LOG_MODE
--------- ---------- ------------
ORCL      READ WRITE NOARCHIVELOG
SQL>
 
Some times when we log in to non-system user account we wont be able to access the v$database view, if we want to know to which database we have connected before implementing the change you can easily get it from "golbal_name"
 
SQL> select * from global_name;

GLOBAL_NAME
-----------------------------------------------------------------
ORCL.REGRESS.RDBMS.DEV.US.ORACLE.COM

SQL>

No comments:

Post a Comment