oracle控制文件重建

本实验内容,删除控制文件后,不进行备份,恢复数据库的控制文件。
因为rman没有使用catalog,所以控制文件删除后没使用rman进行恢复。






模拟控制文件丢失,


[oracle@orahost orcl]$ rm -fr control0*


强制关闭数据库后,打开数据库


[oracle@orahost ~]$ sqlplus / as sysdba




SQL*Plus: Release 10.2.0.1.0 - Production on Tue Feb 18 02:50:35 2014


Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to an idle instance.
 
SQL> startup
ORACLE instance started.


Total System Global Area  285212672 bytes
Fixed Size                  1218968 bytes
Variable Size              71304808 bytes
Database Buffers          205520896 bytes
Redo Buffers                7168000 bytes
ORA-00205: error in identifying control file, check alert log for more info


[oracle@orahost orcl]$ ls -ltr
total 986100
lrwxrwxrwx 1 root   root        16 Oct 25 05:13 test1.dbf -> /dev/raw/raw1011
-rw-r----- 1 oracle dba   52429312 Feb 17 23:19 redo03.log
-rw-r----- 1 oracle dba   52429312 Feb 17 23:19 redo02.log
-rw-r----- 1 oracle dba   20979712 Feb 17 23:20 temp01.dbf
-rw-r----- 1 oracle dba    6561792 Feb 17 23:23 users01.dbf
-rw-r----- 1 oracle dba   26222592 Feb 17 23:23 undotbs01.dbf
-rw-r----- 1 oracle dba   41951232 Feb 17 23:23 testbak.dbf
-rw-r----- 1 oracle dba  503324672 Feb 17 23:23 system01.dbf
-rw-r----- 1 oracle dba  251666432 Feb 17 23:23 sysaux01.dbf
-rw-r----- 1 oracle dba   52429312 Feb 17 23:23 redo01.log




编辑重建控制文件的脚本


本数据库的脚本如下:


CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS ARCHIVELOG
MAXLOGFILES 32
MAXLOGMEMBERS 2
MAXDATAFILES 254
 MAXINSTANCES 8
  MAXLOGHISTORY 907
  LOGFILE  GROUP 1 '/oracle/oradata/orcl/redo01.log' SIZE 51M,  
  GROUP 2 '/oracle/oradata/orcl/redo02.log' SIZE 51M,
   GROUP 3  '/oracle/oradata/orcl/redo03.log' SIZE 51M
   DATAFILE? '/oracle/oradata/orcl/system01.dbf',
    '/oracle/oradata/orcl/sysaux01.dbf',
     '/oracle/oradata/orcl/undotbs01.dbf', 
     '/oracle/oradata/orcl/users01.dbf',
     '/oracle/oradata/orcl/users01.dbf',
     '/oracle/oradata/orcl/testbak.dbf'
  CHARACTER SET ZHS16GBK
  
  
  
  SQL> @ccontrol.sql
 16  ;


Control file created.


SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open




SQL> alter database open  RESETLOGS ;


Database altered.


SQL> show parameter con


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cluster_interconnects                string
control_file_record_keep_time        integer     7
control_files                        string      /oracle/oradata/orcl/control01
                                                 .ctl, /oracle/oradata/orcl/con
                                                 trol02.ctl, /oracle/oradata/or
                                                 cl/control03.ctl
db_file_name_convert                 string
dg_broker_config_file1               string      /oracle/product/10.2.0/db_1/db
                                                 s/dr1orcl.dat
dg_broker_config_file2               string      /oracle/product/10.2.0/db_1/db
                                                 s/dr2orcl.dat
  
  
  
  注意:alter database backup controlfile to trace; 一般都需要先进行控制文件的备份,才可进行实验。
  
  以上,在对控制文件进行重建的时候,如果没有任何备份,要知道数据库的日志文件和数据库文件的的信息,以及日志文件的大小,可以重建,在重建后,要用resetlog的方式打开。
  
  
  SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     1
Next log sequence to archive   2
Current log sequence           2
SQL> 
  
  
 重新打开后,数据库开始新的生命周期,
  
  
  rman全备:
  [oracle@orahost ~]$ sh /oracle/oracle_backup/backup7day.sh


Recovery Manager: Release 10.2.0.1.0 - Production on Tue Feb 18 04:27:51 2014


Copyright (c) 1982, 2005, Oracle.  All rights reserved.


connected to target database: ORCL (DBID=1327540369)


RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 
using target database control file instead of recovery catalog
old RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
new RMAN configuration parameters are successfully stored


allocated channel: c1
channel c1: sid=217 devtype=DISK


allocated channel: c2
channel c2: sid=223 devtype=DISK


allocated channel: c3
channel c3: sid=224 devtype=DISK


sql statement: alter system archive log current


Starting backup at 18-FEB-14
channel c1: starting compressed full datafile backupset
channel c1: specifying datafile(s) in backupset
input datafile fno=00001 name=/oracle/oradata/orcl/system01.dbf
channel c1: starting piece 1 at 18-FEB-14
channel c2: starting compressed full datafile backupset
channel c2: specifying datafile(s) in backupset
input datafile fno=00003 name=/oracle/oradata/orcl/sysaux01.dbf
input datafile fno=00004 name=/oracle/oradata/orcl/users01.dbf
channel c2: starting piece 1 at 18-FEB-14
channel c3: starting compressed full datafile backupset
channel c3: specifying datafile(s) in backupset
input datafile fno=00005 name=/oracle/oradata/orcl/testbak.dbf
input datafile fno=00002 name=/oracle/oradata/orcl/undotbs01.dbf
channel c3: starting piece 1 at 18-FEB-14
channel c3: finished piece 1 at 18-FEB-14
piece handle=/oracle_backup/db_2014-02-18/ORCL_1327540369_8_1_20140218.bkp tag=TAG20140218T042753 comment=NONE
channel c3: backup set complete, elapsed time: 00:00:15
channel c3: starting compressed full datafile backupset
channel c3: specifying datafile(s) in backupset
including current control file in backupset
channel c3: starting piece 1 at 18-FEB-14
channel c3: finished piece 1 at 18-FEB-14
piece handle=/oracle_backup/db_2014-02-18/ORCL_1327540369_9_1_20140218.bkp tag=TAG20140218T042753 comment=NONE
channel c3: backup set complete, elapsed time: 00:00:07
channel c3: starting compressed full datafile backupset
channel c3: specifying datafile(s) in backupset
including current SPFILE in backupset
channel c3: starting piece 1 at 18-FEB-14
channel c3: finished piece 1 at 18-FEB-14
piece handle=/oracle_backup/db_2014-02-18/ORCL_1327540369_10_1_20140218.bkp tag=TAG20140218T042753 comment=NONE
channel c3: backup set complete, elapsed time: 00:00:01
channel c2: finished piece 1 at 18-FEB-14
piece handle=/oracle_backup/db_2014-02-18/ORCL_1327540369_7_1_20140218.bkp tag=TAG20140218T042753 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:39
channel c1: finished piece 1 at 18-FEB-14
piece handle=/oracle_backup/db_2014-02-18/ORCL_1327540369_6_1_20140218.bkp tag=TAG20140218T042753 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:54
Finished backup at 18-FEB-14


sql statement: alter system archive log current


Starting backup at 18-FEB-14
channel c1: starting full datafile backupset
channel c1: specifying datafile(s) in backupset
including current SPFILE in backupset
channel c1: starting piece 1 at 18-FEB-14
channel c1: finished piece 1 at 18-FEB-14
piece handle=/oracle_backup/db_2014-02-18/spfile_ORCL_1327540369_11_1_20140218.bkp tag=TAG20140218T042851 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 18-FEB-14


Starting backup at 18-FEB-14
current log archived
channel c1: starting compressed archive log backupset
channel c1: specifying archive log(s) in backup set
input archive log thread=1 sequence=1 recid=1 stamp=839823468
channel c1: starting piece 1 at 18-FEB-14
channel c2: starting compressed archive log backupset
channel c2: specifying archive log(s) in backup set
input archive log thread=1 sequence=2 recid=2 stamp=839824073
input archive log thread=1 sequence=3 recid=3 stamp=839824131
channel c2: starting piece 1 at 18-FEB-14
channel c3: starting compressed archive log backupset
channel c3: specifying archive log(s) in backup set
input archive log thread=1 sequence=4 recid=4 stamp=839824132
channel c3: starting piece 1 at 18-FEB-14
channel c1: finished piece 1 at 18-FEB-14
piece handle=/oracle_backup/db_2014-02-18/archivelog_ORCL_1327540369_12_1_20140218.bkp tag=TAG20140218T042852 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
channel c1: deleting archive log(s)
archive log filename=/oracle/flash_recovery_area/ORCL/archivelog/2014_02_18/o1_mf_1_1_9j4vmdlb_.arc recid=1 stamp=839823468
channel c2: finished piece 1 at 18-FEB-14
piece handle=/oracle_backup/db_2014-02-18/archivelog_ORCL_1327540369_13_1_20140218.bkp tag=TAG20140218T042852 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:01
channel c2: deleting archive log(s)
archive log filename=/oracle/flash_recovery_area/ORCL/archivelog/2014_02_18/o1_mf_1_2_9j4w696q_.arc recid=2 stamp=839824073
archive log filename=/oracle/flash_recovery_area/ORCL/archivelog/2014_02_18/o1_mf_1_3_9j4w830c_.arc recid=3 stamp=839824131
channel c3: finished piece 1 at 18-FEB-14
piece handle=/oracle_backup/db_2014-02-18/archivelog_ORCL_1327540369_14_1_20140218.bkp tag=TAG20140218T042852 comment=NONE
channel c3: backup set complete, elapsed time: 00:00:01
channel c3: deleting archive log(s)
archive log filename=/oracle/flash_recovery_area/ORCL/archivelog/2014_02_18/o1_mf_1_4_9j4w846h_.arc recid=4 stamp=839824132
Finished backup at 18-FEB-14


Starting backup at 18-FEB-14
channel c1: starting full datafile backupset
channel c1: specifying datafile(s) in backupset
including current control file in backupset
channel c1: starting piece 1 at 18-FEB-14
channel c1: finished piece 1 at 18-FEB-14
piece handle=/oracle_backup/db_2014-02-18/control_ORCL_1327540369_15_1_20140218.bkp tag=TAG20140218T042857 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 18-FEB-14


released channel: c1


released channel: c2


released channel: c3


RMAN> 
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=217 devtype=DISK
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle_backup/db_2014-02-18/ORCL_1327540369_8_1_20140218.bkp recid=1 stamp=839824077
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle_backup/db_2014-02-18/ORCL_1327540369_9_1_20140218.bkp recid=2 stamp=839824093
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle_backup/db_2014-02-18/ORCL_1327540369_10_1_20140218.bkp recid=3 stamp=839824096
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle_backup/db_2014-02-18/ORCL_1327540369_7_1_20140218.bkp recid=4 stamp=839824073
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle_backup/db_2014-02-18/ORCL_1327540369_6_1_20140218.bkp recid=5 stamp=839824073
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle_backup/db_2014-02-18/spfile_ORCL_1327540369_11_1_20140218.bkp recid=6 stamp=839824131
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle_backup/db_2014-02-18/archivelog_ORCL_1327540369_13_1_20140218.bkp recid=7 stamp=839824132
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle_backup/db_2014-02-18/archivelog_ORCL_1327540369_14_1_20140218.bkp recid=8 stamp=839824132
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle_backup/db_2014-02-18/archivelog_ORCL_1327540369_12_1_20140218.bkp recid=9 stamp=839824132
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle_backup/db_2014-02-18/control_ORCL_1327540369_15_1_20140218.bkp recid=10 stamp=839824137
Crosschecked 10 objects




RMAN> 
using channel ORA_DISK_1


RMAN> 


Recovery Manager complete.
[oracle@orahost ~]$ 
  
  
  
  
  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值