rman 学习笔记-rman qucik review

今天粗看了一遍《Recovery Manager Quick Reference》,又了解一些以前不知道的rman(Recovery Manager)的特性和一些还原的步骤。

1、rman也可有日志:rman nocatalog target /log=’rman.log’

2、(1)全库还原步骤:
startup force mount
restore database
recover database
alter database open

(2)表空间还原步骤:
在open状态下:
RUN
{
SQL ‘ALTER TABLESPACE users OFFLINE’;
# To restore to a different location, uncomment the following commands.
# SET NEWNAME FOR DATAFILE 8 TO ‘/newdir/new_filename_for_8.f’;
RESTORE TABLESPACE users;
# If you restored to different locations, uncomment the following line.
# SWITCH DATAFILE ALL;
RECOVER TABLESPACE users;
SQL ‘ALTER TABLESPACE users ONLINE’;
}

(3)数据文件的还原步骤:
在open状态下:
RUN
{
SQL ‘ALTER DATABASE DATAFILE 7 OFFLINE’;
# To restore to a different location, uncomment the following command.
# SET NEWNAME FOR DATAFILE 7 TO ‘/newdir/new_filename.f’;
RESTORE DATAFILE 7;
# If you restored to different locations, uncomment the following line.
# SWITCH DATAFILE ALL;
RECOVER DATAFILE 7;
SQL ‘ALTER DATABASE DATAFILE 7 ONLINE’;
}

(4)block恢复步骤:
BLOCKRECOVER DATAFILE 7 BLOCK 233, 235 DATAFILE 4 BLOCK 101;
或者
BLOCKRECOVER CORRUPTION LIST;(恢复全部坏的block,可以在V$BACKUP_CORRUPTION and V$COPY_CORRUPTION.视图查到)

3、list的写法:
(1)RMAN> list backupof databaseby file|by backup(default)|summary;

数据文件备份列表
========================

文件关键字 TY LV S Ckp SCN Ckp 时间 段数 副本数 标记
—- ——- – — – ———- ———- ——- ——- —
1 1 B F A 12234535 29-12月-06 1 1 FULL_DB_20061229
2 2 B F A 12234538 29-12月-06 1 1 FULL_DB_20061229
3 1 B F A 12234535 29-12月-06 1 1 FULL_DB_20061229
4 2 B F A 12234538 29-12月-06 1 1 FULL_DB_20061229
5 2 B F A 12234538 29-12月-06 1 1 FULL_DB_20061229
6 1 B F A 12234535 29-12月-06 1 1 FULL_DB_20061229
7 2 B F A 12234538 29-12月-06 1 1 FULL_DB_20061229
8 2 B F A 12234538 29-12月-06 1 1 FULL_DB_20061229
9 1 B F A 12234535 29-12月-06 1 1 FULL_DB_20061229
10 2 B F A 12234538 29-12月-06 1 1 FULL_DB_20061229
11 1 B F A 12234535 29-12月-06 1 1 FULL_DB_20061229
12 1 B F A 12234535 29-12月-06 1 1 FULL_DB_20061229

显示过期的备份:
list expired backup;

显示可用的备份:
list backup recoverable;

4、report的写法:

(1)RMAN> reportneed backupdatabase; #超过configure中设定的天数,需要备份的文件

RMAN 保留策略将应用于该命令
将 RMAN 保留策略设置为 2 天的恢复窗口
文件报表的恢复需要超过 2 天的归档日志
文件天数据 名称
—- —– —————————————————–
1 7 D:\ORACLE\ORADATA\ORALOCAL\SYSTEM01.DBF
2 7 D:\ORACLE\ORADATA\ORALOCAL\TS_UNDO_01.DBF
3 7 D:\ORACLE\ORADATA\ORALOCAL\CWMLITE01.DBF
……

(2)RMAN> REPORT OBSOLETE; #超过configure中设定的天数的备份集

RMAN 保留策略将应用于该命令
将 RMAN 保留策略设置为 2 天的恢复窗口
已废弃的备份和副本报表
类型 关键字 完成时间 文件名/句柄
——————– —— —————— ——————–
备份集 17 21-1月 -07
备份段 17 21-1月 -07 D:\BACK UP\DB BAK\RMAN_BK\ARCH_0HI815GU117.RMN
备份集 18 21-1月 -07
备份段 18 21-1月 -07 D:\BACK UP\DB BAK\RMAN_BK\ARCH_0II815GU118.RMN

(3)RMAN> REPORT UNRECOVERABLE;

由于操作无法被恢复,文件的报表需要备份
备份请求名称的文件类型
—- ———————– ———————————–

5、rman的备份时间,可用“长时间操作”的sql脚本检测:

6、恢复目录的使用:
使用恢复目录创建脚本:
C:\Documents and Settings\Administrator>rman catalogrman/rman@orarmantarget /
RMAN> create scrīpt del_arch { #如果要删除或替换或显示脚本,可用delete|replace|print替换create
2> backup archivelog all
3> delete input;
4> }

执行已经保存的脚本:
RMAN> run {execute scrīpt del_arch;}

相关文章

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据