List databases / schemas
Oracle
-- Schemas (users):
SELECT username FROM dba_users ORDER BY username;
-- Multitenant (CDB) PDBs:
SELECT name, open_mode FROM v$pdbs;In Oracle a 'database' corresponds to the instance; the separation is at the schema (user) level or the PDB level inside a CDB.
PostgreSQL
SELECT datname FROM pg_database WHERE datistemplate = false;
-- psql shortcut: \lFor schemas: SELECT schema_name FROM information_schema.schemata;
MySQL
SHOW DATABASES;In MySQL, 'database' and 'schema' are synonyms.
SQL Server
SELECT name, state_desc FROM sys.databases ORDER BY name;state_desc shows the database state, such as ONLINE/OFFLINE/RESTORING.
MongoDB
show dbs
// or: db.adminCommand({ listDatabases: 1 })Empty databases (no data written yet) do not appear in the list.
Redis
INFO keyspace
# db0:keys=..., db1:keys=... lines show the logical DBs in useRedis has numbered logical DBs (default 0-15); in Cluster mode only DB 0 is used.