没有用catalog时候的管理
当没有使用catalog的时候,rman的信息都是放到控制文件中的。要是子自动备份中恢复控制文件后,使用configure做的配置设置都会回退到这个控制文件时候的状态,所以在resotre数据文件之前要先show all看下,检查下配置是否正确。
rman的备份的记录都放在控制文件中,为了防止控制文件因为存放rman repository数据变得过大,如果记录超过了你指定的阀值,那么这个记录可以被重用。
controlf_fil_record_keep_time初始化参数指定了记录被覆盖前的保存的最小天数。如果没有记录超过这个阀值,由于磁盘或别的原因导致了无法向控制文件中添加记录,那么oracle会覆盖最老的记录,然后在alert日志中写入信息
使用crosscheck更新rman repository
crosscheck更新rman repository中的关于repository 记录不匹配物理状态的备份的过期信息,例如,如果一个用户使用操作系统命令移除了备份日志,repository仍然认为日志还在磁盘上,但实际上他们已经不再了。
如果备份在磁盘上,crossback命令决定文件头是否是有效的。如果备份在磁带上,那么命令只是检查备份是否存在,备份的状态可能是:available, unavailable,和expired。
可以使用rman的list命令或是查询v$backup_files视图来查看备份的状态。
CROSSCHECK BACKUP;
RUN {
ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt;
CROSSCHECK BACKUP;
}
CROSSCHECK COPY;
CROSSCHECK BACKUPSET;
CROSSCHECK BACKUP; # checks backup sets, proxy copies, and image copies
CROSSCHECK COPY OF DATABASE;
CROSSCHECK BACKUPSET 1338, 1339, 1340;
CROSSCHECK BACKUPPIECE TAG = 'nightly_backup';
CROSSCHECK CONTROLFILECOPY '/tmp/control01.ctl';
CROSSCHECK DATAFILECOPY 113, 114, 115;
CROSSCHECK PROXY 789;
CROSSCHECK BACKUP OF ARCHIVELOG ALL SPFILE;
删除备份
DELETE BACKUPPIECE 101;
DELETE CONTROLFILECOPY '/tmp/control01.ctl';
DELETE NOPROMPT ARCHIVELOG UNTIL SEQUENCE = 300;
delete noprompt archivelog until time 'sysdate-15';
DELETE BACKUP OF TABLESPACE users DEVICE TYPE sbt; # delete only from tape
DELETE COPY OF CONTROLFILE LIKE '/tmp/%'; #
DELETE BACKUP TAG='before_upgrade';
DELETE NOPROMPT ARCHIVELOG ALL;
DELETE EXPIRED BACKUP;
DELETE OBSOLETE;
删除数据库
To drop a database:
-
Connect RMAN to the target database and (optionally) recovery catalog. For example:
rman TARGET / CATALOG rman/rman@catdb
-
Catalog all backups that are associated with the database. For example, the following commands catalogs files in the flash recovery area, and then in a secondary archiving destination:
RMAN> CATALOG START WITH '+disk1'; # all files from flash recovery area # (stored on ASM disk) RMAN> CATALOG START WITH '/arch_dest2'; # all files from second arch dest
-
Delete all backups and copies associated with the database. For example:
RMAN> DELETE BACKUPSET; # deletes all backups RMAN> DELETE COPY; # delete all image copies (including archived logs)
-
Remove the database from the operating system (and automatically unregister it from the recovery catalog if you are connected to the catalog). For example:
DROP DATABASE; # delete all database files and unregister the database