共计 3617 个字符,预计需要花费 10 分钟才能阅读完成。
Oracle RMAN 备份一例:
Solaris 10 + Oracle 11.2.0.3
Shell:csh, 安装有 bash, 脚本调用 bash
备份策略:周日 0 级备份, 周一~ 周六 1 级备份, 每 6 小时备份归档日志, 每天清理历史文件夹.
–0 级备份脚本:
#!/bin/bash
#db0 level backup
foldername=`date +%Y%m%d`
cd /oradata1/backup
if
[-d
$foldername
]
then
echo
'go on'
else
echo
'need mkdir'
mkdir
$foldername
fi
export ORACLE_BASE=/opt/app/oracle/
export ORACLE_HOME=/opt/app/oracle/product/
11.2.0
/dbhome_1/
export ORACLE_SID=SHIRNOP
export NLS_LANG="simplified chinese_china
.
ZHS16GBK"
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:Mi:SS"
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32
export PATH=/bin:/usr/bin:/usr/ucb:/etc:$ORACLE_HOME/bin:.
rman target / log=/oradata1/backup/
$foldername
/full_LOG
.
log << RMAN_BACKUP
run
{
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/oradata1/backup/$foldername/controlfile%F';
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
backup incremental level 0 tag 'db0' database format '/oradata1/backup/$foldername/db0_%d_%T_%s' include current controlfile;
delete noprompt obsolete;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
RMAN_BACKUP
–1 级备份脚本:
– 归档备份
– 系统级别删除过期备份的空文件夹
#!/bin/bash
#del old folders
cd /oradata1/backup
find . -mtime +
10
| xargs rm -rf
–crontab 调度
crontab -l
0
1
* *
0
/oradata1/backupsh/db0_backup
.
rman > /dev/null
2
&>
1
#
0
1
* *
1
-
6
/oradata1/backupsh/db1_backup
.
rman > /dev/null
2
&>
1
#
0
6
,
12
,
18
* * * /oradata1/backupsh/arch_backup
.
rman > /dev/null
2
&>
1
#
0
3
* * * /oradata1/backupsh/del_old
.
sh > /dev/null
2
&>
1
#
更多 Oracle 相关信息见 Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12
本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-08/146099.htm
正文完
星哥玩云-微信公众号