mardi 8 novembre 2011

Oracle11g: how to know which database is managed by RMAN


Some times it will be interesting to know which database is managed by the RMAN catalog.
There is three ways for archiving this :

  a) By connecting to the rman catalog only
$> rman catalog rcatowner/rcatowner
Recovery Manager: Release 11.2.0.1.0 - Production on Tue Nov 8 17:35:43 2011

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

connected to target database: TEST (DBID=2058702964)
connected to recovery catalog database

RMAN> list incarnation;

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
2       20      TEST     2058702964       PARENT  1          13-AUG-09
2       4       TEST     2058702964       CURRENT 754488     30-AUG-11

  b) By connecting to the rman instance without the catalog
$> rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Tue Nov 8 17:47:09 2011

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

connected to target database: TEST (DBID=2058702964)

RMAN> list incarnation;

using target database control file instead of recovery catalog

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       TEST     2058702964       PARENT  1          13-AUG-09
2       2       TEST     2058702964       CURRENT 754488     30-AUG-11

  b) By connecting directly to the database instance that owns the catalog schema
$> sqlplus rcatowner/rcatowner
SQL*Plus: Release 11.2.0.1.0 Production on Tue Nov 8 17:35:31 2011

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning option

SQL> select * from dbinc;

 DBINC_KEY     DB_KEY DB_NAME   RESET_SCN RESET_TIM PARENT_DBINC_KEY DBINC_ST
---------- ---------- -------- ---------- --------- ---------------- --------
         4          2 TEST         754488 30-AUG-11               20 CURRENT
        20          2 TEST              1 13-AUG-09                  PARENT

note: Each time a database is open using resetlogs, a new database incarnation is created and registered in the catalog database.