Thursday, December 4, 2008

How to monitor tablespaces proactively from back-end in 10g

  • MMON background process monitors the free space in each tablespace and sends out the alerts.
  • we create a tablespace for testing
    create tablespace test datafile '/apps/oracle/oracle/product/10.2.0/oradata/orcl/test01.dbf' size 100m extent management local uniform size 10m;

    Tablespace created.
  • this pl/sql procedure explains us to alert when the tablespace is 80% full and 95% full
    execute DBMS_SERVER_ALERT.SET_THRESHOLD(-
    > DBMS_SERVER_ALERT.TABLESPACE_PCT_FULL,DBMS_SERVER_ALERT.OPERATOR_GE,'80',-
    > DBMS_SERVER_ALERT.OPERATOR_GE,'95',1,1,NULL,-
    > DBMS_SERVER_ALERT.OBJECT_TYPE_TABLESPACE,'TEST');

    PL/SQL procedure successfully completed.
  • by querying from this table we can see which tablespace is the most effected.
    select reason from dba_outstanding_alerts;

    for example if test tablespace is more than 80% we can an entry here.
  • we can add a datafile to test tablespace so that we can avoid any further complications.
    alter tablespace test add datafile ‘'/apps/oracle/oracle/product/10.2.0/oradata/orcl/test02.dbf’ size 50m;
    Tablespace altered
  • by quering again from this table we can see that test tablespace alert is gone from the view. ( for example)
    select reason from dba_outstanding_alerts;
  • all cleared alerts will be shown up in dba_alert_history view
    select reason, resolution from dba_alert_history;

No comments: