How to display databases in Oracle 11g using SQL*Plus
SELECT NAME FROM v$database;
shows the database name in oracle
You can think of a MySQL "database" as a schema/user in Oracle. If you have the privileges, you can query the DBA_USERS
view to see the list of schemas:
SELECT * FROM DBA_USERS;
Oracle does not have a simple database model like MySQL or MS SQL Server. I find the closest thing is to query the tablespaces and the corresponding users within them.
For example, I have a DEV_DB tablespace with all my actual 'databases' within them:
SQL> SELECT TABLESPACE_NAME FROM USER_TABLESPACES;
Resulting in:
SYSTEM SYSAUX UNDOTBS1 TEMP USERS EXAMPLE DEV_DB
It is also possible to query the users in all tablespaces:
SQL> select USERNAME, DEFAULT_TABLESPACE from DBA_USERS;
Or within a specific tablespace (using my DEV_DB tablespace as an example):
SQL> select USERNAME, DEFAULT_TABLESPACE from DBA_USERS where DEFAULT_TABLESPACE = 'DEV_DB';
ROLES DEV_DB
DATAWARE DEV_DB
DATAMART DEV_DB
STAGING DEV_DB