Академический Документы
Профессиональный Документы
Культура Документы
The Oracle DR configurations on both the primary and standby servers are identical. Thus the alias TEST points to the primary server and STTEST points to the standby server on both environments. Only the TNSNAMES.ORA file differs on each server defining the aliases TEST and STTEST. For example on the primary server PRSERVER, TEST points to PRSERVER as the primary server and STSERVER as the standby; where as on the standby server STSERVER the alias TEST points to STSERVER as the primary server and PRSERVER as the standby (opposite to that on PRSERVER).
STTEST.DBSUPPORTSERVICES.CO.UK = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = STSERVER)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED)
(SERVICE_NAME = TEST) ) )
STTEST.DBSUPPORTSERVICES.CO.UK = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = PRSERVER)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = TEST) ) )
Configuring the environments as above will allow log replication to continue after a clean switchover so that it is easy to switch back and forth between servers. For example PRSERVER can become a standby database while STSERVER is primary and vice Aversa.
1.
Launch RMAN to connect to the TEST database and check the current RMAN configuration:
C:\ >set ORACLE_SID=TEST C:\ >rman target / Recovery Manager: Release 9.2.0.6.0 - Production Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved. connected to target database: TEST (DBID=1949209861)
using target database controlfile instead of recovery catalog RMAN configuration parameters are: CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS; CONFIGURE BACKUP OPTIMIZATION ON; CONFIGURE DEFAULT DEVICE TYPE TO DISK; CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'I:\Oracle_Backups\%d_%F.rman'; CONFIGURE DEVICE TYPE DISK PARALLELISM 1; CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT 'I:\Oracle_Backups\%d_ %s_%p.rman'; CONFIGURE MAXSETSIZE TO UNLIMITED; CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'E:\ORACLE\ORA92\DATABASE\SNCFTEST.ORA';
2.
Backup the current production database to create a standby database: RMAN> backup database include current controlfile for standby plus archivelog;
3.
Manually copy the backup sets from I:\Oracle_Backups on the production server to I:\Oracle_Backups on the DR Server (location of backups must match on both production and DR).
4.
On the DR Server start up the TEST database in nomount mode: C:\> set ORACLE_SID=TEST C:\> sqlplus /nolog SQL> connect / as sysdba SQL> startup nomount SQL> exit
5.
Create the standby database using RMAN (This assumes the database file structures will be identical on both servers): C:\> RMAN target sys/fluffy@STTEST auxiliary / RMAN> duplicate target database for standby nofilenamecheck dorecover;
6.
Once the DR database is created; you will need to manually add a tempfile: SQL> alter database open read only; SQL> alter tablespace temp add tempfile F:\Oracle-Databases\TEST\TEMP01.DBF size 500M;
7.
Put the DR database into managed standby mode: SQL> shutdown immediate SQL> startup nomount SQL> alter database mount standby database; SQL> alter database recover managed standby database disconnect;
8.
On the production database switch logs to initiate replication: SQL> alter system switch logfile; The configuration of Dataguard is now complete.
The following section describes how to perform each of the above methods of invoking a standby database:
Database Switchover
Using this method you can switch backwards and forwards between the primary and DR servers (e.g. so that the primary can become DR and DR can become primary) without having to rebuild either environment:
This may cause the following error to be generated: ERROR at line 1: ORA-01093: ALTER DATABASE CLOSE only permitted with no sessions connected If this does occur then restart the database, as below, before retrying the above command: SQL> shutdown immediate SQL> startup
SQL> shutdown immediate SQL> startup nomount SQL> alter database mount standby database; SQL> alter database recover managed standby database disconnect;
On DR Server: SQL> alter database recover managed standby database cancel; SQL> alter database commit to switchover to primary;
The DR server is now configured as the primary database. To switch back you just need to repeat the above process but the other way around (e.g. convert the DR database back to a standby and the primary database back to primary).
SQL> alter database recover managed standby database cancel; SQL> alter database activate standby database; SQL> shutdown immediate SQL> startup
The original primary database is now obsolete and can be rebuilt as a standby database once it is available again.
On standby server: SQL> alter database recover managed standby database cancel; SQL> alter database open read only;
The standby database is now open and available for querying in read only mode. To put the standby database back into standby mode:
SQL> shutdown immediate SQL> startup nomount SQL> alter database mount standby database; SQL> alter database recover managed standby database disconnect;
On the standby server: SQL> SELECT max(sequence#) AS "STANDBY", applied FROM v$archived_log GROUP BY applied;
The standby database is in sync with the primary database if the above PRIMARY value matches the above STANDBY value where applied = 'YES'.