пятница, 16 августа 2013 г.

ADRCI usage examples

Usage example 1:
  1. [oracle@host ~]$ adrci
  2. adrci> show homes
  3. set home diag/rdbms/orcl/orcl
  4. # Output with enter to editor
  5. show alert -p "ORIGINATING_TIMESTAMP >= '2014-02-24 00:00:00'"
  6. # Output to termnal without enter to editor
  7. show alert -p "ORIGINATING_TIMESTAMP >= '2014-02-24 00:00:00'" -term
  8. # Show all 'ORA-%' and 'TNS-%' messages
  9. show alert -p "ORIGINATING_TIMESTAMP >= '2014-02-24 00:00:00' AND (MESSAGE_TEXT LIKE '%ORA-%' or MESSAGE_TEXT LIKE '%TNS-%')" -term
  10. # Show all 'ORA-%' and 'TNS-%' messages with exclude from output specified
  11. show alert -p "ORIGINATING_TIMESTAMP > '2013-08-16 00:00:00' AND (MESSAGE_TEXT LIKE '%ORA-%' or MESSAGE_TEXT LIKE '%TNS-%') AND (MESSAGE_TEXT NOT LIKE '%TNS-12502%' AND MESSAGE_TEXT NOT LIKE '%TNS-12537%' AND MESSAGE_TEXT NOT LIKE '%ORA-609%')" -term
  12. show alert -tail -f
  13. exit
Usage example 2:
  1. [oracle@host ~]$ adrci
  2. adrci> show homes
  3. set home diag/rdbms/orcl/orcl
  4. show alert -tail -f
  5. exit
Incident & Problem
  1. adrci>
  2. show problem
  3. show incident
  4. show incident -mode detail -p "incident_id=6201"
  5. show trace /u01/app/oracle/diag/rdbms/orcl/orcl/incident/incdir_6201/orcl_ora_2299_i6201.trc
Creation of Packages & ZIP files to send to Oracle Support
  1. adrci>
  2. ips create package problem 1 correlate all
  3. ips generate package 2 in "/home/oracle"
Managing, especially purging of tracefiles
  1. adrci>
  2. show tracefile -rt
  3. show control
  4. set control (SHORTP_POLICY = 360)
  5. set control (LONGP_POLICY = 2190)
  6. show control
  7.  
  8. # Purge tracefiles manually
  9. purge -age 2880 -type trace
  10. show tracefile -rt
  11.  
  12. # Purge log directories for listener ADRCI Home
  13. for i in `adrci exec="show homes"|grep listener`;do
  14. # Purge ADRCI Homes log directories older 60 days ago
  15. #for i in `adrci exec="show homes"|sed '1d'`;do
  16. du -hs $ORACLE_BASE/$i | sort -rh
  17. du -hs $ORACLE_BASE/$i/* | sort -rh
  18. du -hs $ORACLE_BASE/$i/trace | sort -rh
  19.  
  20. # Purge listener log directory older 60 days ago
  21. # (60 days * 24h * 60 mins = 86400 mins)
  22. # -age - The data older than ago will be purged
  23. echo "adrci exec=\"set home $i;purge -age 86400\""
  24. adrci exec="set home $i;purge -age 86400";
  25. adrci exec="set home $i;show control;set control \(SHORTP_POLICY = 180\);set control \(LONGP_POLICY = 720\);show control";
  26. du -hs $ORACLE_BASE/$i | sort -rh
  27. du -hs $ORACLE_BASE/$i/* | sort -rh
  28. du -hs $ORACLE_BASE/$i/trace | sort -rh
  29. done
  30. # Check ADRCI Homes policy
  31. for i in `adrci exec="show homes"|sed '1d'`;do
  32. adrci exec="set home $i;show control;";
  33. done
  34. # Set ADRCI Homes policy
  35. for i in `adrci exec="show homes"|sed '1d'`;do
  36. adrci exec="set home $i;show control;set control \(SHORTP_POLICY = 180\);set control \(LONGP_POLICY = 720\);show control";
  37. done