1、建立catalog库,并注册target database和同步catalog db
——建立数据库的备份
[oracle@rh4 ~]$ rman target / catalog rman/rman@catdb
Recovery Manager: Release 10.2.0.1.0 - Production on Sun Feb 19 11:43:13 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: PROD (DBID=187338998)
connected to recovery catalog database
RMAN> backup database format '/disk1/rman/prod/cold_bak/%d_%s.bak';
Starting backup at 19-FEB-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=159 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/u01/app/oracle/oradata/prod/system01.dbf
input datafile fno=00003 name=/u01/app/oracle/oradata/prod/sysaux01.dbf
input datafile fno=00005 name=/u01/app/oracle/oradata/prod/example01.dbf
input datafile fno=00006 name=/u01/app/oracle/oradata/prod/lxtbs1.dbf
input datafile fno=00002 name=/u01/app/oracle/oradata/prod/undotbs01.dbf
input datafile fno=00004 name=/u01/app/oracle/oradata/prod/users01.dbf
channel ORA_DISK_1: starting piece 1 at 19-FEB-12
channel ORA_DISK_1: finished piece 1 at 19-FEB-12
piece handle=/disk1/rman/prod/cold_bak/PROD_71.bak tag=TAG20120219T114346 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05
Finished backup at 19-FEB-12
Starting Control File and SPFILE Autobackup at 19-FEB-12
piece handle=/u01/app/oracle/flash_recovery_area/PROD/autobackup/2012_02_19/o1_mf_s_775655094_7n0w1qr5_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 19-FEB-12
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
389 Full 597.17M DISK 00:01:01 19-FEB-12
BP Key: 390 Status: AVAILABLE Compressed: NO Tag: TAG20120219T114346
Piece Name: /disk1/rman/prod/cold_bak/PROD_71.bak
List of Datafiles in backup set 389
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 634042 19-FEB-12 /u01/app/oracle/oradata/prod/system01.dbf
2 Full 634042 19-FEB-12 /u01/app/oracle/oradata/prod/undotbs01.dbf
3 Full 634042 19-FEB-12 /u01/app/oracle/oradata/prod/sysaux01.dbf
4 Full 634042 19-FEB-12 /u01/app/oracle/oradata/prod/users01.dbf
5 Full 634042 19-FEB-12 /u01/app/oracle/oradata/prod/example01.dbf
6 Full 634042 19-FEB-12 /u01/app/oracle/oradata/prod/lxtbs1.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
405 Full 7.27M DISK 00:00:02 19-FEB-12
BP Key: 412 Status: AVAILABLE Compressed: NO Tag: TAG20120219T114454
Piece Name: /u01/app/oracle/flash_recovery_area/PROD/autobackup/2012_02_19/o1_mf_s_775655094_7n0w1qr5_.bkp
Control File Included: Ckp SCN: 634074 Ckp time: 19-FEB-12
SPFILE Included: Modification time: 19-FEB-12
RMAN> exit
Recovery Manager complete.
2、模拟target database 被破坏,所有的controlfile丢失,重建控制文件
10:53:47 SQL> select name from v$controlfile;
NAME
----------------------------------------------------------------------------------------------------------------------------------
/u01/app/oracle/oradata/prod/control01.ctl
/u01/app/oracle/oradata/prod/control02.ctl
/u01/app/oracle/oradata/prod/control03.ctl
11:47:36 SQL> alter database backup controlfile to trace;
Database altered.
11:47:52 SQL> !
[oracle@rh4 ~]$ ls -lt /u01/app/oracle/admin/prod/udump/
total 556
-rw-r----- 1 oracle oinstall 7759 Feb 19 11:47 prod_ora_7588.trc
-rw-r----- 1 oracle oinstall 736 Feb 19 11:44 prod_ora_12464.trc
-rw-r----- 1 oracle oinstall 708 Feb 19 11:31 prod_ora_12034.trc
-rw-r----- 1 oracle oinstall 737 Feb 19 11:28 prod_ora_11849.trc
-rw-r----- 1 oracle oinstall 17460 Feb 19 10:53 prod_ora_7566.trc
-rw-r----- 1 oracle oinstall 714 Feb 19 10:51 prod_ora_7563.trc
[oracle@rh4 ~]$ more /u01/app/oracle/admin/prod/udump/prod_ora_7588.trc
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "PROD" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/prod/redo01.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/prod/redo02.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/prod/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/prod/system01.dbf',
'/u01/app/oracle/oradata/prod/undotbs01.dbf',
'/u01/app/oracle/oradata/prod/sysaux01.dbf',
'/u01/app/oracle/oradata/prod/users01.dbf',
'/u01/app/oracle/oradata/prod/example01.dbf',
'/u01/app/oracle/oradata/prod/lxtbs1.dbf'
CHARACTER SET ZHS16GBK
;
sqlplus '/as sysdba'
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Feb 19 11:49:23 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
11:49:23 SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
11:50:01 SQL> !
[oracle@rh4 ~]$ rm /u01/app/oracle/oradata/prod/*.ctl
[oracle@rh4 ~]$ !sql
sqlplus '/as sysdba'
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Feb 19 11:50:26 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
11:50:26 SQL> startup
ORACLE instance started.
Total System Global Area 184549376 bytes
Fixed Size 1218412 bytes
Variable Size 71305364 bytes
Database Buffers 109051904 bytes
Redo Buffers 2973696 bytes
ORA-00205: error in identifying control file, check alert log for more info
CREATE CONTROLFILE REUSE DATABASE "PROD" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
GROUP 1 '/u01/app/oracle/oradata/prod/redo01.log' SIZE 50M,
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/prod/redo01.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/prod/redo02.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/prod/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/prod/system01.dbf',
'/u01/app/oracle/oradata/prod/undotbs01.dbf',
'/u01/app/oracle/oradata/prod/sysaux01.dbf',
'/u01/app/oracle/oradata/prod/users01.dbf',
'/u01/app/oracle/oradata/prod/example01.dbf',
'/u01/app/oracle/oradata/prod/lxtbs1.dbf'
CHARACTER SET ZHS16GBK
11:50:57 20 ;
Control file created.
11:50:59 SQL> select status from v$instance;
STATUS
------------
MOUNTED
11:51:20 SQL> alter database open;
Database altered.
11:51:32 SQL> select name from v$datafile;
NAME
----------------------------------------------------------------------------------------------------------------------------------
/u01/app/oracle/oradata/prod/system01.dbf
/u01/app/oracle/oradata/prod/undotbs01.dbf
/u01/app/oracle/oradata/prod/sysaux01.dbf
/u01/app/oracle/oradata/prod/users01.dbf
/u01/app/oracle/oradata/prod/example01.dbf
/u01/app/oracle/oradata/prod/lxtbs1.dbf
6 rows selected.
11:51:43 SQL>
3、新的控制文件中的rman 备份的元数据丢失,无法查看到备份信息
[oracle@rh4 ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Sun Feb 19 11:51:53 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: PROD (DBID=187338998)
RMAN> list backup;
using target database control file instead of recovery catalog
RMAN> exit
Recovery Manager complete.
4、连接到catalog db 库,恢复rman的元数据
[oracle@rh4 ~]$ rman target / catalog rman/rman@catdb
Recovery Manager: Release 10.2.0.1.0 - Production on Sun Feb 19 11:52:06 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: PROD (DBID=187338998)
connected to recovery catalog database
RMAN> list backup;
starting full resync of recovery catalog
full resync complete
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
389 Full 597.17M DISK 00:01:01 19-FEB-12
BP Key: 390 Status: AVAILABLE Compressed: NO Tag: TAG20120219T114346
Piece Name: /disk1/rman/prod/cold_bak/PROD_71.bak
List of Datafiles in backup set 389
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 634042 19-FEB-12 /u01/app/oracle/oradata/prod/system01.dbf
2 Full 634042 19-FEB-12 /u01/app/oracle/oradata/prod/undotbs01.dbf
3 Full 634042 19-FEB-12 /u01/app/oracle/oradata/prod/sysaux01.dbf
4 Full 634042 19-FEB-12 /u01/app/oracle/oradata/prod/users01.dbf
5 Full 634042 19-FEB-12 /u01/app/oracle/oradata/prod/example01.dbf
6 Full 634042 19-FEB-12 /u01/app/oracle/oradata/prod/lxtbs1.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
405 Full 7.27M DISK 00:00:02 19-FEB-12
BP Key: 412 Status: AVAILABLE Compressed: NO Tag: TAG20120219T114454
Piece Name: /u01/app/oracle/flash_recovery_area/PROD/autobackup/2012_02_19/o1_mf_s_775655094_7n0w1qr5_.bkp
Control File Included: Ckp SCN: 634074 Ckp time: 19-FEB-12
SPFILE Included: Modification time: 19-FEB-12
starting full resync of recovery catalog
full resync complete
(文章来自网络,如有侵权请来信告知,本站将在第一时间删除。)
总机:(010)-88589926,88589826,88587026 QQ讨论群:243729577 182441349 邮箱:cuug_bj@cuug.com
通信地址:北京市海淀区紫竹院路98号北京化工大学科技园609室(CUUG)邮政编码:100089
中国UNIX用户协会 Copyright 2010 ALL Rights Reserved 北京神脑资讯技术有限公司
京ICP备11008061号 京公网安备110108006275号