在同一臺主機上建立複製資料庫

楊奇龍發表於2010-06-05

自己做了在同一臺主機上建立複製資料庫,由於歸檔日誌的問題,在做rman建立複製資料庫時,出現問題,先轉摘了一篇:

一、手工建立輔助例項
1。建立密碼檔案
orapwd file=F:oracleproduct10.1.0em_1databasePWDaux1.ora password=liang
2. 建立引數檔案initaux1.ora
DB_NAME=test(注:與源資料庫的db_name相同)
DB_UNIQUE_NAME=aux1_test(注:需要唯一名字)
sga_target=250000000(需要足夠大,否則出現ora-4031錯誤。當sga_target為預設值時,依然出現ORA-04031: unable to allocate 100 bytes of shared memory ("shared
pool","declare fullname varchar2 ( ...","PL/SQL MPCODE","Machine Code Part Holder"))
CONTROL_FILES="F:\oracle\product\10.1.0\oradataaux1\control01.ctl"
REMOTE_LOGIN_PASSWORDFILE=exclusive
COMPATIBLE =10.2.0.1.0
DB_BLOCK_SIZE=8192
指定輔助集檔案的位置:
db_file_name_convert=("F:oracleproduct10.1.0oradatatest", "F:oracleproduct10.1.0oradataaux1")
log_file_name_convert=("F:oracleproduct10.1.0oradatatest", "F:oracleproduct10.1.0oradataaux1")
3。建立oracle例項aux1
oradim -new -sid aux1
以上是建立輔助例項的過程,建立好後可以用rman 連線(必須事先做好rman全備份)

二。

C:Documents and Settingsliang>set oracle_sid=aux1(用作業系統認證,需設定該環境變數)

C:Documents and Settingsliang>rman target auxiliary /

Recovery Manager: Release 10.2.0.1.0 - Production on Tue Jan 30 19:13:16 2007

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

connected to target database: TEST (DBID=1911386690)
connected to auxiliary database: TEST (not mounted)

Recovery Manager complete.

C:Documents and Settingsliang>set oracle_sid=aux1

C:Documents and Settingsliang>rman target auxiliary /

Recovery Manager: Release 10.2.0.1.0 - Production on Tue Jan 30 22:46:03 2007

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

connected to target database: TEST (DBID=1911386690)
connected to auxiliary database: AUX1 (not mounted)

RMAN> run{
2> ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
3> DUPLICATE TARGET DATABASE TO aux1
4> LOGFILE
5> 'F:oracleproduct10.1.0oradataux1redo01a.log' SIZE 16000K,
6> 'F:oracleproduct10.1.0oradataux1redo02a.log' SIZE 16000K,
7> 'F:oracleproduct10.1.0oradataux1redo03a.log' SIZE 16000K;
8> }

using target database control file instead of recovery catalog
allocated channel: aux1
channel aux1: sid=157 devtype=DISK

Starting Duplicate Db at 2007-01-30 22:46:12

contents of Memory Script.:
{
set until scn 498379;
set newname for datafile 1 to
"F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSTEM01.DBF";
set newname for datafile 2 to
"F:ORACLEPRODUCT10.1.0ORADATAAUX1UNDOTBS01.DBF";
set newname for datafile 3 to
"F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSAUX01.DBF";
restore
check readonly
clone database
;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 2007-01-30 22:46:14

channel aux1: starting datafile backupset restore
channel aux1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSTEM01.DBF
restoring datafile 00002 to F:ORACLEPRODUCT10.1.0ORADATAAUX1UNDOTBS01.DBF
restoring datafile 00003 to F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSAUX01.DBF
channel aux1: reading from backup piece F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTBACKUPSET2007_01_30O1_MF_NNNDF_TAG20070130T170959_2VY2V889_.BKP
channel aux1: restored backup piece 1
piece handle=F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTBACKUPSET2007_01_30O1_MF_NNNDF_TAG20070130T170959_2VY2V889_.BKP tag=TAG20070130T170959
channel aux1: restore complete, elapsed time: 00:00:55
Finished restore at 2007-01-30 22:47:09
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "AUX1" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 'F:oracleproduct10.1.0oradataux1redo01a.log' SIZE 16000 K ,
GROUP 2 'F:oracleproduct10.1.0oradataux1redo02a.log' SIZE 16000 K ,
GROUP 3 'F:oracleproduct10.1.0oradataux1redo03a.log' SIZE 16000 K
DATAFILE
'F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSTEM01.DBF'
CHARACTER SET ZHS16GBK


contents of Memory Script.:
{
switch clone datafile all;
}
executing Memory Script

datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=613262831 filename=F:ORACLEPRODUCT10.1.0ORADATAAUX1UNDOTBS01.DBF
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=613262831 filename=F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSAUX01.DBF

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

executing command: SET until clause

Starting recover at 2007-01-30 22:47:10

starting media recovery

archive log thread 1 sequence 24 is already on disk as file F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTARCHIVELOG2007_01_30O1_MF_1_24_2VY31OJ3_.ARC
archive log thread 1 sequence 25 is already on disk as file F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTARCHIVELOG2007_01_30O1_MF_1_25_2VY31RXS_.ARC
archive log thread 1 sequence 26 is already on disk as file F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTARCHIVELOG2007_01_30O1_MF_1_26_2VY31Y1Y_.ARC
archive log thread 1 sequence 27 is already on disk as file F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTARCHIVELOG2007_01_30O1_MF_1_27_2VYB48KL_.ARC
archive log filename=F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTARCHIVELOG2007_01_30O1_MF_1_24_2VY31OJ3_.ARC thread=1 sequence=24
archive log filename=F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTARCHIVELOG2007_01_30O1_MF_1_25_2VY31RXS_.ARC thread=1 sequence=25
archive log filename=F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTARCHIVELOG2007_01_30O1_MF_1_26_2VY31Y1Y_.ARC thread=1 sequence=26
archive log filename=F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTARCHIVELOG2007_01_30O1_MF_1_27_2VYB48KL_.ARC thread=1 sequence=27
media recovery complete, elapsed time: 00:00:06
Finished recover at 2007-01-30 22:47:18

contents of Memory Script.:
{
shutdown clone;
startup clone nomount ;
}
executing Memory Script

database dismounted
Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area 251658240 bytes

Fixed Size 1248356 bytes
Variable Size 79692700 bytes
Database Buffers 163577856 bytes
Redo Buffers 7139328 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "AUX1" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 'F:oracleproduct10.1.0oradataux1redo01a.log' SIZE 16000 K ,
GROUP 2 'F:oracleproduct10.1.0oradataux1redo02a.log' SIZE 16000 K ,
GROUP 3 'F:oracleproduct10.1.0oradataux1redo03a.log' SIZE 16000 K
DATAFILE
'F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSTEM01.DBF'
CHARACTER SET ZHS16GBK


contents of Memory Script.:
{
set newname for tempfile 1 to
"F:ORACLEPRODUCT10.1.0ORADATAAUX1TEMP01.DBF";
switch clone tempfile all;
catalog clone datafilecopy "F:ORACLEPRODUCT10.1.0ORADATAAUX1UNDOTBS01.DBF";
catalog clone datafilecopy "F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSAUX01.DBF";
switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed temporary file 1 to F:ORACLEPRODUCT10.1.0ORADATAAUX1TEMP01.DBF in control file

cataloged datafile copy
datafile copy filename=F:ORACLEPRODUCT10.1.0ORADATAAUX1UNDOTBS01.DBF recid=1 stamp=613262847

cataloged datafile copy
datafile copy filename=F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSAUX01.DBF recid=2 stamp=613262847

datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=613262847 filename=F:ORACLEPRODUCT10.1.0ORADATAAUX1UNDOTBS01.DBF
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=613262847 filename=F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSAUX01.DBF

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

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 01/30/2007 22:47:29
RMAN-03015: error occurred in stored script. Memory Script
RMAN-06136: ORACLE error from auxiliary database: ORA-00344: unable to re-create online log 'F:ORACLEPRODUCT10.1.0ORADATAUX1REDO01A.LOG'
ORA-27040: file create error, unable to create file
OSD-04002: unable to open file
O/S-Error: (OS 3) ???????????('F:ORACLEPRODUCT10.1.0ORADATAUX1REDO01A.LOG'
寫錯了ORADATAUX1應為ORADATAAUX1

RMAN>
低階錯誤,折騰一晚上!!!!!!!!!!

 


Recovery Manager complete.
C:Documents and Settingsliang>set oracle_sid=aux1
C:Documents and Settingsliang>rman target auxiliary /
Recovery Manager: Release 10.2.0.1.0 - Production on Tue Jan 30 22:53:37 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: TEST (DBID=1911386690)
connected to auxiliary database: AUX1 (not mounted)
RMAN> run{
2> ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
3> DUPLICATE TARGET DATABASE TO aux1
4> LOGFILE
5> 'F:oracleproduct10.1.0oradataaux1redo01a.log' SIZE 16000K,
6> 'F:oracleproduct10.1.0oradataaux1redo02a.log' SIZE 16000K,
7> 'F:oracleproduct10.1.0oradataaux1redo03a.log' SIZE 16000K;
8> }

using target database control file instead of recovery catalog
allocated channel: aux1
channel aux1: sid=157 devtype=DISK

Starting Duplicate Db at 2007-01-30 22:53:49
contents of Memory Script.:
{
set until scn 498379;
set newname for datafile 1 to
"F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSTEM01.DBF";
set newname for datafile 2 to
"F:ORACLEPRODUCT10.1.0ORADATAAUX1UNDOTBS01.DBF";
set newname for datafile 3 to
"F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSAUX01.DBF";
restore
check readonly
clone database
;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 2007-01-30 22:53:50
channel aux1: starting datafile backupset restore
channel aux1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSTEM01.DBF
restoring datafile 00002 to F:ORACLEPRODUCT10.1.0ORADATAAUX1UNDOTBS01.DBF
restoring datafile 00003 to F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSAUX01.DBF
channel aux1: reading from backup piece F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTBACKUPSET2007_01_30O1_MF_NNNDF_TAG20070130T170959_2VY2V889_.BKP
channel aux1: restored backup piece 1
piece handle=F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTBACKUPSET2007_01_30O1_MF_NNNDF_TAG20070130T170959_2VY2V889_.BKP tag=TAG20070130T170959
channel aux1: restore complete, elapsed time: 00:00:55
Finished restore at 2007-01-30 22:54:45
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "AUX1" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 'F:oracleproduct10.1.0oradataaux1redo01a.log' SIZE 16000 K ,
GROUP 2 'F:oracleproduct10.1.0oradataaux1redo02a.log' SIZE 16000 K ,
GROUP 3 'F:oracleproduct10.1.0oradataaux1redo03a.log' SIZE 16000 K
DATAFILE
'F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSTEM01.DBF'
CHARACTER SET ZHS16GBK


contents of Memory Script.:
{
switch clone datafile all;
}
executing Memory Script
datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=613263288 filename=F:ORACLEPRODUCT10.1.0ORADATAAUX1UNDOTBS01.DBF
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=613263288 filename=F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSAUX01.DBF
contents of Memory Script.:
{
set until scn 498379;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 2007-01-30 22:54:47
starting media recovery
archive log thread 1 sequence 24 is already on disk as file F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTARCHIVELOG2007_01_30O1_MF_1_24_2VY31OJ3_.ARC
archive log thread 1 sequence 25 is already on disk as file F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTARCHIVELOG2007_01_30O1_MF_1_25_2VY31RXS_.ARC
archive log thread 1 sequence 26 is already on disk as file F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTARCHIVELOG2007_01_30O1_MF_1_26_2VY31Y1Y_.ARC
archive log thread 1 sequence 27 is already on disk as file F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTARCHIVELOG2007_01_30O1_MF_1_27_2VYB48KL_.ARC
archive log filename=F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTARCHIVELOG2007_01_30O1_MF_1_24_2VY31OJ3_.ARC thread=1 sequence=24
archive log filename=F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTARCHIVELOG2007_01_30O1_MF_1_25_2VY31RXS_.ARC thread=1 sequence=25
archive log filename=F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTARCHIVELOG2007_01_30O1_MF_1_26_2VY31Y1Y_.ARC thread=1 sequence=26
archive log filename=F:ORACLEPRODUCT10.1.0FLASH_RECOVERY_AREATESTARCHIVELOG2007_01_30O1_MF_1_27_2VYB48KL_.ARC thread=1 sequence=27
media recovery complete, elapsed time: 00:00:06
Finished recover at 2007-01-30 22:54:56

contents of Memory Script.:
{
shutdown clone;
startup clone nomount ;
}
此處需注意,要關閉所有連線,否則會掛起!!!!!!
executing Memory Script
database dismounted
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 251658240 bytes
Fixed Size 1248356 bytes
Variable Size 79692700 bytes
Database Buffers 163577856 bytes
Redo Buffers 7139328 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "AUX1" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 'F:oracleproduct10.1.0oradataaux1redo01a.log' SIZE 16000 K ,
GROUP 2 'F:oracleproduct10.1.0oradataaux1redo02a.log' SIZE 16000 K ,
GROUP 3 'F:oracleproduct10.1.0oradataaux1redo03a.log' SIZE 16000 K
DATAFILE
'F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSTEM01.DBF'
CHARACTER SET ZHS16GBK

contents of Memory Script.:
{
set newname for tempfile 1 to
"F:ORACLEPRODUCT10.1.0ORADATAAUX1TEMP01.DBF";
switch clone tempfile all;
catalog clone datafilecopy "F:ORACLEPRODUCT10.1.0ORADATAAUX1UNDOTBS01.DBF";
catalog clone datafilecopy "F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSAUX01.DBF";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed temporary file 1 to F:ORACLEPRODUCT10.1.0ORADATAAUX1TEMP01.DBF in control file
cataloged datafile copy
datafile copy filename=F:ORACLEPRODUCT10.1.0ORADATAAUX1UNDOTBS01.DBF recid=1 stamp=613263302
cataloged datafile copy
datafile copy filename=F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSAUX01.DBF recid=2 stamp=613263303
datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=613263302 filename=F:ORACLEPRODUCT10.1.0ORADATAAUX1UNDOTBS01.DBF
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=613263303 filename=F:ORACLEPRODUCT10.1.0ORADATAAUX1SYSAUX01.DBF

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

database opened
Finished Duplicate Db at 2007-01-30 22:55:24

RMAN>

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22664653/viewspace-664440/,如需轉載,請註明出處,否則將追究法律責任。

相關文章