DBAtlas · Database operations atlas

Show version and uptime

Oracle

SELECT banner_full FROM v$version;
SELECT startup_time, ROUND(SYSDATE - startup_time, 1) AS up_days
FROM v$instance;

v$instance also provides instance details such as status and host_name.

PostgreSQL

SELECT version();
SELECT pg_postmaster_start_time() AS started,
       now() - pg_postmaster_start_time() AS uptime;

server_version_num is handy for numeric comparison (e.g. 160002 = 16.2).

MySQL

SELECT VERSION();
SHOW GLOBAL STATUS LIKE 'Uptime';  -- seconds

Uptime is in seconds; divide by 86400 to get days.

SQL Server

SELECT @@VERSION;
SELECT sqlserver_start_time,
       DATEDIFF(DAY, sqlserver_start_time, GETDATE()) AS up_days
FROM sys.dm_os_sys_info;

SERVERPROPERTY('ProductVersion') and ('Edition') give version/edition details.

MongoDB

db.version()
db.serverStatus().uptime   // seconds

serverStatus() also includes host, process and connections information.

Redis

INFO server
# redis_version and uptime_in_seconds / uptime_in_days lines

INFO server also provides os, run_id and tcp_port information.

Open in DBAtlas →