Tuesday, April 29, 2014

How to Get the DBID when Instance in NOMOUNT State

The Arup Nanda Blog: How to Get the DBID when Instance in in NOMOUNT St...: You lost your controlfile and the catalog. To restore the controlfile, you must know the DBID. Did you follow the advise to write down the D...

Monday, April 14, 2014

Duplicate Database Using RMAN



Since 11gR2 released we're able to duplicate database without connecting to target DB or CATALOG using backup where target database could be down. This kind of duplicate termed as “Backup-Based Duplication without a target and Recovery Catalog Connection”.

    1-    From RMAN prompt check control file autobackup is ON.

    2-   Connect to the target to get a new backup.
cmd > rman target /
rman > backup database plus archivelog;

    3-   Once it finished copy backup folder to your destination DB using normal OS copy.

    4-   Create your duplicate instance – windows only
cmd > oradim –NEW –SID destination database name

    5-   Create parameter file with following parameter.
Dn_name= destination database name
Db_unique_name= destination database name
Db_file_name_conevrt=’source datafile location’,’destination datafile location’
Log_file_name_convert=’source logfile location’,’destination logfile location’

    6-   Startup the destination DB in nomount stage.
sql > Startup nomount

    7-   Connect to the auxiliary through RMAN and restore the db.
cmd > rman auxiliary /
rman > duplicate database to DB_NAME backup location ‘backup PATH’;

Note:
As per metaling In release 11.2.0.2 there is a bug through an ora-600


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 01/09/2013 11:39:15
RMAN-06403: could not obtain a fully authorized session
RMAN-04006: error from auxiliary database: ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
RMAN-04014: startup failed: ORA-00600: internal error code, arguments: [17099], [], [], [], [], [], [], [], [], [], [], []
ORA-00600: internal error code, arguments: [KSMFPG5], [0xAEC0000], [], [], [], [], [], [], [], [], [], []


When you try to open the DB you will get following error:


ORA-19838: Cannot use this control file to open database


And when you show up db_name and db_unique_name parameters , you find old name for db_name so continue next steps.

    8-   Backup control file as trace.
sql > alter database backup controlfile to trace as ‘PATH(CNTRL.sql)’;

    9-   Edit controlfile trace to replace (REUSE to SET, OLD_DB_NAME to NEW_DB_NAME and remove all blank spaces and commented rows)

    10- Restart database  in mount stage and change the DB_NAME
sql > shutdown
sql > startup mount
sql > alter system set db_name=NEW_DB_NAME scope=spfile;

    11- Shutdown the DB again and recreate control file after remove it through OS.
sql > shutdown
sql > @CNTRL.sql

    12-Alter database open with resetlogs option.
sql > alter database open resetlogs

Note:
If you get below error go and check the alert file to find out which parameters are deprecated and remove them.

ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance

Congratulation you have duplicate your database successfully.