Controlfile Recover

  • 6,463 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
6,463
On Slideshare
0
From Embeds
0
Number of Embeds
5

Actions

Shares
Downloads
35
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Anar Godjaev http://anargodjaev.wordpress.com/ Controlfile recover LOST IF ONE OR MORE CONTROLFILE IF YOU LOST ALL CONTROLFILE(CREATE CONTROLFILE COMMAND) IF YOU LOST ALL CONTROLFILE(RECOVER CONTROLFILE) ******************************************************************************** ************************************************** LOST IF ONE OR MORE CONTROLFILE *************************************************************************** ******************************************************************************** ************************************************** SQL> show parameter control_file NAME TYPE VALUE ------------------------------------ ----------- -----------------------------control_files string /export/d3120/oradata/AZKKDB/c ontrol01.ctl, /export/d3120/or adata/AZKKDB/control02.ctl, /e xport/d3120/oradata/AZKKDB/con trol03.ctl SQL> shu abort ORACLE instance shut down. SQL> SQL> exit Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production With the Partitioning, OLAP and Data Mining options bash-3.00$ ls arch control02.ctl cooldata01.dbf redo01.log redo03.log system01.dbf ttstest.dbf users01.dbf control01.ctl control03.ctl cooldata02.dbf redo02.log sysaux01.dbf temp02.dbf undotbs01.dbf backup bash-3.00$ rm control01.ctl bash-3.00$ sqlplus "/ as sysdba" SQL*Plus: Release 10.2.0.2.0 - Production on Thu Nov 28 09:09:08 2013 Copyright (c) 1982, 2005, Oracle. All Rights Reserved. Connected to an idle instance. SQL> startup ORACLE instance started.
  • 2. Anar Godjaev http://anargodjaev.wordpress.com/ Total System Global Area 1258291200 bytes Fixed Size 2126904 bytes Variable Size 513641416 bytes Database Buffers 738197504 bytes Redo Buffers 4325376 bytes ORA-00205: error in identifying control file, check alert log for more info SQL> exit Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production With the Partitioning, OLAP and Data Mining options bash-3.00$ cp control02.ctl control01.ctl bash-3.00$ bash-3.00$ bash-3.00$ sqlplus "/ as sysdba" SQL*Plus: Release 10.2.0.2.0 - Production on Thu Nov 28 09:09:56 2013 Copyright (c) 1982, 2005, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production With the Partitioning, OLAP and Data Mining options SQL> startup ORA-01081: cannot start already-running ORACLE - shut it down first SQL> startup force ORACLE instance started. Total System Global Area 1258291200 bytes Fixed Size 2126904 bytes Variable Size 513641416 bytes Database Buffers 738197504 bytes Redo Buffers 4325376 bytes Database mounted. Database opened. SQL> ********************************************************************* ************************************************************* IF YOU LOST ALL CONTROLFILE(CREATE CONTROLFILE COMMAND) ********************************************************************* ************************************************************* bash-3.00$ ls -lrt total 3720312 -rw-r----- 1 oracle oinstall 69214208 Nov 27 17:41 temp02.dbf -rw-r----- 1 oracle oinstall 10493952 Nov 27 17:41 ttstest.dbf
  • 3. Anar Godjaev http://anargodjaev.wordpress.com/ -rw-r----- 1 oracle oinstall 52429312 Nov 27 17:45 redo02.log -rw-r----- 1 oracle oinstall 52429312 Nov 27 18:14 redo03.log drwxr-xr-x 2 oracle oinstall 1024 Nov 27 18:14 arch -rw-r----- 1 oracle oinstall 5251072 Nov 27 18:20 users01.dbf -rw-r----- 1 oracle oinstall 52436992 Nov 27 18:20 cooldata02.dbf -rw-r----- 1 oracle oinstall 419438592 Nov 27 18:20 cooldata01.dbf -rw-r----- 1 oracle oinstall 367009792 Nov 27 21:37 sysaux01.dbf -rw-r----- 1 oracle oinstall 173023232 Nov 27 21:41 undotbs01.dbf -rw-r----- 1 oracle oinstall 629153792 Nov 27 21:45 system01.dbf -rw-r----- 1 oracle oinstall 52429312 Nov 27 21:45 redo01.log -rw-r----- 1 oracle oinstall 7061504 Nov 27 21:49 control03.ctl -rw-r----- 1 oracle oinstall 7061504 Nov 27 21:49 control01.ctl -rw-r----- 1 oracle oinstall 7061504 Nov 27 21:49 control02.ctl bash-3.00$ sqlplus "/ as sysdba" SQL*Plus: Release 10.2.0.2.0 - Production on Wed Nov 27 21:49:58 2013 Copyright (c) 1982, 2005, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production With the Partitioning, OLAP and Data Mining options SQL> host pwd /export/d3120/oradata/AZKKDB SQL> host mkdir backup SQL> alter database begin backup; Database altered. SQL> host cp *.dbf backup/ SQL> alter database end backup; Database altered. SQL> SQL> alter database backup controlfile to trace as '/export/d3120/oradata/AZKKDB/backup/controlfile.trc'; Database altered. SQL> alter database backup controlfile to '/export/d3120/oradata/AZKKDB/backup/control01.ctl'; Database altered. SQL> host rm *.dbf
  • 4. Anar Godjaev http://anargodjaev.wordpress.com/ SQL> host ls arch control01.ctl control02.ctl control03.ctl redo01.log redo02.log SQL> host rm *.ctl SQL> host ls arch redo01.log redo02.log redo03.log backup SQL> create table eser as select * from dba_objects; create table eser as select * from dba_objects * ERROR at line 1: ORA-00604: error occurred at recursive SQL level 1 ORA-01116: error in opening database file 1 ORA-01110: data file 1: '/export/d3120/oradata/AZKKDB/system01.dbf' ORA-27041: unable to open file SVR4 Error: 2: No such file or directory Additional information: 3 SQL> SQL> shu abort ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 1258291200 bytes Fixed Size 2126904 bytes Variable Size 513641416 bytes Database Buffers 738197504 bytes Redo Buffers 4325376 bytes ORA-00205: error in identifying control file, check alert log for more info bash-3.00$ cp ./backup/*.dbf . bash-3.00$ ls -lrt total 3686554 -rw-r----- 1 oracle oinstall 52429312 Nov 27 17:45 redo02.log -rw-r----- 1 oracle oinstall 52429312 Nov 27 18:14 redo03.log drwxr-xr-x 2 oracle oinstall 1024 Nov 27 18:14 arch drwxr-xr-x 2 oracle oinstall 1024 Nov 27 21:54 backup -rw-r----- 1 oracle oinstall 52429312 Nov 27 21:56 redo01.log -rw-r----- 1 oracle oinstall 419438592 Nov 27 21:58 cooldata01.dbf -rw-r----- 1 oracle oinstall 52436992 Nov 27 21:58 cooldata02.dbf -rw-r----- 1 oracle oinstall 367009792 Nov 27 21:59 sysaux01.dbf -rw-r----- 1 oracle oinstall 629153792 Nov 27 21:59 system01.dbf -rw-r----- 1 oracle oinstall 69214208 Nov 27 21:59 temp02.dbf -rw-r----- 1 oracle oinstall 10493952 Nov 27 21:59 ttstest.dbf -rw-r----- 1 oracle oinstall 173023232 Nov 27 21:59 undotbs01.dbf -rw-r----- 1 oracle oinstall 5251072 Nov 27 21:59 users01.dbf redo03.log backup
  • 5. Anar Godjaev http://anargodjaev.wordpress.com/ bash-3.00$ vi ./backup/controlfile.trc STARTUP NOMOUNT CREATE CONTROLFILE REUSE DATABASE "AZKKDB" NORESETLOGS ARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 '/export/d3120/oradata/AZKKDB/redo01.log' SIZE 50M, GROUP 2 '/export/d3120/oradata/AZKKDB/redo02.log' SIZE 50M, GROUP 3 '/export/d3120/oradata/AZKKDB/redo03.log' SIZE 50M DATAFILE '/export/d3120/oradata/AZKKDB/system01.dbf', '/export/d3120/oradata/AZKKDB/undotbs01.dbf', '/export/d3120/oradata/AZKKDB/sysaux01.dbf', '/export/d3120/oradata/AZKKDB/users01.dbf', '/export/d3120/oradata/AZKKDB/cooldata01.dbf', '/export/d3120/oradata/AZKKDB/cooldata02.dbf' CHARACTER SET WE8ISO8859P9 ; SQL> shu abort ORACLE instance shut down. SQL> startup nomount ORACLE instance started. Total System Global Area 1258291200 bytes Fixed Size 2126904 bytes Variable Size 513641416 bytes Database Buffers 738197504 bytes Redo Buffers 4325376 bytes SQL> SQL> STARTUP NOMOUNT CREATE CONTROLFILE REUSE DATABASE "AZKKDB" NORESETLOGS ARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 ORA-01081: cannot start already-running ORACLE - shut it down first SQL> 2 3 4 5 MAXINSTANCES 8 6 MAXLOGHISTORY 292 7 LOGFILE 8 GROUP 1 '/export/d3120/oradata/AZKKDB/redo01.log' SIZE 50M, 9 GROUP 2 '/export/d3120/oradata/AZKKDB/redo02.log' SIZE 50M, 10 GROUP 3 '/export/d3120/oradata/AZKKDB/redo03.log' SIZE 50M 11 DATAFILE 12 '/export/d3120/oradata/AZKKDB/system01.dbf', 13 '/export/d3120/oradata/AZKKDB/undotbs01.dbf',
  • 6. Anar Godjaev http://anargodjaev.wordpress.com/ 14 15 16 17 18 19 '/export/d3120/oradata/AZKKDB/sysaux01.dbf', '/export/d3120/oradata/AZKKDB/users01.dbf', '/export/d3120/oradata/AZKKDB/cooldata01.dbf', '/export/d3120/oradata/AZKKDB/cooldata02.dbf' CHARACTER SET WE8ISO8859P9 ; Control file created. SQL> select status from v$instance; STATUS -----------MOUNTED SQL> alter database open; alter database open * ERROR at line 1: ORA-01113: file 1 needs media recovery ORA-01110: data file 1: '/export/d3120/oradata/AZKKDB/system01.dbf' SQL> recover database; Media recovery complete. SQL> SQL> alter database open; Database altered. SQL> select status from v$instance; STATUS -----------OPEN ********************************************************************* ****************************************** IF YOU LOST ALL CONTROLFILE(RECOVER CONTROLFILE) ********************************************************************* ****************************************** bash-3.00$ pwd /export/d3120/oradata/AZKKDB bash-3.00$ cp /export/d3120/oradata/AZKKDB/backup/control01.ctl . bash-3.00$ cp control01.ctl control02.ctl bash-3.00$ cp control01.ctl control03.ctl bash-3.00$ ls *.ctl
  • 7. Anar Godjaev http://anargodjaev.wordpress.com/ control01.ctl control02.ctl control03.ctl bash-3.00$ rm *.dbf bash-3.00$ bash-3.00$ bash-3.00$ ls arch control01.ctl control02.ctl control03.ctl redo01.log redo02.log bash-3.00$ rm *.ctl bash-3.00$ cp ./backup/*.dbf . bash-3.00$ cp /export/d3120/oradata/AZKKDB/backup/control01.ctl . bash-3.00$ cp control01.ctl control02.ctl bash-3.00$ cp control01.ctl control03.ctl bash-3.00$ bash-3.00$ bash-3.00$ sqlplus "/ as sysdba" redo03.log SQL*Plus: Release 10.2.0.2.0 - Production on Wed Nov 27 22:14:04 2013 Copyright (c) 1982, 2005, Oracle. All Rights Reserved. Connected to an idle instance. SQL> startup mount; ORACLE instance started. Total System Global Area 1258291200 bytes Fixed Size 2126904 bytes Variable Size 513641416 bytes Database Buffers 738197504 bytes Redo Buffers 4325376 bytes Database mounted. 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; alter database open resetlogs * ERROR at line 1: ORA-01195: online backup of file 1 needs more recovery to be consistent ORA-01110: data file 1: '/export/d3120/oradata/AZKKDB/system01.dbf' SQL> recover database using backup controlfile until cancel; ORA-00279: change 11166401 generated at 04/27/2013 21:51:00 needed for thread 1 ORA-00289: suggestion : /export/d3120/oradata/AZKKDB/arch/1_2_749583954.dbf ORA-00280: change 11166401 for thread 1 is in sequence #2 backup
  • 8. Anar Godjaev http://anargodjaev.wordpress.com/ Specify log: {<RET>=suggested | filename | AUTO | CANCEL} AUTO ORA-00279: change 11186531 generated at 04/27/2013 22:04:32 needed for thread 1 ORA-00289: suggestion : /export/d3120/oradata/AZKKDB/arch/1_3_749583954.dbf ORA-00280: change 11186531 for thread 1 is in sequence #3 ORA-00278: log file '/export/d3120/oradata/AZKKDB/arch/1_2_749583954.dbf' no longer needed for this recovery ORA-00308: cannot open archived log '/export/d3120/oradata/AZKKDB/arch/1_3_749583954.dbf' ORA-27037: unable to obtain file status SVR4 Error: 2: No such file or directory Additional information: 3 SQL> alter database open resetlogs; Database altered. SQL> select status from v$instance; STATUS -----------OPEN SQL>