Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I want to list all database names, but not getting any command to do so, please help...

thanks in advance
Posted
Updated 18-Feb-18 10:55am

SQL
1) To view database

select * from v$database;

2) To view instance

select * from v$instance;

3) To view all users

select * from all_users;


4) To view table and columns for a particular user

select tc.table_name Table_name
,tc.column_id Column_id
,lower(tc.column_name) Column_name
,lower(tc.data_type) Data_type
,nvl(tc.data_precision,tc.data_length) Length
,lower(tc.data_scale) Data_scale
,tc.nullable nullable
FROM all_tab_columns tc
,all_tables t
WHERE tc.table_name = t.table_name;
 
Share this answer
 
Comments
djrocks0101 29-Mar-12 5:37am    
I want the list of database names..not current db which is in use...Please help..
I think you need to read up on the Oracle concepts[^], concentrating on Instance, Database and Schema.

To find out which instances is running on your server: /bin/ps -ef | grep ora_pmon | grep -v grep
If you have a Windows server you'll get the same information at Administrative Tools > Services.

SQL
select owner from dba_tables
union
select owner from dba_views;

Will get you schemas/users who actually have existing tables/views.

SQL
select username from dba_users;

Will give all the existing users/schemas that could potentially own database objects.
 
Share this answer
 
Comments
Member 11745200 6-Jun-15 6:40am    
Is there any oracle query which gives you database, instances, users and privileges by running single query?
To check databases with location execute this command from OS prompt $cat /etc/oratab
 
Share this answer
 
Comments
CHill60 18-Feb-18 15:54pm    
Stick to answering new questions where the OP still needs help. Nearly 6 years after the question was posted you've added nothing to the thread

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900