While running rman commands from the catalog database, you might get the error RMAN-20005: target database name is ambiguous. , if the database was restored from another database.

ERROR:

rman target sys/oracle#51234@RMANBKP catalog rman_b2ccrmpd/rman@catdb

Recovery Manager: Release 12.1.0.2.0 – Production on Fri Oct 14 10:34:05 2016

Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.

connected to target database: B2CCRMPD (DBID=1927730802, not open)
connected to recovery catalog database
RMAN> list backup;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of list command at 10/11/2016 06:13:34
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20005: target database name is ambiguous

SOLUTION:

1. connect to the catalog database , check the dbid.
oracle@sec86-5:~/RMAN$ sqlplus rman_b2ccrmpd/rman@catdb

SQL*Plus: Release 12.1.0.2.0 Production on Tue Oct 11 06:14:17 2016
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select db_key,dbid,name from rc_database;

DB_KEY DBID NAME
———- ———- ——–
96243 1927730802 B2CCRMPD
    1 1924697918 B2CCRMPD

 

We can see there are two dbid entries in the catalog. Now set the correct db id of the target db and run rman commands.
rman target sys/oracle#51234@RMANBKP catalog rman_b2ccrmpd/rman@catdb

Recovery Manager: Release 12.1.0.2.0 – Production on Fri Oct 14 10:34:05 2016

Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.

connected to target database: B2CCRMPD (DBID=1927730802, not open)
connected to recovery catalog database
RMAN> set DBID=1927730802;

RMAN> list backup;

it will work