欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

RMAN还原控制文件

程序员文章站 2022-05-14 20:26:50
...

如果丢失或损坏所有的控制文件就需要从备份中还原控制文件。restore controlfile命令用来还原控制文件。在还原控制文件后需要对数

如果丢失或损坏所有的控制文件就需要从备份中还原控制文件。restore controlfile命令用来还原控制文件。在还原控制文件后需要对数据亩执行完全介质恢复并以resetlog选项来打开数据库。RMAN可以将控制文件还原到它的默认存储位置,也可以使用restore controlfile ... to destination来指定位置。

从已经知的控制文件备份中还原控制文件
SQL> show parameter control_files

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string /u01/app/Oracle/oradata/test/c
ontrol01.ctl, /u01/app/oracle/
oradata/test/control02.ctl, /u
01/app/oracle/oradata/test/con
trol03.ctl


显示当前可用的备份
RMAN> list backup;


List of Backup Sets
===================

BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
77 693.50K DISK 00:00:02 28-JAN-15
BP Key: 75 Status: AVAILABLE Compressed: YES Tag: TAG20150128T131713
Piece Name: /u02/test_df870182233_s95_s1

List of Archived Logs in backup set 77
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 13 2928236 28-JAN-15 2928830 28-JAN-15

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
78 Full 166.91M DISK 00:01:19 28-JAN-15
BP Key: 76 Status: AVAILABLE Compressed: YES Tag: TAG20150128T131716
Piece Name: /u02/test_df870182236_s96_s1
List of Datafiles in backup set 78
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 2928835 28-JAN-15 /u01/app/oracle/oradata/test/system01.dbf
2 Full 2928835 28-JAN-15 /u01/app/oracle/oradata/test/undotbs01.dbf
3 Full 2928835 28-JAN-15 /u01/app/oracle/oradata/test/sysaux01.dbf
4 Full 2928835 28-JAN-15 /u01/app/oracle/oradata/test/users01.dbf
5 Full 2928835 28-JAN-15 /u01/app/oracle/oradata/test/example01.dbf
6 Full 2928835 28-JAN-15 /u01/app/oracle/oradata/test/test01.dbf

BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
79 7.50K DISK 00:00:01 28-JAN-15
BP Key: 77 Status: AVAILABLE Compressed: YES Tag: TAG20150128T131841
Piece Name: /u02/test_df870182321_s97_s1

List of Archived Logs in backup set 79
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 14 2928830 28-JAN-15 2928868 28-JAN-15

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
80 Full 9.42M DISK 00:00:02 28-JAN-15
BP Key: 78 Status: AVAILABLE Compressed: NO Tag: TAG20150128T131843
Piece Name: /u01/app/oracle/10.2.0/db/dbs/c-2155613261-20150128-0d
Control File Included: Ckp SCN: 2928874 Ckp time: 28-JAN-15
SPFILE Included: Modification time: 28-JAN-15

从上面的信息可以看到备份集80是控制文件与spfile文件的备份