انجام duplicate با کمک Data Guard

اجرای دستور duplicate برای ایجاد بانک جدید(دیتابیس تستی و یا دیتاگارد چندم) بر روی بانک اصلی ممکن است سبب ایجاد کندی در آن شود، در صورتی که از قبل دیتاگاردی در این محیط پیکربندی شده باشد، می توان با کمک ان، از بار ناشی از ایجاد دیتابیس جدید در بانک اصلی جلوگیری کرد.

اجرای دستور duplicate در محیط دیتاگارد(برای ایجاد دیتاگارد دوم و یا دیتابیس جدید) در اوراکل 11g هم امکان پذیر است منتها تغییر در دیتاگارد سبب می شود تا عملیات duplicate به صورت کامل انجام نشود و در نتیجه باید در زمان اجرای دستور duplicate، از ارسال آرشیولاگ جدید به دیتابیس جلوگیری کرد و یا انکه دیتاگارد را از حالت recover خارج نمود همچنین snapshot standby هم می تواند از گزینه ها باشد، در غیر این صورت، ممکن است اجرای دستور duplicate با خطا همراه باشد:

–in 11g

RMAN>  duplicate target database to dupstb  from active database;

contents of Memory Script:

{   set until scn  710247536913;

   recover

   clone database

   noredo

    delete archivelog;}

contents of Memory Script:{

   Alter clone database open resetlogs;

}

executing Memory Script

RMAN-03002: failure of Duplicate Db command at 11/20/2018 12:06:33

RMAN-05501: aborting duplication of target database

RMAN-03015: error occurred in stored script Memory Script

RMAN-06136: ORACLE error from auxiliary database: ORA-01194: file 1 needs more recovery to be consistent

ORA-01110: data file 1: ‘/u01/oracle/oradata/dupstb/DUPSTB/datafile/o1_mf_system_prtimipp_.dbf’

همچنین دیتاگارد باید در وضیعت open قرار داشته باشد:

–in 11g

RMAN> duplicate target database to dupstb  from active database;

RMAN-03002: failure of Duplicate Db command at 11/20/2018 11:47:28

RMAN-05501: aborting duplication of target database

RMAN-05531: a mounted database cannot be duplicated while datafiles are fuzzy

در اوراکل 12cR2، می توان دستور duplicate را بدون محدودیتهایی آن در اوراکل 11g، در محیط دیتاگارد(چه در حالت mount و چه در حالت ADG) اجرا کرد(برای ایجاد دیتاگارد چندم و یا دیتابیس جدید):

SQL> select status from v$instance;

STATUS

————

MOUNTED

 [oracle@myhost ~]$ rman target sys/a@stb auxiliary sys/a@dupstb

Recovery Manager: Release 18.0.0.0.0 – Production on Sun Nov 18 14:31:10 2018

Version 18.3.0.0.0

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

connected to target database: STB (DBID=910611036, not open)

connected to auxiliary database: JADID_DB (not mounted)

RMAN> duplicate target database to jadid_db  from active database using backupset;

Starting Duplicate Db at 18-NOV-18

using target database control file instead of recovery catalog

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=530 device type=DISK

current log archived at primary database

contents of Memory Script:

{

   sql clone “alter system set  db_name =

 ”STB” comment=

 ”Modified by RMAN duplicate” scope=spfile”;

   sql clone “alter system set  db_unique_name =

 ”JADID_DB” comment=

 ”Modified by RMAN duplicate” scope=spfile”;

   shutdown clone immediate;

   startup clone force nomount

   restore clone from service  ‘stb’ primary controlfile;

   alter clone database mount;

}

executing Memory Script

sql statement: alter system set  db_name =  ”STB” comment= ”Modified by RMAN duplicate” scope=spfile

sql statement: alter system set  db_unique_name =  ”JADID_DB” comment= ”Modified by RMAN duplicate” scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area    1426062064 bytes

Fixed Size                     8657648 bytes

Variable Size                335544320 bytes

Database Buffers            1073741824 bytes

Redo Buffers                   8118272 bytes

Starting restore at 18-NOV-18

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=399 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore

channel ORA_AUX_DISK_1: using network backup set from service stb

channel ORA_AUX_DISK_1: restoring control file

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

output file name=/18c/base/oradata/jadid_db/control01.ctl

Finished restore at 18-NOV-18

database mounted

contents of Memory Script:

{

   set newname for clone datafile  1 to new;

   set newname for clone datafile  2 to new;

   set newname for clone datafile  3 to new;

   set newname for clone datafile  4 to new;

   set newname for clone datafile  5 to new;

   set newname for clone datafile  7 to new;

   restore

   from  nonsparse   from service

 ‘stb’   clone database

   ;

}

executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 18-NOV-18

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 stb

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

channel ORA_AUX_DISK_1: restoring datafile 00001 to /18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_system_%u_.dbf

channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15

channel ORA_AUX_DISK_1: starting datafile backup set restore

channel ORA_AUX_DISK_1: using network backup set from service stb

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

channel ORA_AUX_DISK_1: restoring datafile 00002 to /18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_tbs_%u_.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 stb

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

channel ORA_AUX_DISK_1: restoring datafile 00003 to /18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_sysaux_%u_.dbf

channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15

channel ORA_AUX_DISK_1: starting datafile backup set restore

channel ORA_AUX_DISK_1: using network backup set from service stb

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

channel ORA_AUX_DISK_1: restoring datafile 00004 to /18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_undotbs1_%u_.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 stb

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

channel ORA_AUX_DISK_1: restoring datafile 00005 to /18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_undotbs2_%u_.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 stb

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

channel ORA_AUX_DISK_1: restoring datafile 00007 to /18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_users_%u_.dbf

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

Finished restore at 18-NOV-18

current log archived at primary database

contents of Memory Script:

{

   restore clone force from service  ‘stb’

           archivelog from scn  4062049;

   switch clone datafile all;

}

executing Memory Script

Starting restore at 18-NOV-18

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 stb

channel ORA_AUX_DISK_1: restoring archived log

archived log thread=1 sequence=14

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 stb

channel ORA_AUX_DISK_1: restoring archived log

archived log thread=1 sequence=15

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

Finished restore at 18-NOV-18

datafile 1 switched to datafile copy

input datafile copy RECID=19 STAMP=992529155 file name=/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_system_fz2ko2dr_.dbf

datafile 2 switched to datafile copy

input datafile copy RECID=20 STAMP=992529155 file name=/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_tbs_fz2kokj4_.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=21 STAMP=992529155 file name=/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_sysaux_fz2kolrm_.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=22 STAMP=992529155 file name=/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_undotbs1_fz2kp1y4_.dbf

datafile 5 switched to datafile copy

input datafile copy RECID=23 STAMP=992529155 file name=/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_undotbs2_fz2kp4yj_.dbf

datafile 7 switched to datafile copy

input datafile copy RECID=24 STAMP=992529155 file name=/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_users_fz2kp646_.dbf

contents of Memory Script:

{

   set until scn  4062220;

   recover

   clone database

    delete archivelog

   ;

}

executing Memory Script

executing command: SET until clause

Starting recover at 18-NOV-18

using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 14 is already on disk as file /18c/home/dbs/arch1_14_992525952.dbf

archived log for thread 1 with sequence 15 is already on disk as file /18c/home/dbs/arch1_15_992525952.dbf

archived log file name=/18c/home/dbs/arch1_14_992525952.dbf thread=1 sequence=14

archived log file name=/18c/home/dbs/arch1_15_992525952.dbf thread=1 sequence=15

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

Finished recover at 18-NOV-18

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=982 device type=DISK

deleted archived log

archived log file name=/18c/home/dbs/arch1_14_992525952.dbf RECID=1 STAMP=992529153

deleted archived log

archived log file name=/18c/home/dbs/arch1_15_992525952.dbf RECID=2 STAMP=992529154

Deleted 2 objects

Oracle instance started

Total System Global Area    1426062064 bytes

Fixed Size                     8657648 bytes

Variable Size                335544320 bytes

Database Buffers            1073741824 bytes

Redo Buffers                   8118272 bytes

contents of Memory Script:

{

   sql clone “alter system set  db_name =

 ”JADID_DB” 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 =  ”JADID_DB” 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    1426062064 bytes

Fixed Size                     8657648 bytes

Variable Size                335544320 bytes

Database Buffers            1073741824 bytes

Redo Buffers                   8118272 bytes

sql statement: CREATE CONTROLFILE REUSE SET DATABASE “JADID_DB” RESETLOGS ARCHIVELOG

  MAXLOGFILES    192

  MAXLOGMEMBERS      3

  MAXDATAFILES     1024

  MAXINSTANCES    32

  MAXLOGHISTORY      292

 LOGFILE

  GROUP   1  SIZE 200 M ,

  GROUP   2  SIZE 200 M

 DATAFILE

  ‘/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_system_fz2ko2dr_.dbf’

 CHARACTER SET AL32UTF8

sql statement: ALTER DATABASE ADD LOGFILE

    INSTANCE ‘i2’

  GROUP   3  SIZE 200 M ,

  GROUP   4  SIZE 200 M

contents of Memory Script:

{

   set newname for clone tempfile  1 to new;

   switch clone tempfile all;

   catalog clone datafilecopy  “/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_tbs_fz2kokj4_.dbf”,

 “/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_sysaux_fz2kolrm_.dbf”,

 “/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_undotbs1_fz2kp1y4_.dbf”,

 “/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_undotbs2_fz2kp4yj_.dbf”,

 “/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_users_fz2kp646_.dbf”;

   switch clone datafile all;

}

executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_temp_%u_.tmp in control file

cataloged datafile copy

datafile copy file name=/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_tbs_fz2kokj4_.dbf RECID=1 STAMP=992529186

cataloged datafile copy

datafile copy file name=/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_sysaux_fz2kolrm_.dbf RECID=2 STAMP=992529186

cataloged datafile copy

datafile copy file name=/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_undotbs1_fz2kp1y4_.dbf RECID=3 STAMP=992529186

cataloged datafile copy

datafile copy file name=/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_undotbs2_fz2kp4yj_.dbf RECID=4 STAMP=992529186

cataloged datafile copy

datafile copy file name=/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_users_fz2kp646_.dbf RECID=5 STAMP=992529186

datafile 2 switched to datafile copy

input datafile copy RECID=1 STAMP=992529186 file name=/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_tbs_fz2kokj4_.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=2 STAMP=992529186 file name=/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_sysaux_fz2kolrm_.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=3 STAMP=992529186 file name=/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_undotbs1_fz2kp1y4_.dbf

datafile 5 switched to datafile copy

input datafile copy RECID=4 STAMP=992529186 file name=/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_undotbs2_fz2kp4yj_.dbf

datafile 7 switched to datafile copy

input datafile copy RECID=5 STAMP=992529186 file name=/18c/base/oradata/jadid_db/JADID_DB/datafile/o1_mf_users_fz2kp646_.dbf

contents of Memory Script:

{

   Alter clone database open resetlogs;

}

executing Memory Script

database opened

Finished Duplicate Db at 18-NOV-18

ارائه خدمات مشاوره ، پشتیبانی و نصب و راه اندازی پایگاه داده اوراکل در سراسر کشور...................... تلفن: 09128110897 ایمیل:vahidusefzadeh@gmail.com

Comment (1)

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *