Restore the database environment by using the resetlog recovery control file: rhel 5.5, oracle10.2.0.1xmanager4.0 after backing up the control file, perform a series of operations on the database to close the database; restore the control file, start to mount and use resetlogs to recreate the control file to retrieve our data.
Backup control file backupdatafile 1; RMAN> backup datafile 1; RMAN> backup datafile 1; www.2cto.com Startingbackup at 26-JUN-12usingchannel usage: starting compressed full datafile usage: specifying datafile (s) in backupsetinputdatafile fno = 00001 name =/opt/oracle/product/10.2.0/oradata/cuug/system01.dbfchannelORA _ DISK_1: starting piece 1 at 26-JUN-12channelORA_DISK_1: finished piece 1 at 26-JUN-12piecehandle =/opt/oracle/product/10.2.0/flash_recovery_area/CUUG/backupset/2012_06_26/snapshot _. bkptag = tag20120626t111_1 comment = NONEchannelORA_DISK_1: backup set complete, elapsed time: 00: 08: 06channelORA_DISK_1: throttle time: 0: 06: 39 Finishedbackup at 26-JUN-12 StartingControl File Autobackup at 26-JUN-12piecehandle =/opt/oracle/product/10.2.0/flash_recovery_area/CUUG/autobackup/2012_06_26/limit 6mm _. bkpcomment = NONEFinishedControl File Autobackup at 26-JUN-12 perform some operations and switch logs to SQL> select group #, sequence #, status from v $ log; GROUP # SEQUENCE # STATUS ------------------ -------------- 1 9 INACTIVE 2 10 CURRENT 3 7 INACTIVE 4 8 INACTIVE [oracle @ rhel5cuug] $ cp cuug01.dbf cuug01.dbf _ bakSQL> select username, default_tablespace from dba_users where username = 'Scott '; www.2cto.com USERNAME DEFAULT_TABLESPACE------------------------------------------------------------SCOTT CUUGSQL> create table SCOTT. a as select * from tab; Tablecreated. SQL> create table scott. aa as select * fromtab; SQL> select count (*) from scott. a; COUNT (*) ---------- 3642SQL> create tablespace test datafile '/opt/oracle/product/10.2.0/oradata/cuug/test01.dbf' size 100 m; Tablespacecreated. tablespacecreated. SQL> alter system switch logfile; Systemaltered. www.2cto.com SQL> select file_name from dba_data_files; FILE_NAME users/opt/oracle/product/10.2.0/oradata/cuug/cuug01.dbf/opt/oracle/product/10.2.0/oradata/cuug/rmans01.dbf/opt/oracle/product/10.2.0/oradata /cuug/users01.dbf/opt/oracle/product/10.2.0/oradata/cuug/sysaux01.dbf/opt/oracle/product/10.2.0/oradata/cuug/undotbs01.dbf/opt/oracle/product/10.2.0 /oradata/cuug/system01.dbf/opt/oracle/product/10.2.0/oradata/cuug/test01.dbf SQL> select group #, status, sequence # from v $ log; GROUP # status sequence # -------------------------- 1 INACTIVE 9 2 CURRENT 10 3 INACTIVE 7 4 INACTIVE 8 SQL> shutdown abortORACLEinstance shut down. delete the control file and modify the cuug data file [oracle @ rhel5cuug] $ mkdir bak [oracle @ rhel5cuug] $ mv *. ctl bak/[oracle @ rhel5cuug] $ mv cuug01.dbf cuug01.bakSQL> startupORACLEinstance started. totalSystem Global Area 218103808 bytesFixedSize 1218604 bytesVariableSize 62916564 bytes 150994944 bytesRedoBuffers 2973696 bytesORA-00205: error in identifying control file, check alert log for more info www.2cto.com recovery control file [oracle@rhel510.2.0] $ rman target/RecoveryManager: release 10.2.0.1.0-Production on Mon Jun 25 10:26:22 2012 Copyright (c) 1982,200 5, Oracle. all rightsreserved. connectedto target database: orcl (not mounted) RMAN> restore controlfile from '/opt/oracle/product/10.2.0/flash_recovery_area/CUUG/autobackup/2012_06_26/o1_mf_n_786973989_7yldk 6mm _. bkp '; Startingrestore at 26-JUN-12usingchannel ORA_DISK_1 channelORA_DISK_1: restoring control filechannelORA_DISK_1: restore complete, elapsed time: 00: 00: 03 outputfilename =/opt/oracle/product/10.2.0/oradata/cuug/control01.ctloutputfilename =/opt/oracle/product/10.2.0/oradata/cuug/control02.ctloutputfilename =/opt/oracle/product/ 10.2.0/oradata/cuug/control03.ctlFinishedrestore at 26-JUN-12 mark the control file as the trace file SQL> alter session set tracefile_identifier = 'cuug '; sessionaltered. SQL> alter database mount; Databasealtered. SQL> alter database backup controlfile to trace; Databasealtered. recreate the control file, first shut down the database, delete the control file that was previously recovered from the backup, start to nomount stage SQL> shutdown immediateORA-01109: database not open Databasedismounted. ORACLEinstance shut down. SQL> startup nomount; ORACLEinstance started. when TotalSystem Global Area 218103808 bytesFixedSize 1218604 bytesVariableSize 79693780 bytes 134217728 bytesRedoBuffers 2973696 bytes is created using noresetlogs. Because the online logs are still present, you can use the noresetlogs method to create [oracle @ rhel5orcl *. ctlcontrol01.ctl control02.ctl control03.ctl [oracle @ rhel5orcl] $ rm *. ctl [oracle @ rhel5udump] $ vi recommend reuse database "ORCL" NORESETLOGS allow GROUP 1'/opt/oracle/product/10.2.0/oradata/orcl/redo01.log 'size 50 M, GROUP 2 '/opt/oracle/product/10.2.0/oradata/orcl/redo02.log' SIZE 50 M, GROUP 3 '/opt/oracle/product/10.2.0/oradata/orcl/redo03.log' SIZE 50 M, GROUP 4'/opt/oracle/product/10.2.0/oradata/orcl/redo04.log 'size 50M--STANDBY logfiledatafile'/opt/oracle/product/10.2.0/oradata/orcl/system01.dbf ', '/opt/oracle/product/10.2.0/oradata/orcl/undotbs01.dbf','/opt/oracle/product/10.2.0/oradata/orcl/sysaux01.dbf ', '/opt/oracle/product/10.2.0/oradata/orcl/users01.dbf','/opt/oracle/product/10.2.0/oradata/orcl/rmans01.dbf ', '/opt/oracle/product/10.2.0/oradata/orcl/cuug01.dbf','/opt/oracle/product/10.2.0/oradata/orcl/ORCL/datafile/ow.mf_zxm_7ycm0twl _. dbf', '/opt/oracle/product/10.2.0/oradata/orcl/ORCL/datafile/o1_mf_cuug_7ycm20jq _. dbf 'characterset UTF8; an error will be prompted when you open the database. First, you must restore the data file to query the data file SQL> select name from v $ datafile; NAME users/opt/oracle/product/10.2.0/oradata/cuug/system01.dbf/opt/oracle/product/10.2.0/oradata/cuug/undotbs01.dbf/opt/oracle/product/10.2.0/oradata /cuug/sysaux01.dbf/opt/oracle/product/10.2.0/oradata/cuug/users01.dbf/opt/oracle/product/10.2.0/oradata/cuug/rmans01.dbf/opt/oracle/product/10.2.0 /oradata/cuug/cuug01.dbf/opt/oracle/product/10.2.0/db_1/dbs/unnamed3167sql> alter database rename file '/opt/oracle/product/10.2.0/db_1/dbs/UNNAMED00007 'to'/opt/oracle/product/10.2.0/oradata/cuug/test01.dbf '; SQL> select name from v $ datafile; www.2cto.com NAME samples/opt/oracle/product/10.2.0/oradata/cuug/system01.dbf/opt/oracle/product/10.2.0/oradata/cuug/undotbs01.dbf/opt/oracle/product/10.2.0/ oradata/cuug/sysaux01.dbf/opt/oracle/product/10.2.0/oradata/cuug/users01.dbf/opt/oracle/product/10.2.0/oradata/cuug/rmans01.dbf/opt/oracle/product/ 10.2.0/oradata/cuug/cuug01.dbf/opt/oracle/product/10.2.0/oradata/cuug/test01.dbf
At present, the data files are not consistent, need to restore the media, but do not use the using clause SQL> recover database using backup controlfile; ORA-00279: change 708399 generated at 06/26/2012 12:11:13 needed for thread 1ORA-00289: suggestion: /opt/oracle/product/10.2.0/flash_recovery_area/CUUG/archivelog/2012_06_26/o1_mf_1_10 _ % u _. arcORA-00280: change 708399 for thread 1 is in sequence #10 Specifylog: {<RET> = suggested | filename | AUTO | CANCEL}/opt/oracle/product/10. 2.0/oradata/cuug/redo02.logLogapplied. mediarecovery completeSQL> alter database open resetlogs; Databasealtered. query the restoration status selectfile_name, tablespace_name, bytes/1024/1024 MB quota www.2cto.com FILE_NAME TABLESPACE_NAME MB quota ----------/opt/oracle/product/10.2.0/oradata/cuug/cuug01.dbf CUUG 200/opt/Chengdu L E/product/10.2.0/oradata/cuug/rmans01.dbf RMANS 500/opt/oracle/product/10.2.0/oradata/cuug/users01.dbf USERS 5/opt/oracle/product/10.2.0/oradata/ cuug/sysaux01.dbf SYSAUX 250/opt/oracle/product/10.2.0/oradata/cuug/export UNDOTBS1 25/opt/oracle/product/10.2.0/oradata/cuug/system01.dbf SYSTEM 480/opt/ oracle/product/10.2.0/oradata/cuug/test01.dbf TEST 100 www.2cto.com SQL> select count (*) from s Cott. a 2; COUNT (*) ---------- 3642 SQL> select count (*) from scott. aa; COUNT (*) ---------- 3642 Recovery completed. Author: Dream19881003