ITPub博客

首页 > 数据库 > Oracle > data guard 归档日志管理 (primary)

data guard 归档日志管理 (primary)

原创 Oracle 作者:lovehewenyu 时间:2012-04-17 10:05:42 0 删除 编辑
 

主库归档管理:

1、 用SHELL脚本,取归档已被APP的。然后删除已经APP的归档。

2、 用RMAN 备份策略管理:oracle 自带的策略:

RMAN> configure archivelog deletion policy to applied on standby;

有报错,解决方法:

SQL>alter system set "_log_deletion_policy"=ALL scope=spfile sid='*';

 

Oracle 在删除已经备份完的归档时,会看下是否已经被APP 没有APP的就不删除。

 

3、利用RMAN备份的时间点和删除时间点分离,这样就给了数据库一段时间内的归档冗余,在这段时间内备库应该可以把归档应用了这个时间点可以尽量长一些。

这个方案虽然不够严谨,但是可以解决一些实际问题。

 

下面是方案:

4点 full.sh

3点 delete.sh

 

 

 

[ora@dg-pp ~]$ cat full.sh

# .bash_profile

 

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

        . ~/.bashrc

fi

 

# User specific environment and startup programs

 

PATH=$PATH:$HOME/bin

 

export PATH

unset USERNAME

 

#--------------------------------------

# Set for Oracle10g Install 20101015;

#--------------------------------------

trap " " 0 1 2 3 5 9 15

trap clear 0

export TMP=/tmp

export TMPDIR=$TMP

export ORACLE_BASE=/opt/oracle

export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1

export ORACLE_SID=research

export ORACLE_TERM=xterm

export PATH=/usr/sbin:$PATH

export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/usr/X11R6/lib64/

export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

export LD_ASSUME_KERNEL=2.6.9

export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"

export TNS_ADMIN=$ORACLE_HOME/network/admin

export LC_CTYPE=en_US.UTF-8

export LC_ALL=en_US.UTF8

export LANG=en_US.UTF8

umask 022

#

if [ $USER = "ora" ]; then

if [ $SHELL = "/bin/ksh" ]; then

ulimit -p 16384

ulimit -n 65536

else

ulimit -u 16384 -n 65536

fi

fi

#------------------- Set Over

 

全库备库,不删除多余的备份和归档日志。

rman target /  nocatalog log=/rman/log/rman_db_full.log <

run {

allocate channel d1 type disk;

allocate channel d2 type disk;

allocate channel d3 type disk;

     backup  ( database

                     include current controlfile

                     filesperset=2

                     format '/rman/data/full_data_%s_%p'

                     tag="fullbackup_data");

   backup  ( archivelog all

                     filesperset=4

                     format '/rman/arch/arch_%s_%p'

                     tag="fullbackup_arch");

release channel d1;

release channel d2;

release channel d3;

crosscheck backup;

}

exit

EOF

 

0级数据压缩备份,不删除多余的备份和归档。

rman target /  nocatalog log=/u01/rman/log/rman_db_level0.log <

run {

allocate channel d1 type disk;

allocate channel d2 type disk;

allocate channel d3 type disk;

backup as compressed backupset incremental level 0 database filesperset 4 format

'/u01/rman/data/level0_%d_%s_%p_%u_%T.bak' include current controlfile;

sql 'alter system archive log current';

backup archivelog all filesperset 10 format '/u01/rman/arch/arc_%d_%s_%p_%u_%T.bak';

release channel d1;

release channel d2;

release channel d3;

crosscheck backup;

}

exit

EOF

 

 

[ora@dg-pp ~]$ cat delete.sh

# .bash_profile

 

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

        . ~/.bashrc

fi

 

# User specific environment and startup programs

 

PATH=$PATH:$HOME/bin

 

export PATH

unset USERNAME

 

#--------------------------------------

# Set for Oracle10g Install 20101015;

#--------------------------------------

trap " " 0 1 2 3 5 9 15

trap clear 0

export TMP=/tmp

export TMPDIR=$TMP

export ORACLE_BASE=/opt/oracle

export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1

export ORACLE_SID=research

export ORACLE_TERM=xterm

export PATH=/usr/sbin:$PATH

export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/usr/X11R6/lib64/

export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

export LD_ASSUME_KERNEL=2.6.9

export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"

export TNS_ADMIN=$ORACLE_HOME/network/admin

export LC_CTYPE=en_US.UTF-8

export LC_ALL=en_US.UTF8

export LANG=en_US.UTF8

umask 022

#

if [ $USER = "ora" ]; then

if [ $SHELL = "/bin/ksh" ]; then

ulimit -p 16384

ulimit -n 65536

else

ulimit -u 16384 -n 65536

fi

fi

#------------------- Set Over

 

rman target / nocatalog log=/u01/rman/log/rman_db_delete.log <

run {

crosscheck backup;

delete noprompt expired backup ;

delete noprompt obsolete;}

exit

EOF

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26442936/viewspace-721392/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
Oracle,Mysql,EMC 存储,NBU备份

注册时间:2012-02-03

  • 博文量
    267
  • 访问量
    1271539