Wednesday, 4 June 2014

Database uptime and startup time / Lost clone in DB

/* Formatted on 6/4/2014 2:28:17 PM (QP5 v5.115.810.9015) */
SELECT 'Hostname : ' || host_name "Host name",
       'Instance Name : ' || instance_name "Instance Name",
       'Started At : ' || TO_CHAR (startup_time, 'DD-MON-YYYY HH24:MI:SS')
          "Startup Time",
       'Uptime : ' || FLOOR (SYSDATE - startup_time) || ' days(s) '
       || TRUNC(24
                * ( (SYSDATE - startup_time) - TRUNC (SYSDATE - startup_time)))
       || ' hour(s) '
       || MOD (TRUNC(1440
                     * ( (SYSDATE - startup_time)
                        - TRUNC (SYSDATE - startup_time))),
               60
          )
       || ' minute(s) '
       || MOD (TRUNC(86400
                     * ( (SYSDATE - startup_time)
                        - TRUNC (SYSDATE - startup_time))),
               60
          )
       || ' seconds'
          "Uptime"
FROM v$instance


No comments:

Post a Comment