Welcome 微信登录

首页 / 数据库 / MySQL / DataGuard备库删除已经应用的日志

前言:公司搭建了DataGuard,刚开始没有注意备库归档日志的管理,系统运行了一段时间之后,发现备库的空间被归档日志给撑爆了。解决思路:Oracle提供了一个视图可以查看归档日志的执行情况,只要归档日志已经被应用了,就可以通过操作系统进行删除。查看归档日志的运用脚本:select sequence#,applied from v$archived_log order by sequence#;以下是我配置的操作系统的定时删除脚本:#!/bin/shexport PATHORACLE_SID=orclTABLE="v$archived_log"export ORACLE_BASE ORACLE_SIDexport ORACLE_HOME=/u01/app/oracle/product/OraDb11g_home1export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch$ORACLE_HOME/bin/sqlplus -silent "/ as sysdba" <<EOF > /home/oracle/deleteorclarch.sh
 
set heading off;set pagesize 0;set term off;set feedback off;set linesize 32767;select "rm -rf "||name from ${TABLE}  where DELETED="NO" and APPLIED="YES";exit;EOFsh /home/oracle/deleteorclarch.shrman target /<<ENDcrosscheck archivelog all;delete noprompt expired archivelog all;exit;END 通过crontab每天定时运行脚本即可;在CentOS 6.4下安装Oracle 11gR2(x64) http://www.linuxidc.com/Linux/2014-02/97374.htmOracle 11gR2 在VMWare虚拟机中安装步骤 http://www.linuxidc.com/Linux/2013-09/89579p2.htmDebian 下 安装 Oracle 11g XE R2 http://www.linuxidc.com/Linux/2014-03/98881.htmOracle Data Guard 重要配置参数 http://www.linuxidc.com/Linux/2013-08/88784.htm基于同一主机配置 Oracle 11g Data Guard http://www.linuxidc.com/Linux/2013-08/88848.htm探索Oracle之11g DataGuard http://www.linuxidc.com/Linux/2013-08/88692.htmOracle Data Guard (RAC+DG) 归档删除策略及脚本 http://www.linuxidc.com/Linux/2013-07/87782.htmOracle Data Guard 的角色转换 http://www.linuxidc.com/Linux/2013-06/86190.htmOracle Data Guard的日志FAL gap问题 http://www.linuxidc.com/Linux/2013-04/82561.htmOracle 11g Data Guard Error 16143 Heartbeat failed to connect to standby 处理方法 http://www.linuxidc.com/Linux/2013-03/82009.htm更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12本文永久更新链接地址