본문 바로가기
스터디북

[10/12] RMAN 복구 실습 - 4

by 파이어볼러 2015. 10. 12.

출처 : http://cafe.naver.com/ocmkorea/4493 이현룡 교수님 카페 참조



RMAN> list copy;


specification does not match any datafile copy in the repository

specification does not match any control file copy in the repository

List of Archived Log Copies for database with db_unique_name ORCL

=====================================================================



RMAN> backup as copy database;


Starting backup at 12-OCT-15

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=143 device type=DISK

allocated channel: ORA_DISK_2

channel ORA_DISK_2: SID=20 device type=DISK

channel ORA_DISK_1: starting datafile copy

input datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf

channel ORA_DISK_2: starting datafile copy

input datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf

output file name=/BACKUP/rman/ORCL_71_1 tag=TAG20151012T163854 RECID=4 STAMP=892917542

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15

channel ORA_DISK_1: starting datafile copy

input datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf

output file name=/BACKUP/rman/ORCL_72_1 tag=TAG20151012T163854 RECID=5 STAMP=892917543

channel ORA_DISK_2: datafile copy complete, elapsed time: 00:00:15

channel ORA_DISK_2: starting datafile copy

input datafile file number=00005 name=/u01/app/oracle/oradata/orcl/example01.dbf

output file name=/BACKUP/rman/ORCL_73_1 tag=TAG20151012T163854 RECID=6 STAMP=892917551

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03

channel ORA_DISK_1: starting datafile copy

input datafile file number=00006 name=/u01/app/oracle/oradata/orcl/rman_tbs.dbf

output file name=/BACKUP/rman/ORCL_74_1 tag=TAG20151012T163854 RECID=7 STAMP=892917551

channel ORA_DISK_2: datafile copy complete, elapsed time: 00:00:03

channel ORA_DISK_2: starting datafile copy

input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf

output file name=/BACKUP/rman/ORCL_75_1 tag=TAG20151012T163854 RECID=9 STAMP=892917553

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

output file name=/BACKUP/rman/ORCL_76_1 tag=TAG20151012T163854 RECID=8 STAMP=892917553

channel ORA_DISK_2: datafile copy complete, elapsed time: 00:00:01

Finished backup at 12-OCT-15


Starting Control File and SPFILE Autobackup at 12-OCT-15

piece handle=/BACKUP/rman_con/c-1420439357-20151012-0a comment=NONE

Finished Control File and SPFILE Autobackup at 12-OCT-15


RMAN> list copy;


specification does not match any control file copy in the repository

List of Datafile Copies

=======================


Key     File S Completion Time Ckp SCN    Ckp Time

------- ---- - --------------- ---------- ---------------

1256    1    A 12-OCT-15       1001633    12-OCT-15

        Name: /BACKUP/rman/ORCL_71_1

        Tag: TAG20151012T163854


1257    2    A 12-OCT-15       1001634    12-OCT-15

        Name: /BACKUP/rman/ORCL_72_1

        Tag: TAG20151012T163854


1258    3    A 12-OCT-15       1001639    12-OCT-15

        Name: /BACKUP/rman/ORCL_73_1

        Tag: TAG20151012T163854


1260    4    A 12-OCT-15       1001644    12-OCT-15

        Name: /BACKUP/rman/ORCL_76_1

        Tag: TAG20151012T163854


1259    5    A 12-OCT-15       1001640    12-OCT-15

        Name: /BACKUP/rman/ORCL_74_1

        Tag: TAG20151012T163854


1261    6    A 12-OCT-15       1001642    12-OCT-15

        Name: /BACKUP/rman/ORCL_75_1

        Tag: TAG20151012T163854



SYS@orcl>select userenv('language') from dual;


USERENV('LANGUAGE')

----------------------------------------------------

AMERICAN_AMERICA.AL32UTF8


export NLS_DATE_FORMAT=YYYY-MM-DD:HH24:MI:SS

export NLS_LANG=AMERICAN_AMERICA.AL32UTF8

12-OCT-15 04.59.55.087759 PM +09:00


xport NLS_LANG=AMERICAN_AMERICA.AL32UTF8

export TEMP=/tmp

export TMPDIR=/tmp


==============================================

RMAN 불완전 복구 실습 (Time Base)

==============================================



[oracle@lnx04 ~]$ ss


SQL*Plus: Release 11.2.0.1.0 Production on Mon Oct 12 16:58:43 2015


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



Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options


SYS@orcl>create table hr_emp

  2  as select * from hr.employees;


Table created.


SYS@orcl>!vi drop_time.sql


select systimestamp from dual;

drop table hr_emp purge;


SYS@orcl>@drop_time.sql


SYSTIMESTAMP

---------------------------------------------------------------------------

12-OCT-15 04.59.55.087759 PM +09:00



Table dropped.


SYS@orcl>shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SYS@orcl>startup mount

ORACLE instance started.


Total System Global Area 1707446272 bytes

Fixed Size                  1336988 bytes

Variable Size            1006635364 bytes

Database Buffers          687865856 bytes

Redo Buffers               11608064 bytes

Database mounted.

SYS@orcl>exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@lnx04 ~]$ rman target /


Recovery Manager: Release 11.2.0.1.0 - Production on Mon Oct 12 17:00:32 2015


Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


connected to target database: ORCL (DBID=1420439357, not open)


RMAN> run {

2> allocate channel c1 type disk;

3> allocate channel c2 type disk;

4> set until time = '2015-10-12:16:59:55';

5> restore database;

6> recover database;

7> alter database open resetlogs; }


using target database control file instead of recovery catalog

allocated channel: c1

channel c1: SID=133 device type=DISK


allocated channel: c2

channel c2: SID=10 device type=DISK


executing command: SET until clause


Starting restore at 2015-10-12:17:02:40


channel c1: restoring datafile 00001

input datafile copy RECID=4 STAMP=892917542 file name=/BACKUP/rman/ORCL_71_1

destination for restore of datafile 00001: /u01/app/oracle/oradata/orcl/system01.dbf

channel c2: restoring datafile 00002

input datafile copy RECID=5 STAMP=892917543 file name=/BACKUP/rman/ORCL_72_1

destination for restore of datafile 00002: /u01/app/oracle/oradata/orcl/sysaux01.dbf

channel c1: copied datafile copy of datafile 00001

output file name=/u01/app/oracle/oradata/orcl/system01.dbf RECID=0 STAMP=0

channel c1: restoring datafile 00003

input datafile copy RECID=6 STAMP=892917551 file name=/BACKUP/rman/ORCL_73_1

destination for restore of datafile 00003: /u01/app/oracle/oradata/orcl/undotbs01.dbf

channel c2: copied datafile copy of datafile 00002

output file name=/u01/app/oracle/oradata/orcl/sysaux01.dbf RECID=0 STAMP=0

channel c2: restoring datafile 00004

input datafile copy RECID=8 STAMP=892917553 file name=/BACKUP/rman/ORCL_76_1

destination for restore of datafile 00004: /u01/app/oracle/oradata/orcl/users01.dbf

channel c1: copied datafile copy of datafile 00003

output file name=/u01/app/oracle/oradata/orcl/undotbs01.dbf RECID=0 STAMP=0

channel c1: restoring datafile 00005

input datafile copy RECID=7 STAMP=892917551 file name=/BACKUP/rman/ORCL_74_1

destination for restore of datafile 00005: /u01/app/oracle/oradata/orcl/example01.dbf

channel c2: copied datafile copy of datafile 00004

output file name=/u01/app/oracle/oradata/orcl/users01.dbf RECID=0 STAMP=0

channel c2: restoring datafile 00006

