Chinaunix首页 | 论坛 | 博客
  • 博客访问: 660294
  • 博文数量: 109
  • 博客积分: 6081
  • 博客等级: 准将
  • 技术积分: 1318
  • 用 户 组: 普通用户
  • 注册时间: 2009-10-24 10:28
文章分类
文章存档

2011年(8)

2010年(39)

2009年(62)

分类: Oracle

2010-03-12 17:08:33

rman 备份实施记录

---------------------------------------------------------------------------
CONTROL file 保留参数设置:
SQL>alter system set control_file_record_keep_time=14 scope=both;
 
归档路径设置
SQL〉alter system set  log_archive_dest_1='location=/arch' scope=spfile;
数据库必须启用在 archive log 状态
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
SQL> alter system archive log start;
SQL> alter database open;

/oracle/rmanscript/rman_full.sh
----------------------------------------------------------------------------
rman target / nocatalog msglog /oracle/rmanscript/rman_full.log append << EOF
run
{
allocate channel c1 type disk maxpiecesize 20G;
backup format '/orabak/billing/full_%s_%p_%t' database;
backup current controlfile format '/orabak/billing/control_%s_%p_%t';
release channel c1;
}
exit;

/oracle/rmanscript/rman_arch.sh
-----------------------------------------------------------------------------
rman target / nocatalog msglog /oracle/rmanscript/rman_arch.log append << EOF
run
{
allocate channel c1 type disk;
sql 'alter system archive log current';
backup format '/orabak/billing/arch_%s_%p_%t' archivelog all delete input;
release channel c1;
}
exit;

/oracle/rmanscript/rman_check.sh
-----------------------------------------------------------------------------
find /orabak/billing -name 'arch*' -mtime +14 -exec rm {} \;
find /orabak/billing -name 'full*' -mtime +14 -exec rm {} \;
find /orabak/settle -name 'control*' -mtime +14 -exec rm {} \;
rman target / nocatalog msglog /oracle/rmanscript/rman_check.log append << EOF
crosscheck backupset;
delete noprompt expired backupset;
exit;

新建 orabak 用户 属组 为 dba,其crontab 如下设置:
------------------------------------------------------------------------------
20 3 * * 0 /oracle/rmanscript/rman_full.sh
0 5 * * * /oracle/rmanscript/rman_arch.sh
0 6 * * * /oracle/rmanscript/rman_check.sh
 
------------------------------------------------------------------------------
/oracle/rmanscript/rman_full.sh
----------------------------------------------------------------------------
rman target / nocatalog msglog /oracle/rmanscript/rman_full.log << EOF
run
{
allocate channel c1 type disk maxpiecesize 20G;
backup format '/orabak/settle/full_%s_%p_%t' database;
backup current controlfile format '/orabak/settle/control_%s_%p_%t';
release channel c1;
}
exit;

/oracle/rmanscript/rman_arch.sh
---------------------------------------------------------------------
rman target / nocatalog msglog /oracle/rmanscript/rman_arch.log << EOF
run
{
allocate channel c1 type disk;
sql 'alter system archive log current';
backup format '/orabak/settle/arch_%s_%p_%t' archivelog all delete input;
release channel c1;
}
exit;

/oracle/rmanscript/rman_check.sh
------------------------------------------------------------------------
find /orabak/settle -name 'arch*' -mtime +14 -exec rm {} \;
find /orabak/settle -name 'full*' -mtime +14 -exec rm {} \;
find /orabak/settle -name 'control*' -mtime +14 -exec rm {} \;
rman target / nocatalog msglog /oracle/rmanscript/rman_check.log << EOF
crosscheck backupset;
delete noprompt  expired backupset;
exit;

新建 orabak 用户 属组 为 dba,其crontab 如下设置:
-------------------------------------------------------------------------
0 0 * * 0 . /home/oracle/.bash_profile; /oracle/rmanscript/rman_full.sh
0 2 * * * . /home/oracle/.bash_profile; /oracle/rmanscript/rman_arch.sh
0 3 * * * . /home/oracle/.bash_profile; /oracle/rmanscript/rman_check.sh
阅读(1630) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~