您的位置:首页 > 其它

使用Duplication创建Auxiliary Instance的基本步骤

2008-12-09 20:02 387 查看
使用Duplication创建Auxiliary Instance的基本步骤
Preparing the Auxiliary Instance for Duplication: Basic Steps

Perform these tasks before performing RMAN duplication:
Task 1: Create an Oracle Password File for the Auxiliary Instance
Task 2: Ensure Oracle Net Connectivity to the Auxiliary Instance
Task 3: Create an Initialization Parameter File for the Auxiliary Instance
Task 4: Start the Auxiliary Instance
Task 5: Mount or Open the Target Database
Task 6: Make Sure You Have the Necessary Backups and Archived Redo Logs
Task 7: Allocate Auxiliary Channels if Automatic Channels Are Not Configured

下面是具体的执行过程:
1、Create an Oracle Password File for the Auxiliary Instance
[oracle@localhost dbs]$ pwd
/opt/oracle/product/10.2.0/dbs
[oracle@localhost dbs]$ orapwd FILE=/opt/oracle/product/10.2.0/dbs/orapwdupge PASSWORD=test ENTRIES=30
[oracle@localhost ~]$ cd /opt/oracle/product/10.2.0/dbs
[oracle@localhost dbs]$ ls -l orapwdupge
-rw-r----- 1 oracle oinstall 5120 Dec 7 20:43 orapwdupge

2、Ensure Oracle Net Connectivity to the Auxiliary Instance
[oracle@localhost dbs]$ cd /opt/oracle/product/10.2.0/network/admin
[oracle@localhost admin]$ cat listener.ora
# listener.ora Network Configuration File: /opt/oracle/product/10.2.0/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /opt/oracle/product/10.2.0)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = ge02)
(ORACLE_HOME = /opt/oracle/product/10.2.0)
(SID_NAME = ge02)
)
(SID_DESC =
(GLOBAL_DBNAME = cata)
(ORACLE_HOME = /opt/oracle/product/10.2.0)
(SID_NAME = cata)
)
(SID_DESC =
(GLOBAL_DBNAME = ge)
(ORACLE_HOME = /opt/oracle/product/10.2.0)
(SID_NAME = ge)
)
(SID_DESC =
(GLOBAL_DBNAME = dupge)
(ORACLE_HOME = /opt/oracle/product/10.2.0)
(SID_NAME = dupge)
) --此处是新增加的部分
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
)
)

EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
重新启动下监听:
[oracle@localhost admin]$ lsnrctl stop
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 07-DEC-2008 20:57:24
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
The command completed successfully

[oracle@localhost admin]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 07-DEC-2008 20:57:33
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /opt/oracle/product/10.2.0/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /opt/oracle/product/10.2.0/network/admin/listener.ora
Log messages written to /opt/oracle/product/10.2.0/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 07-DEC-2008 20:57:33
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/10.2.0/network/admin/listener.ora
Listener Log File /opt/oracle/product/10.2.0/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "cata" has 1 instance(s).
Instance "cata", status UNKNOWN, has 1 handler(s) for this service...
Service "dupge" has 1 instance(s).
Instance "dupge", status UNKNOWN, has 1 handler(s) for this service...
Service "ge" has 1 instance(s).
Instance "ge", status UNKNOWN, has 1 handler(s) for this service...
Service "ge02" has 1 instance(s).
Instance "ge02", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

[root@localhost admin]#cat tnsnames.ora
添加了下列语句
aux =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.160)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dupge)
)
)

3、Create an Initialization Parameter File for the Auxiliary Instance
[oracle@localhost opt]$ su - root
Password:
[root@localhost ~]# mkdir /opt/dup
[root@localhost ~]# chown oracle.oinstall /opt/dup
[root@localhost dup]# su - oracle
.bash_profile executed
[oracle@localhost ~]$ cd /opt/dup
[oracle@localhost dup]$ cat initdupge.ora
###########################################
#database Identification
###########################################
DB_NAME=dupge
CONTROL_FILES=(/opt/dup/oracle/oradata/ge/control01.ctl,
/opt/dup/oracle/oradata/ge/control02.ctl,
/opt/dup/oracle/oradata/ge/control03.ctl)
###########################################
# Cache and I/O
###########################################
db_block_size=8192

