溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

同一主機下Duplicate DB實驗(含GI)

發(fā)布時間:2020-08-08 16:43:04 來源:ITPUB博客 閱讀:145 作者:大鯊魚o0O 欄目:關(guān)系型數(shù)據(jù)庫
說明性文字:
           oracle版本11g        操作系統(tǒng):oracle linux 5
       Main DB(target DB)  ----->連接------>   Duplicate DB

同一主機下Duplicate DB實驗(含GI)
----根據(jù)主庫創(chuàng)建Duplicate DB的目錄
----根據(jù)主庫的參數(shù)文件(pfile)創(chuàng)建Duplicate DB的參數(shù)文件(pfile),如果在上述路徑?jīng)]有找到的話在主庫創(chuàng)建pfile:create pfile from spfile;  然后再到$ORACLE_HOME/dbs路徑下ls就能看到了
----圖中的vim /etc/hosts是為了添加IP解析
[root@sink ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 sink localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.10.6 sink
同一主機下Duplicate DB實驗(含GI)
-----刪除 sink.  的行,那是在sink實例下內(nèi)容,我們這里是在根據(jù)sink庫創(chuàng)建test庫,所以不能存在sink實例的參數(shù)信息
-----修改memory_target的大小,最好和原始值有一定的差距,因為那是一個主機運行的內(nèi)存,如果不修改就會報錯,提示無法打開test庫
-----如果有db_unique_name需要刪掉這一行,不刪的話就是一個庫,unique是別名的意思,相當(dāng)于創(chuàng)建輔助庫,在手工TSPITR  和 RMAN TSPITR的時候需要設(shè)置db_unique_name,這里新設(shè)一個庫,所以不需要
-----注意control_files的路徑,最好設(shè)在一個路徑下面好修改,當(dāng)然也可以多路復(fù)用,只不過比較麻煩而已,這部分內(nèi)容我還掌握的不好,不好班門弄斧,這里就設(shè)置同一路徑吧
-----  esc 到底行命令模式  :%s/sink/test/g  替換所有sink為test
----- 最后 加入 最下面2個 路徑轉(zhuǎn)換(數(shù)據(jù)文件,redo日志文件),最好去主庫看一下asm路徑,這是只是參考性的路徑,您的實際路徑肯定和我的不一樣
同一主機下Duplicate DB實驗(含GI)
----配置了GI之后listener.ora監(jiān)聽就由GI接管了,所以在grid用戶網(wǎng)絡(luò)配置中配置監(jiān)聽
----在duplicate當(dāng)中test庫是必須是nomunt狀態(tài)的,所以如果要連接監(jiān)聽,就只能是靜態(tài)注冊,所以在默認(rèn)監(jiān)聽上給test配置靜態(tài)注冊
----下面的tnsname.ora的信息是我截圖多出來了,不用理會
----ORACLE_HOME需要特別注意別寫錯了,我當(dāng)時就寫錯了,然后后面的lsnrctl status的時候看到的狀態(tài)老是BLOCKED,這里踩了一個大坑,最好在命令行下echo $ORACLE_HOME查看一下實際的路徑

同一主機下Duplicate DB實驗(含GI)
----來到oralce用戶,listener.ora信息是截圖多出來的不必理會(圖片沒處理好,請大家見諒,我也只是小白,一知半解,堅持寫博客只是為了激發(fā)熱情,分享感悟)
----到oracle網(wǎng)絡(luò)配置路徑下,配置tnsname.ora,sink(main DB)test(duplicate DB)
同一主機下Duplicate DB實驗(含GI)
---默認(rèn)的是sink實例
----直接 !sql --->  打開 sink(main DB)
同一主機下Duplicate DB實驗(含GI)
----export到test實例
----將test庫startup nomount
同一主機下Duplicate DB實驗(含GI)
---到grid用戶下重新啟動listener監(jiān)聽
---發(fā)現(xiàn)test連接上了,狀態(tài)信息顯示為UNKNOW表示test走的是剛才配置的靜態(tài)注冊,如果為BLOCKED則表示你配置靜態(tài)注冊存在問題,test沒有走靜態(tài)注冊
同一主機下Duplicate DB實驗(含GI)
-----開始  main DB (sink) -----連接----->  duplicate DB  (test)
-----提示:error 來自 目標(biāo)庫,target DB 是指 main DB (主庫 sink)所以下面重啟sink庫
同一主機下Duplicate DB實驗(含GI)
-----重啟target DB
同一主機下Duplicate DB實驗(含GI)
----重啟之后,正常進(jìn)入了RMAN環(huán)境
----duplicate 開始duplicate target DB 到(to) test 庫 
同一主機下Duplicate DB實驗(含GI)
----這是duplicate命令的結(jié)束截圖,如圖database opened ....表示克隆完成
同一主機下Duplicate DB實驗(含GI)
------重新來到克隆好的test庫,做一下簡單查詢,查看test的信息
同一主機下Duplicate DB實驗(含GI)
-----好了,感覺成功了

PS:歡迎轉(zhuǎn)載,如需轉(zhuǎn)載請標(biāo)明出處鏈接,謝啦

這是最后一步執(zhí)行克隆的輸出信息,留給下次研究,因為我也不知道Duplicate DB的過程中到底是什么樣的過程,這里暫且擱置,下次一定補好

Xshell for Xmanager Enterprise 5 (Build 0738)

Copyright (c) 2002-2015 NetSarang Computer, Inc. All rights reserved.

Type `help' to learn how to use Xshell prompt.

[c:\~]$

Connecting to 192.168.10.6:22...

Connection established.

To escape to local shell, press 'Ctrl+Alt+]'.

Last login: Thu Jan  4 19:33:04 2018 from 192.168.10.1

[root@sink ~]# su - oracle

[oracle@sink ~]$ rman target sys/oracle@sink auxiliary sys/oracle@test

 

Recovery Manager: Release 11.2.0.4.0 - Production on Thu Jan 4 19:33:54 2018

 

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

 

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

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

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

RMAN-00554: initialization of internal recovery manager package failed

RMAN-04005: error from target database:

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

[oracle@sink ~]$ rman target sys/oracle@sink auxiliary sys/oracle@test

 

Recovery Manager: Release 11.2.0.4.0 - Production on Thu Jan 4 19:34:33 2018

 

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

 

connected to target database: SINK (DBID=207714324)

connected to auxiliary database: TEST (not mounted)

 

RMAN> duplicate target database to "test" from active database nofilenamecheck;

 

Starting Duplicate Db at 04-JAN-18

using target database control file instead of recovery catalog

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=20 device type=DISK

 

contents of Memory Script:

{

   sql clone "create spfile from memory";

}

executing Memory Script

 

sql statement: create spfile from memory

 

contents of Memory Script:

{

   shutdown clone immediate;

   startup clone nomount;

}

executing Memory Script

 

Oracle instance shut down

 

connected to auxiliary database (not started)

Oracle instance started

 

Total System Global Area     538640384 bytes

 

Fixed Size                     2254992 bytes

Variable Size                415238000 bytes

Database Buffers             117440512 bytes

Redo Buffers                   3706880 bytes

 

contents of Memory Script:

{

   sql clone "alter system set  db_name =

 ''SINK'' comment=

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

   sql clone "alter system set  db_unique_name =

 ''TEST'' comment=

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

   shutdown clone immediate;

   startup clone force nomount

   backup as copy current controlfile auxiliary format  '/u01/app/oracle/oradata/test/control01.ctl';

   restore clone controlfile to  '/u01/app/oracle/oradata/test/control02.ctl' from

 '/u01/app/oracle/oradata/test/control01.ctl';

   alter clone database mount;

}

executing Memory Script

 

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

 

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

 

Oracle instance shut down

 

Oracle instance started

 

Total System Global Area     538640384 bytes

 

Fixed Size                     2254992 bytes

Variable Size                415238000 bytes

Database Buffers             117440512 bytes

Redo Buffers                   3706880 bytes

 

Starting backup at 04-JAN-18

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=40 device type=DISK

channel ORA_DISK_1: starting datafile copy

copying current control file

output file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_sink.f tag=TAG20180104T193452 RECID=2 STAMP=964553692

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

Finished backup at 04-JAN-18

 

Starting restore at 04-JAN-18

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=18 device type=DISK

 

channel ORA_AUX_DISK_1: copied control file copy

Finished restore at 04-JAN-18

 

database mounted

 

contents of Memory Script:

{

   set newname for datafile  1 to

 "/u01/app/oracle/oradata/test/system01.dbf";

   set newname for datafile  2 to

 "/u01/app/oracle/oradata/test/sysaux01.dbf";

   set newname for datafile  3 to

 "/u01/app/oracle/oradata/test/undotbs01.dbf";

   set newname for datafile  4 to

 "/u01/app/oracle/oradata/test/users01.dbf";

   set newname for datafile  5 to

 "/u01/app/oracle/oradata/test/example01.dbf";

   set newname for datafile  6 to

 "/u01/app/oracle/oradata/test/tbssss.256.963504823";

   backup as copy reuse

   datafile  1 auxiliary format

 "/u01/app/oracle/oradata/test/system01.dbf"   datafile

 2 auxiliary format

 "/u01/app/oracle/oradata/test/sysaux01.dbf"   datafile

 3 auxiliary format

 "/u01/app/oracle/oradata/test/undotbs01.dbf"   datafile

 4 auxiliary format

 "/u01/app/oracle/oradata/test/users01.dbf"   datafile

 5 auxiliary format

 "/u01/app/oracle/oradata/test/example01.dbf"   datafile

 6 auxiliary format

 "/u01/app/oracle/oradata/test/tbssss.256.963504823"   ;

   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

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

Starting backup at 04-JAN-18

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile copy

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

output file name=/u01/app/oracle/oradata/test/system01.dbf tag=TAG20180104T193459

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

channel ORA_DISK_1: starting datafile copy

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

output file name=/u01/app/oracle/oradata/test/sysaux01.dbf tag=TAG20180104T193459

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

channel ORA_DISK_1: starting datafile copy

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

output file name=/u01/app/oracle/oradata/test/example01.dbf tag=TAG20180104T193459

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

channel ORA_DISK_1: starting datafile copy

input datafile file number=00006 name=+DATA/sink/datafile/tbssss.256.963504823

output file name=/u01/app/oracle/oradata/test/tbssss.256.963504823 tag=TAG20180104T193459

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

channel ORA_DISK_1: starting datafile copy

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

output file name=/u01/app/oracle/oradata/test/undotbs01.dbf tag=TAG20180104T193459

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

channel ORA_DISK_1: starting datafile copy

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

output file name=/u01/app/oracle/oradata/test/users01.dbf tag=TAG20180104T193459

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

Finished backup at 04-JAN-18

 

sql statement: alter system archive log current

 

contents of Memory Script:

{

   backup as copy reuse

   archivelog like  "/dsk1/arch_sink/1_12_963448790.dbf" auxiliary format

 "/dsk1/arch_test/1_12_963448790.dbf"   ;

   catalog clone archivelog  "/dsk1/arch_test/1_12_963448790.dbf";

   switch clone datafile all;

}

executing Memory Script

 

Starting backup at 04-JAN-18

using channel ORA_DISK_1

channel ORA_DISK_1: starting archived log copy

input archived log thread=1 sequence=12 RECID=8 STAMP=964553753

output file name=/dsk1/arch_test/1_12_963448790.dbf RECID=0 STAMP=0

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

Finished backup at 04-JAN-18

 

cataloged archived log

archived log file name=/dsk1/arch_test/1_12_963448790.dbf RECID=8 STAMP=964553755

 

datafile 1 switched to datafile copy

input datafile copy RECID=2 STAMP=964553755 file name=/u01/app/oracle/oradata/test/system01.dbf

datafile 2 switched to datafile copy

input datafile copy RECID=3 STAMP=964553755 file name=/u01/app/oracle/oradata/test/sysaux01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=4 STAMP=964553755 file name=/u01/app/oracle/oradata/test/undotbs01.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=5 STAMP=964553755 file name=/u01/app/oracle/oradata/test/users01.dbf

datafile 5 switched to datafile copy

input datafile copy RECID=6 STAMP=964553755 file name=/u01/app/oracle/oradata/test/example01.dbf

datafile 6 switched to datafile copy

input datafile copy RECID=7 STAMP=964553755 file name=/u01/app/oracle/oradata/test/tbssss.256.963504823

 

contents of Memory Script:

{

   set until scn  1158304;

   recover

   clone database

    delete archivelog

   ;

}

executing Memory Script

 

executing command: SET until clause

 

Starting recover at 04-JAN-18

using channel ORA_AUX_DISK_1

 

starting media recovery

 

archived log for thread 1 with sequence 12 is already on disk as file /dsk1/arch_test/1_12_963448790.dbf

archived log file name=/dsk1/arch_test/1_12_963448790.dbf thread=1 sequence=12

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

Finished recover at 04-JAN-18

Oracle instance started

 

Total System Global Area     538640384 bytes

 

Fixed Size                     2254992 bytes

Variable Size                415238000 bytes

Database Buffers             117440512 bytes

Redo Buffers                   3706880 bytes

 

contents of Memory Script:

{

   sql clone "alter system set  db_name =

 ''TEST'' 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 =  ''TEST'' 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     538640384 bytes

 

Fixed Size                     2254992 bytes

Variable Size                415238000 bytes

Database Buffers             117440512 bytes

Redo Buffers                   3706880 bytes

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

  MAXLOGFILES     16

  MAXLOGMEMBERS      3

  MAXDATAFILES      200

  MAXINSTANCES     8

  MAXLOGHISTORY      292

 LOGFILE

  GROUP   1 ( '/u01/app/oracle/oradata/test/redo01.log' ) SIZE 50 M  REUSE,

  GROUP   2 ( '/u01/app/oracle/oradata/test/redo02.log' ) SIZE 50 M  REUSE,

  GROUP   3 ( '/u01/app/oracle/oradata/test/redo03.log' ) SIZE 50 M  REUSE

 DATAFILE

  '/u01/app/oracle/oradata/test/system01.dbf'

 CHARACTER SET ZHS16GBK

 

 

contents of Memory Script:

{

   set newname for tempfile  1 to

 "/u01/app/oracle/oradata/test/temp01.dbf";

   switch clone tempfile all;

   catalog clone datafilecopy  "/u01/app/oracle/oradata/test/sysaux01.dbf",

 "/u01/app/oracle/oradata/test/undotbs01.dbf",

 "/u01/app/oracle/oradata/test/users01.dbf",

 "/u01/app/oracle/oradata/test/example01.dbf",

 "/u01/app/oracle/oradata/test/tbssss.256.963504823";

   switch clone datafile all;

}

executing Memory Script

 

executing command: SET NEWNAME

 

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

 

cataloged datafile copy

datafile copy file name=/u01/app/oracle/oradata/test/sysaux01.dbf RECID=1 STAMP=964553762

cataloged datafile copy

datafile copy file name=/u01/app/oracle/oradata/test/undotbs01.dbf RECID=2 STAMP=964553762

cataloged datafile copy

datafile copy file name=/u01/app/oracle/oradata/test/users01.dbf RECID=3 STAMP=964553762

cataloged datafile copy

datafile copy file name=/u01/app/oracle/oradata/test/example01.dbf RECID=4 STAMP=964553762

cataloged datafile copy

datafile copy file name=/u01/app/oracle/oradata/test/tbssss.256.963504823 RECID=5 STAMP=964553762

 

datafile 2 switched to datafile copy

input datafile copy RECID=1 STAMP=964553762 file name=/u01/app/oracle/oradata/test/sysaux01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=2 STAMP=964553762 file name=/u01/app/oracle/oradata/test/undotbs01.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=3 STAMP=964553762 file name=/u01/app/oracle/oradata/test/users01.dbf

datafile 5 switched to datafile copy

input datafile copy RECID=4 STAMP=964553762 file name=/u01/app/oracle/oradata/test/example01.dbf

datafile 6 switched to datafile copy

input datafile copy RECID=5 STAMP=964553762 file name=/u01/app/oracle/oradata/test/tbssss.256.963504823

 

contents of Memory Script:

{

   Alter clone database open resetlogs;

}

executing Memory Script

 

database opened

Finished Duplicate Db at 04-JAN-18

 

RMAN> 

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI