由于归档日志不能存放于raw设备,rac环境中归档日志一般存放于本地目录,模拟环境如下;
ALTER SYSTEM SET LOG_ARCHIVE_DEST_1 = 'LOCATION=/opt/oracle/archivelog/' SID = 'itdb1';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_1 = 'LOCATION=/opt/oracle/archivelog/' SID = 'itdb2';
任意节点执行
执行备份:
run
{
allocate channel c1 device type disk format '/opt/oracle/%U' connect
sys/oracle@itdb1;
allocate channel c2 device type disk format '/opt/oracle/%U' connect
sys/oracle@itdb2;
backup database plus archivelog;
}
恢复方法:
srvctl stop database -d itdb
节点1:
rman target /
startup mount
节点2:
rman target /
startup mount
任意节点执行:
还原数据库
run
{
allocate channel c1 device type disk format '/opt/oracle/%U' connect
sys/oracle@itdb1;
allocate channel c2 device type disk format '/opt/oracle/%U' connect
sys/oracle@itdb2;
restore database;
}
还原归档
run
{
allocate channel c1 device type disk format '/opt/oracle/%U' connect
sys/oracle@itdb1;
allocate channel c2 device type disk format '/opt/oracle/%U' connect
sys/oracle@itdb2;
restore (archivelog sequence between m and n thread 1)
(archivelog sequence between m and n thread 2);
}
拷贝节点2上的归档日志到节点1上
scp node2:/opt/oracle/archivelog/* node1:/opt/oracle/archivelog/
恢复数据库
run
{
allocate channel c1 device type disk format '/opt/oracle/%U' connect
sys/oracle@itdb1;
allocate channel c2 device type disk format '/opt/oracle/%U' connect
sys/oracle@itdb2;
recover database;
}
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10513540/viewspace-714548/
,如需转载,请注明出处,否则将追究法律责任。