input datafile copy RECID=9 STAMP=892917553 file name=/BACKUP/rman/ORCL_75_1

destination for restore of datafile 00006: /u01/app/oracle/oradata/orcl/rman_tbs.dbf

channel c1: copied datafile copy of datafile 00005

output file name=/u01/app/oracle/oradata/orcl/example01.dbf RECID=0 STAMP=0

channel c2: copied datafile copy of datafile 00006

output file name=/u01/app/oracle/oradata/orcl/rman_tbs.dbf RECID=0 STAMP=0

Finished restore at 2015-10-12:17:02:59


Starting recover at 2015-10-12:17:02:59


starting media recovery

media recovery complete, elapsed time: 00:00:01


Finished recover at 2015-10-12:17:03:00


database opened

released channel: c1

released channel: c2


RMAN> exit



Recovery Manager complete.

[oracle@lnx04 ~]$ ss


SQL*Plus: Release 11.2.0.1.0 Production on Mon Oct 12 17:03:09 2015


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



Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options


SYS@orcl>select * from hr_emp;


EMPLOYEE_ID FIRST_NAME           LAST_NAME                 EMAIL                     PHONE_NUMBER          HIRE_DATE           JOB_ID         SALARY

----------- -------------------- ------------------------- ------------------------- -------------------- ------------------- ---------- ----------

COMMISSION_PCT MANAGER_ID DEPARTMENT_ID

-------------- ---------- -------------



107 rows selected.


SYS@orcl>exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@lnx04 ~]$ rtc


Recovery Manager: Release 11.2.0.1.0 - Production on Mon Oct 12 17:03:17 2015


Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


connected to target database: ORCL (DBID=1420439357)

connected to recovery catalog database


RMAN> reset database;


new incarnation of database registered in recovery catalog

starting full resync of recovery catalog

full resync complete


RMAN> resync catalog;


starting full resync of recovery catalog

full resync complete


RMAN> delete backupset;

RMAN> backup database plus archivelog;



==============================================

Control file 유실 시 복구 방법(불완전 복구)

==============================================

[oracle@lnx04 ~]$ sqlplus scott/tiger


SQL*Plus: Release 11.2.0.1.0 Production on Mon Oct 12 17:06:11 2015


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



Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options


SCOTT@orcl>update emp

  2  set sal=sal*1.1

  3  where empno=7788;


1 row updated.


SCOTT@orcl>commit;


Commit complete.


SCOTT@orcl>!vi /home/oracle/break_db_2.sh


connect system/oracle

set echo off

set head off

set feedback off;

alter system switch logfile;

alter system switch logfile;

alter system switch logfile;

alter system switch logfile;

spool /home/oracle/break_db_2.sh

select 'rm -f  ' || name || '; ' from v$controlfile;

spool off

!chmod 775 /home/oracle/break_db_2.sh

!/home/oracle/break_db_2.sh

!rm /home/oracle/break_db_2.sh

conn /as sysdba

shutdown abort

exit



SCOTT@orcl>@/home/oracle/break_db_2.sql

SP2-0310: unable to open file "/home/oracle/break_db_2.sql"

SCOTT@orcl>exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@lnx04 ~]$ ss


SQL*Plus: Release 11.2.0.1.0 Production on Mon Oct 12 17:08:16 2015


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



Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options


SYS@orcl>@break_db_2.sql

SP2-0310: unable to open file "break_db_2.sql"

SYS@orcl>exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@lnx04 ~]$ ll

total 60

-rw-r--r-- 1 oracle oinstall  138 Oct 12 13:02 1

-rw-r--r-- 1 oracle oinstall  137 Oct 12 11:24 afiedt.buf

-rw-r--r-- 1 oracle oinstall  428 Oct 12 17:08 break_db_2.sh

-rw-r--r-- 1 oracle oinstall  798 Oct  9 17:06 credb.sql

drwxr-xr-x 8 oracle oinstall 4096 Aug 19  2009 database

-rwxr-xr-x 1 oracle oinstall   58 Oct  9 19:26 dbstart.sh

-rw-r--r-- 1 oracle oinstall  139 Oct 12 13:03 dd.sql

drwxr-xr-x 2 oracle oinstall 4096 Sep  8 18:19 Desktop

-rw-r--r-- 1 oracle oinstall   56 Oct 12 16:59 drop_time.sql

-rw-r--r-- 1 oracle oinstall  104 Oct  9 17:08 insdb.sql

-rw-r--r-- 1 oracle oinstall   91 Oct 12 12:06 log2.sql

-rw-r--r-- 1 oracle oinstall   56 Oct 12 12:07 log3.sql

-rw-r--r-- 1 oracle oinstall  110 Oct 12 12:02 log.sql

drwxr-xr-x 3 oracle oinstall 4096 Sep  8 18:38 oradiag_oracle

-rw-r--r-- 1 oracle oinstall   58 Oct 12 12:00 switch.sql

[oracle@lnx04 ~]$ cp break_db_2.sh break_db_2.sql

[oracle@lnx04 ~]$ rm break_db_2.sh

[oracle@lnx04 ~]$ ss


SQL*Plus: Release 11.2.0.1.0 Production on Mon Oct 12 17:08:46 2015


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



Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options


SYS@orcl>@break_db_2.sql

Connected.


rm -f  /u01/app/oracle/oradata/orcl/control01.ctl;

rm -f  /u01/app/oracle/oradata/orcl/control02.ctl;




Connected.

ORACLE instance shut down.

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@lnx04 ~]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.1.0 Production on Mon Oct 12 17:09:04 2015


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


Connected to an idle instance.


SYS@orcl>startup

ORACLE instance started.


Total System Global Area 1707446272 bytes

Fixed Size                  1336988 bytes

Variable Size            1006635364 bytes

Database Buffers          687865856 bytes

Redo Buffers               11608064 bytes

ORA-00205: error in identifying control file, check alert log for more info


alert log

ALTER DATABASE   MOUNT

ORA-00210: cannot open the specified control file

ORA-00202: control file: '/u01/app/oracle/oradata/orcl/control02.ctl'

ORA-27037: unable to obtain file status

Linux Error: 2: No such file or directory

Additional information: 3

ORA-00210: cannot open the specified control file

ORA-00202: control file: '/u01/app/oracle/oradata/orcl/control01.ctl'

ORA-27037: unable to obtain file status

Linux Error: 2: No such file or directory

Additional information: 3

Mon Oct 12 17:09:08 2015

Checker run found 2 new persistent data failures

ORA-205 signalled during: ALTER DATABASE   MOUNT...




SYS@orcl>startup

ORACLE instance started.


Total System Global Area 1707446272 bytes

Fixed Size                  1336988 bytes

Variable Size            1006635364 bytes

Database Buffers          687865856 bytes

Redo Buffers               11608064 bytes

ORA-00205: error in identifying control file, check alert log for more info



SYS@orcl>

SYS@orcl>exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@lnx04 ~]$ rman target system/oracle


Recovery Manager: Release 11.2.0.1.0 - Production on Mon Oct 12 17:09:52 2015


Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


connected to target database: ORCL (not mounted)


RMAN> show all;


using target database control file instead of recovery catalog

RMAN configuration parameters for database with db_unique_name ORCL are:

CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

CONFIGURE BACKUP OPTIMIZATION OFF; # default

CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default

CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE MAXSETSIZE TO UNLIMITED; # default

CONFIGURE ENCRYPTION FOR DATABASE OFF; # default

CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default

CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default

CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default


RMAN> host;


[oracle@lnx04 ~]$ cd /BACKUP/rman_con/

[oracle@lnx04 rman_con]$ ls

c-1420439357-20151012-0c

[oracle@lnx04 rman_con]$ exit

exit

host command complete


RMAN> restore controlfile;


Starting restore at 2015-10-12:17:10:23

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=133 device type=DISK


RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of restore command at 10/12/2015 17:10:23

RMAN-06563: control file or SPFILE must be restored using FROM AUTOBACKUP


RMAN> exit



SYS@orcl>show parameter pfile;


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

spfile                               string      /u01/app/oracle/product/11.2.0

                                                 /db_1/dbs/spfileorcl.ora

SYS@orcl>restore controlfile from autobackup;

SP2-0734: unknown command beginning "restore co..." - rest of line ignored.

SYS@orcl>exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@lnx04 ~]$ rman target system/oracle


Recovery Manager: Release 11.2.0.1.0 - Production on Mon Oct 12 17:11:11 2015


Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


connected to target database: ORCL (not mounted)


RMAN> restore controlfile from autobackup;


Starting restore at 2015-10-12:17:11:20

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=125 device type=DISK


recovery area destination: /u01/app/oracle/flash_recovery_area

database name (or database unique name) used for search: ORCL

channel ORA_DISK_1: no AUTOBACKUPS found in the recovery area

AUTOBACKUP search with format "%F" not attempted because DBID was not set

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of restore command at 10/12/2015 17:11:21

RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece


RMAN> restore controlfile to 'c-1420439357-20151012-0c' from autobackup;


Starting restore at 2015-10-12:17:12:02

using channel ORA_DISK_1


recovery area destination: /u01/app/oracle/flash_recovery_area

database name (or database unique name) used for search: ORCL

channel ORA_DISK_1: no AUTOBACKUPS found in the recovery area

AUTOBACKUP search with format "%F" not attempted because DBID was not set

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of restore command at 10/12/2015 17:12:03

RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece


RMAN> restore controlfile from '/BACKUP/rman_con/c-1420439357-20151012-0c';


Starting restore at 2015-10-12:17:12:28

using channel ORA_DISK_1


channel ORA_DISK_1: restoring control file

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

output file name=/u01/app/oracle/oradata/orcl/control01.ctl

output file name=/u01/app/oracle/oradata/orcl/control02.ctl

Finished restore at 2015-10-12:17:12:29


RMAN> alter database mount;


database mounted

released channel: ORA_DISK_1


RMAN> alter database open;


RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of alter db command at 10/12/2015 17:13:22

ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


RMAN> alter database open resetlogs;


RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of alter db command at 10/12/2015 17:13:32

ORA-01194: file 1 needs more recovery to be consistent

ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'


RMAN> recover database;


Starting recover at 2015-10-12:17:13:42

Starting implicit crosscheck backup at 2015-10-12:17:13:42

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=125 device type=DISK

allocated channel: ORA_DISK_2

channel ORA_DISK_2: SID=10 device type=DISK

Crosschecked 18 objects

Crosschecked 18 objects

Finished implicit crosscheck backup at 2015-10-12:17:13:43


Starting implicit crosscheck copy at 2015-10-12:17:13:43

using channel ORA_DISK_1

using channel ORA_DISK_2

Crosschecked 6 objects

Finished implicit crosscheck copy at 2015-10-12:17:13:43


searching for all files in the recovery area

cataloging files...

no files cataloged


using channel ORA_DISK_1

using channel ORA_DISK_2


starting media recovery


archived log for thread 1 with sequence 5 is already on disk as file /u01/app/oracle/oradata/orcl/redo02.log

archived log for thread 1 with sequence 6 is already on disk as file /u01/app/oracle/oradata/orcl/redo03.log

archived log for thread 1 with sequence 7 is already on disk as file /u01/app/oracle/oradata/orcl/redo01.log

archived log file name=/ARC/ORCL_892918980_1_3.arc thread=1 sequence=3

archived log file name=/ARC/ORCL_892918980_1_4.arc thread=1 sequence=4

archived log file name=/u01/app/oracle/oradata/orcl/redo02.log thread=1 sequence=5

archived log file name=/u01/app/oracle/oradata/orcl/redo03.log thread=1 sequence=6

archived log file name=/u01/app/oracle/oradata/orcl/redo01.log thread=1 sequence=7

media recovery complete, elapsed time: 00:00:01

Finished recover at 2015-10-12:17:13:45


RMAN> alter database open resetlogs;


database opened



===================================================================

user managed incomplete recovery 1(all controlfile lost recovery)

===================================================================


SYS@orcl>alter database backup controlfile to trace as '/home/oracle/backup/back.trc';


Database altered.


SYS@orcl>alter system archive log current;


System altered.


SYS@orcl>/


System altered.


SYS@orcl>insert into scott.dept values(90,'insa','Seoul');


1 row created.


SYS@orcl>shutdown abort;

ORACLE instance shut down.

SYS@orcl>!rm $ORACLE_BASE/oradata/orcl/control*


SYS@orcl>!cp /BACKUP/close/control* /$ORACLE_BASE/oradata/orcl/


SYS@orcl>startup mount;

ORACLE instance started.


Total System Global Area 1707446272 bytes

Fixed Size                  1336988 bytes

Variable Size            1006635364 bytes

Database Buffers          687865856 bytes

Redo Buffers               11608064 bytes

Database mounted.

SYS@orcl>recover database using backup controlfile;

ORA-00279: change 1025465 generated at 10/12/2015 17:17:32 needed for thread 1

ORA-00289: suggestion : /ARC/ORCL_892919631_1_3.arc

ORA-00280: change 1025465 for thread 1 is in sequence #3


--------------------------------------------------------

alert log

--------------------------------------------------------


WARNING! Recovering data file 1 from a fuzzy file. If not the current file

it might be an online backup taken without entering the begin backup command.

WARNING! Recovering data file 2 from a fuzzy file. If not the current file

it might be an online backup taken without entering the begin backup command.

WARNING! Recovering data file 3 from a fuzzy file. If not the current file

it might be an online backup taken without entering the begin backup command.

WARNING! Recovering data file 4 from a fuzzy file. If not the current file

it might be an online backup taken without entering the begin backup command.

WARNING! Recovering data file 5 from a fuzzy file. If not the current file

it might be an online backup taken without entering the begin backup command.

WARNING! Recovering data file 6 from a fuzzy file. If not the current file

it might be an online backup taken without entering the begin backup command.

Parallel Media Recovery started with 2 slaves

ORA-279 signalled during: ALTER DATABASE RECOVER  database using backup controlfile  ...

ALTER DATABASE RECOVER    CONTINUE DEFAULT

Media Recovery Log /ARC/ORCL_892919631_1_3.arc

ORA-279 signalled during: ALTER DATABASE RECOVER    CONTINUE DEFAULT  ...


-------------------------------------------------------------------------------



Specify log: {<RET>=suggested | filename | AUTO | CANCEL}


ORA-00279: change 1025633 generated at 10/12/2015 17:22:13 needed for thread 1

ORA-00289: suggestion : /ARC/ORCL_892919631_1_4.arc

ORA-00280: change 1025633 for thread 1 is in sequence #4

ORA-00278: log file '/ARC/ORCL_892919631_1_3.arc' no longer needed for this recovery



Specify log: {<RET>=suggested | filename | AUTO | CANCEL}


ORA-00279: change 1025640 generated at 10/12/2015 17:22:24 needed for thread 1

ORA-00289: suggestion : /ARC/ORCL_892919631_1_5.arc

ORA-00280: change 1025640 for thread 1 is in sequence #5

ORA-00278: log file '/ARC/ORCL_892919631_1_4.arc' no longer needed for this recovery



Specify log: {<RET>=suggested | filename | AUTO | CANCEL}


ORA-00308: cannot open archived log '/ARC/ORCL_892919631_1_5.arc'

ORA-27037: unable to obtain file status

Linux Error: 2: No such file or directory

Additional information: 3



SYS@orcl>recover database using backup controlfile;

ORA-00279: change 1025640 generated at 10/12/2015 17:22:24 needed for thread 1

ORA-00289: suggestion : /ARC/ORCL_892919631_1_5.arc

ORA-00280: change 1025640 for thread 1 is in sequence #5



Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

/u01/app/oracle/oradata/orcl/redo01.log

ORA-00310: archived log contains sequence 4; sequence 5 required

ORA-00334: archived log: '/u01/app/oracle/oradata/orcl/redo01.log'


--------------------------------------------------------

alert log

--------------------------------------------------------


자신의 로그 히스토리와 시퀀스 넘버를 서로 비교해서 맞는 리두 로그 파일을 지정해서 복구 가능


Mon Oct 12 17:34:57 2015

ALTER DATABASE RECOVER    LOGFILE '/u01/app/oracle/oradata/orcl/redo01.log'

Media Recovery Log /u01/app/oracle/oradata/orcl/redo01.log

Mon Oct 12 17:34:57 2015

Errors with log /u01/app/oracle/oradata/orcl/redo01.log

Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_pr00_6680.trc:

ORA-00310: archived log contains sequence 4; sequence 5 required

ORA-00334: archived log: '/u01/app/oracle/oradata/orcl/redo01.log'

ORA-310 signalled during: ALTER DATABASE RECOVER    LOGFILE '/u01/app/oracle/oradata/orcl/redo01.log'  ...

ALTER DATABASE RECOVER CANCEL

Media Recovery Canceled

Completed: ALTER DATABASE RECOVER CANCEL

^[[A^[[BALTER DATABASE RECOVER  database using backup controlfile

Media Recovery Start

 started logmerger process

Mon Oct 12 17:35:06 2015

WARNING! Recovering data file 1 from a fuzzy file. If not the current file

it might be an online backup taken without entering the begin backup command.

WARNING! Recovering data file 2 from a fuzzy file. If not the current file

it might be an online backup taken without entering the begin backup command.

WARNING! Recovering data file 3 from a fuzzy file. If not the current file

it might be an online backup taken without entering the begin backup command.

WARNING! Recovering data file 4 from a fuzzy file. If not the current file

it might be an online backup taken without entering the begin backup command.

WARNING! Recovering data file 5 from a fuzzy file. If not the current file

it might be an online backup taken without entering the begin backup command.

WARNING! Recovering data file 6 from a fuzzy file. If not the current file

it might be an online backup taken without entering the begin backup command.

Parallel Media Recovery started with 2 slaves

ORA-279 signalled during: ALTER DATABASE RECOVER  database using backup controlfile  ...

Mon Oct 12 17:35:11 2015


-------------------------------------------------------------------------------


SYS@orcl>recover database using backup controlfile;

ORA-00279: change 1025640 generated at 10/12/2015 17:22:24 needed for thread 1

ORA-00289: suggestion : /ARC/ORCL_892919631_1_5.arc

ORA-00280: change 1025640 for thread 1 is in sequence #5



Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

/u01/app/oracle/oradata/orcl/redo02.log

Log applied.

Media recovery complete.



--------------------------------------------------------

alert log

--------------------------------------------------------


ALTER DATABASE RECOVER    LOGFILE '/u01/app/oracle/oradata/orcl/redo02.log'

Media Recovery Log /u01/app/oracle/oradata/orcl/redo02.log

Media Recovery Complete (orcl)

Completed: ALTER DATABASE RECOVER    LOGFILE '/u01/app/oracle/oradata/orcl/redo02.log'



-------------------------------------------------------------------------------


SYS@orcl>alter database open resetlogs;


Database altered.



===================================================================

user managed incomplete recovery 2(all controlfile lost recovery)

===================================================================


SYS@orcl>alter database backup controlfile to trace as '/home/oracle/backup/back.trc';


Database altered.


SYS@orcl>@break_db_2.sh

SP2-0310: unable to open file "break_db_2.sh"

SYS@orcl>@break_db_2.sql

Connected.


rm -f  /u01/app/oracle/oradata/orcl/control01.ctl;

rm -f  /u01/app/oracle/oradata/orcl/control02.ctl;




Connected.


[oracle@lnx04 backup]$ vi back.trc


STARTUP NOMOUNT

CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS  ARCHIVELOG

    MAXLOGFILES 16

    MAXLOGMEMBERS 3

    MAXDATAFILES 100

    MAXINSTANCES 8

    MAXLOGHISTORY 292

LOGFILE

  GROUP 1 (

    '/u01/app/oracle/oradata/orcl/redo01.log',

    '/u01/app/oracle/oradata/orcl/redo01_b.log'

  ) SIZE 50M BLOCKSIZE 512,

  GROUP 2 (

    '/u01/app/oracle/oradata/orcl/redo02.log',

    '/u01/app/oracle/oradata/orcl/redo02_b.log'

  ) SIZE 50M BLOCKSIZE 512,

  GROUP 3 (

    '/u01/app/oracle/oradata/orcl/redo03.log',

    '/u01/app/oracle/oradata/orcl/redo03_b.log'

  ) SIZE 50M BLOCKSIZE 512

-- STANDBY LOGFILE

DATAFILE

  '/u01/app/oracle/oradata/orcl/system01.dbf',

  '/u01/app/oracle/oradata/orcl/sysaux01.dbf',

  '/u01/app/oracle/oradata/orcl/undotbs01.dbf',

  '/u01/app/oracle/oradata/orcl/users01.dbf',

  '/u01/app/oracle/oradata/orcl/example01.dbf',

  '/u01/app/oracle/oradata/orcl/rman_tbs.dbf'

CHARACTER SET AL32UTF8

;


[oracle@lnx04 backup]$ cp back.trc /home/oracle/control.sql


[oracle@lnx04 ~]$ ss


SQL*Plus: Release 11.2.0.1.0 Production on Mon Oct 12 17:50:41 2015


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


Connected to an idle instance.


SYS@orcl>@control.sql

ORACLE instance started.


Total System Global Area 1707446272 bytes

Fixed Size                  1336988 bytes

Variable Size            1006635364 bytes

Database Buffers          687865856 bytes

Redo Buffers               11608064 bytes


Control file created.


SYS@orcl>select status from v$instance;


STATUS

------------

MOUNTED


SYS@orcl>alter database open;

alter database open

*

ERROR at line 1:

ORA-01113: file 1 needs media recovery

ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'



SYS@orcl>recover database;

Media recovery complete.

SYS@orcl>alter database open;


Database altered.


SYS@orcl>select instance_name, status from v$controlfile;

select instance_name, status from v$controlfile

       *

ERROR at line 1:

ORA-00904: "INSTANCE_NAME": invalid identifier



SYS@orcl>select * from v$controlfile;


STATUS

-------

NAME

------------------------------------------------------------------------------------------------------------------------------------------------------

IS_ BLOCK_SIZE FILE_SIZE_BLKS

--- ---------- --------------


/u01/app/oracle/oradata/orcl/control01.ctl

NO       16384            614



/u01/app/oracle/oradata/orcl/control02.ctl

NO       16384            614



'스터디북' 카테고리의 다른 글

[10/13] 실습 - 1 RMAN - current redolog file  (0) 2015.10.13
[10/13] 정리  (0) 2015.10.13
[10/12] RMAN 복구 실습 - 3  (0) 2015.10.12
[10/12] 실습 - 2  (0) 2015.10.12
[10/12] 정리 그리고 실습 - 1  (0) 2015.10.12