Skip to main content

OEM SQL

DB Growth  Month wise....
  
=================================================
SELECT TARGET_NAME,
       decode(metric_column, 'spaceAllocated', 'AVERAGE_SIZE_GB', 'spaceUsed', 'AVERAGE_USED_GB'),
       month_timestamp,
       avg(value)
FROM
  (SELECT m.TARGET_NAME,
          m.metric_column AS metric_column,
          TO_DATE(TO_CHAR(m.rollup_timestamp, 'YYYY-MM'), 'YYYY-MM') AS month_timestamp,
          sum(m.average/1024) AS value
   FROM mgmt$metric_daily m,
        mgmt$target_type t
   WHERE (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'
          OR t.metric_column='spaceUsed')
     AND m.rollup_timestamp > sysdate-360
   GROUP BY m.TARGET_NAME,
            m.metric_column,
            m.rollup_timestamp)
WHERE metric_column='spaceAllocated'
GROUP BY TARGET_NAME,
         metric_column,
         month_timestamp
ORDER BY TARGET_NAME,
         month_timestamp ASC,
         metric_column DESC;

=================================================

DB using filesystem as datafile;

 select distincT TARGET_NAME,(substr(file_name,1,instr(file_name,'/',-3)))AS DG_NAME ,HOST_NAME,TARGET_TYPE from MGMT$DB_DATAFILES where file_name like '/%'; 

======================================

 DB using filesystem as datafile;

  select distincT TARGET_NAME,(substr(file_name,1,instr(file_name,'/',-3)))AS DG_NAME ,HOST_NAME,TARGET_TYPE from MGMT$DB_DATAFILES where file_name like '/+'  ;


======================================

Archive DG with FRA threshold limit 

 select distinct v1.target_name, v1.key_value , v1.value/1024 "Size", v2.value/1024 "Available" ,v3.value "pct Available"
from
(select target_name, key_value,  value  from mgmt$metric_current
where
metric_name='Filesystems'
and metric_column ='size') v1,
(select target_name, key_value,  value   from mgmt$metric_current
where
metric_name='Filesystems'
and metric_column ='available') v2,
(select target_name, key_value,  value  from mgmt$metric_current
where
metric_name='Filesystems'
and metric_column ='pctAvailable') v3
where v1.key_value=v2.key_value
and v2.key_value=v3.key_value
order by v1.key_value
/
===========================================

Comments

  1. Hello Jayesh,

    Could you please provide the script only for tablespace growth and tablespaces which are reached above 85% if you have any.

    Gmail : dsnagendra.dba@gmail.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                 ...