in reply to Re: [OT] Get the database name in Oracle
in thread [OT] Get the database name in Oracle

Well, from erix response, above, I tried the following in sql*plus and it worked: select name from v$database; It'll print the database you're currently loged in.
  • Comment on Re^2: [OT] Get the database name in Oracle

Replies are listed 'Best First'.
Re^3: [OT] Get the database name in Oracle
by Anonymous Monk on Dec 22, 2008 at 10:31 UTC
    it is not working for me! :( Here is the output when I tried in SQL plus window: SQL> select name from v$database; select name from v$database * ERROR at line 1: ORA-00942: table or view does not exist
      You don't have the permissions to read v$database. Hint: grant select to this view or do the "dba" role to user (at your own risk)
      Try this one : select ora_database_name from dual;

        You're late, the thread is almost 10 years old, and that answer came in 6 years ago;-)

      I am also facing same problem
        this view need to be granted from DBA. SELECT SUBSTR (GLOBAL_NAME, 1, INSTR (GLOBAL_NAME, '.') - 1) FROM GLOBAL_NAME ;
      You might haven't connected to any database yet.