# note that the following two initialization parameters have equivalents
# on the DUPLICATE command itself
DB_FILE_NAME_CONVERT=(/opt/oracle/oradata/ge,/opt/dup/oracle/oradata/ge )
LOG_FILE_NAME_CONVERT=(/opt/oracle/oradata/ge/redo,/opt/dup/oracle/oradata/ge/redo)
compatible=10.2.0.1.0 #新增的行
shared_pool_size=50M #新增的行

4、Start the Auxiliary Instance,创建下SPFILE文件
[oracle@localhost admin]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Dec 7 20:58:31 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.

SQL> connect sys/test@aux as sysdba
Connected to an idle instance.
SQL> startup force nomount pfile='/opt/dup/initdupge.ora';
ORACLE instance started.
Total System Global Area 113246208 bytes
Fixed Size 1218004 bytes
Variable Size 58722860 bytes
Database Buffers 50331648 bytes
Redo Buffers 2973696 bytes

此时创建下SPFILE文件
SQL> CREATE SPFILE FROM PFILE='/opt/dup/initdupge.ora';
File created.

5、 Mount or Open the Target Database
[oracle@localhost ~]$ export ORACLE_SID=ge
[oracle@localhost ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Dec 7 21:02:08 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> connect sys/test@GE as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 92276980 bytes
Database Buffers 71303168 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.

6、Make Sure You Have the Necessary Backups and Archived Redo Logs
[oracle@localhost ~]$ rman target sys/test@GE
Recovery Manager: Release 10.2.0.1.0 - Production on Sun Dec 7 21:11:55 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: GE (DBID=1385239465)

RMAN> list backup;

RMAN> backup database;
Starting backup at 07-DEC-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/opt/oracle/oradata/ge/system01.dbf
input datafile fno=00003 name=/opt/oracle/oradata/ge/sysaux01.dbf
input datafile fno=00002 name=/opt/oracle/oradata/ge/undotbs01.dbf
input datafile fno=00004 name=/opt/oracle/oradata/ge/users01.dbf
channel ORA_DISK_1: starting piece 1 at 07-DEC-08
channel ORA_DISK_1: finished piece 1 at 07-DEC-08
piece handle=/opt/oracle/flash_recovery_area/GE/backupset/2008_12_07/o1_mf_nnndf_TAG20081207T211249_4mqlyl2c_.bkp tag=TAG20081207T211249 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:03:07
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 07-DEC-08
channel ORA_DISK_1: finished piece 1 at 07-DEC-08
piece handle=/opt/oracle/flash_recovery_area/GE/backupset/2008_12_07/o1_mf_ncsnf_TAG20081207T211249_4mqm4hl7_.bkp tag=TAG20081207T211249 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
Finished backup at 07-DEC-08

RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2 Full 649.44M DISK 00:03:00 07-DEC-08
BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20081207T211249
Piece Name: /opt/oracle/flash_recovery_area/GE/backupset/2008_12_07/o1_mf_nnndf_TAG20081207T211249_4mqlyl2c_.bkp
List of Datafiles in backup set 2
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 635427 07-DEC-08 /opt/oracle/oradata/ge/system01.dbf
2 Full 635427 07-DEC-08 /opt/oracle/oradata/ge/undotbs01.dbf
3 Full 635427 07-DEC-08 /opt/oracle/oradata/ge/sysaux01.dbf
4 Full 635427 07-DEC-08 /opt/oracle/oradata/ge/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3 Full 6.80M DISK 00:00:03 07-DEC-08
BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20081207T211249
Piece Name: /opt/oracle/flash_recovery_area/GE/backupset/2008_12_07/o1_mf_ncsnf_TAG20081207T211249_4mqm4hl7_.bkp
Control File Included: Ckp SCN: 635530 Ckp time: 07-DEC-08
SPFILE Included: Modification time: 07-DEC-08

7、 Allocate Auxiliary Channels if Automatic Channels Are Not Configured
--启动catalog数据库
[oracle@localhost ~]$ export ORACLE_SID=cata
[oracle@localhost ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 2 22:41:01 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> connect / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 83888372 bytes
Database Buffers 79691776 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
SQL>

--nomountAUXILIARY数据库
[oracle@localhost ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 2 22:44:39 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> connect sys/test@aux as sysdba
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 113246208 bytes
Fixed Size 1218004 bytes
Variable Size 58722860 bytes
Database Buffers 50331648 bytes
Redo Buffers 2973696 bytes
SQL>

--下面是连接CATALOG以及TARGET数据库来DUPLICATE TARGET数据库到AUXILIARY数据库dupge
[oracle@localhost admin]$ rman TARGET SYS/test@GE CATALOG rman/rman@CATA AUXILIARY SYS/test@aux
Recovery Manager: Release 10.2.0.1.0 - Production on Sun Dec 7 21:30:20 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: GE (DBID=1385239465)
connected to recovery catalog database
connected to auxiliary database: DUPGE (not mounted)
RMAN> RUN
2> {
3> # to manually allocate a channel of type sbt issue:
4> ALLOCATE AUXILIARY CHANNEL ch1 DEVICE TYPE DISK;

# to manually allocate three auxiliary channels for disk issue (specifying
5> 6> 7> # whatever channel id that you want):
8> ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
9> ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;
10> ALLOCATE AUXILIARY CHANNEL aux3 DEVICE TYPE DISK;
11> DUPLICATE TARGET DATABASE TO dupge;
12> }
allocated channel: ch1
channel ch1: sid=35 devtype=DISK
allocated channel: aux1
channel aux1: sid=34 devtype=DISK
allocated channel: aux2
channel aux2: sid=33 devtype=DISK
allocated channel: aux3
channel aux3: sid=32 devtype=DISK
Starting Duplicate Db at 07-DEC-08
released channel: ch1
released channel: aux1
released channel: aux2
released channel: aux3
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 12/07/2008 21:31:07
ORA-01405: fetched column value is NULL

--尝试在目标库执行下面的语句:
SQL> alter system switch logfile;
System altered.

--在/opt/dup路径下没有相应的文件夹路径,下面创建相应的文件路径:
[root@localhost dup]# su - oracle
.bash_profile executed
[oracle@localhost ~]$ mkdir -p /opt/dup/oracle/oradata/ge

重新执行DUPLICATE命令:
[oracle@localhost ~]$ rman TARGET SYS/test@GE CATALOG rman/rman@CATA AUXILIARY SYS/test@aux
Recovery Manager: Release 10.2.0.1.0 - Production on Tue Dec 9 18:50:03 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: GE (DBID=1385239465)
connected to recovery catalog database
connected to auxiliary database: DUPGE (not mounted)

RMAN> DUPLICATE TARGET DATABASE TO dupge;
Starting Duplicate Db at 09-DEC-08
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=36 devtype=DISK
contents of Memory Script:
{
set until scn 728198;
set newname for datafile 1 to
"/opt/dup/oracle/oradata/ge/system01.dbf";
set newname for datafile 2 to
"/opt/dup/oracle/oradata/ge/undotbs01.dbf";
set newname for datafile 3 to
"/opt/dup/oracle/oradata/ge/sysaux01.dbf";
set newname for datafile 4 to
"/opt/dup/oracle/oradata/ge/users01.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
executing command: SET NEWNAME
Starting restore at 09-DEC-08
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /opt/dup/oracle/oradata/ge/system01.dbf
restoring datafile 00002 to /opt/dup/oracle/oradata/ge/undotbs01.dbf
restoring datafile 00003 to /opt/dup/oracle/oradata/ge/sysaux01.dbf
restoring datafile 00004 to /opt/dup/oracle/oradata/ge/users01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /opt/oracle/flash_recovery_area/GE/backupset/2008_12_07/o1_mf_nnndf_TAG20081207T211249_4mqlyl2c_.bkp
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/opt/oracle/flash_recovery_area/GE/backupset/2008_12_07/o1_mf_nnndf_TAG20081207T211249_4mqlyl2c_.bkp tag=TAG20081207T211249
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:04:20
Finished restore at 09-DEC-08
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUPGE" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/opt/dup/oracle/oradata/ge/redo01.log' ) SIZE 50 M REUSE,
GROUP 2 ( '/opt/dup/oracle/oradata/ge/redo02.log' ) SIZE 50 M REUSE,
GROUP 3 ( '/opt/dup/oracle/oradata/ge/redo03.log' ) SIZE 50 M REUSE
DATAFILE
'/opt/dup/oracle/oradata/ge/system01.dbf'
CHARACTER SET ZHS16GBK
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
released channel: ORA_AUX_DISK_1
datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=673037683 filename=/opt/dup/oracle/oradata/ge/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=673037683 filename=/opt/dup/oracle/oradata/ge/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=673037683 filename=/opt/dup/oracle/oradata/ge/users01.dbf
contents of Memory Script:
{
set until scn 728198;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 09-DEC-08
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=38 devtype=DISK
starting media recovery
archive log thread 1 sequence 11 is already on disk as file /opt/oracle/flash_recovery_area/GE/archivelog/2008_12_07/o1_mf_1_11_4mqn4qbd_.arc
archive log thread 1 sequence 12 is already on disk as file /opt/oracle/flash_recovery_area/GE/archivelog/2008_12_08/o1_mf_1_12_4mt4fl19_.arc
archive log thread 1 sequence 13 is already on disk as file /opt/oracle/flash_recovery_area/GE/archivelog/2008_12_09/o1_mf_1_13_4mwl6cod_.arc
archive log filename=/opt/oracle/flash_recovery_area/GE/archivelog/2008_12_07/o1_mf_1_11_4mqn4qbd_.arc thread=1 sequence=11
archive log filename=/opt/oracle/flash_recovery_area/GE/archivelog/2008_12_08/o1_mf_1_12_4mt4fl19_.arc thread=1 sequence=12
archive log filename=/opt/oracle/flash_recovery_area/GE/archivelog/2008_12_09/o1_mf_1_13_4mwl6cod_.arc thread=1 sequence=13
media recovery complete, elapsed time: 00:01:31
Finished recover at 09-DEC-08
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 134217728 bytes

Fixed Size 1218124 bytes
Variable Size 79694260 bytes
Database Buffers 50331648 bytes
Redo Buffers 2973696 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUPGE" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/opt/dup/oracle/oradata/ge/redo01.log' ) SIZE 50 M REUSE,
GROUP 2 ( '/opt/dup/oracle/oradata/ge/redo02.log' ) SIZE 50 M REUSE,
GROUP 3 ( '/opt/dup/oracle/oradata/ge/redo03.log' ) SIZE 50 M REUSE
DATAFILE
'/opt/dup/oracle/oradata/ge/system01.dbf'
CHARACTER SET ZHS16GBK
contents of Memory Script:
{
set newname for tempfile 1 to
"/opt/dup/oracle/oradata/ge/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/opt/dup/oracle/oradata/ge/undotbs01.dbf";
catalog clone datafilecopy "/opt/dup/oracle/oradata/ge/sysaux01.dbf";
catalog clone datafilecopy "/opt/dup/oracle/oradata/ge/users01.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed temporary file 1 to /opt/dup/oracle/oradata/ge/temp01.dbf in control file
cataloged datafile copy
datafile copy filename=/opt/dup/oracle/oradata/ge/undotbs01.dbf recid=1 stamp=673037801
cataloged datafile copy
datafile copy filename=/opt/dup/oracle/oradata/ge/sysaux01.dbf recid=2 stamp=673037802
cataloged datafile copy
datafile copy filename=/opt/dup/oracle/oradata/ge/users01.dbf recid=3 stamp=673037802
datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=673037801 filename=/opt/dup/oracle/oradata/ge/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=673037802 filename=/opt/dup/oracle/oradata/ge/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=673037802 filename=/opt/dup/oracle/oradata/ge/users01.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 09-DEC-08

这次DUPLICATE命令执行成功了!!

下面总结下执行DUPLICATE时的注意点:
1、在执行rman TARGET SYS/test@GE02 CATALOG rman/rman@CATA AUXILIARY SYS/test@aux命令之前,要确保AUXILIARY数据库是处于nomount状态下;
2、并且初始参数的设置需要设置compatible=10.2.0.1.0,如果不设置compatible=10.2.0.1.0,则会报ORA-01130: database file version 10.2.0.1.0
incompatible with ORACLE version 10.2.0.0.0错误;
3、要注意设置AUXILIARY数据库的初始参数中要求存在的路径,否则会无法找到需要的路径,会报ORA-19504: failed to create file错误;
4、在AUXILIARY数据库被nomount之后需要关闭启动AUXILIARY数据库的会话,否则会阻止DUPLICATE操作;
5、在/opt/oracle/product/10.2.0/dbs/路径下需要存在目标数据库以及AUXILIARY数据库的初始参数文件,否则数据库会在自动启动时
(不是手动启动)会报LRM-00109: could not open parameter file '/opt/oracle/product/10.2.0/dbs/initdupge.ora';
6、修改AUXILIARY数据库dupge的初始参数,设置shared_pool_size=50M,否则会报ORA-04031: unable to allocate 1024 bytes of shared memory;

安装过程中遇到的错误解决:
1、确保AUXILIARY数据库是处于nomount状态,否则会遇到 RMAN-06403 RMAN-04006 ORA-01034错误,显示如下
[oracle@localhost dbs]$ rman TARGET SYS/test@GE02 CATALOG rman/rman@CATA AUXILIARY SYS/test@aux
Recovery Manager: Release 10.2.0.1.0 - Production on Mon Dec 1 23:51:02 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: GE02 (DBID=1566649158, not open)
connected to recovery catalog database
connected to auxiliary database (not started)
RMAN> RUN
2> {
3> # to manually allocate a channel of type sbt issue:
4> ALLOCATE AUXILIARY CHANNEL ch1 DEVICE TYPE DISK;
5>
6> # to manually allocate three auxiliary channels for disk issue (specifying
7> # whatever channel id that you want):
8> ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
9> ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;
10> ALLOCATE AUXILIARY CHANNEL aux3 DEVICE TYPE DISK;
11> DUPLICATE TARGET DATABASE TO dupge02;
12> }
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of allocate command at 12/01/2008 23:53:02
RMAN-06403: could not obtain a fully authorized session
RMAN-04006: error from auxiliary database: ORA-01034: ORACLE not available

RMAN> DUPLICATE TARGET DATABASE TO dupge02;
Starting Duplicate Db at 01-DEC-08
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 12/01/2008 23:59:53
RMAN-06403: could not obtain a fully authorized session
RMAN-04006: error from auxiliary database: ORA-01034: ORACLE not available

解决方法:是因为AUXILIARY数据库没有 nomount,AUXILIARY数据库还处于关闭状态,所以连接不上AUXILIARY数据库报错
执行下面的语句即可:
SQL> connect sys/dupge02@aux as sysdba
SQL> startup nomount;

2、并且初始参数的设置需要设置compatible=10.2.0.1.0,如果不设置compatible=10.2.0.1.0,则会报ORA-01130: database file version 10.2.0.1.0
incompatible with ORACLE version 10.2.0.0.0错误;
RMAN> RUN
2> {
3> # to manually allocate three auxiliary channels for disk issue (specifying
4> # whatever channel id that you want):
5> ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
6> ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;
7> DUPLICATE TARGET DATABASE TO dupge;
8> }
allocated channel: aux1
。。。。。。
released channel: aux1
released channel: aux2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 12/07/2008 21:50:45
RMAN-06136: ORACLE error from auxiliary database: ORA-01503: CREATE CONTROLFILE failed
ORA-01130: database file version 10.2.0.1.0 incompatible with ORACLE version 10.2.0.0.0
ORA-01110: data file 1: '/opt/dup/oracle/oradata/ge/system01.dbf'
分析错误:
根据ORA-01503: CREATE CONTROLFILE failed,查看dupge数据库的初始文件
查找资料,说需要在dupge数据库的初始文件中加入compatible=10.2.0.1.0这句话,否则会报错
参考网页:http://www.ningoo.net/html/2007/oracle11g_new_feature_active_database_duplicate.html

3、要注意设置AUXILIARY数据库的初始参数中要求存在的路径,否则会无法找到需要的路径,会报ORA-19504: failed to create file错误
--下面重新执行上面的RUN脚本
RMAN> RUN
{
# to manually allocate a channel of type sbt issue:
ALLOCATE AUXILIARY CHANNEL ch1 DEVICE TYPE DISK;
2> 3> 4> 5>
6> # to manually allocate three auxiliary channels for disk issue (specifying
7> # whatever channel id that you want):
8> ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
9> ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux3 DEVICE TYPE DISK;
10> 11> DUPLICATE TARGET DATABASE TO dupge;
12> }
allocated channel: ch1
。。。。。。
released channel: aux3
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 12/07/2008 21:34:53
RMAN-03015: error occurred in stored script Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore

分析:
根据ORA-19504: failed to create file "/opt/dup/oracle/oradata/ge/system01.dbf"
ORA-27040: file create error, unable to create file
错误提示,说明在/opt/dup路径下没有相应的文件夹路径,下面创建相应的文件路径:
[root@localhost dup]# su - oracle
.bash_profile executed
[oracle@localhost ~]$ mkdir -p /opt/dup/oracle/oradata/ge

4、在AUXILIARY数据库被nomount之后需要关闭启动AUXILIARY数据库的会话,否则会阻止DUPLICATE操作;
[oracle@localhost admin]$ rman TARGET SYS/test@GE CATALOG rman/rman@CATA AUXILIARY SYS/test@aux
Recovery Manager: Release 10.2.0.1.0 - Production on Sun Dec 7 22:35:13 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: GE (DBID=1385239465)
connected to recovery catalog database
connected to auxiliary database: DUPGE (not mounted)
RMAN> RUN
2> {
3> # to manually allocate three auxiliary channels for disk issue (specifying
4> # whatever channel id that you want):
5> ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
6> ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;
7> DUPLICATE TARGET DATABASE TO dupge;
8> }
allocated channel: aux1
channel aux1: sid=35 devtype=DISK
..............
contents of Memory Script:
{
shutdown clone;
startup clone nomount ;
}
executing Memory Script
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 12/08/2008 00:04:31
RMAN-03015: error occurred in stored script Memory Script
RMAN-06136: ORACLE error from auxiliary database: ORA-01013: user requested cancel of current operation

执行了这个RUN脚本执行了已经几遍,还是报上面的错误。然后尝试打开数据库:
QL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-01100: database already mounted

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL> alter database open RESETLOGS;
alter database open RESETLOGS
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced

从执行结果来看,open不了数据库,
然后查找资料,网上资料说 :
引用http://www.appsboss.com/redirect.php?tid=355&goto=lastpost 网页中的一句:
Cause
User 'system' session, which has been used to startup the auxiliary intance in nomount, is still active and blocking the DUPLICATE operation.
DUPLICATE is using a shutdown normal to shutdown the AUXILIARY instance, hence all sessions
other than RMAN needs to be exited.
Solution
1- Exit the system session with the auxiliary instance.
2- Retry the duplicate operation.
网页上说需要关闭启动AUXILIARY数据库的会话,否则会阻止DUPLICATE操作

5、关闭nomount auxiliary intance的会话之后,并且在/opt/oracle/product/10.2.0/dbs/路径下需要存在目标数据库以及AUXILIARY数据库的初始参数文件,
否则数据库会在自动启动时不是手动启动),会报LRM-00109: could not open parameter file '/opt/oracle/product/10.2.0/dbs/initdupge.ora';
下面重新执行DUPLICATE命令,如下:
[oracle@localhost ~]$ rman TARGET SYS/test@GE CATALOG rman/rman@CATA AUXILIARY SYS/test@aux
Recovery Manager: Release 10.2.0.1.0 - Production on Mon Dec 8 22:03:48 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: GE (DBID=1385239465)
connected to recovery catalog database
connected to auxiliary database: DUPGE (not mounted)

RMAN> DUPLICATE TARGET DATABASE TO dupge;
Starting Duplicate Db at 08-DEC-08
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=35 devtype=DISK
contents of Memory Script:
{
set until scn 678248;
set newname for datafile 1 to
"/opt/dup/oracle/oradata/ge/system01.dbf";
set newname for datafile 2 to
"/opt/dup/oracle/oradata/ge/undotbs01.dbf";
set newname for datafile 3 to
"/opt/dup/oracle/oradata/ge/sysaux01.dbf";
set newname for datafile 4 to
"/opt/dup/oracle/oradata/ge/users01.dbf";
restore
check readonly
clone database
;
}
executing Memory Script
................
contents of Memory Script:
{
shutdown clone;
startup clone nomount ;
}
executing Memory Script
database dismounted
Oracle instance shut down
connected to auxiliary database (not started)
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/opt/oracle/product/10.2.0/dbs/initdupge.ora'
starting Oracle instance without parameter file for retrival of spfile
Oracle instance started
Total System Global Area 159383552 bytes
Fixed Size 1218268 bytes
Variable Size 54528292 bytes
Database Buffers 100663296 bytes
Redo Buffers 2973696 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUPGE" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
....................
CHARACTER SET ZHS16GBK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 12/08/2008 22:08:22
RMAN-06136: ORACLE error from auxiliary database: ORA-01503: CREATE CONTROLFILE failed
ORA-01504: database name 'DUPGE' does not match parameter db_name 'GE'

这次出现了不同的错误:
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/opt/oracle/product/10.2.0/dbs/initdupge.ora'
解决:在/opt/oracle/product/10.2.0/dbs/路径下创建initdupge.ora文件,只是将/opt/dup/initdupge.ora该文件cp到/opt/oracle/product/10.2.0/dbs/路径下

6、修改AUXILIARY数据库dupge的初始参数,设置shared_pool_size=50M,否则会报ORA-04031: unable to allocate 1024 bytes of shared memory;
[oracle@localhost ~]$ rman TARGET SYS/test@GE CATALOG rman/rman@CATA AUXILIARY SYS/test@aux
Recovery Manager: Release 10.2.0.1.0 - Production on Mon Dec 8 22:37:59 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: GE (DBID=1385239465)
connected to recovery catalog database
connected to auxiliary database: DUPGE (not mounted)

RMAN> DUPLICATE TARGET DATABASE TO dupge;
Starting Duplicate Db at 08-DEC-08
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=35 devtype=DISK
contents of Memory Script:
{
set until scn 678248;
set newname for datafile 1 to
"/opt/dup/oracle/oradata/ge/system01.dbf";
set newname for datafile 2 to
"/opt/dup/oracle/oradata/ge/undotbs01.dbf";
set newname for datafile 3 to
"/opt/dup/oracle/oradata/ge/sysaux01.dbf";
set newname for datafile 4 to
"/opt/dup/oracle/oradata/ge/users01.dbf";
restore
check readonly
clone database
;
}
executing Memory Script
。。。。。。。。。。。。。。。。。。。。。。。。。
executing Memory Script
executing command: SET NEWNAME
renamed temporary file 1 to /opt/dup/oracle/oradata/ge/temp01.dbf in control file
cataloged datafile copy
datafile copy filename=/opt/dup/oracle/oradata/ge/undotbs01.dbf recid=1 stamp=672965070
cataloged datafile copy
datafile copy filename=/opt/dup/oracle/oradata/ge/sysaux01.dbf recid=2 stamp=672965071
cataloged datafile copy
datafile copy filename=/opt/dup/oracle/oradata/ge/users01.dbf recid=3 stamp=672965071
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 12/08/2008 22:44:33
RMAN-03015: error occurred in stored script Memory Script
RMAN-06136: ORACLE error from auxiliary database: ORA-00600: internal error code, arguments: [15435], [SYS], [X$STANDARD], [], [], [], [], []
ORA-04031: unable to allocate 1024 bytes of shared memory ("shared pool","X$STANDARD","PL/SQL DIANA","PAR.C:parapt:Page")
RMAN-06015: error while looking up datafile copy name: /opt/dup/oracle/oradata/ge/sysaux01.dbf

查找资料,参考资料
http://bbs.bitscn.com/archiver/tid-120824.html
根据"由于在还原过程需要执行大量的内部PL/SQL,所以share_pool_size 需要设置大一点,否者将出现ORA-04031错误。",
所以给AUXILIARY数据库设置了shared_pool_size=50M
此时修改AUXILIARY数据库dupge的初始参数,设置shared_pool_size=50M,关闭AUXILIARY数据库dupge,重新启动下AUXILIARY数据库
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: