rman搭建测试库的时候,使用duplicate发现出现段错误,查看源端和目标端日志都没有任何报错:
[oracle@bre1 bre1]$ rman target sys/manager
Recovery Manager: Release 11.2.0.4.0 - Production on Mon Jan 29 10:42:10 2024
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: BRE1 (DBID=2718330383)
RMAN> connect auxiliary sys/manager@bre2_test
connected to auxiliary database: BRE1 (not mounted)
RMAN> DUPLICATE TARGET DATABASE TO bre1 FROM ACTIVE DATABASE nofilenamecheck;
Starting Duplicate Db at 29-JAN-2024 10:42:19
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=171 device type=DISK
contents of Memory Script:
{
sql clone "alter system set db_name =
''BRE1'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''BRE1'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
backup as copy current controlfile auxiliary format '/u01/oradata/bre1/control01.ctl';
restore clone primary controlfile to '/u01/oradata/bre1/control02.ctl' from
'/u01/oradata/bre1/control01.ctl';
alter clone database mount;
}
executing Memory Script
sql statement: alter system set db_name = ''BRE1'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''BRE1'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 2505338880 bytes
Fixed Size 2255832 bytes
Variable Size 587203624 bytes
Database Buffers 1895825408 bytes
Redo Buffers 20054016 bytes
Starting backup at 29-JAN-2024 10:42:28
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=21 device type=DISK
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_bre1.f tag=TAG20240129T104228
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 29-JAN-2024 10:42:29
Starting restore at 29-JAN-2024 10:42:29
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=170 device type=DISK
channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 29-JAN-2024 10:42:30
database mounted
contents of Memory Script:
{
sql clone 'alter database flashback off';
set newname for datafile 1 to
"/u01/oradata/bre1/system01.dbf";
set newname for datafile 2 to
"/u01/oradata/bre1/sysaux01.dbf";
set newname for datafile 3 to
"/u01/oradata/bre1/undotbs01.dbf";
set newname for datafile 4 to
"/u01/oradata/bre1/users01.dbf";
set newname for datafile 5 to
"/u01/oradata/bre1/soe.dbf";
set newname for datafile 6 to
"/u01/oradata/bre1/tsp_tmp1.dbf";
backup as copy reuse
datafile 1 auxiliary format
"/u01/oradata/bre1/system01.dbf" datafile
2 auxiliary format
"/u01/oradata/bre1/sysaux01.dbf" datafile
3 auxiliary format
"/u01/oradata/bre1/undotbs01.dbf" datafile
4 auxiliary format
"/u01/oradata/bre1/users01.dbf" datafile
5 auxiliary format
"/u01/oradata/bre1/soe.dbf" datafile
6 auxiliary format
"/u01/oradata/bre1/tsp_tmp1.dbf" ;
sql 'alter system archive log current';
}
executing Memory Script
sql statement: alter database flashback off
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 29-JAN-2024 10:42:35
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/u01/oradata/bre1/soe.dbf
output file name=/u01/oradata/bre1/soe.dbf tag=TAG20240129T104235
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/oradata/bre1/users01.dbf
output file name=/u01/oradata/bre1/users01.dbf tag=TAG20240129T104235
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/oradata/bre1/undotbs01.dbf
output file name=/u01/oradata/bre1/undotbs01.dbf tag=TAG20240129T104235
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u01/oradata/bre1/sysaux01.dbf
output file name=/u01/oradata/bre1/sysaux01.dbf tag=TAG20240129T104235
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/oradata/bre1/system01.dbf
output file name=/u01/oradata/bre1/system01.dbf tag=TAG20240129T104235
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=/u01/oradata/bre1/tsp_tmp1.dbf
Oracle instance started
Segmentation fault (core dumped)
这个时候再继续重新duplicate,发现出现了真正的错误:
Fixed Size 2255832 bytes
Variable Size 587203624 bytes
Database Buffers 1895825408 bytes
Redo Buffers 20054016 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''BRE1'' comment=
''Reset to original value by RMAN'' scope=spfile";
sql clone "alter system reset db_unique_name scope=spfile";
shutdown clone immediate;
}
executing Memory Script
sql statement: alter system set db_name = ''BRE1'' comment= ''Reset to original value by RMAN'' scope=spfile
sql statement: alter system reset db_unique_name scope=spfile
Oracle instance shut down
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 01/29/2024 11:25:29
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 01/29/2024 11:25:20
ORA-19566: exceeded limit of 0 corrupt blocks for file /u01/oradata/bre1/tsp_tmp1.dbf
RMAN>
这里发现数据文件出现了坏块,通过dbv检查确认有坏块:
DBVERIFY - Verification complete
Total Pages Examined : 12800
Total Pages Processed (Data) : 183
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 139
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 12474
Total Pages Marked Corrupt : 4
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 5627921 (0.5627921)
后面使用其它手段修复坏块后恢复