'RMAN'에 해당되는 글 3건

  1. 2024.08.20 rman duplicate (Local 복제테스트)
  2. 2018.07.06 rman set newnname 생성 PL/SQL
  3. 2014.09.16 rman duplicate


원격이 아닌 Local 환경에서 rman dulicate 테스트를 해 보자..

- 현재 Single 19c 환경에 ORCL 이라는 DB가 있다.
  필요에 의해 ORCL2 이라는 이름으로 DB 복제하여 생성하고자 할 경우 아래과 같이 진행...
  

전체조건 : Source가 Archive mode 이여야 가능함 !!

테스트 환경은 19.23 으로 진행
    
1. parameter 화일 생성

vi /oracle/app/oracle/product/19.0.0/dbs/initORCL2.ora
DB_NAME=ORCL2

2. passwd 화일 생성

$ORACLE_HOME/dbs/orapwd file=orapwORCL2 password=oracle entries=10 format=12 force=y

3. 접속환경 구성

listener.ora 에 추가

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ora19c)(PORT = 1522))
    )
  )

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = ORCL2)
      (ORACLE_HOME = /oracle/app/oracle/product/19.0.0)
      (SID_NAME = ORCL2)
    )
  )

tnsnames.ora 에 추가

ORCL2 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ora19c)(PORT = 1522))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ORCL2)
    )
  )
  
 [ORCL2]oracle@ora19c:/home/oracle# lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 20-AUG-2024 16:02:21

Copyright (c) 1991, 2024, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.140)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                20-AUG-2024 14:52:10
Uptime                    0 days 1 hr. 10 min. 11 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/app/oracle/product/19.0.0/network/admin/listener.ora
Listener Log File         /oracle/app/oracle/diag/tnslsnr/ora19c/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.140)(PORT=1522)))
Services Summary...
Service "ORCL" has 1 instance(s).
  Instance "ORCL", status READY, has 1 handler(s) for this service...
Service "ORCL2" has 1 instance(s).
  Instance "ORCL2", status UNKNOWN, has 1 handler(s) for this service...
Service "ORCLXDB" has 1 instance(s).
  Instance "ORCL", status READY, has 1 handler(s) for this service...
The command completed successfully

3. 디렉토리 생성
mkdir -p /oracle/app/oracle/oradata/ORCL2
mkdir -p /oracle/app/oracle/admin/ORCL2/adump
mkdir -p /oracle/archive2

5. nomount 로 DB기동

export ORACLE_SID=ORCL2
sqlplus "/as sysdba"

startup nomount pfile=/oracle/app/oracle/product/19.0.0/dbs/initORCL2.ora

6. rman 접속

! rman target sys/oracle@ORCL auxiliary sys/oracle@ORCL2

RMAN>
DUPLICATE DATABASE TO ORCL2
FROM ACTIVE DATABASE
SPFILE
parameter_value_convert ('ORCL','ORCL2')
set db_file_name_convert='/oracle/app/oracle/oradata/ORCL/','/oracle/app/oracle/oradata/ORCL2/'
set log_file_name_convert='/oracle/app/oracle/oradata/ORCL/','/oracle/app/oracle/oradata/ORCL2/'
set control_files='/oracle/app/oracle/oradata/ORCL2/control01.ctl','/oracle/app/oracle/oradata/ORCL2/control02.ctl'
set log_archive_dest_1='location=/oracle/archive2'
;

- 여기서부터는 진행 로그
Starting Duplicate Db at 20-AUG-24
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=38 device type=DISK
current log archived

contents of Memory Script:
{
   restore clone from service  'ORCL' spfile to 
 '/oracle/app/oracle/product/19.0.0/dbs/spfileORCL2.ora';
   sql clone "alter system set spfile= ''/oracle/app/oracle/product/19.0.0/dbs/spfileORCL2.ora''";
}
executing Memory Script

Starting restore at 20-AUG-24
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service ORCL
channel ORA_AUX_DISK_1: restoring SPFILE
output file name=/oracle/app/oracle/product/19.0.0/dbs/spfileORCL2.ora
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 20-AUG-24

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

contents of Memory Script:
{
   sql clone "alter system set  db_name = 
 ''ORCL2'' comment=
 ''duplicate'' scope=spfile";
   sql clone "alter system set  audit_file_dest = 
 ''/oracle/app/oracle/admin/ORCL2/adump'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_name = 
 ''ORCL2'' comment=
 '''' scope=spfile";
   sql clone "alter system set  dispatchers = 
 ''(PROTOCOL=TCP) (SERVICE=ORCL2XDB)'' comment=
 '''' scope=spfile";
   sql clone "alter system set  local_listener = 
 ''LISTENER_ORCL2'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_file_name_convert = 
 ''/oracle/app/oracle/oradata/ORCL/'', ''/oracle/app/oracle/oradata/ORCL2/'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_file_name_convert = 
 ''/oracle/app/oracle/oradata/ORCL/'', ''/oracle/app/oracle/oradata/ORCL2/'' comment=
 '''' scope=spfile";
   sql clone "alter system set  control_files = 
 ''/oracle/app/oracle/oradata/ORCL2/control01.ctl'', ''/oracle/app/oracle/oradata/ORCL2/control02.ctl'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_archive_dest_1 = 
 ''location=/oracle/archive2'' comment=
 '''' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

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

sql statement: alter system set  audit_file_dest =  ''/oracle/app/oracle/admin/ORCL2/adump'' comment= '''' scope=spfile

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

sql statement: alter system set  dispatchers =  ''(PROTOCOL=TCP) (SERVICE=ORCL2XDB)'' comment= '''' scope=spfile

sql statement: alter system set  local_listener =  ''LISTENER_ORCL2'' comment= '''' scope=spfile

sql statement: alter system set  db_file_name_convert =  ''/oracle/app/oracle/oradata/ORCL/'', ''/oracle/app/oracle/oradata/ORCL2/'' comment= '''' scope=spfile

sql statement: alter system set  log_file_name_convert =  ''/oracle/app/oracle/oradata/ORCL/'', ''/oracle/app/oracle/oradata/ORCL2/'' comment= '''' scope=spfile

sql statement: alter system set  control_files =  ''/oracle/app/oracle/oradata/ORCL2/control01.ctl'', ''/oracle/app/oracle/oradata/ORCL2/control02.ctl'' comment= '''' scope=spfile

sql statement: alter system set  log_archive_dest_1 =  ''location=/oracle/archive2'' comment= '''' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    3690983864 bytes

Fixed Size                     8946104 bytes
Variable Size                721420288 bytes
Database Buffers            2952790016 bytes
Redo Buffers                   7827456 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
   restore clone from service  'ORCL' primary controlfile;
   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    3690983864 bytes

Fixed Size                     8946104 bytes
Variable Size                721420288 bytes
Database Buffers            2952790016 bytes
Redo Buffers                   7827456 bytes

Starting restore at 20-AUG-24
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=7 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service ORCL
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/oracle/app/oracle/oradata/ORCL2/control01.ctl
output file name=/oracle/app/oracle/oradata/ORCL2/control02.ctl
Finished restore at 20-AUG-24

database mounted

contents of Memory Script:
{
   set newname for datafile  1 to 
 "/oracle/app/oracle/oradata/ORCL2/system01.dbf";
   set newname for datafile  2 to 
 "/oracle/app/oracle/oradata/ORCL2/sysaux01.dbf";
   set newname for datafile  3 to 
 "/oracle/app/oracle/oradata/ORCL2/undotbs01.dbf";
   set newname for datafile  4 to 
 "/oracle/app/oracle/oradata/ORCL2/users01.dbf";
   restore
   from  nonsparse   from service 
 'ORCL'   clone database
   ;
   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 restore at 20-AUG-24
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service ORCL
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /oracle/app/oracle/oradata/ORCL2/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service ORCL
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00002 to /oracle/app/oracle/oradata/ORCL2/sysaux01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service ORCL
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to /oracle/app/oracle/oradata/ORCL2/undotbs01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service ORCL
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00004 to /oracle/app/oracle/oradata/ORCL2/users01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 20-AUG-24

sql statement: alter system archive log current
current log archived

contents of Memory Script:
{
   restore clone force from service  'ORCL' 
           archivelog from scn  1080410;
   switch clone datafile all;
}
executing Memory Script

Starting restore at 20-AUG-24
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service ORCL
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=36
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service ORCL
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=37
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 20-AUG-24

datafile 1 switched to datafile copy
input datafile copy RECID=5 STAMP=1177516834 file name=/oracle/app/oracle/oradata/ORCL2/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=6 STAMP=1177516834 file name=/oracle/app/oracle/oradata/ORCL2/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=7 STAMP=1177516834 file name=/oracle/app/oracle/oradata/ORCL2/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=8 STAMP=1177516834 file name=/oracle/app/oracle/oradata/ORCL2/users01.dbf

contents of Memory Script:
{
   set until scn  1080548;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 20-AUG-24
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 36 is already on disk as file /oracle/archive2/arch_1_1151767787_36.arc
archived log for thread 1 with sequence 37 is already on disk as file /oracle/archive2/arch_1_1151767787_37.arc
archived log file name=/oracle/archive2/arch_1_1151767787_36.arc thread=1 sequence=36
archived log file name=/oracle/archive2/arch_1_1151767787_37.arc thread=1 sequence=37
media recovery complete, elapsed time: 00:00:00
Finished recover at 20-AUG-24

contents of Memory Script:
{
   delete clone force archivelog all;
}
executing Memory Script

released channel: ORA_AUX_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=80 device type=DISK
deleted archived log
archived log file name=/oracle/archive2/arch_1_1151767787_36.arc RECID=1 STAMP=1177516832
deleted archived log
archived log file name=/oracle/archive2/arch_1_1151767787_37.arc RECID=2 STAMP=1177516833
Deleted 2 objects

Oracle instance started

Total System Global Area    3690983864 bytes

Fixed Size                     8946104 bytes
Variable Size                721420288 bytes
Database Buffers            2952790016 bytes
Redo Buffers                   7827456 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";
}
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 started

Total System Global Area    3690983864 bytes

Fixed Size                     8946104 bytes
Variable Size                721420288 bytes
Database Buffers            2952790016 bytes
Redo Buffers                   7827456 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORCL2" RESETLOGS ARCHIVELOG 
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP     1 ( '/oracle/app/oracle/oradata/ORCL2/redo01.log' ) SIZE 200 M  REUSE,
  GROUP     2 ( '/oracle/app/oracle/oradata/ORCL2/redo02.log' ) SIZE 200 M  REUSE,
  GROUP     3 ( '/oracle/app/oracle/oradata/ORCL2/redo03.log' ) SIZE 200 M  REUSE
 DATAFILE
  '/oracle/app/oracle/oradata/ORCL2/system01.dbf'
 CHARACTER SET AL32UTF8


contents of Memory Script:
{
   set newname for tempfile  1 to 
 "/oracle/app/oracle/oradata/ORCL2/temp01.dbf";
   switch clone tempfile all;
   catalog clone datafilecopy  "/oracle/app/oracle/oradata/ORCL2/sysaux01.dbf", 
 "/oracle/app/oracle/oradata/ORCL2/undotbs01.dbf", 
 "/oracle/app/oracle/oradata/ORCL2/users01.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

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

cataloged datafile copy
datafile copy file name=/oracle/app/oracle/oradata/ORCL2/sysaux01.dbf RECID=1 STAMP=1177516866
cataloged datafile copy
datafile copy file name=/oracle/app/oracle/oradata/ORCL2/undotbs01.dbf RECID=2 STAMP=1177516866
cataloged datafile copy
datafile copy file name=/oracle/app/oracle/oradata/ORCL2/users01.dbf RECID=3 STAMP=1177516866

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=1177516866 file name=/oracle/app/oracle/oradata/ORCL2/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=1177516866 file name=/oracle/app/oracle/oradata/ORCL2/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=1177516866 file name=/oracle/app/oracle/oradata/ORCL2/users01.dbf

contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script

database opened
Finished Duplicate Db at 20-AUG-24

RMAN>

복제 완료 !!

- 테스트후 ORCL2 drop

export ORACLE_SID=ORCL2
sqlplus "/as sysdba"

shutdown immediate
startup mount exclusive restrict;
drop database;

- 만일 이짓거리를 반복적으로 수행하고자 한다면..

1. vi dup.sql

DUPLICATE DATABASE TO ORCL2
FROM ACTIVE DATABASE
SPFILE
parameter_value_convert ('ORCL','ORCL2')
set db_file_name_convert='/oracle/app/oracle/oradata/ORCL/','/oracle/app/oracle/oradata/ORCL2/'
set log_file_name_convert='/oracle/app/oracle/oradata/ORCL/','/oracle/app/oracle/oradata/ORCL2/'
set control_files='/oracle/app/oracle/oradata/ORCL2/control01.ctl','/oracle/app/oracle/oradata/ORCL2/control02.ctl'
set log_archive_dest_1='location=/oracle/archive2'
;


2. vi dup.sh
export ORACLE_SID=ORCL2
sqlplus / as sysdba <<EOF
shutdown immediate;
startup mount exclusive restrict;
drop database;
EOF
export ORACLE_SID=ORCL2
sqlplus / as sysdba <<EOF
startup nomount pfile='/oracle/app/oracle/product/19.0.0/dbs/initORCL2.ora';
! rman target sys/oracle@ORCL auxiliary sys/oracle@ORCL2 cmdfile=/home/oracle/dup.sql log=/home/oracle/dup.log append
exit
EOF

3. crontab 등록해서 원하는 주기로 반복 사용 가능
00 23 * * * /home/oracle/dup.sh

Posted by pat98

- rman set newnname 생성 PL/SQL


set serveroutput on;

declare

    cursor df is select file#, name from v$datafile;

begin

    dbms_output.put_line('run');

    dbms_output.put_line('{');

    for dfrec in df loop

        dbms_output.put_line('set newname for datafile ' ||

            dfrec.file# || ' to ''' || dfrec.name ||''' ;');

    end loop;

    dbms_output.put_line('restore database;');

    dbms_output.put_line('switch all;');

    dbms_output.put_line('}');

end;

/


run

{

set newname for datafile 1 to '/oradata/TEST/system01.dbf' ;

set newname for datafile 2 to '/oradata/TEST/sysaux01.dbf' ;

set newname for datafile 3 to '/oradata/TEST/undotbs01.dbf' ;

set newname for datafile 4 to '/oradata/TEST/users01.dbf' ;

set newname for datafile 5 to '/oradata/TEST/test01.dbf' ;

restore database;

switch all;

}


PL/SQL procedure successfully completed.

Posted by pat98

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 이전버튼

01-03 07:06
Flag Counter
Yesterday
Today
Total

글 보관함

최근에 올라온 글

달력

 « |  » 2025.1
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

최근에 달린 댓글