您的位置:首页 > 数据库

RMAN复制数据库(使用恢复目录库)

2009-08-04 10:51 483 查看
-------------------------------------------------------RMAN复制数据库(使用恢复目录库)-------------------------------------------------------
计划把172.19.201.240上的SGPMDB复制到172.19.4.1服务器,目录结构相同

首先改变172.19.201.240上的SGPMDB为归档模式
改变非归档模式到归档模式:
1)SQL>SHUTDOWN NORMAL/IMMEDIATE;
2)SQL>STARTUP MOUNT;
3)SQL>ALTER DATABASE ARCHIVELOG;
4)SQL>ALTER DATABASE OPEN;
5)SQL>做一次完全备份,因为非归档日志模式下产生的备份日志对于归档模式已经不可用了.这一步非非常重要!

在172.19.201.240和172.19.4.1全都配置TNS,注意:SID的长度不能超过8位,如果超过,超过部分不能识别。
SGTESTA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = TCP)
(HOST = 172.19.4.1)
(PORT = 1521)
)
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = SGTESTA)
)
)

SGPMDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.19.201.240)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = SGPMDB)
)
)

DBRMAN =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.19.201.240)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dbrman)
)
)

----------------------------------创建恢复目录数据库并且注册好源库------------------------------------
在240的服务器上,用dbca创建dbrman数据库,建好后:
create tablespace catalog_tbs
DATAFILE '/app/oracle/base/oradata/dbrman/catalog_tbs.dbf' SIZE 1000M REUSE
AUTOEXTEND ON NEXT 200M EXTENT MANAGEMENT LOCAL ;

CREATE USER rman IDENTIFIED BY rman DEFAULT TABLESPACE catalog_tbs;

GRANT connect,resource,recovery_catalog_owner TO rman;

使用RMAN连接的恢复目录
rman catalog=rman/rman

在RMAN 提示符下执行create catalog命令
create catalog tablespace catalog_tbs;

在恢复目录中注册数据库
export ORACLE_SID=SGPMDB
rman target=sys/sys_240_sgpmdb catalog=rman/rman@DBRMAN

使用恢复目录注册数据库
RMAN>register database;

-------------------------------------目标库上准备pfile和密码文件,nomount启动辅助实例-------------------------------
新建和源库上一样的目录结构

在4.1的目标机器上,用oracle用户建密码文件
orapwd FILE=/app/oracle/base/product/10.2.0/db_1/dbs/orapwdSGTESTA PASSWORD=oracle ENTRIES=30

新建initSGTESTA.ora文件
DB_NAME=SGTESTA
db_block_size=8192
compatible=10.2.0.3.0
shared_pool_size=500M
db_file_name_convert('SGPMDB','SGTESTA') ;
log_file_name_convert('SGPMDB','SGTESTA') ;

--nomount AUXILIARY数据库
export ORACLE_SID=SGTESTA
sqlplus / as sysdba
STARTUP NOMOUNT PFILE='/app/oracle/base/admin/SGTESTA/pfile/initSGTESTA.ora';
创建SPFILE后重新启动
create spfile='/app/oracle/base/product/10.2.0/db_1/dbs/spfileSGTESTA.ora' from pfile='/app/oracle/base/admin/SGTESTA/pfile/initSGTESTA.ora' ;

SQL> startup force nomount

--启动catalog数据库
export ORACLE_SID=dbrman
sqlplus / as sysdba
startup

--下面是连接CATALOG以及TARGET数据库来DUPLICATE TARGET数据库到AUXILIARY,在辅助实例库上登录rman
export ORACLE_SID=SGTESTA
rman TARGET sys/sys_release4144_sgpmdb@SGPMDB_201_240 CATALOG rman/rman@DBRMAN AUXILIARY sys/oracle

Recovery Manager: Release 10.2.0.4.0 - Production on Mon Aug 3 16:43:43 2009

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

connected to target database: SGPMDB (DBID=3784337228)
connected to recovery catalog database
connected to auxiliary database: SGTESTA (not mounted)

或者分别连接三个,是一样的
export ORACLE_SID=SGTESTA
RMAN> connect target sys/sys_release4144_sgpmdb@SGPMDB_201_240

connected to target database: SGPMDB (DBID=3784337228)

RMAN> connect auxiliary sys/oracle

connected to auxiliary database: SGPMDB (nomount)

RMAN> connect catalog rman/rman@DBRMAN

connected to recovery catalog database

备份命令
run {
allocate channel ch1 device type disk maxpiecesize=10g;
sql 'alter system archive log current';
change archivelog all crosscheck;
backup full database tag=sgpmdbfullbk
format '/app/oracle/base/admin/SGPMDB/arch/%d_db_%t_%s_%p'
plus archivelog format '/app/oracle/base/admin/SGPMDB/arch/%d_arch_%t_%s_%p' delete all input;
backup current controlfile
format '/app/oracle/base/admin/SGPMDB/arch/%d_ctlfile_%t_%s_%p';
release channel ch1;
}
备份的时候用archive log list 查看当前的logseq号,并且记录下来

用scp命令拷贝数据文件,归档日志,控制文件备份(必须和目标数据库路径完全一致)。
在RMAN里面综合用list backup 以及在/app/oracle/base/admin/SGPMDB/arch目录里面看时间戳
Piece Name: /app/oracle/base/admin/SGPMDB/arch/SGPMDB_arch_693938700_22_1
Piece Name: /app/oracle/base/admin/SGPMDB/arch/SGPMDB_arch_693938891_23_1
piece handle=/app/oracle/base/admin/SGPMDB/arch/SGPMDB_arch_693939137_24_1 tag=TAG20090803T164451 comment=NONE
piece handle=/app/oracle/base/admin/SGPMDB/arch/SGPMDB_arch_693939342_25_1 tag=TAG20090803T164451 comment=NONE
piece handle=/app/oracle/base/admin/SGPMDB/arch/SGPMDB_db_693939538_26_1 tag=SGPMDBFULLBK comment=NONE
piece handle=/app/oracle/base/admin/SGPMDB/arch/SGPMDB_db_693940293_27_1 tag=SGPMDBFULLBK comment=NONE
piece handle=/app/oracle/base/admin/SGPMDB/arch/SGPMDB_arch_693940302_28_1 tag=TAG20090803T171142 comment=NONE
piece handle=/app/oracle/base/admin/SGPMDB/arch/SGPMDB_ctlfile_693940305_29_1 tag=TAG20090803T171145 comment=NONE

复制命令
RUN
{
set until logseq 9963 thread 1 ;
ALLOCATE AUXILIARY CHANNEL ch1 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux3 DEVICE TYPE DISK;
DUPLICATE TARGET DATABASE TO SGTESTA nofilenamecheck;
}

RMAN> RUN
2> {
3> set until logseq 9963 thread 1 ;
4> ALLOCATE AUXILIARY CHANNEL ch1 DEVICE TYPE DISK;
5> ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
6> ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;
7> ALLOCATE AUXILIARY CHANNEL aux3 DEVICE TYPE DISK;
8> DUPLICATE TARGET DATABASE TO SGTESTA nofilenamecheck;
9> }

executing command: SET until clause

allocated channel: ch1
channel ch1: sid=36 devtype=DISK

allocated channel: aux1
channel aux1: sid=35 devtype=DISK

allocated channel: aux2
channel aux2: sid=34 devtype=DISK

allocated channel: aux3
channel aux3: sid=33 devtype=DISK

Starting Duplicate Db at 03-AUG-09

contents of Memory Script:
{
set until scn 10110023328185;
set newname for datafile 1 to
"/app/oracle/base/oradata/SGTESTA/system01.dbf";
set newname for datafile 2 to
"/app/oracle/base/oradata/SGTESTA/undotbs01.dbf";
set newname for datafile 3 to
"/app/oracle/base/oradata/SGTESTA/sysaux01.dbf";
set newname for datafile 4 to
"/app/oracle/base/oradata/SGTESTA/users01.dbf";
set newname for datafile 5 to
"/app/oracle/base/oradata/SGTESTA/DATA_A001.DBF";
set newname for datafile 6 to
"/app/oracle/base/oradata/SGTESTA/DATA_C001.DBF";
set newname for datafile 7 to
"/app/oracle/base/oradata/SGTESTA/DATA_D001.DBF";
set newname for datafile 8 to
"/app/oracle/base/oradata/SGTESTA/DATA_M001.DBF";
set newname for datafile 9 to
"/app/oracle/base/oradata/SGTESTA/DATA_R001.DBF";
set newname for datafile 10 to
"/app/oracle/base/oradata/SGTESTA/DATA_O001.DBF";
set newname for datafile 11 to
"/app/oracle/base/oradata/SGTESTA/DATA_E001.DBF";
set newname for datafile 12 to
"/app/oracle/base/oradata/SGTESTA/DATA_G001.DBF";
set newname for datafile 13 to
"/app/oracle/base/oradata/SGTESTA/DATA_P001.DBF";
set newname for datafile 14 to
"/app/oracle/base/oradata/SGTESTA/DATA_S001.DBF";
set newname for datafile 15 to
"/app/oracle/base/oradata/SGTESTA/IDX_A001.DBF";
set newname for datafile 16 to
"/app/oracle/base/oradata/SGTESTA/IDX_C001.DBF";
set newname for datafile 17 to
"/app/oracle/base/oradata/SGTESTA/IDX_D001.DBF";
set newname for datafile 18 to
"/app/oracle/base/oradata/SGTESTA/IDX_M001.DBF";
set newname for datafile 19 to
"/app/oracle/base/oradata/SGTESTA/IDX_R001.DBF";
set newname for datafile 20 to
"/app/oracle/base/oradata/SGTESTA/IDX_O001.DBF";
set newname for datafile 21 to
"/app/oracle/base/oradata/SGTESTA/IDX_E001.DBF";
set newname for datafile 22 to
"/app/oracle/base/oradata/SGTESTA/IDX_G001.DBF";
set newname for datafile 23 to
"/app/oracle/base/oradata/SGTESTA/IDX_P001.DBF";
set newname for datafile 24 to
"/app/oracle/base/oradata/SGTESTA/IDX_S001.DBF";
set newname for datafile 25 to
"/app/oracle/base/oradata/SGTESTA/DATA_MAN001.DBF";
set newname for datafile 26 to
"/app/oracle/base/oradata/SGTESTA/IDX_MAN001.DBF";
set newname for datafile 27 to
"/app/oracle/base/oradata/SGTESTA/DATA_SGPM.DBF";
set newname for datafile 28 to
"/app/oracle/base/oradata/SGTESTA/DATA_Y.DBF";
set newname for datafile 29 to
"/app/oracle/base/oradata/SGTESTA/IDX_Y.DBF";
set newname for datafile 30 to
"/app/oracle/base/oradata/SGTESTA/DATA_OUT.DBF";
set newname for datafile 31 to
"/app/oracle/base/oradata/SGTESTA/IDX_OUT.DBF";
set newname for datafile 32 to
"/app/oracle/base/oradata/SGTESTA/DATA_ARC001.DBF";
set newname for datafile 33 to
"/app/oracle/base/oradata/SGTESTA/IDX_ARC001.DBF";
set newname for datafile 34 to
"/app/oracle/base/oradata/SGTESTA/pa_data01.dbf";
set newname for datafile 35 to
"/app/oracle/base/oradata/SGTESTA/pa_index01.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

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

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 03-AUG-09

channel ch1: starting datafile backupset restore
channel ch1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /app/oracle/base/oradata/SGTESTA/system01.dbf
restoring datafile 00002 to /app/oracle/base/oradata/SGTESTA/undotbs01.dbf
restoring datafile 00003 to /app/oracle/base/oradata/SGTESTA/sysaux01.dbf
restoring datafile 00004 to /app/oracle/base/oradata/SGTESTA/users01.dbf
restoring datafile 00005 to /app/oracle/base/oradata/SGTESTA/DATA_A001.DBF
restoring datafile 00006 to /app/oracle/base/oradata/SGTESTA/DATA_C001.DBF
restoring datafile 00007 to /app/oracle/base/oradata/SGTESTA/DATA_D001.DBF
restoring datafile 00008 to /app/oracle/base/oradata/SGTESTA/DATA_M001.DBF
restoring datafile 00009 to /app/oracle/base/oradata/SGTESTA/DATA_R001.DBF
restoring datafile 00010 to /app/oracle/base/oradata/SGTESTA/DATA_O001.DBF
restoring datafile 00011 to /app/oracle/base/oradata/SGTESTA/DATA_E001.DBF
restoring datafile 00012 to /app/oracle/base/oradata/SGTESTA/DATA_G001.DBF
restoring datafile 00013 to /app/oracle/base/oradata/SGTESTA/DATA_P001.DBF
restoring datafile 00014 to /app/oracle/base/oradata/SGTESTA/DATA_S001.DBF
restoring datafile 00015 to /app/oracle/base/oradata/SGTESTA/IDX_A001.DBF
restoring datafile 00016 to /app/oracle/base/oradata/SGTESTA/IDX_C001.DBF
restoring datafile 00017 to /app/oracle/base/oradata/SGTESTA/IDX_D001.DBF
restoring datafile 00018 to /app/oracle/base/oradata/SGTESTA/IDX_M001.DBF
restoring datafile 00019 to /app/oracle/base/oradata/SGTESTA/IDX_R001.DBF
restoring datafile 00020 to /app/oracle/base/oradata/SGTESTA/IDX_O001.DBF
restoring datafile 00021 to /app/oracle/base/oradata/SGTESTA/IDX_E001.DBF
restoring datafile 00022 to /app/oracle/base/oradata/SGTESTA/IDX_G001.DBF
restoring datafile 00023 to /app/oracle/base/oradata/SGTESTA/IDX_P001.DBF
restoring datafile 00024 to /app/oracle/base/oradata/SGTESTA/IDX_S001.DBF
restoring datafile 00025 to /app/oracle/base/oradata/SGTESTA/DATA_MAN001.DBF
restoring datafile 00026 to /app/oracle/base/oradata/SGTESTA/IDX_MAN001.DBF
restoring datafile 00027 to /app/oracle/base/oradata/SGTESTA/DATA_SGPM.DBF
restoring datafile 00028 to /app/oracle/base/oradata/SGTESTA/DATA_Y.DBF
restoring datafile 00029 to /app/oracle/base/oradata/SGTESTA/IDX_Y.DBF
restoring datafile 00030 to /app/oracle/base/oradata/SGTESTA/DATA_OUT.DBF
restoring datafile 00031 to /app/oracle/base/oradata/SGTESTA/IDX_OUT.DBF
restoring datafile 00032 to /app/oracle/base/oradata/SGTESTA/DATA_ARC001.DBF
restoring datafile 00033 to /app/oracle/base/oradata/SGTESTA/IDX_ARC001.DBF
restoring datafile 00034 to /app/oracle/base/oradata/SGTESTA/pa_data01.dbf
restoring datafile 00035 to /app/oracle/base/oradata/SGTESTA/pa_index01.dbf
channel ch1: reading from backup piece /app/oracle/base/product/10.2.0/db_1/dbs/0kkk7b4i_1_1
channel ch1: restored backup piece 1
piece handle=/app/oracle/base/product/10.2.0/db_1/dbs/0kkk7b4i_1_1 tag=TAG20090715T174904
channel ch1: restore complete, elapsed time: 00:57:55
Finished restore at 03-AUG-09
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "SGTESTA" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 4672
LOGFILE
GROUP 1 ( '/app/oracle/base/oradata/SGTESTA/redo01.log' ) SIZE 50 M REUSE,
GROUP 2 ( '/app/oracle/base/oradata/SGTESTA/redo02.log' ) SIZE 50 M REUSE,
GROUP 3 ( '/app/oracle/base/oradata/SGTESTA/redo03.log' ) SIZE 50 M REUSE
DATAFILE
'/app/oracle/base/oradata/SGTESTA/system01.dbf'
CHARACTER SET UTF8

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

datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=693957595 filename=/app/oracle/base/oradata/SGTESTA/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=693957595 filename=/app/oracle/base/oradata/SGTESTA/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=693957595 filename=/app/oracle/base/oradata/SGTESTA/users01.dbf
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=693957596 filename=/app/oracle/base/oradata/SGTESTA/DATA_A001.DBF
datafile 6 switched to datafile copy
input datafile copy recid=5 stamp=693957596 filename=/app/oracle/base/oradata/SGTESTA/DATA_C001.DBF
datafile 7 switched to datafile copy
input datafile copy recid=6 stamp=693957596 filename=/app/oracle/base/oradata/SGTESTA/DATA_D001.DBF
datafile 8 switched to datafile copy
input datafile copy recid=7 stamp=693957596 filename=/app/oracle/base/oradata/SGTESTA/DATA_M001.DBF
datafile 9 switched to datafile copy
input datafile copy recid=8 stamp=693957596 filename=/app/oracle/base/oradata/SGTESTA/DATA_R001.DBF
datafile 10 switched to datafile copy
input datafile copy recid=9 stamp=693957596 filename=/app/oracle/base/oradata/SGTESTA/DATA_O001.DBF
datafile 11 switched to datafile copy
input datafile copy recid=10 stamp=693957596 filename=/app/oracle/base/oradata/SGTESTA/DATA_E001.DBF
datafile 12 switched to datafile copy
input datafile copy recid=11 stamp=693957596 filename=/app/oracle/base/oradata/SGTESTA/DATA_G001.DBF
datafile 13 switched to datafile copy
input datafile copy recid=12 stamp=693957596 filename=/app/oracle/base/oradata/SGTESTA/DATA_P001.DBF
datafile 14 switched to datafile copy
input datafile copy recid=13 stamp=693957596 filename=/app/oracle/base/oradata/SGTESTA/DATA_S001.DBF
datafile 15 switched to datafile copy
input datafile copy recid=14 stamp=693957596 filename=/app/oracle/base/oradata/SGTESTA/IDX_A001.DBF
datafile 16 switched to datafile copy
input datafile copy recid=15 stamp=693957596 filename=/app/oracle/base/oradata/SGTESTA/IDX_C001.DBF
datafile 17 switched to datafile copy
input datafile copy recid=16 stamp=693957596 filename=/app/oracle/base/oradata/SGTESTA/IDX_D001.DBF
datafile 18 switched to datafile copy
input datafile copy recid=17 stamp=693957596 filename=/app/oracle/base/oradata/SGTESTA/IDX_M001.DBF
datafile 19 switched to datafile copy
input datafile copy recid=18 stamp=693957596 filename=/app/oracle/base/oradata/SGTESTA/IDX_R001.DBF
datafile 20 switched to datafile copy
input datafile copy recid=19 stamp=693957597 filename=/app/oracle/base/oradata/SGTESTA/IDX_O001.DBF
datafile 21 switched to datafile copy
input datafile copy recid=20 stamp=693957597 filename=/app/oracle/base/oradata/SGTESTA/IDX_E001.DBF
datafile 22 switched to datafile copy
input datafile copy recid=21 stamp=693957597 filename=/app/oracle/base/oradata/SGTESTA/IDX_G001.DBF
datafile 23 switched to datafile copy
input datafile copy recid=22 stamp=693957597 filename=/app/oracle/base/oradata/SGTESTA/IDX_P001.DBF
datafile 24 switched to datafile copy
input datafile copy recid=23 stamp=693957597 filename=/app/oracle/base/oradata/SGTESTA/IDX_S001.DBF
datafile 25 switched to datafile copy
input datafile copy recid=24 stamp=693957597 filename=/app/oracle/base/oradata/SGTESTA/DATA_MAN001.DBF
datafile 26 switched to datafile copy
input datafile copy recid=25 stamp=693957597 filename=/app/oracle/base/oradata/SGTESTA/IDX_MAN001.DBF
datafile 27 switched to datafile copy
input datafile copy recid=26 stamp=693957597 filename=/app/oracle/base/oradata/SGTESTA/DATA_SGPM.DBF
datafile 28 switched to datafile copy
input datafile copy recid=27 stamp=693957597 filename=/app/oracle/base/oradata/SGTESTA/DATA_Y.DBF
datafile 29 switched to datafile copy
input datafile copy recid=28 stamp=693957597 filename=/app/oracle/base/oradata/SGTESTA/IDX_Y.DBF
datafile 30 switched to datafile copy
input datafile copy recid=29 stamp=693957597 filename=/app/oracle/base/oradata/SGTESTA/DATA_OUT.DBF
datafile 31 switched to datafile copy
input datafile copy recid=30 stamp=693957597 filename=/app/oracle/base/oradata/SGTESTA/IDX_OUT.DBF
datafile 32 switched to datafile copy
input datafile copy recid=31 stamp=693957597 filename=/app/oracle/base/oradata/SGTESTA/DATA_ARC001.DBF
datafile 33 switched to datafile copy
input datafile copy recid=32 stamp=693957597 filename=/app/oracle/base/oradata/SGTESTA/IDX_ARC001.DBF
datafile 34 switched to datafile copy
input datafile copy recid=33 stamp=693957597 filename=/app/oracle/base/oradata/SGTESTA/pa_data01.dbf
datafile 35 switched to datafile copy
input datafile copy recid=34 stamp=693957597 filename=/app/oracle/base/oradata/SGTESTA/pa_index01.dbf

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

executing command: SET until clause

Starting recover at 03-AUG-09

starting media recovery

channel ch1: starting archive log restore to default destination
channel aux1: starting archive log restore to default destination
channel aux2: starting archive log restore to default destination
channel ch1: restoring archive log
archive log thread=1 sequence=9814
channel aux1: restoring archive log
archive log thread=1 sequence=9859
channel aux2: restoring archive log
archive log thread=1 sequence=9911
channel ch1: restoring archive log
archive log thread=1 sequence=9815
channel aux1: restoring archive log
archive log thread=1 sequence=9860
channel aux2: restoring archive log
archive log thread=1 sequence=9912
channel ch1: restoring archive log
archive log thread=1 sequence=9816
channel aux1: restoring archive log
archive log thread=1 sequence=9861
channel aux2: restoring archive log
archive log thread=1 sequence=9913
channel ch1: restoring archive log
archive log thread=1 sequence=9823
channel aux1: restoring archive log
archive log thread=1 sequence=9862
channel aux2: restoring archive log
archive log thread=1 sequence=9914
channel ch1: restoring archive log
archive log thread=1 sequence=9824
channel aux1: restoring archive log
archive log thread=1 sequence=9863
channel aux2: restoring archive log
archive log thread=1 sequence=9915
channel ch1: restoring archive log
archive log thread=1 sequence=9825
channel aux1: restoring archive log
archive log thread=1 sequence=9864
channel aux2: restoring archive log
archive log thread=1 sequence=9916
channel ch1: restoring archive log
archive log thread=1 sequence=9826
channel aux1: restoring archive log
archive log thread=1 sequence=9865
channel aux2: restoring archive log
archive log thread=1 sequence=9917
channel ch1: restoring archive log
archive log thread=1 sequence=9827
channel aux1: restoring archive log
archive log thread=1 sequence=9866
channel aux2: restoring archive log
archive log thread=1 sequence=9918
channel ch1: restoring archive log
archive log thread=1 sequence=9828
channel aux1: restoring archive log
archive log thread=1 sequence=9867
channel aux2: restoring archive log
archive log thread=1 sequence=9919
channel ch1: restoring archive log
archive log thread=1 sequence=9829
channel aux1: restoring archive log
archive log thread=1 sequence=9868
channel aux2: restoring archive log
archive log thread=1 sequence=9920
channel ch1: restoring archive log
archive log thread=1 sequence=9830
channel aux1: restoring archive log
archive log thread=1 sequence=9869
channel aux2: restoring archive log
archive log thread=1 sequence=9921
channel ch1: restoring archive log
archive log thread=1 sequence=9831
channel aux1: restoring archive log
archive log thread=1 sequence=9870
channel aux2: restoring archive log
archive log thread=1 sequence=9922
channel ch1: restoring archive log
archive log thread=1 sequence=9832
channel aux1: restoring archive log
archive log thread=1 sequence=9871
channel aux2: restoring archive log
archive log thread=1 sequence=9923
channel ch1: restoring archive log
archive log thread=1 sequence=9833
channel aux1: restoring archive log
archive log thread=1 sequence=9872
channel aux2: restoring archive log
archive log thread=1 sequence=9924
channel ch1: restoring archive log
archive log thread=1 sequence=9834
channel aux1: restoring archive log
archive log thread=1 sequence=9873
channel aux2: restoring archive log
archive log thread=1 sequence=9925
channel ch1: restoring archive log
archive log thread=1 sequence=9835
channel aux1: restoring archive log
archive log thread=1 sequence=9874
channel aux2: restoring archive log
archive log thread=1 sequence=9926
channel ch1: restoring archive log
archive log thread=1 sequence=9836
channel aux1: restoring archive log
archive log thread=1 sequence=9875
channel aux2: restoring archive log
archive log thread=1 sequence=9927
channel ch1: restoring archive log
archive log thread=1 sequence=9837
channel aux1: restoring archive log
archive log thread=1 sequence=9876
channel aux2: restoring archive log
archive log thread=1 sequence=9928
channel ch1: restoring archive log
archive log thread=1 sequence=9838
channel aux1: restoring archive log
archive log thread=1 sequence=9877
channel aux2: restoring archive log
archive log thread=1 sequence=9929
channel ch1: restoring archive log
archive log thread=1 sequence=9839
channel aux1: restoring archive log
archive log thread=1 sequence=9878
channel aux2: restoring archive log
archive log thread=1 sequence=9930
channel ch1: restoring archive log
archive log thread=1 sequence=9840
channel aux1: restoring archive log
archive log thread=1 sequence=9879
channel aux2: restoring archive log
archive log thread=1 sequence=9931
channel ch1: restoring archive log
archive log thread=1 sequence=9841
channel aux1: restoring archive log
archive log thread=1 sequence=9880
channel aux2: restoring archive log
archive log thread=1 sequence=9932
channel ch1: restoring archive log
archive log thread=1 sequence=9842
channel aux1: restoring archive log
archive log thread=1 sequence=9881
channel aux2: restoring archive log
archive log thread=1 sequence=9933
channel ch1: restoring archive log
archive log thread=1 sequence=9843
channel aux1: restoring archive log
archive log thread=1 sequence=9882
channel aux2: restoring archive log
archive log thread=1 sequence=9934
channel ch1: restoring archive log
archive log thread=1 sequence=9844
channel aux1: restoring archive log
archive log thread=1 sequence=9883
channel aux2: restoring archive log
archive log thread=1 sequence=9935
channel ch1: restoring archive log
archive log thread=1 sequence=9845
channel aux1: restoring archive log
archive log thread=1 sequence=9884
channel aux2: restoring archive log
archive log thread=1 sequence=9936
channel ch1: restoring archive log
archive log thread=1 sequence=9846
channel aux1: restoring archive log
archive log thread=1 sequence=9885
channel aux2: restoring archive log
archive log thread=1 sequence=9937
channel ch1: restoring archive log
archive log thread=1 sequence=9847
channel aux1: restoring archive log
archive log thread=1 sequence=9886
channel aux2: restoring archive log
archive log thread=1 sequence=9938
channel ch1: restoring archive log
archive log thread=1 sequence=9848
channel aux1: restoring archive log
archive log thread=1 sequence=9887
channel aux2: restoring archive log
archive log thread=1 sequence=9939
channel ch1: restoring archive log
archive log thread=1 sequence=9849
channel aux1: restoring archive log
archive log thread=1 sequence=9888
channel aux2: restoring archive log
archive log thread=1 sequence=9940
channel ch1: restoring archive log
archive log thread=1 sequence=9850
channel aux1: restoring archive log
archive log thread=1 sequence=9889
channel aux2: restoring archive log
archive log thread=1 sequence=9941
channel ch1: restoring archive log
archive log thread=1 sequence=9851
channel aux1: restoring archive log
archive log thread=1 sequence=9890
channel aux2: restoring archive log
archive log thread=1 sequence=9942
channel ch1: restoring archive log
archive log thread=1 sequence=9852
channel aux1: restoring archive log
archive log thread=1 sequence=9891
channel aux2: restoring archive log
archive log thread=1 sequence=9943
channel ch1: restoring archive log
archive log thread=1 sequence=9853
channel aux1: restoring archive log
archive log thread=1 sequence=9892
channel aux2: restoring archive log
archive log thread=1 sequence=9944
channel ch1: restoring archive log
archive log thread=1 sequence=9854
channel aux1: restoring archive log
archive log thread=1 sequence=9893
channel aux2: restoring archive log
archive log thread=1 sequence=9945
channel ch1: restoring archive log
archive log thread=1 sequence=9855
channel aux1: restoring archive log
archive log thread=1 sequence=9894
channel aux2: restoring archive log
archive log thread=1 sequence=9946
channel ch1: restoring archive log
archive log thread=1 sequence=9856
channel aux1: restoring archive log
archive log thread=1 sequence=9895
channel aux2: restoring archive log
archive log thread=1 sequence=9947
channel ch1: restoring archive log
archive log thread=1 sequence=9857
channel aux1: restoring archive log
archive log thread=1 sequence=9896
channel aux2: restoring archive log
archive log thread=1 sequence=9948
channel ch1: restoring archive log
archive log thread=1 sequence=9858
channel ch1: reading from backup piece /app/oracle/base/admin/SGPMDB/arch/SGPMDB_arch_693938891_23_1
channel aux1: restoring archive log
archive log thread=1 sequence=9897
channel aux2: restoring archive log
archive log thread=1 sequence=9949
channel aux1: restoring archive log
archive log thread=1 sequence=9898
channel aux2: restoring archive log
archive log thread=1 sequence=9950
channel aux1: restoring archive log
archive log thread=1 sequence=9899
channel aux2: restoring archive log
archive log thread=1 sequence=9951
channel aux1: restoring archive log
archive log thread=1 sequence=9900
channel aux2: restoring archive log
archive log thread=1 sequence=9952
channel aux1: restoring archive log
archive log thread=1 sequence=9901
channel aux2: restoring archive log
archive log thread=1 sequence=9953
channel aux1: restoring archive log
archive log thread=1 sequence=9902
channel aux2: restoring archive log
archive log thread=1 sequence=9954
channel aux1: restoring archive log
archive log thread=1 sequence=9903
channel aux2: restoring archive log
archive log thread=1 sequence=9955
channel aux1: restoring archive log
archive log thread=1 sequence=9904
channel aux2: restoring archive log
archive log thread=1 sequence=9956
channel aux1: restoring archive log
archive log thread=1 sequence=9905
channel aux2: restoring archive log
archive log thread=1 sequence=9957
channel aux1: restoring archive log
archive log thread=1 sequence=9906
channel aux2: restoring archive log
archive log thread=1 sequence=9958
channel aux1: restoring archive log
archive log thread=1 sequence=9907
channel aux2: restoring archive log
archive log thread=1 sequence=9959
channel aux1: restoring archive log
archive log thread=1 sequence=9908
channel aux2: restoring archive log
archive log thread=1 sequence=9960
channel aux1: restoring archive log
archive log thread=1 sequence=9909
channel aux2: restoring archive log
archive log thread=1 sequence=9961
channel aux1: restoring archive log
archive log thread=1 sequence=9910
channel aux1: reading from backup piece /app/oracle/base/admin/SGPMDB/arch/SGPMDB_arch_693939137_24_1
channel aux2: restoring archive log
archive log thread=1 sequence=9962
channel aux2: reading from backup piece /app/oracle/base/admin/SGPMDB/arch/SGPMDB_arch_693939342_25_1
channel ch1: restored backup piece 1
piece handle=/app/oracle/base/admin/SGPMDB/arch/SGPMDB_arch_693938891_23_1 tag=TAG20090803T164451
channel ch1: restore complete, elapsed time: 00:04:56
archive log filename=/app/oracle/base/product/10.2.0/db_1/dbs/arch1_9814_652109004.dbf thread=1 sequence=9814
channel clone_default: deleting archive log(s)
archive log filename=/app/oracle/base/product/10.2.0/db_1/dbs/arch1_9814_652109004.dbf recid=25 stamp=693957697
archive log filename=/app/oracle/base/product/10.2.0/db_1/dbs/arch1_9815_652109004.dbf thread=1 sequence=9815
channel clone_default: deleting archive log(s)
archive log filename=/app/oracle/base/product/10.2.0/db_1/dbs/arch1_9815_652109004.dbf recid=42 stamp=693957733
archive log filename=/app/oracle/base/product/10.2.0/db_1/dbs/arch1_9816_652109004.dbf thread=1 sequence=9816
channel clone_default: deleting archive log(s)
archive log filename=/app/oracle/base/product/10.2.0/db_1/dbs/arch1_9816_652109004.dbf recid=10 stamp=693957660
unable to find archive log
archive log thread=1 sequence=9817
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 08/03/2009 22:07:01
RMAN-03015: error occurred in stored script Memory Script
RMAN-06054: media recovery requesting unknown log: thread 1 seq 9817 lowscn 10109672261341

SQL> alter database open resetlogs ;

ALTER TABLESPACE TEMP ADD TEMPFILE '/app/oracle/base/oradata/SGTESTA/temp01.dbf'
SIZE 48234496 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;

创建
create pfile='/app/oracle/base/admin/SGTESTA/pfile/pfileSGTESTA' from spfile ;
接着shutdown immediate,然后
拷贝并修改控制文件名称和位置,
cd /app/oracle/base/product/10.2.0/db_1/dbs
cp ./cntrlSGTESTA.dbf /app/oracle/base/oradata/SGTESTA/control01.ctl
cp ./cntrlSGTESTA.dbf /app/oracle/base/oradata/SGTESTA/control02.ctl
cp ./cntrlSGTESTA.dbf /app/oracle/base/oradata/SGTESTA/control03.ctl

在pfile里面指明control_files='/app/oracle/base/oradata/SGTESTA/control01.ctl','/app/oracle/base/oradata/SGTESTA/control02.ctl','/app/oracle/base/oradata/SGTESTA/control03.ctl'

最后用pfile启动,并且创建spfile
startup pfile='/app/oracle/base/admin/SGTESTA/pfile/pfileSGTESTA' ;

create spfile from pfile='/app/oracle/base/admin/SGTESTA/pfile/pfileSGTESTA' ;

一切OK !
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: