ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle-10g数据库一周备份方案的设计(linux)

Oracle-10g数据库一周备份方案的设计(linux)

原创 Linux操作系统 作者:baizhaoxian 时间:2009-01-09 17:16:58 0 删除 编辑
实施思路:
1、mkdir
cd /rmanbak
2、通用脚本
connect.rcv
connect catalog rmanuser/rman@orac;
connect target sys/system@clonedb;
global_del global_arch global_ctl
1、
rman>replace global script. global_del{
allocate channel d1 device type disk;
delete obsolete recovery window of 15 days;
release channel d1;
}
---查看----
list global script. names;
print global script  global_bkctl;
{allocate channel d1 device type disk;
backup as compressed backupset
format='/rmanbak.backupctl.ctl'
tag ='bkctl'
channel = d1
current controlfile reuse;
release channel d1;
}
2.
rman> replace global script. global_arch commect "backup archivelog  
as well as delete input"{
allocate channel d1 device type disk;
sql " alter database archive log current";
set limit channel d1 readrate = 10240;
set limit channel d1 kbytes = 4096000;
backup as compressed backupset
format='/rmanbak/arch_%d_%U'
tag = 'bkarch'
channel = d1
archivelog all delete input;
replease channel d1;
}
零级备份
rman> replace global script. global_inc0 comment
"backup database as incremental level 0"{
execute global script  global_del;
allocate channel d1 device type disk;
set limit channel d1 readrate = 10240;
set limit channel d1 kbytes = 4096000;
backup as compressed backupset
incremental level = 0
format ='/rmanbak/inc0_%d_%U'
tag = 'inc0'
channel =d1
database;
release channel d1;
execute global script. global_arch;
execute global script. global_bkctl;
}
1级备份
rman> replace global script. global_inc1 comment
"backup database as incremental level 1"{
execute global script  global_del;
allocate channel d1 device type disk;
set limit channel d1 readrate = 10240;
set limit channel d1 kbytes = 4096000;
backup as compressed backupset
incremental level = 1
format ='/rmanbak/inc0_%d_%U'
tag = 'inc1'
channel =d1
database;
release channel d1;
execute global script. global_arch;
execute global script. global_bkctl;
}
2级备份
rman> replace global script. global_inc2 comment
"backup database as incremental level 2"{
execute global script  global_del;
allocate channel d1 device type disk;
set limit channel d1 readrate = 10240;
set limit channel d1 kbytes = 4096000;
backup as compressed backupset
incremental level = 2
format ='/rmanbak/inc0_%d_%U'
tag = 'inc2'
channel =d1
database;
release channel d1;
execute global script. global_arch;
execute global script. global_bkctl;
}
--检验脚本
run{
execute global script. global_inc0;
execute global script. global_inc1;
execute global script. global_inc2;
}
3、Cmdfile$rman catalog script.
执行外部命令:
rman cmdfile=/rmanbak/script/connect.rcv
vi inc0.rcv
@@/rmanbak/script/connect.rcv
run{
execute global script. global_inc0;
}
exit
*******************************************
vi inc1.rcv
@@/rmanbak/script/connect.rcv
run{
execute global script. global_inc1;
}
exit
*******************************************
vi inc2.rcv
*******************************************
@@/rmanbak/script/connect.rcv
run{
execute global script. global_inc2;
}
exit
*******************************************
4、shell script.
vi inc0.sh
****************************************************
nohup$ORACLE_HOME/bin/rman cmdfile=/rmanbak/dcript/inc0.rcv
log = /rmanbak/script/inc0.log append
$
****************************************************
vi inc1.sh
***************************************************
nohup$ORACLE_HOME/bin/rman cmdfile=/rmanbak/dcript/inc1.rcv
log = /rmanbak/script/inc1.log append
$
***************************************************
vi inc2.sh
****************************************************
nohup$ORACLE_HOME/bin/rman cmdfile=/rmanbak/dcript/inc2.rcv
log = /rmanbak/script/inc2.log append
$
***************************************************
5、crontab -e(备份计划和方案)
***************************************************
#min  hour  date  mon  day   command
0         1         *       *       0        /rmanbak/script/inc0.sh
0         1         *       *       1       /rmanbak/script/inc2.sh
0         1         *       *       2       /rmanbak/script/inc2.sh
0         1         *       *       3      /rmanbak/script/inc2.sh
0         1         *       *       4      /rmanbak/script/inc1.sh
0         1         *       *       5     /rmanbak/script/inc2.sh
0         1        *        *       6     /rmanbak/script/inc2.sh
**************************************************
6、chown u+x*.sh(执行权限)
experience:
1、bakckup controlfile in each script's tail
2、delete obsolete backupset in each script's thrashold
3、switch logfile before backup database
4、chmod u+x*.sh

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

请登录后发表评论 登录
全部评论

注册时间:2008-10-23

  • 博文量
    29
  • 访问量
    123539