RMAN Tutorial Series

RMAN 脚本类型:

Select table_name from dictwhere TABLE_NAME like "%SGA%"

Select * from V$SGAINFO

 

1:RMAN脚本

@bak_user-schem.rman orrman @bak_user-schem.rmanorrman cmdfile=bak_user-schem.rman

connect target /

run{

allocate chanel CH1 type disk format '/home/oracle/%N_%s_%P_%t.bak';

backup tablespace users; orbackup tablespace users &2;

release channel CH1;

}

 

2:SHELL脚本 封装 Rman脚本

./bak_user-schem.sh user

umask 0022

rman <<EOF

@bak_user-schem.rman $1

EOF

3:Store Backup Script in the database

To create recoverary catalog database and then <connect catalog rman/oracledba@rmancat>

To create below script on the catalog database

create script bak_tablespace

{

allcocate ***

backup database ***

}

PS: to create a catalog databaseinstead of using control file to keep the related RMAN backup information, an independent box with Oracle installed should be in place and the RMAN recoverage database should be created there.

 

4: Examples for production RMAN backup script

Requirement Analisis:

1)Incremental data backup per day ( Cumulative or Difference backup ) ;

2)Month or Year or Week based daily?  the week based daily should be chose ;

3)Sun(level 0)-Mon(level 1)-Tue(level 1)-Wes(level 1)-Thu(level 1)-Fri(level 1)-Sat(level 1)-Sun((level 0 again) ;

4)Automatically delete the expired backup files previous level 0 backup ;

5) Backup for the archive log accordingly .

How to implement it:

prepare for the scripts(Level 0 backup script and Level 1 backup script) ;

export ORACLE_SID

export ORACLE_HOME

export TBS_LOCATION

export RMAN_LOG

stty erase ^H

rman target / smglog $MAN_LOG append <<EOF

run{

allocate channel CH1 type disk;

allocate channel CH2 type disk;

backup tablespace users incremental level=0 format $TBS_LOCATION//$N_%s_%t.bak;

(backup tablespace users incremental level=1 format $TBS_LOCATION//$N_%s_%t.bak;)

(

exec >>backup_level11.og

rman catalog rman/rman1@orcl tareget / <<EOF

backup incremental level=1 database;

crosscheck backup;

delete expired backup;

exit;

EOF

)

sql 'alter system arvhive log current'

release channel CH1;

release channel CH2;

}

delete noprompt obosolete;//related with redunency number; the outnumbered backup will be marked as obselete

delete noprompt expired backup ;//

EOF

mailx -s "RMAN BAKUP USER TBLESPACE" yourmain@itf.com.cn<$RMAN_LOG

 

crontab -e 30 23 * * 0    /script

crontab -e 30 23 * * 1-6 /script

 RMAN Image Copy

per se it is just a direct copy of all the related database files and quite efficent in recovering. it is not appropriate for big volumn database; it also support incremental backup.

allocate channel;

backup database as copy;

release channel;

<list copy> is used to check the rman image copy; <delete copy> is used to delete.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值