Rman测试
RMAN是用本地的controlfile作为catalog的.
1.
RMAN> run {
2> allocate channel 't1' type disk;
3> allocate channel 't2' type disk;
4> backup full tag'rmanfull' format 'd:\rmanfull%u_%p_%c' database;
5> sql 'alter system archive log current';
6> backup filesperset 3 archivelog all delete input;
7> release channel t1;
8> release channel t2;
9> }
做了一个全备
2.drop tablespace hunter including contents;
删除了hunter表空间
3.
RMAN> restore tablespace hunter;
启动 restore 于 08-6月 -06
使用通道 ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 06/08/2006 13:36:36
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20202: tablespace not found in
the recovery catalog
RMAN-06019: could not translate tablespace name "HUNTER"
在这发现在由于我是用controlfile作为catalog的,可能是删掉了hunter表空间,controlfile中也就是
catalog中没有了hunter表空间,所以没有办法恢复
4.想办法去恢复CONTROLFILE
RMAN> list backup of controlfile;
BS 关键字 类型 LV 大小 设备类型 经过时间 完成时间
------- ---- -- ---------- ----------- ------------ ----------
88 Full 1M DISK 00:02:20 08-6月 -06
BP 关键字: 90 状态: AVAILABLE 标记:RMANFULL
段名
\RMANFULL04HL40EM_1_1
控制文件包括: Ckp SCN: 1020674 Ckp 时间:08-6月 -06
还好,刚才的全备在有
5。
RMAN> restore controlfile from autobackup;
启动 restore 于 08-6月 -06
使用通道 ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 06/08/2006 13:56:21
RMAN-06495: must explicitly specify DBID with SET DBID command
RMAN> restore controlfile to 'D:\oracle\oradata\hunter\control01.ctl' from autobackup;
启动 restore 于 08-6月 -06
使用通道 ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 06/08/2006 13:59:36
RMAN-06495: must explicitly specify DBID with SET DBID command
试了一下,好像不行,看来少写了命令,要我去set dbid
6. 在SQLPLUS在找到DBID
SQL> select * from v$database;
select * from v$database
*
ERROR 位于第 1 行:
ORA-01507: ??????
在这发现没有mount,
SQL> alter database mount;
数据库已更改。
SQL> select dbid from v$database;
DBID
----------
142338310
7.
RMAN> set DBID 142338310
正在执行命令: SET DBID
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of CSET command at 06/08/2006 14:06:44
RMAN-06188: cannot use command when connected to a mounted target database
好烦呀,看来要先开关,再启到nomount;
RMAN> shutdown immediate
正在使用目标数据库控制文件替代恢复目录
数据库已卸载
Oracle 例程已关闭
RMAN>startup nomount;
8.
RMAN> set DBID 142338310;
正在执行命令: SET DBID
RMAN> restore controlfile from 'D:\RMANFULL04HL40EM_1_1';
启动 restore 于 08-6月 -06
使用通道 ORA_DISK_1
通道 ORA_DISK_1: 正在恢复控制文件
通道 ORA_DISK_1: 恢复完成
正在复制控制文件
输出文件名=D:\ORACLE\ORADATA\HUNTER\CONTROL01.CTL
输出文件名=D:\ORACLE\ORADATA\HUNTER\CONTROL02.CTL
输出文件名=D:\ORACLE\ORADATA\HUNTER\CONTROL03.CTL
完成 restore 于 08-6月 -06
哈哈,controlfile终于恢复了,高兴中,但也别太高兴太早,hunter表空间还没有恢复呢?革命尚未成
功呀,接着来
9.
RMAN> restore tablespace hunter;
启动 restore 于 08-6月 -06
使用通道 ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 06/08/2006 14:13:45
ORA-01507: 未安装数据库
RMAN> sql ' alter database mount';
sql 语句: alter database mount
RMAN> restore tablespace hunter;
启动 restore 于 08-6月 -06
使用通道 ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 06/08/2006 14:14:40
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 12 found to restore
怪怪,吓我一大跳呀,怎么no backup or copy of datafile 12 ,神经!!
在这里我说找不到,可是刚才做过全备,在SQLPLUS也可以看到!
SQL> select * from v$dbfile;
FILE# NAME
---------- --------------------------------------------------------------------
-------------------------------------------------------------------------------
10 D:\ORACLE\ORADATA\HUNTER\XDB01.DBF
9 D:\ORACLE\ORADATA\HUNTER\USERS01.DBF
2 D:\ORACLE\ORADATA\HUNTER\UNDOTBS01.DBF
8 D:\ORACLE\ORADATA\HUNTER\TOOLS01.DBF
1 D:\ORACLE\ORADATA\HUNTER\SYSTEM01.DBF
7 D:\ORACLE\ORADATA\HUNTER\ODM01.DBF
6 D:\ORACLE\ORADATA\HUNTER\INDX01.DBF
5 D:\ORACLE\ORADATA\HUNTER\EXAMPLE01.DBF
4 D:\ORACLE\ORADATA\HUNTER\DRSYS01.DBF
3 D:\ORACLE\ORADATA\HUNTER\CWMLITE01.DBF
11 D:\ORACLE\ORADATA\HUNTER\RMAN_TS.DBF
FILE# NAME
---------- --------------------------------------------------------------------
-------------------------------------------------------------------------------
12 D:\ORACLE\ORADATA\HUNTER\HUNTER01.DBF
已选择12行。
郁闷,接下来就不知道怎么操作了?
哪位大师帮我解答一下,不胜感激!!