Tuesday, October 28, 2008

Updating Clone Database using RMAN Duplicate

This action is intended to update the clone database without shutting down the production database. This require that you have created a running clone using cold backup and the production database is already backed up using RMAN. Also the clone is started up using pfile.

For example, the production instance name is PROD and the clone instance is
TEST. These are the steps:

1. Update the tnsnames.ora on TEST instance. You can find it on {TEST base dir}/db/tech_st/10.2.0/network/admin/TEST_ebs/tnsnames.ora. Add tnsnames for
PROD. Example:
PROD=
       (DESCRIPTION=
               (ADDRESS=(PROTOCOL=tcp)(HOST=ebs)(PORT=1521))
           (CONNECT_DATA=
               (SID=PROD)
           )
       )

2. If both instance are not on the same server, you must copy the rman backup files to the TEST instance server with the same exact path.

3. This step must be done only if you have different path to data file on PROD and TEST. For example the base directory are different. Update the initTEST.ora on TEST instance. You can find it on {TEST base dir}/db/tech_st/10.2.0/dbs. Add these lines to the end:
db_file_name_convert=({PROD base dir}/db/apps_st/data/,{TEST base dir}/db/apps_st/data/)
log_file_name_convert=({PROD base dir}/db/apps_st/data/,{TEST base dir}/db/apps_st/data/)

4. Source your TEST database environment.

5. Shutdown the TEST database and then startup using nomount mode.

6. Start RMAN using this command:
    rman target sys/{password of sys}@PROD nocatalog auxiliary /

7. On RMAN use this command to duplicate the database:
   duplicate target database to "TEST";

8. Wait until it finished.

9. On some case, you might encounter invalid data file. Run this: 
    perl {TEST base dir}/db/tech_st/appsutil/clone/bin adcfgclone.pl database

No comments: