DBA Utilities
Practical Oracle SQL for reviewing database status, instance information, configuration and operational details.
Useful checks for everyday DBA work
These read-only queries provide a quick operational view of an Oracle database before deeper administration or troubleshooting work begins.
Review database status
Check the database name, open mode, role and protection mode from the database instance.
SELECT
name,
db_unique_name,
open_mode,
database_role,
protection_mode,
log_mode
FROM v$database;Review instance information
Review the instance name, host, startup time and current instance status.
SELECT
instance_number,
instance_name,
host_name,
version,
status,
startup_time
FROM v$instance;Check Oracle version information
Review the database version and banner information reported by the Oracle instance.
SELECT
banner
FROM v$version
WHERE banner LIKE 'Oracle Database%';Review selected initialization parameters
Review initialization parameters that are often useful when establishing the current database configuration.
SELECT
name,
value,
isdefault,
issys_modifiable
FROM v$parameter
WHERE name IN (
'memory_target',
'memory_max_target',
'sga_target',
'sga_max_size',
'pga_aggregate_target',
'processes',
'sessions'
)
ORDER BY name;Review installed database components
Review database components and their current status. This can be useful when establishing the software features available in an environment.
SELECT
comp_id,
comp_name,
version,
status
FROM dba_registry
ORDER BY comp_id;Review recent instance startup
Check when the current instance started and calculate the approximate uptime from the current system time.
SELECT
instance_name,
startup_time,
ROUND(
(SYSDATE - startup_time),
2
) AS uptime_days
FROM v$instance;Establish the environment before changing it.
Operational checks are most useful when they establish the current database state before configuration changes, troubleshooting or maintenance activities are performed. Capture the relevant baseline first and interpret the results in the context of the environment.
