Home » SQL & PL/SQL » SQL & PL/SQL » How to find database name from sqlplus prompt
How to find database name from sqlplus prompt [message #187338] Sat, 12 August 2006 04:59 Go to next message
sv.venkat
Messages: 12
Registered: July 2006
Location: HYDERABAD
Junior Member
Dear members,
Pl.let me know How to find database name from sqlplus prompt.
Thank you.
VENKAT
Re: How to find database name from sqlplus prompt [message #187341 is a reply to message #187338] Sat, 12 August 2006 05:58 Go to previous messageGo to next message
khosravi
Messages: 68
Registered: April 2006
Member
run this script
select * from global_name;
Re: How to find database name from sqlplus prompt [message #187345 is a reply to message #187338] Sat, 12 August 2006 07:32 Go to previous messageGo to next message
rabhavani
Messages: 8
Registered: June 2006
Location: HYDERABAD
Junior Member

Hi Venkat,

Simply u can run this query to find the database name

select name from v$database;

Thanks
Bhavani
Re: How to find database name from sqlplus prompt [message #187391 is a reply to message #187338] Sun, 13 August 2006 04:38 Go to previous messageGo to next message
youthsen
Messages: 45
Registered: August 2006
Member
hi khosravi/rabhavani

khosravi, your command is working.

SQL> select * from global_name;

GLOBAL_NAME
-----------------------------------------
ORACLE.WORLD



from above output. is oracle.world a database name?. why i am asking this since i am newcomer to oracle. pls ans me.

rabhavani, your command is not working. it shows following error.

SQL> select name from v$database;
select name from v$database
                 *
ERROR at line 1:
ORA-00942: table or view does not exist



thanks for all
Re: How to find database name from sqlplus prompt [message #187403 is a reply to message #187338] Sun, 13 August 2006 10:57 Go to previous messageGo to next message
Yasir Hashmi
Messages: 304
Registered: April 2006
Senior Member
whats ur log ID?
Re: How to find database name from sqlplus prompt [message #187593 is a reply to message #187338] Mon, 14 August 2006 10:24 Go to previous messageGo to next message
youthsen
Messages: 45
Registered: August 2006
Member
hi Yasir Hashmi

username : scott
password : tiger
Re: How to find database name from sqlplus prompt [message #187868 is a reply to message #187593] Wed, 16 August 2006 02:06 Go to previous message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
This should work:
SQL> select sys_context('USERENV','DB_NAME') x
  2  from dual
  3  /


MHE
Previous Topic: Declare private attribute of Object type
Next Topic: required query
Goto Forum:
  


Current Time: Sun Dec 04 04:19:44 CST 2016

Total time taken to generate the page: 0.10831 seconds