DGMGRL… Configuration of Disaster Recovery in few steps…

Sometimes there is a need to make a DR confgiuration as fast as possible, the fastet way is to use dgmgrl utility, which is available under Enterprise Edition.

We’ll need:

  • — Primary DB;
  • — Oracle_home.

At the first I need to make few preparations at primary DB:

SQL> alter database force logging;
Database altered.
SQL> alter database flashback on;
Database altered.

Then I need to create standby logfiles (amount of logfiles + 1), a standby control file and copy primary datafiles to target host (in my case the same, but in a different directory):

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 ('C:\TOOLS\ORACLE\PRODUCT\ORADATA\PRM\redo04.stb') SIZE 50M;
Database altered.
SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 ('C:\TOOLS\ORACLE\PRODUCT\ORADATA\PRM\redo05.stb') SIZE 50M;
Database altered.
SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 ('C:\TOOLS\ORACLE\PRODUCT\ORADATA\PRM\redo06.stb') SIZE 50M;
Database altered.
SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 7 ('C:\TOOLS\ORACLE\PRODUCT\ORADATA\PRM\redo07.stb') SIZE 50M;
Database altered.
SQL> alter database create standby controlfile as 'stbprm.ctl';
Database altered.
SQL> alter database begin backup;
Database altered.
SQL> host "copy C:\Tools\Oracle\product\oradata\PRM\*.* C:\Tools\Oracle\product\oradata\STB";
C:\Tools\Oracle\product\oradata\PRM\CONTROL01.CTL
C:\Tools\Oracle\product\oradata\PRM\REDO01.LOG
C:\Tools\Oracle\product\oradata\PRM\REDO02.LOG
C:\Tools\Oracle\product\oradata\PRM\REDO03.LOG
C:\Tools\Oracle\product\oradata\PRM\REDO04.STB
C:\Tools\Oracle\product\oradata\PRM\REDO05.STB
C:\Tools\Oracle\product\oradata\PRM\REDO06.STB
C:\Tools\Oracle\product\oradata\PRM\REDO07.STB
C:\Tools\Oracle\product\oradata\PRM\SYSAUX01.DBF
C:\Tools\Oracle\product\oradata\PRM\SYSTEM01.DBF
C:\Tools\Oracle\product\oradata\PRM\TEMP01.DBF
C:\Tools\Oracle\product\oradata\PRM\UNDOTBS01.DBF
C:\Tools\Oracle\product\oradata\PRM\USERS01.DBF
Скопировано файлов: 13.
SQL> alter database end backup;
Database altered.
SQL> create pfile from spfile;
File created.

Now I have everything I need to start standby instance.

1. Copy pfile INITprm.ora to INITstb.ora,add one string  into it and replace pathes to match their new locations:

*.control_files='C:\Tools\Oracle\product\oradata\STB\control01.ctl','C:\Tools\Oracle\product\oradata\STB\control02.ctl'
*.audit_file_dest='C:\Tools\Oracle\product\admin\STB\adump'
*.db_name='PRM'
db_unique_name='STB';

2. Copy PWDPRM.ora (password file) to PWDSTB.ora.

3. Set ORACLE_SID and add a service by oradim:

C:\Tools\Oracle\product\11.2.0\db\database>set ORACLE_SID=STB
C:\Tools\Oracle\product\11.2.0\db\database>oradim -new -SID STB -startmode manual -spfile -srvcstart system
Instance created.

4.Replace original control files by standby version .

5. Connect to new created idle instance by sqlplus and mount it using pfile :

SQL> startup mount pfile='%ORACLE_HOME%\database\INITstb.ora';

6. Then rename all datafiles and logfiles to match new pathes (You also can duplicate DB with RMAN):

SQL> alter database rename file 'C:\TOOLS\ORACLE\PRODUCT\ORADATA\PRM\SYSTEM01.DBF' to 'C:\TOOLS\ORACLE\PRODUCT\ORADATA\STB\SYSTEM01.DBF';
Database altered.

Repeat this step for every datafile and logfile. You can find their names in v$datafile, v$logfile views;

7. Create spfile, shutdown instance, startup nomount and mount in standby mode:

SQL> create spfile from pfile;
File created.
SQL> shutdown immediate;
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 810053632 bytes
Fixed Size 2180104 bytes
Variable Size 478153720 bytes
Database Buffers 322961408 bytes
Redo Buffers 6758400 bytes
SQL> alter database mount standby database;
Database altered.

Assure for ability to connect to both instances.

The final stage — DGMGRL:

1. To start DataGuard Broker run at both instances:

SQL> alter system set dg_broker_start=true scope=both;
System altered.

This is a dynamic parameter.

2. Connect to DataGuard broker and create a configuration in 3 steps:

C:\Tools\Oracle\product\11.2.0\db\BIN>dgmgrl sys/manager
DGMGRL for 64-bit Windows: Version 11.2.0.1.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> create configuration DR as primary database is PRM connect identifier is PRM;
Configuration "dr" created with primary database "prm"
DGMGRL> add database STB as connect identifier is STB maintained as physical;
Database "stb" added
DGMGRL> enable configuration
Enabled.
DGMGRL> show configuration
Configuration - dr
Protection Mode: MaxPerformance
 Databases:
 prm - Primary database
 stb - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS

3. Technically — that is all. You have an async MaxPerformance DR. But to make it more reliable I’ll make it SYNC and MaxAvailability:

DGMGRL> edit database PRM set property LogXptMode=SYNC;
Property "logxptmode" updated
DGMGRL> edit database STB set property LogXptMode=SYNC;
Property "logxptmode" updated
DGMGRL> edit configuration set protection mode as MaxAvailability;
Succeeded.

Now we have a syncronized and protected DR solution! And just in few steps.

No need to make huge changes in pfile — everything is done by dgmgrl! The longest procedure is to make a copy of the primary database.

Реклама

One response to “DGMGRL… Configuration of Disaster Recovery in few steps…

  1. Mahir M. Quluzade 05.04.2012 в 09:22

    Very Nice!

    I have create a video about that subject.
    Please watch : http://www.youtube.com/watch?v=5keahpkzLtM

    Regards
    Mahir M. Quluzade
    http://www.mahir-qluzade.com

Добавить комментарий

Заполните поля или щелкните по значку, чтобы оставить свой комментарий:

Логотип WordPress.com

Для комментария используется ваша учётная запись WordPress.com. Выход / Изменить )

Фотография Twitter

Для комментария используется ваша учётная запись Twitter. Выход / Изменить )

Фотография Facebook

Для комментария используется ваша учётная запись Facebook. Выход / Изменить )

Google+ photo

Для комментария используется ваша учётная запись Google+. Выход / Изменить )

Connecting to %s

%d такие блоггеры, как: