Skip to main content

12c. Monthly Database Growth from OEM 12c.

SELECT alloc.TARGET_NAME,TO_DATE(TO_CHAR(alloc.timestamp, 'MON RR'), 'MON RR') AS CALENDAR_MONTH,
       alloc.tablespace AS TABLESPACE,
       round(avg(alloc.avg_size_mb), 2) AS SIZE_MB,
       round(avg(used.avg_used_mb), 2) AS USED_MB,
       round(avg(alloc.avg_size_mb - used.avg_used_mb), 2) AS FREE_MB,
       round(avg((used.avg_used_mb*100)/ decode(alloc.avg_size_mb, 0, 1, alloc.avg_size_mb)), 2) AS USED_PCT,
       round(max(alloc.max_size_mb), 2) AS SIZE_MAX_MB,
       round(max(used.max_used_mb), 2) AS USED_MAX_MB,
       round(max(alloc.avg_size_mb - used.avg_used_mb), 2) AS FREE_MAX_MB,
       round(max((used.avg_used_mb*100)/decode(alloc.avg_size_mb, 0, 1, alloc.avg_size_mb)), 2) AS USED_MAX_PCT,
       round(min(alloc.min_size_mb), 2) AS SIZE_MIN_MB,
       round(min(used.min_used_mb), 2) AS USED_MIN_MB,
       round(min(alloc.avg_size_mb - used.avg_used_mb), 2) AS FREE_MIN_MB,
       round(min((used.avg_used_mb*100)/decode(alloc.avg_size_mb, 0, 1, alloc.avg_size_mb)), 2) AS USED_MIN_PCT
FROM
  (SELECT m.key_value AS TABLESPACE,t.TARGET_NAME,
          m.rollup_timestamp AS TIMESTAMP,
          avg(m.average) AS avg_size_mb,
          min(m.minimum) AS min_size_mb,
          max(m.maximum) AS max_size_mb
   FROM mgmt$metric_daily m,
        mgmt$target_type t
   WHERE t.TARGET_NAME='DB_NAME'
     AND (t.target_type='rac_database'
          OR t.target_type='oracle_pdb'
          OR (t.target_type='oracle_database'
              AND t.TYPE_QUALIFIER3 != 'RACINST'))
     AND m.target_guid=t.target_guid
     AND m.metric_guid=t.metric_guid
     AND t.metric_name='tbspAllocation'
     AND (t.metric_column='spaceAllocated')
      AND m.rollup_timestamp >SYSDATE -360
   GROUP BY m.rollup_timestamp,t.TARGET_NAME,
            m.key_value) alloc,
  (SELECT m.key_value AS TABLESPACE,t.TARGET_NAME,
          m.rollup_timestamp AS TIMESTAMP,
          avg(m.average) AS avg_used_mb,
          min(m.minimum) AS min_used_mb,
          max(m.maximum) AS max_used_mb
   FROM mgmt$metric_daily m,
        mgmt$target_type t
   WHERE t.TARGET_NAME='DB_NAME'
     AND (t.target_type='rac_database'
          OR t.target_type='oracle_pdb'
          OR (t.target_type='oracle_database'
              AND t.TYPE_QUALIFIER3 != 'RACINST'))
     AND m.target_guid=t.target_guid
     AND m.metric_guid=t.metric_guid
     AND t.metric_name='tbspAllocation'
     AND (t.metric_column='spaceUsed')
      AND m.rollup_timestamp > SYSDATE -360
   GROUP BY m.rollup_timestamp,t.TARGET_NAME,
            m.key_value) used
WHERE alloc.timestamp=used.timestamp
  AND alloc.tablespace=used.tablespace
GROUP BY alloc.TARGET_NAME,TO_CHAR(alloc.timestamp, 'MON RR'),
         alloc.tablespace;

Comments

  1. Hello Jayesh,

    My name Siva, is there any scripts for tablespaces which are reached 85% threshold and at the same time, the growth of tablespace on daily basis with in same script from OEM BI publisher.

    Could you please share the script if you have any to me.

    Gmail : dsnagendra.dba@gmail.com

    Thanks in advace

    ReplyDelete
  2. You can use Information published reports for table space threshold. for daily growth use above script and group it on day basis. I will try to build the same scrip and share on your email id.

    ReplyDelete
  3. The query shows missing right parenthesis in oem 13c, data model.

    ReplyDelete
    Replies
    1. For the time is not checked in 13 C i will update on this very soon

      Delete
    2. Any update on the 13 c query for this ?

      Delete
  4. Hi Jayesh,
    I am in search for Tablespace utilization monitoring script from OEM repository tables.
    Can you please help me by sharing the script on below mail ID if you are having it.
    chennareddyn@hotmail.com

    ReplyDelete

Post a Comment

Popular posts from this blog

Hard dependency with ip address Oracle RAC Cluster.

Command error out due to hard dependency with ip address [-Node1]/app/grid/oracle/product/11.2.0/grid/bin>./crsctl relocate resource RDBMS_DB -n Node2 CRS-2527: Unable to start 'RDBMS_DB' because it has a 'hard' dependency on 'sDB' CRS-2525: All instances of the resource 'sDB' are already running; relocate is not allowed because the force option was not specified CRS-4000: Command Relocate failed, or completed with errors. [-Node1]/app/grid/oracle/product/11.2.0/grid/bin>./crsctl relocate resource sDB  -n Node2 CRS-2529: Unable to act on 'DB' because that would require stopping or relocating 'LISTENER_DB', but the force option was not specified CRS-4000: Command Relocate failed, or completed with errors. [-Node1]/app/grid/oracle/product/11.2.0/grid/bin>./crsctl relocate resource LISTENER_DB  -n Node2 CRS-2527: Unable to start 'LISTENER_DB' because it has a 'hard' dependency on 'sD...

19C NID ( Rename Database)

 [oracle@localhost ~]$ nid DBNEWID: Release 19.0.0.0.0 - Production on Thu Dec 23 00:05:36 2021 Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved. Keyword     Description                    (Default) ---------------------------------------------------- TARGET      Username/Password              (NONE) DBNAME      New database name              (NONE) LOGFILE     Output Log                     (NONE) REVERT      Revert failed change           NO SETNAME     Set a new database name only   NO APPEND      Append to output log           NO HELP        Displays these messages    ...

ORA-01017/ORA-28000 with AUDIT_TRAIL

With default profile in Oracle 11g, accounts are automatically locked 1 day ( PASSWORD_LOCK_TIME ) after 10 failed login attempt ( FAILED_LOGIN_ATTEMPTS ): SQL > SET lines 200 SQL > SET pages 200 SQL > SELECT * FROM dba_profiles WHERE PROFILE = 'DEFAULT' ORDER BY resource_name; PROFILE                         RESOURCE_NAME                      RESOURCE LIMIT ------------------------------ -------------------------------- -------- ---------------------------------------- DEFAULT                         COMPOSITE_LIMIT                 ...