No great genius has ever existed without some touch of madness.

Sunday 6 May 2012

RMAN-20004: target database name does not match name in recovery catalog


RMAN-06004: ORACLE error from recovery catalog database
RMAN-20004: target database name does not match name in recovery catalog

SCENARIO:

TARGET DATABASE :   sagdb
CATALOG DATABASE: catdb

So, sagdb is my production database and catdb is my catalog database ,acting as a repository of all backup information of sagdb.

The way I connect:

$ export ORACLE_SID=sagdb
$ rman target / catalog rman/rman@catdb
Recovery Manager: Release 11.2.0.1.0 - Production on Mon May 7 12:05:36 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to target database: SAGDB (DBID=775267598)
connected to recovery catalog database
RMAN>


MISTAKE:

Last Saturday , I was working on the same and by mistake it happened.
Let’s see what did I do:--

$ export ORACLE_SID=catdb
$rman target / catalog rman/rman@catdb
Recovery Manager: Release 11.2.0.1.0 - Production on Mon May 7 12:05:36 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to target database: CATDB (DBID=775267598)
connected to recovery catalog database
RMAN>

But it was late:
Now ,after identifying my mistake ,I tried to establish my usual connection:

$ export ORACLE_SID=sagdb
$ rman target / catalog rman/rman@catdb
Recovery Manager: Release 11.2.0.1.0 - Production on Mon May 7 12:05:36 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to target database: SAGDB (DBID=775267598)
connected to recovery catalog database
RMAN>

But as soon as I executed –
RMAN> report schema;

I got an error…
RMAN-06004: ORACLE error from recovery catalog database
RMAN-20004: target database name does not match name in recovery catalog

I was getting this error In every command I executed on rman .

NOTE: There  can be no. of reasons for this error (my scenario is just an example)

SOLUTION:

I connected in the wrong way , i.e

$ export ORACLE_SID=catdb
$rman target / catalog rman/rman@catdb
Recovery Manager: Release 11.2.0.1.0 - Production on Mon May 7 12:05:36 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to target database: CATDB (DBID=775267598)
connected to recovery catalog database
RMAN>

And then I executed:
RMAN> unregister database;

After executing above command , I made the right connect as:

$ export ORACLE_SID=sagdb
$ rman target / catalog rman/rman@catdb
Recovery Manager: Release 11.2.0.1.0 - Production on Mon May 7 12:05:36 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to target database: SAGDB (DBID=775267598)
connected to recovery catalog database
RMAN>

And then ,  I executed :
RMAN > register database;

And, so I saved my day.