Data Guard – ASM primary to filesystem physical standby – using RMAN duplicate

ASM databases and filesystem databases run together in Oracle Data Guard, it helps us move database into or take if out of ASM disks/filesystem without concern on data loss.

Notes:
db_create_file_dest is the key because of the nature of ASM+OMF dynamic name with their rules. //*online_log*dest* plays the same role.

Steps
Use RMAN duplicate cocmmand to create Data Gurard with ASM primary and filesystem physcial standby.
1) have RMAN backup primary database (either ASM or on filesytem)
2) create parameter file, password file, tnsnames.ora entry, filesystem or ASM diskgroup for standby database, and optional listener for standby.
3) make sure backup in step 1 is avaiable for standby server.
4) call RMAN duplicate command
5) start log apply in standby database

Example:
10gR2(10.2.0.1), primary database: db10g on ASM disks, standby database db10gs on filesystem
. Both databases on the same server.

– 1. backup of primary database

[oracle@dbhost1 ~]$ rman target /
RMAN>  backup device type disk format=’/d02/backup/db10g%U.bkp’ incremental level 0 database include current controlfile for standby plus archivelog;

– 2. create pfile of standby database

[oracle@dbhost1 ~]$ sqlplus "/as sysdba"

SQL> create pfile=’db10g.pfile’ from spfile;

[oracle@dbhost1 ~]$ cd $ORACLE_HOME/dbs/
[oracle@dbhost1 dbs]$ mv db10g.pfile initdb10gs.ora
[oracle@dbhost1 dbs]$ vi initdb10gs.ora

– …
– db_create_file_dest   =’/d07/oradata’
– db_recovery_file_dest =’/d07/fra’
– …

[oracle@dbhost1 dbs]$ export ORACLE_SID=db10gs

[oracle@dbhost1 dbs]$ sqlplus "/as sysdba"

SQL> create spfile from pfile;

– 3. create password file of standby database
[oracle@dbhost1 dbs]$ orapwd file=orapwdb10gs password=<my_password>

– 4. create folders of standby database
[oracle@dbhost1 dbs]$ mkdir -p /d01/oracle/10g/admin/db10gs

– datafile location, flush recovery area location
[oracle@dbhost1 dbs]$ mkdir -p /d07/oradata 
[oracle@dbhost1 dbs]$ mkdir -p /d07/fra

– 5. listener.ora and tnsnames.ora entry of standby database

– 6. RMAN duplicate command

[oracle@dbhost1 dbs]$ rman target sys/<sys_password>@<target database> auxiliary /


connected to target database: DB10G (DBID=83196489)
connected to auxiliary database (not started)

RMAN> startup auxiliary nomount

RMAN> duplicate target database for standby dorecover;



contents of Memory Script:
{
   set until scn  35036080;
   restore clone standby controlfile;
   sql clone ‘alter database mount standby database';
}



contents of Memory Script:
{
   set until scn  35036080;
   set newname for clone tempfile  1 to new;
   switch clone tempfile all;
   set newname for clone datafile  1 to new;
   set newname for clone datafile  2 to new;
    …
   restore
   check readonly
   clone database
   ;
}



contents of Memory Script:
{
   switch clone datafile all;
}



contents of Memory Script:
{
   set until scn  35036080;
   recover
   standby
   clone database
    delete archivelog
   ;
}



RMAN> exit

Note: Even without duplicate command, We can still do it with above commands with variance. This is what my focus on.

About these ads

About Pang

Oracle DBA who is contributing in database, fusion middleware and identity management
This entry was posted in Oracle. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s