SELECT
INSTANCE_NAME,
HOST_NAME,
VERSION || '-' || EDITION AS VERSION,
floor((SYSDATE - startup_time)*60*60*24) AS UPTIME,
decode(status,'STARTED',1,'MOUNTED',2,'OPEN',3,'OPEN MIGRATE',4, 0) AS STATUS,
decode(archiver,'STOPPED',1,'STARTED',2,'FAILED',3, 0) AS  ARCHIVER,
decode(instance_role,'PRIMARY_INSTANCE',1,'SECONDARY_INSTANCE',2, 0) AS  INSTANCE_ROLE
FROM v$instance;