'rman duplicate'에 해당되는 글 1건

  1. 2014.09.16 rman duplicate

2014. 9. 16. 14:55 오라클

rman duplicate



11g 에서는 rman 을 이용하여 DB가 백업본이 없어도 운영중인 상태에서 복제가 가능하다.(FROM ACTIVE DATABASE 이용)


현재 서버 ORCL DB -> 다른서버의 ORCL2 라는 이름으로  복제해 보자. 귀찮아서 새로운 서버의 화일 경로는 바꾸지 않았다.

 

1. source 와 target에서 각각의 서비스를 tnsnames.ora 에 모두 반영

 

target 관련 TNS에는 from active database 옵션을 써서 복제할 경우 startup nomount 상태시 target 의 listener 가 blocking 되어 통신이 되지 않으므로 (UR=A) 항목을 추가해 줘서 에러를 방지해 준다.

 

TEST2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = single2)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = TEST2) (UR=A)
    )
  )


2. 양쪽 listener start 


3. source 에서 pfile 을 생성하여 target 환경에 맞게 수정후 init 화일 생성


SQL> create pfile from spfile;


생성된 pfile 을 이용하여 target 에 init화일을 생성해준다.


환경에 맞게 db_name 등을 수정반영


ORCL.__db_cache_size=197132288

ORCL.__java_pool_size=4194304

ORCL.__db_cache_size=197132288

ORCL.__java_pool_size=4194304

ORCL.__large_pool_size=4194304

ORCL.__oracle_base='/oracle'#ORACLE_BASE set from environment

ORCL.__pga_aggregate_target=251658240

ORCL.__sga_target=369098752

ORCL.__shared_io_pool_size=0

ORCL.__shared_pool_size=150994944

ORCL.__streams_pool_size=0

*.audit_file_dest='/oracle/admin/ORCL/adump'

*.audit_trail='db'

*.compatible='11.2.0.0.0'

*.control_files='/oradata/control01.ctl','/oradata/control02.ctl','/oradata/control03.ctl'

*.db_block_size=8192

*.db_domain=''

*.db_name='ORCL2'

*.diagnostic_dest='/oracle/'

*.log_archive_dest_1='LOCATION=/oradata/arch'

*.log_archive_format='arch_%t_%r_%s.arc'

*.memory_target=620756992

*.open_cursors=300

*.processes=500


4. target 에서 원격접속을 위해 passwd 화일 생성


[oracle:/oracle/product/11.2.0.4/dbs]#orapwd file=orapwORCL2 password=manager entries=10


5. nomount 로 DB기동


export ORACLE_SID=ORCL2

sqlplus "/as sysdba"


SQL> startup nomount


6. rman 접속


target 에서


[oracle:/home/oracle]#rman target sys/manager@ORCL auxiliary sys/manager@ORCL2



Recovery Manager: Release 11.2.0.4.0 - Production on Tue Sep 16 14:37:21 2014


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


connected to target database: ORCL (DBID=1380694829)

connected to auxiliary database: ORCL2 (not mounted)


DUPLICATE TARGET DATABASE TO "ORCL2"

FROM ACTIVE DATABASE

SPFILE

NOFILENAMECHECK;

      

Starting Duplicate Db at 16-SEP-2014 14:37:32

using target database control file instead of recovery catalog

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=19 device type=DISK


contents of Memory Script:

{

   backup as copy reuse

   targetfile  '/oracle/product/11.2.0.4/dbs/spfileORCL.ora' auxiliary format 

 '/oracle/product/11.2.0.4/dbs/spfileORCL2.ora'   ;

   sql clone "alter system set spfile= ''/oracle/product/11.2.0.4/dbs/spfileORCL2.ora''";

}

executing Memory Script


Starting backup at 16-SEP-2014 14:37:33

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=35 device type=DISK

Finished backup at 16-SEP-2014 14:37:35


sql statement: alter system set spfile= ''/oracle/product/11.2.0.4/dbs/spfileORCL2.ora''


contents of Memory Script:

{

   sql clone "alter system set  db_name = 

 ''ORCL2'' comment=

 ''duplicate'' scope=spfile";

   shutdown clone immediate;

   startup clone nomount;

}

executing Memory Script


sql statement: alter system set  db_name =  ''ORCL2'' comment= ''duplicate'' scope=spfile


Oracle instance shut down


connected to auxiliary database (not started)

Oracle instance started


Total System Global Area     617975808 bytes


Fixed Size                     2255752 bytes

