?
Solved

How to find database name?

Posted on 2003-02-25
9
Medium Priority
?
36,943 Views
Last Modified: 2012-06-27
I know oracle provides database_name function (actually it is "dbms_standard.database_name") to get database name.

But this function may not installed on server by default, does any one know other way of finding database name?
0
Comment
Question by:sollala
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 8

Expert Comment

by:Danielzt
ID: 8021176
select * from sys.v_$database

select * from sys.v_$database where name='db_name'

tnsnames.ora
init.ora

windows: registry
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE

UNIX: $env  
look for ORACLE_SID





0
 

Author Comment

by:sollala
ID: 8021322
I need sql query, not from env. Above sql query will not work for normal user, needs dba access
0
 
LVL 1

Expert Comment

by:roberttran
ID: 8021935
create a view that contains info from v$database and grant select for that user.

Hope it helps.
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:sollala
ID: 8022085
My application will run on any DB and will not have DBA access to modify grants.
0
 
LVL 4

Accepted Solution

by:
asimkovsky earned 75 total points
ID: 8022232
Try this:

select ora_database_name
from dual;



Andrew
0
 
LVL 8

Expert Comment

by:Danielzt
ID: 8022267
try this:

select global_name from global_name;
0
 
LVL 7

Expert Comment

by:Fayyaz
ID: 8023125
1).Open init.ora initialization parameter file
and check db_name= "          "
parameter this will tell u the database name.

or check this query

2) connect sys/change_on_install;
   select name from v$database;

Hope this will help

Fayyaz
0
 

Expert Comment

by:rashidahmedkhan
ID: 8024340
Try this

select sys_context('userenv','db_name') from dual;

With warm regards
Rashid
0
 
LVL 2

Expert Comment

by:Datamonkey
ID: 8026660
all these things that have been said before work fine for users without any privileges:
select ora_database_name from dual;
select sys_context('userenv','db_name') from dual;
select global_name from global_name;

however, I don't understand the starting point of the question. dbms_standard should always be available in the database, it's created in dbmsstdx.sql which is one of the first things called by catproc.sql which should always have been run when the database was created.
If dbms_standard is not available, not being able to find out the database name should not be your greatest worry.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question