RAC to single RMAN 복구 (예제 - from ASM to ASM)

RAC to single RMAN 복구 (예제 - from ASM to ASM)



1. 원본 DB에서 RMAN으로 Full 백업



$ rman target /

RMAN> run {

Allocate channel c2 device type disk

format ‘경로/파일명.bkp’;

backup database plus archivelog;

}



2. 파라미터 파일 복원



원본 서버에서 RMAN 백업 파일을 가져옵니다.

복구 테스트 서버에는 엔진만 설치 되어 있습니다.


$ export ORACLE_SID=test (복구하는 db는 다른이름으로 해도 상관없습니다.)

$ rman target /

RMAN> startup nomount;  (명령을 하면 파라미터 파일 없이 구동됩니다)

RMAN> restore spfile from '백업파일이 있는 경로/파일.bkp’; 

- (RMAN 으로 백업된 파일이 여러 개 이기 때문에 이중에서 spfile이 들어있는 파일을 찾아야 하는데 명령어를 날려서 성공하는걸 찾는 수밖에 없습니다.)


 이 작업이 성공하면 $ORACLE_HOME/dbs 밑에 복구 DB의 ORACLE_SID로 설정된 명칭으로 spfile이 생성됩니다.

Sqlplus / as sysdba 접속해서

Create pfile from spfile; 명령으로 파라미터 파일을 pfile로 생성합니다.

Initnirs.ora 파일을 열고 RAC 관련된 부분을 삭제합니다.


변경전 (예제)

test2.__db_cache_size=1526726656

test1.__db_cache_size=1459617792

test2.__java_pool_size=16777216

test1.__java_pool_size=16777216

test2.__large_pool_size=33554432

test1.__large_pool_size=33554432

test1.__oracle_base='/app/oracle'#ORACLE_BASE set from environment

test2.__oracle_base='/app/oracle'#ORACLE_BASE set from environment

test2.__pga_aggregate_target=1258291200

test1.__pga_aggregate_target=1342177280

test2.__sga_target=2097152000

test1.__sga_target=2013265920

test2.__shared_io_pool_size=0

test1.__shared_io_pool_size=0

test2.__shared_pool_size=486539264

test1.__shared_pool_size=469762048

test2.__streams_pool_size=0

test1.__streams_pool_size=0

*.audit_file_dest='/app/oracle/admin/test/adump'

*.audit_trail='db'

*.cluster_database=true

*.compatible='11.2.0.4.0'

*.control_files='+DATA/test/controlfile/current.260.923661671','+RECO/test/controlfile/current.256.923661671'

*.db_block_size=8192

*.db_create_file_dest='+DATA'

*.db_domain=''

*.db_name='test'

*.db_recovery_file_dest='+RECO'

*.db_recovery_file_dest_size=7423918080

*.diagnostic_dest='/app/oracle'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=testXDB)'

test1.instance_number=1

test2.instance_number=2

*.log_archive_dest_1='LOCATION=/archive'

*.log_archive_format='arch_test_%t_%s_%r.arc'

*.memory_target=3348103168

*.open_cursors=300

*.processes=350

*.remote_listener='test-cluster-scan:1521'

*.remote_login_passwordfile='exclusive'

*.sessions=390

test2.thread=2

test1.thread=1

test2.undo_tablespace='UNDOTBS2'

test1.undo_tablespace='UNDOTBS1'

*.utl_file_dir='/log/logminer'


변경 후

test.__db_cache_size=1459617792

test.__java_pool_size=16777216

test.__large_pool_size=33554432

test.__oracle_base='/app/oracle'#ORACLE_BASE set from environment

test.__pga_aggregate_target=1342177280

test.__sga_target=2013265920

test.__shared_io_pool_size=0

test.__shared_pool_size=469762048

test.__streams_pool_size=0

*.audit_file_dest='/app/oracle/admin/test/adump'

*.audit_trail='db'

*.cluster_database=false

*.compatible='11.2.0.4.0'

*.control_files='+DATA/test/controlfile/current.260.923661671'

*.db_block_size=8192

*.db_create_file_dest='+DATA'

*.db_domain=''

*.db_name='test'

*.db_recovery_file_dest='+DATA'

*.db_recovery_file_dest_size=7423918080

*.diagnostic_dest='/app/oracle'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=testXDB)'

test.instance_number=1

#test2.instance_number=2

*.log_archive_dest_1='LOCATION=/archive'

*.log_archive_format='arch_test_%t_%s_%r.arc'

*.memory_target=3348103168

*.open_cursors=300

*.processes=350

#*.remote_listener='test-cluster-scan:1521'

*.remote_login_passwordfile='exclusive'

*.sessions=390

#test2.thread=2

test.thread=1

#test2.undo_tablespace='UNDOTBS2'

test.undo_tablespace='UNDOTBS1'


 * Diag 파일 경로 생성,

 * Archive log 경로 생성 or 변경, 

 * db_nique_name, service_name 변경

 * cluster parameter 변경

 * SGA,PGA TEST DB에 맞게 변경.


새로 생성한 pfile을 이용해 DB를 nomount로 open 합니다.



3. Control file 복원



$ export ORACLE_SID=test

$ rman target /

RMAN> restore controlfile from ‘백업파일이 있는 경로/파일.bkp’;

RMAN> restore controlfile from '/work/rman/0rrijm6l_1_1_20161017.bkp';


Starting restore at 23-OCT-16

using channel ORA_DISK_1


channel ORA_DISK_1: restoring control file

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

output file name=+DATA/test/controlfile/current.256.926006957

Finished restore at 23-OCT-16

성공하면 위와 같이 에러 메시지 없이 완료됩니다. (역시 어떤 백업 파일에 있는지 모르니 될떄까지 파일을 선택해 봐야 합니다.)

RMAN> alter database mount;

데이터베이스를 Mount 합니다.

RMAN> alter database mount;


database mounted

released channel: ORA_DISK_1


RMAN>



4. 패스워드 파일 복사



scp orapwtest1 ‘복구할DB’:/oracle/app/oracle/product/11.2.0.4/db_1/dbs/orapwtest



5. 데이터 파일 복구



RMAN> catalog start with '백업파일이 있는 경로';

RMAN> CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/work/rman/%U_%T.bkp';

RMAN> CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/work/rman/%U_%T.bkp';

RMAN> CONFIGURE CHANNEL 3 DEVICE TYPE DISK FORMAT '/work/rman/%U_%T.bkp';

RMAN> CONFIGURE CHANNEL 4 DEVICE TYPE DISK FORMAT '/work/rman/%U_%T.bkp';


RMAN> catalog start with '/work/rman/';


searching for all files that match the pattern /work/rman/


List of Files Unknown to the Database

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

File Name: /work/rman/0rrijm6l_1_1_20161017.bkp

File Name: /work/rman/0prijlsh_1_1_20161017.bkp

File Name: /work/rman/0srijm73_1_1_20161017.bkp

File Name: /work/rman/0qrijlsp_1_1_20161017.bkp


Do you really want to catalog the above files (enter YES or NO)? yes

cataloging files...

cataloging done


List of Cataloged Files

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

File Name: /work/rman/0rrijm6l_1_1_20161017.bkp

File Name: /work/rman/0prijlsh_1_1_20161017.bkp

File Name: /work/rman/0srijm73_1_1_20161017.bkp

File Name: /work/rman/0qrijlsp_1_1_20161017.bkp


RMAN> restore database;      


Starting restore at 23-OCT-16

using channel ORA_DISK_1


channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_DISK_1: restoring datafile 00001 to +DATA/test/datafile/system.256.923661571

channel ORA_DISK_1: restoring datafile 00002 to +DATA/test/datafile/sysaux.257.923661571

channel ORA_DISK_1: restoring datafile 00003 to +DATA/test/datafile/undotbs1.258.923661573

channel ORA_DISK_1: restoring datafile 00004 to +DATA/test/datafile/users.259.923661573

channel ORA_DISK_1: restoring datafile 00005 to +DATA/test/datafile/example.264.923661707

channel ORA_DISK_1: restoring datafile 00006 to +DATA/test/datafile/undotbs2.265.923661973

channel ORA_DISK_1: restoring datafile 00007 to +DATA/test/datafile/test01.269.924548909

channel ORA_DISK_1: reading from backup piece /work/rman/0qrijlsp_1_1_20161017.bkp

channel ORA_DISK_1: piece handle=/work/rman/0qrijlsp_1_1_20161017.bkp tag=TAG20161017T161729

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:18:05

Finished restore at 23-OCT-16


RMAN> recover database;


Starting recover at 23-OCT-16

using channel ORA_DISK_1


starting media recovery


channel ORA_DISK_1: starting archived log restore to default destination

channel ORA_DISK_1: restoring archived log

archived log thread=2 sequence=473

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=239

channel ORA_DISK_1: reading from backup piece /work/rman/0srijm73_1_1_20161017.bkp

channel ORA_DISK_1: ORA-19870: error while restoring backup piece /work/rman/0srijm73_1_1_20161017.bkp

ORA-19504: failed to create file "/archive/arch_test_2_473_923661675.arc"

ORA-27040: file create error, unable to create file

Linux-x86_64 Error: 13: Permission denied

Additional information: 1


failover to previous backup

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

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

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

RMAN-03002: failure of recover command at 10/23/2016 17:28:31

RMAN-20506: no backup of archived log found

RMAN-06053: unable to perform media recovery because of missing log

RMAN-06025: no backup of archived log for thread 1 with sequence 239 and starting SCN of 4539696 found to restore

RMAN-06025: no backup of archived log for thread 2 with sequence 473 and starting SCN of 4539693 found to restore


RMAN> alter database open resetlogs;

database opened


$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Sun Oct 23 17:32:51 2016


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



Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options


SQL> select open_mode from v$database;


OPEN_MODE

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

READ WRITE


SQL>


티스토리 툴바