Oracle various log cleaning (general oracle software directory is about 10G)
generally advance the $ORACLE_BASE directory, check which directory takes up more space, and go deeper into it, locate the directory that occupies a large amount, determine the file type and clean it up. As follows:
[oracle@test-for-lihb ~]$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.4 (Santiago)
[oracle@test-for-lihb ~]$ cd $ORACLE_BASE
[oracle@test-for -lihb /opt/app/oracle]$ du -sm *|sort -n
1 admin
1 afiedt.buf
1 checkpoints
3 cfgtoollogs
10 flash_recovery_area
1377 diag
8501 product
1 Archive file
path:
(SQL> archive log list Get archive from Archive destination path)
method:
delete archive via rman
[oracle@test-for-lihb ~]$ rman target/
RMAN> delete archivelog all completed before 'sysdate-1'; ("1" corresponds to one day, if you want to delete the archive log 6 hours ago, change it to 0.25)
After the archive is deleted, if there is a corresponding backup strategy, you need to restart the full ready.
2 Alert alert log file
path:
/alert_.log (Get the log file location from SQL> show parameter background_dump_dest/core_dump_dest/user_dump_dest)
Method:
1) Clear alert_.log > alert_.log (suggestion: tail -100000 alert_.log > alert_.log_bak20170601, keep 10w rows of data and delete it)
2) The system will automatically generate a new alert_.log
3) find . -mtime +30 -name "*.trc/trm" | wc -l View trc/ one month ago Number of trm files
4) find . -mtime +30 -name "*.trc/trm" | xargs rm -rf delete trc/trm files one month ago
3 Listen log file
path:
$ORACLE_HOME/network/log/listener.log (The location of the log file is obtained from the Listener Log File in the listener name of $ lsnrctl status $)
If it is a log file
, method 1:
1) lsnrctl set log_status off
2) Delete or remove the listener.log (recommendation: tail -100000 listener.log > listener.log_bak20170601, keep 10w rows of data and delete it)
3) lsnrctl set log_status on At this time, the system regenerates the listener. Log
method 2:
1) Directly clear the log file: >listener.log (recommendation: tail -100000 listener.log > listener.log_bak20170601, keep 10w rows of data and then delete it)
If it is an xml file
method:
keep log.xml, others can be deleted, For example: find . -mtime +30 -name "log_*.xml" | xargs rm -rf
At the same time, the log files in the trace directory at the same level can be cleaned up:
cd ../trace
tail -100000 listener.log > listener.log_bak20170601
>listener .log
4 OEM log file
path:
$ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole__/log/http-web-access.log or em-application.log
Method:
Check the OEM status: $ emctl status If dbconsole
is not running,
directly remove or delete http-web-access.log/em-application.log.
If it is running,
stop dbconsole (emctl stop dbconsole),
remove or delete http-web-access.log/em-application.log,
restart dbconsole (emctl start dbconsole), and
check the oem status (emctl start dbconsole).
5 CRS log file
path:
11g: grid user: $ORACLE_HOME/log/$HOSTNAME/crsd/crsdOUT.log (by default, 10 historical records will be kept, each 10M, and the file name is crsd.l01/02/03... )
10g: grid user: $ORA_CRS_HOME/log/$HOSTNAME/crsd/
Method:
Clean up historical crsd.l0* files, keep crsdOUT.log and crsd.log in
other same-level directories agent/cssd/gipcd/mdnsd/ctssd/ohasd The cleaning method is similar to the crsd directory
6 Audit file
path:
(SQL> show parameter audit_file_dest view)
Method:
Clear audit files older than 7 days: find . -mtime +7 -name "*.aud" | xargs rm -rf
Oracle various log cleaning
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=325016690&siteId=291194637
Recommended
Ranking