一个rman的catalog库,是9i的版本。在连接这个库做backup的时候,能正常完成,但是在做restore的时候,就报错了:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
ecovery Manager: Release 9.2.0.8.0 - 64bit Production Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved. RMAN> executing command: SET DBID RMAN> connected to target database: (not mounted) RMAN> connected to recovery catalog database RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19> 20> 21> 22> allocated channel: ch1 channel ch1: sid=11 devtype=SBT_TAPE channel ch1: Veritas NetBackup for Oracle - Release 7.1 (2011120716) allocated channel: ch2 channel ch2: sid=12 devtype=SBT_TAPE channel ch2: Veritas NetBackup for Oracle - Release 7.1 (2011120716) allocated channel: ch3 channel ch3: sid=13 devtype=SBT_TAPE channel ch3: Veritas NetBackup for Oracle - Release 7.1 (2011120716) allocated channel: ch4 channel ch4: sid=14 devtype=SBT_TAPE channel ch4: Veritas NetBackup for Oracle - Release 7.1 (2011120716) allocated channel: ch5 channel ch5: sid=15 devtype=SBT_TAPE channel ch5: Veritas NetBackup for Oracle - Release 7.1 (2011120716) allocated channel: ch6 channel ch6: sid=16 devtype=SBT_TAPE channel ch6: Veritas NetBackup for Oracle - Release 7.1 (2011120716) allocated channel: ch7 channel ch7: sid=17 devtype=SBT_TAPE channel ch7: Veritas NetBackup for Oracle - Release 7.1 (2011120716) allocated channel: ch8 channel ch8: sid=18 devtype=SBT_TAPE channel ch8: Veritas NetBackup for Oracle - Release 7.1 (2011120716) sent command to channel: ch1 sent command to channel: ch2 sent command to channel: ch3 sent command to channel: ch4 sent command to channel: ch5 sent command to channel: ch6 sent command to channel: ch7 sent command to channel: ch8 Starting restore at 2013-10-28 18:35:47 released channel: ch1 released channel: ch2 released channel: ch3 released channel: ch4 released channel: ch5 released channel: ch6 released channel: ch7 released channel: ch8 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of restore command at 10/28/2013 18:35:48 RMAN-06004: ORACLE error from recovery catalog database: ORA-01455: converting column overflows integer datat ype RMAN> Recovery Manager complete. |
根据RMAN-06004和ORA-01455,我们很容易就能发现9i catalog库的一个bug:bug 1260760,详见 Known RMAN Bugs in Oracle9i (Doc ID 227398.1)
在9i中,当使用catalog库进行restore等操作时,会引用rman_seq这个序列,而rman这个程序是由proc C写的,在定义字段时,接受的值被定义成UB4MAXVAL,这种类型的值最大为4294967295,即2^32-1。当从catalog库传rman.seq值给rman时,如果超过这了4294967295,就会报错rman-6004和ora-1455。
解决的方法可以是:
1 2 |
1. 新建一个catalog库 2. 升级catalog库到10g以上。 |
建议采用第二种方法。新建10g catalog,将9i的数据导入。目前从遇到该问题的别的客户那边看,大多采用第二种的方法。
如在上面的报错的那个库中,我们检查到rman_seq的值为:
1 2 3 4 5 6 7 |
SQL> select rman_seq.nextval from dual; NEXTVAL ---------- 4846456353 SQL> |
另,排除其他ora-1445的bug,如:
(1)在11g中,数据文件超过4T,也会触发ora-1455,我们的版本不是11g,也没有数据文件超过4T。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
SQL> select file_name, round(bytes / 1024 / 1024 / 1024 / 1024, 2) size_tb 2 from dba_data_files 3 where round(bytes / 1024 / 1024 / 1024 / 1024, 2) > 0.05 4 order by 2; FILE_NAME SIZE_TB -------------------------------------------------------------------------------- ---------- /copn/my/impdb/data5/oradata/impdb/odsdata_data276.dbf 0.06 /copn/my/impdb/data5/oradata/impdb/odsdata_data277.dbf 0.06 /copn/my/impdb/data5/oradata/impdb/odsdata_data278.dbf 0.06 /copn/my/impdb/data5/oradata/impdb/odsdata_data279.dbf 0.06 /copn/my/impdb/data5/oradata/impdb/odsdata_data280.dbf 0.06 /copn/my/impdb/data5/oradata/impdb/odsdata_data281.dbf 0.06 /copn/my/impdb/data5/oradata/impdb/odsdata_data283.dbf 0.06 /copn/my/impdb/data5/oradata/impdb/odsdata_data284.dbf 0.06 /copn/my/impdb/data5/oradata/impdb/odsdata_data285.dbf 0.06 /copn/my/impdb/data5/oradata/impdb/odsdata_data286.dbf 0.06 /copn/my/impdb/data8/oradata/impdb/odscapbdata01.dbf 0.06 /copn/my/impdb/data11/oradata/impdb/odsdata_data603.dbf 0.06 /copn/my/impdb/data11/oradata/impdb/odsdata_data604.dbf 0.06 /copn/my/impdb/data11/oradata/impdb/odsdata_data605.dbf 0.06 /copn/my/impdb/data11/oradata/impdb/odsdata_data606.dbf 0.06 /copn/my/impdb/data11/oradata/impdb/odsdata_data607.dbf 0.06 /copn/my/impdb/data11/oradata/impdb/odsdata_data608.dbf 0.06 /copn/my/impdb/data12/oradata/impdb/odscapbdata09.dbf 0.06 /copn/my/impdb/data12/oradata/impdb/odscapbdata10.dbf 0.06 19 rows selected SQL> |
(2)由于夏令时的切换,导致start_time>completion_time,也会触发ora-1455,我们不存在start_time>completion_time的记录。
1 2 3 4 5 6 7 8 |
SQL> select * from rc_backup_piece x 2 where x.start_time>x.completion_time 3 / DB_KEY DB_ID BP_KEY RECID STAMP BS_KEY SET_STAMP SET_COUNT BACKUP_TYPE INCREMENTAL_LEVEL PIECE# COPY# DEVICE_TYPE HANDLE COMMENTS MEDIA MEDIA_POOL CONCUR TAG START_TIME COMPLETION_TIME ELAPSED_SECONDS STATUS ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------- ----------------- ---------- ---------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ---------- ------ -------------------------------- ----------- --------------- --------------- ------ SQL> |
Ps:另外,根据分析,在该catalog库上有3个库的备份,一个是verdb,一个是impdb,一个是mandb。在rc_backup_datafile会记录备份的各个文件,备份时会取rman_seq的序列的值进行记录。rc_backup_datafile的其中一个基表是bs表,bs表有个字段叫bs_key,是主键,这个值的取值是根据rman_seq来取。
也就是说,在备份时,每个文件会对应一个rman_seq号,然后写入到rc_backup_datafile中记录。而rman_seq在一个owner下是公用的,因此用的比较快,加上verdb和impdb都是大库,文件比较多,因此用rman_seq就很快达到阀值了。(因此,9i中,对于很多数据文件的大库的catalog库,最好还是分不同的owner)。
从检查情况看:
1 2 3 4 5 6 7 8 9 10 11 |
SQL> select db_name,max(bs_key) from rc_backup_datafile 2 group by db_name 3 / DB_NAME MAX(BS_KEY) -------- ----------- verdb 4839910893 impdb 4844109647 mandb 2054440332 SQL> |
verdb和impdb由于bs_key的值已经超过阀值,因此已经无法把最新的备份restore回去。而mandb的备份应该还可以restore回去。
3个库可以restore回去最近的时间为:
1 2 3 4 5 6 7 8 9 10 11 12 |
SQL> select db_name,max(completion_time) from rc_backup_datafile 2 where bs_key<'4294967295' 3 group by db_name 4 / DB_NAME MAX(COMPLETION_TIME) -------- -------------------- verdb 2013/10/11 12:24:03 impdb 2013/10/11 12:12:37 mandb 2013/5/22 4:43:54 SQL> |