Sometimes you will see this error while doing duplicate database
Oracle instance shut down
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 04/18/2017 13:10:23
RMAN-05501: aborting duplication of target database
RMAN-06136: ORACLE error from auxiliary database: ORA-06502: PL/SQL: numeric or value error
Recovery Manager complete.
Then connect to the source database and its catalog database. now unregister the unique name which you are going to re-use. In my scenario, I tried to duplicate the database as Testt13 and it's already exists.
rman target /
connect catalog rman/password@Rmancatalog
Recovery Manager: Release 11.2.0.4.0 - Production on Tue Apr 18 13:35:43 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: TESTPG (DBID=1734399999)
connected to recovery catalog database
RMAN> list db_unique_name of database;
List of Databases
DB Key DB Name DB ID Database Role Db_unique_name
------- ------- ----------------- --------------- ------------------
5548648 TESTPG 1734399999 PRIMARY TESTPG_DG1
5548648 TESTPG 1734399999 STANDBY TESTT10
5548648 TESTPG 1734399999 STANDBY TESTT13
5548648 TESTPG 1734399999 STANDBY TESTPG
5548648 TESTPG 1734399999 STANDBY TESTSG
5548648 TESTPG 1734399999 STANDBY TESTPG_DG2
RMAN> resync catalog;
starting full resync of recovery catalog
full resync complete
RMAN> unregister db_unique_name 'TESTT13';
database db_unique_name is "TESTT13", db_name is "TESTPG" and DBID is 1734399999
Want to unregister the database with target db_unique_name (enter YES or NO)? YES
database with db_unique_name TESTT13 unregistered from the recovery catalog
RMAN> unregister db_unique_name 'TESTT10';
database db_unique_name is "TESTT10", db_name is "TESTPG" and DBID is 1734399999
Want to unregister the database with target db_unique_name (enter YES or NO)? YES
database with db_unique_name TESTT10 unregistered from the recovery catalog
RMAN> resync catalog;
starting full resync of recovery catalog
full resync complete
RMAN> list db_unique_name of database;
List of Databases
DB Key DB Name DB ID Database Role Db_unique_name
------- ------- ----------------- --------------- ------------------
5548648 TESTPG 1734399999 PRIMARY TESTPG_DG1
5548648 TESTPG 1734399999 STANDBY TESTPG
5548648 TESTPG 1734399999 STANDBY TESTSG
5548648 TESTPG 1734399999 STANDBY TESTPG_DG2
RMAN> exit
Now retry the duplicate it will work
Oracle instance shut down
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 04/18/2017 13:10:23
RMAN-05501: aborting duplication of target database
RMAN-06136: ORACLE error from auxiliary database: ORA-06502: PL/SQL: numeric or value error
Recovery Manager complete.
Then connect to the source database and its catalog database. now unregister the unique name which you are going to re-use. In my scenario, I tried to duplicate the database as Testt13 and it's already exists.
rman target /
connect catalog rman/password@Rmancatalog
Recovery Manager: Release 11.2.0.4.0 - Production on Tue Apr 18 13:35:43 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: TESTPG (DBID=1734399999)
connected to recovery catalog database
RMAN> list db_unique_name of database;
List of Databases
DB Key DB Name DB ID Database Role Db_unique_name
------- ------- ----------------- --------------- ------------------
5548648 TESTPG 1734399999 PRIMARY TESTPG_DG1
5548648 TESTPG 1734399999 STANDBY TESTT10
5548648 TESTPG 1734399999 STANDBY TESTT13
5548648 TESTPG 1734399999 STANDBY TESTPG
5548648 TESTPG 1734399999 STANDBY TESTSG
5548648 TESTPG 1734399999 STANDBY TESTPG_DG2
RMAN> resync catalog;
starting full resync of recovery catalog
full resync complete
removing the unwanted unique names
RMAN> unregister db_unique_name 'TESTT13';
database db_unique_name is "TESTT13", db_name is "TESTPG" and DBID is 1734399999
Want to unregister the database with target db_unique_name (enter YES or NO)? YES
database with db_unique_name TESTT13 unregistered from the recovery catalog
RMAN> unregister db_unique_name 'TESTT10';
database db_unique_name is "TESTT10", db_name is "TESTPG" and DBID is 1734399999
Want to unregister the database with target db_unique_name (enter YES or NO)? YES
database with db_unique_name TESTT10 unregistered from the recovery catalog
RMAN> resync catalog;
starting full resync of recovery catalog
full resync complete
RMAN> list db_unique_name of database;
List of Databases
DB Key DB Name DB ID Database Role Db_unique_name
------- ------- ----------------- --------------- ------------------
5548648 TESTPG 1734399999 PRIMARY TESTPG_DG1
5548648 TESTPG 1734399999 STANDBY TESTPG
5548648 TESTPG 1734399999 STANDBY TESTSG
5548648 TESTPG 1734399999 STANDBY TESTPG_DG2
RMAN> exit
Now retry the duplicate it will work