0
点赞
收藏
分享

微信扫一扫

Oracle归档日志清理小脚本

曾宝月 2022-11-21 阅读 114
  • 保留一天归档日志

#/bin/bash

export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export PATH=$ORACLE_HOME/bin:$PATH
export TNS_ADMIN=$ORACLE_HOME/network/admin

export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

rman target / <<EOF
delete force noprompt archivelog all completed before 'sysdate-1';
exit;
EOF

  • Linux计划任务

# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed

  • 手动清理
    oracle用户环境rman登录

rman target /

  • 登录成功后执行语句清理

delete force noprompt archivelog all completed before 'sysdate-1';

Oracle归档日志清理小脚本_oracle



举报

相关推荐

0 条评论