Variable Size                398460024 bytes

Database Buffers             213909504 bytes

Redo Buffers                   3350528 bytes


contents of Memory Script:

{

   sql clone "alter system set  db_name = 

 ''ORCL'' comment=

 ''Modified by RMAN duplicate'' scope=spfile";

   sql clone "alter system set  db_unique_name = 

 ''ORCL2'' comment=

 ''Modified by RMAN duplicate'' scope=spfile";

   shutdown clone immediate;

   startup clone force nomount

   backup as copy current controlfile auxiliary format  '/oradata/control01.ctl';

   restore clone controlfile to  '/oradata/control02.ctl' from 

 '/oradata/control01.ctl';

   restore clone controlfile to  '/oradata/control03.ctl' from 

 '/oradata/control01.ctl';

   alter clone database mount;

}

executing Memory Script


sql statement: alter system set  db_name =  ''ORCL'' comment= ''Modified by RMAN duplicate'' scope=spfile


sql statement: alter system set  db_unique_name =  ''ORCL2'' comment= ''Modified by RMAN duplicate'' scope=spfile


Oracle instance shut down


Oracle instance started


Total System Global Area     617975808 bytes


Fixed Size                     2255752 bytes

Variable Size                398460024 bytes

Database Buffers             213909504 bytes

Redo Buffers                   3350528 bytes


Starting backup at 16-SEP-2014 14:38:04

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile copy

copying current control file

output file name=/oracle/product/11.2.0.4/dbs/snapcf_ORCL.f tag=TAG20140916T143803 RECID=3 STAMP=858436686

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

Finished backup at 16-SEP-2014 14:38:11


Starting restore at 16-SEP-2014 14:38:12

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=19 device type=DISK


channel ORA_AUX_DISK_1: copied control file copy

Finished restore at 16-SEP-2014 14:38:13


Starting restore at 16-SEP-2014 14:38:14

using channel ORA_AUX_DISK_1


channel ORA_AUX_DISK_1: copied control file copy

Finished restore at 16-SEP-2014 14:38:15


database mounted

RMAN-05538: WARNING: implicitly using DB_FILE_NAME_CONVERT


contents of Memory Script:

{

   set newname for datafile  1 to 

 "/oradata/system01.dbf";

   set newname for datafile  2 to 

 "/oradata/sysaux01.dbf";

   set newname for datafile  3 to 

 "/oradata/undotbs01.dbf";

   set newname for datafile  4 to 

 "/oradata/ogg01.dbf";

   backup as copy reuse

   datafile  1 auxiliary format 

 "/oradata/system01.dbf"   datafile 

 2 auxiliary format 

 "/oradata/sysaux01.dbf"   datafile 

 3 auxiliary format 

 "/oradata/undotbs01.dbf"   datafile 

 4 auxiliary format 

 "/oradata/ogg01.dbf"   ;

   sql 'alter system archive log current';

}

executing Memory Script


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


Starting backup at 16-SEP-2014 14:38:23

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile copy

input datafile file number=00001 name=/oradata/system01.dbf

output file name=/oradata/system01.dbf tag=TAG20140916T143822

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

channel ORA_DISK_1: starting datafile copy

input datafile file number=00002 name=/oradata/sysaux01.dbf

output file name=/oradata/sysaux01.dbf tag=TAG20140916T143822

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:02:05

channel ORA_DISK_1: starting datafile copy

input datafile file number=00003 name=/oradata/undotbs01.dbf

output file name=/oradata/undotbs01.dbf tag=TAG20140916T143822

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

channel ORA_DISK_1: starting datafile copy

input datafile file number=00004 name=/oradata/ogg01.dbf

output file name=/oradata/ogg01.dbf tag=TAG20140916T143822

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

Finished backup at 16-SEP-2014 14:44:05


sql statement: alter system archive log current


contents of Memory Script:

{

   backup as copy reuse

   archivelog like  "/oradata/arch/arch_1_852914093_13.arc" auxiliary format 

 "/oradata/archarch_1_852914093_13.arc"   ;

   catalog clone archivelog  "/oradata/archarch_1_852914093_13.arc";

   switch clone datafile all;

}

executing Memory Script


Starting backup at 16-SEP-2014 14:44:07

using channel ORA_DISK_1

channel ORA_DISK_1: starting archived log copy

input archived log thread=1 sequence=13 RECID=3 STAMP=858437045

output file name=/oradata/archarch_1_852914093_13.arc RECID=0 STAMP=0

channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01

Finished backup at 16-SEP-2014 14:44:09


cataloged archived log

archived log file name=/oradata/archarch_1_852914093_13.arc RECID=3 STAMP=858437050


datafile 1 switched to datafile copy

input datafile copy RECID=3 STAMP=858437051 file name=/oradata/system01.dbf

datafile 2 switched to datafile copy

input datafile copy RECID=4 STAMP=858437051 file name=/oradata/sysaux01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=5 STAMP=858437051 file name=/oradata/undotbs01.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=6 STAMP=858437051 file name=/oradata/ogg01.dbf


contents of Memory Script:

{

   set until scn  342205;

   recover

   clone database

    delete archivelog

   ;

}

executing Memory Script


executing command: SET until clause


Starting recover at 16-SEP-2014 14:44:13

using channel ORA_AUX_DISK_1


starting media recovery


archived log for thread 1 with sequence 13 is already on disk as file /oradata/archarch_1_852914093_13.arc

archived log file name=/oradata/archarch_1_852914093_13.arc thread=1 sequence=13

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

Finished recover at 16-SEP-2014 14:44:19

Oracle instance started


Total System Global Area     617975808 bytes


Fixed Size                     2255752 bytes

Variable Size                398460024 bytes

Database Buffers             213909504 bytes

Redo Buffers                   3350528 bytes


contents of Memory Script:

{

   sql clone "alter system set  db_name = 

 ''ORCL2'' comment=

 ''Reset to original value by RMAN'' scope=spfile";

   sql clone "alter system reset  db_unique_name scope=spfile";

   shutdown clone immediate;

   startup clone nomount;

}

executing Memory Script


sql statement: alter system set  db_name =  ''ORCL2'' comment= ''Reset to original value by RMAN'' scope=spfile


sql statement: alter system reset  db_unique_name scope=spfile


Oracle instance shut down


connected to auxiliary database (not started)

Oracle instance started


Total System Global Area     617975808 bytes


Fixed Size                     2255752 bytes

Variable Size                398460024 bytes

Database Buffers             213909504 bytes

Redo Buffers                   3350528 bytes

sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORCL2" RESETLOGS ARCHIVELOG 

  MAXLOGFILES      5

  MAXLOGMEMBERS      5

  MAXDATAFILES     1000

  MAXINSTANCES     1

  MAXLOGHISTORY      292

 LOGFILE

  GROUP   1 ( '/oradata/redo01.log' ) SIZE 100 M  REUSE,

  GROUP   2 ( '/oradata/redo02.log' ) SIZE 100 M  REUSE,

  GROUP   3 ( '/oradata/redo03.log' ) SIZE 100 M  REUSE

 DATAFILE

  '/oradata/system01.dbf'

 CHARACTER SET AL32UTF8



contents of Memory Script:

{

   set newname for tempfile  1 to 

 "/oradata/temp01.dbf";

   switch clone tempfile all;

   catalog clone datafilecopy  "/oradata/sysaux01.dbf", 

 "/oradata/undotbs01.dbf", 

 "/oradata/ogg01.dbf";

   switch clone datafile all;

}

executing Memory Script


executing command: SET NEWNAME


renamed tempfile 1 to /oradata/temp01.dbf in control file


cataloged datafile copy

datafile copy file name=/oradata/sysaux01.dbf RECID=1 STAMP=858437097

cataloged datafile copy

datafile copy file name=/oradata/undotbs01.dbf RECID=2 STAMP=858437098

cataloged datafile copy

datafile copy file name=/oradata/ogg01.dbf RECID=3 STAMP=858437098


datafile 2 switched to datafile copy

input datafile copy RECID=1 STAMP=858437097 file name=/oradata/sysaux01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=2 STAMP=858437098 file name=/oradata/undotbs01.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=3 STAMP=858437098 file name=/oradata/ogg01.dbf

Reenabling controlfile options for auxiliary database

Executing: alter database add supplemental log data


contents of Memory Script:

{

   Alter clone database open resetlogs;

}

executing Memory Script


database opened

Finished Duplicate Db at 16-SEP-2014 14:45:31


끝. 10분이면 완료


복제가 잘 되었다. Archive 설정도 자동으로 되어 있다.

Single 은 초간단하게 복제 가능 !!




Posted by pat98
이전버튼 1 이전버튼

05-09 04:31
Flag Counter
Yesterday
Today
Total

글 보관함

최근에 올라온 글

달력

 « |  » 2024.5
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

최근에 달린 댓글