database backup scripts

冷备脚本:

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;
}

 

上一篇:Linux7 启动网卡报错


下一篇:修改react项目的默认端口