Chinaunix首页 | 论坛 | 博客
  • 博客访问: 666241
  • 博文数量: 168
  • 博客积分: 2928
  • 博客等级: 中校
  • 技术积分: 1904
  • 用 户 组: 普通用户
  • 注册时间: 2010-01-04 09:56
文章分类

全部博文(168)

文章存档

2010年(168)

我的朋友

分类: Oracle

2010-03-24 17:31:56

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
阅读(440) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~