Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Is there an equivalent to MySQL SHOW DATABASES statement?

Is it possible to find databases in a cluster? i.e. databases present on the network on some other system?

Could I analyze the files present on an Oracle installation to find the same?

Given complete access credentials to an Oracle system how would you go about enumerating all the databases that exist?

share|improve this question
3  
Note also there is a terminology mismatch between MySQL and Oracle Database. In terms of architecture, Oracle has table->schema->database, and at the same time also table->tablespace->database. MySQL has simply table->database. So maybe you are really searching for Oracle schema list (think: SQL namespaces for tables) or Oracle tablespace list (think: groups of OS files for tables). –  kubanczyk Oct 29 '12 at 8:45
add comment

3 Answers 3

up vote 9 down vote accepted

Is there an equivalent to MySQL SHOW DATABASES statement?

There is no such thing. You can query listeners on a machine (lsnrctl status) to see what services are registered there, but that doesn't map one-to-one to database (and there could be multiple listeners on the same machine). Otherwise, the tools commonly used connect to one database instance, and an instance belongs to a single database.

If you're talking about Oracle RAC clusters, then each instance knows of its peers (other instances that service the same database) and you can find the other instances currently started for that database using the gv$instance view.
You can also use the crsctl utility to list the services (including databases) that are registered in the cluster, and their status.
If you're talking about another vendor's clustering software, I'm pretty sure they all have these types of resource management utilities to query.

If you're talking about just a bunch of machines, then no, there's no 100% reliable way of enumerating all databases on a network.

To find active (i.e. started) databases, look for *_pmon_* processes on Unix (there's one per database instance), and Oracle services on Windows.

To locate installations of Oracle database software, look at /etc/oratab on Unix. This should contain all the ORACLE_HOMEs installed. You can look inside each of those in $ORACLE_HOME/dbs for spfile<SID>.ora and/or init<SID>.ora files - there will be one for each database.

(I believe you can find the equivalent of the information in oratab in the Windows registry keys below HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE, but I don't know its structure.)

Now, of course, if you've registered all your database with an OEM (Enterprise Manager) server when you installed them, you can find the complete list there - but I guess if you're asking that's not the case.

share|improve this answer
add comment

Simply speaking, there is no direct analogy for MySQL 'databases' or a 'cluster' on Oracle: the closest match is a 'schema' but that is still very different.

This is apparently going to change in 12c with the introduction of pluggable databases:

Dividing the database operations cleanly from the user's content is a major transformation from traditional database architectures. Oracle 11g, and all its predecessors, could only run one database at a time, Kyte said. If an organization wanted to run multiple databases on a single server, it would need to run multiple instances of Oracle 11g, one for each database. As the name implies, pluggable databases allow multiple tenant databases to run under one copy of Oracle 12c.

share|improve this answer
    
Uh great, more complication, more job security... –  kubanczyk Nov 21 '12 at 15:03
add comment

Oracle has no databases but schemas, you can list them with

SELECT USERNAME FROM ALL_USERS ORDER BY USERNAME; 

or something like this :

SELECT TABLESPACE_NAME FROM USER_TABLESPACES;
share|improve this answer
    
Tablespaces are not linked to schemas in general. –  Mat Nov 7 '12 at 7:12
1  
ALL_USERS? USER_TABLESPACES? –  kubanczyk Nov 21 '12 at 14:55
    
"Is there an equivalent to MySQL SHOW DATABASES statement?" im trying to answers that question. dont say u dont know –  DevYudh Nov 23 '12 at 4:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.