RMAN> resync catalog;
starting full resync of recovery catalog
full resync complete
或
RMAN> report schema; --这条命令也能做到同步信息的效果,只是它会打印出来很多信息
Report of database schema for database with db_unique_name SJJC
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 690 SYSTEM YES /u01/app/oracle/oradata/sjjc/system01.dbf
2 520 SYSAUX NO /u01/app/oracle/oradata/sjjc/sysaux01.dbf
3 100 UNDOTBS1 YES /u01/app/oracle/oradata/sjjc/undotbs01.dbf
4 5 USERS NO /u01/app/oracle/oradata/sjjc/users01.dbf
5 100 EXAMPLE NO /u01/app/oracle/oradata/sjjc/example01.dbf
6 100 RMAN_TBS NO /u01/app/oracle/oradata/sjjc/rman_tbs01.dbf
List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 29 TEMP 32767 /u01/app/oracle/oradata/sjjc/temp01.dbf
RMAN>
level0
run {
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
allocate channel d1 type disk;
backup incremental level 0 database format '/u01/app/oracle/backup/level0_%T_%d_%s_%p_%u.dbf.bak'
tag='level 0' include current controlfile;
sql'alter system archive log current';
backup archivelog all format '/u01/app/oracle/backup/log_%T_%d_%s_%p_%u.arc.bak' delete all input;
release channel d1;
}
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
resync catalog;
level1
run {
allocate channel d1 type disk;
backup incremental level 1 database format '/u01/app/oracle/backup/level1_%T_%d_%s_%p_%u.dbf.bak'
tag='level 1' include current controlfile;
sql 'alter system archive log current';
backup archivelog all format '/u01/app/oracle/backup/log_%T_%d_%s_%p_%u.arc.bak' delete all input;
release channel d1;
}
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
resync catalog;
level2
run {
allocate channel d1 type disk;
backup incremental level 2 database format '/u01/app/oracle/backup/level2_%T_%d_%s_%p_%u.dbf.bak'
tag='level 2' include current controlfile;
sql 'alter system archive log current';
backup archivelog all format '/u01/app/oracle/backup/log_%T_%d_%s_%p_%u.arc.bak' delete all input;
release channel d1;
}
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
resync catalog;
level2c
run {
allocate channel d1 type disk;
backup incremental level 2 cumulative database format '/u01/app/oracle/backup/level2c_%T_%d_%s_%p_%u.dbf.bak'
tag='level 2' include current controlfile;
sql 'alter system archive log current';
backup archivelog all format '/u01/app/oracle/backup/log_%T_%d_%s_%p_%u.arc.bak' delete all input;
release channel d1;
}
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
resync catalog;
(在root下)
crontab -e -u oracle (若在oracle用户下则 crontab -e)
10 10 * * 0 source ~/.bash_profile; rman target sys/runner@dndn catalog rman/rman@sjjc @/u01/app/oracle/backup/script/level0.rman
10 10 * * 1,4 source ~/.bash_profile; rman target sys/runner@dndn catalog rman/rman@sjjc @/u01/app/oracle/backup/script/level2.rman
10 10 * * 2,5,6 source ~/.bash_profile; rman target sys/runner@dndn catalog rman/rman@sjjc @/u01/app/oracle/backup/script/level2c.rman
10 10 * * 3 source ~/.bash_profile; rman target sys/ru