欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

oracle数据库中rman备份归档日志的常用脚本

程序员文章站 2022-06-08 18:09:48
$ vi bk_db_arch.sh oracle_base=/u01/app/oracle oracle_home=$oracle_base/product/11.2.0/db_1 oracle_...

$ vi bk_db_arch.sh

oracle_base=/u01/app/oracle

oracle_home=$oracle_base/product/11.2.0/db_1

oracle_sid=orcl

nls_lang=american_america.zhs16gbk

path=$path:/oracle_home/bin

ora_nls33=$oracle_home/ocommon/nls/admin/data

path=$path:$oracle_home/bin:$oracle_home/apache/apache/bin:$oracle_home/opatch

classpath=$oracle_home/jre:$oracle_home/jlib:$oracle_home/rdbms/jlib

classpath=$classpath:$oracle_home/network/jlib

export ora_nls33

export oracle_base oracle_home oracle_sid

export db_name nls_lang path ld_library_path classpath db_name

rman target=/ cmdfile=/u03/rman/rman_script/bk_db_arch.rman log=/u03/rman/rman_log/bk_db_arch_`date +%y%m%d%h%m%s`.log

$vi bk_db_arch.rman

run

{

allocate channel ch1 device type disk maxpiecesize=8000m ;

sql 'alter system checkpoint';

sql 'alter system archive log current';

sql 'alter system archive log current';

backup as compressed backupset archivelog all delete input

format '/mnt/backup/arch_%d_%u_%t.bkp';

release channel ch1;

}

run

{

allocate channel ch1 device type disk maxpiecesize=8000m;

backup current controlfile format '/mnt/backup/ctl_%d_%u_%t.bkp';

release channel ch1;

}

crosscheck backup;

crosscheck archivelog all;

list backup;

exit;