发生的这个错误的由于:
在RMAN CATALOG中,register了一个name叫test的数据库,后来这个库被我搞坏了。就重建了一个test的数据库,名称没有更改,又重新register到RMAN CATALOG中。在用CATALOG备份都是没有问题。后来模拟controlfile/datafile丢失的case,就发生了
RMAN-20005: target database name is ambiguous的错误。
由于CATALOG上有两个不同DBID但是名称相同的target database,CATALOG不知道要连接哪个target,故报错。
可以通过以下方式解决:
1. 连接到catalog 上,获取到dbid的信息
$ sqlplus rman/rman@db
SQL*Plus: Release 9.2.0.1.0 - Production on Thu Mar 13 14:43:24 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
SQL> select * from rc_database;
DB_KEY DBINC_KEY DBID NAME RESETLOGS_CHANGE# RESETLOGS_TIME
---------- ---------- ---------- -------- ----------------- ---------------
1 2 1943768960 TEST 845248 15-FEB-08
287 288 1947325841 TEST 1 12-MAR-08
新库比老库创建的晚,那DBID为 1947325841
2. 确认DBID的信息:
通过list backup反馈的信息确认是否正确:
$ rman target / catalog rman/rman@db
Recovery Manager: Release 9.2.0.1.0 - 64bit Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: test (not mounted)
connected to recovery catalog database
RMAN> set dbid = 1947325841
executing command: SET DBID
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
317 Full 65M DISK 00:00:04 13-MAR-08
BP Key: 319 Status: AVAILABLE Tag: TAG20080313T100953
Piece Name: /backup2/test/test_03jb5dfh_1_1.bak
List of Datafiles in backup set 317
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
2 Full 70680 13-MAR-08 /backup1/data/test/oradata/undotbs01.dbf
3 Full 70680 13-MAR-08 /backup1/data/test/oradata/test01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
318 Full 127M DISK 00:00:13 13-MAR-08
BP Key: 320 Status: AVAILABLE Tag: TAG20080313T100953
Piece Name: /backup2/test/test_04jb5dfh_1_1.bak
List of Datafiles in backup set 318
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 70680 13-MAR-08 /backup1/data/test/oradata/system01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
325 Full 2M DISK 00:00:01 13-MAR-08
BP Key: 326 Status: AVAILABLE Tag:
Piece Name: /backup2/test/test_c_c-1947325841-20080313-00
SPFILE Included: Modification time: 28-FEB-08
我只备份了一次新库,呵呵。毫无疑问,DBID是正确的。
说明:
不要在同一个CATALOG中注册相同的DBNAME的库,否则会产生混乱。