database backup scripts

孤者浪人 提交于 2019-11-28 10:09:39

冷备脚本:

run{
shutdown immediate;
startup mount;
allocate channel c1 device type disk;
allocate channel c2 device type disk;
backup database format '/u01/backup/rman/db_%d_%T_%U.bak'; backup current controlfile format '/u01/backup/rman/ctl_%d_%T_%U.bak'; alter database open;
release channel c1;
release channel c2;
}

热备脚本:

run{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
backup database format '/u01/backup/rman/db_%d_%T_%U.bak'
plus archivelog format '/u01/backup/rman/ar_%d_%T_%U.bak'; backup current controlfile format '/u01/backup/rman/ctl_%d_%T_%U.bak'; release channel c1;
release channel c2;
}

非归档模式还原:

startup force nomount:

restore controlfile;

alter database mount;

restore database;

recover database noredo;

alter database open resetlogs;

块追踪增加增量备份速度(已废弃)

alter database enable block change tracking using file ‘xxx’;

alter database disable block change tracking;

select * from v$block_change_tracking; 

增量热备level 0

run{
crosscheck backup;
allocate channel c1 device type disk;
allocate channel c2 device type disk;
backup incremental level 0 database format '/u01/
backup/rman/db_%d_%T_%U.bak'
plus archivelog format '/u01/backup/rman/ar_%d_%T_%U.bak'; backup current controlfile format
'/u01/backup/rman/ctl_%d_%T_%U.bak';
report obsolete device type disk;
delete noprompt obsolete device type disk;
delete noprompt expired backup device type disk;
release channel c1;
release channel c2;
}

增量热备level1:

run{
crosscheck backup;
allocate channel c1 device type disk;
allocate channel c2 device type disk;
backup incremental level 1 database format '/u01/ backup/rman/db_%d_%T_%U.bak'

backup current controlfile format
'/u01/backup/rman/ctl_%d_%T_%U.bak';
report obsolete device type disk;
delete noprompt obsolete device type disk; delete noprompt expired backup device type disk; release channel c1;
release channel c2;
}

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!