sollala
asked on
How to find database name?
I know oracle provides database_name function (actually it is "dbms_standard.database_na me") to get database name.
But this function may not installed on server by default, does any one know other way of finding database name?
But this function may not installed on server by default, does any one know other way of finding database name?
ASKER
I need sql query, not from env. Above sql query will not work for normal user, needs dba access
create a view that contains info from v$database and grant select for that user.
Hope it helps.
Hope it helps.
ASKER
My application will run on any DB and will not have DBA access to modify grants.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
try this:
select global_name from global_name;
select global_name from global_name;
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
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
Try this
select sys_context('userenv','db_ name') from dual;
With warm regards
Rashid
select sys_context('userenv','db_
With warm regards
Rashid
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.
select ora_database_name from dual;
select sys_context('userenv','db_
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.
select * from sys.v_$database where name='db_name'
tnsnames.ora
init.ora
windows: registry
HKEY_LOCAL_MACHINE\SOFTWAR
UNIX: $env
look for ORACLE_SID