Published by : Obay Salah , November 19, 2024

 Before creating the Standby Database, the following steps must be done in the Primary Database:

1- Activate Forced Logging:

ALTER DATABASE FORCE LOGGING


2- Create the Password File if it does not exist:

C:\orapwd file=D:\oracle\product\10.1.0\Db_1\database\PWDprim.ora entries=10

Password=SYS force=y


3- Configure the variables file in the Primary Database:

But before configuring the variables file, do you know how the Primary Database deals with the Standby Database? Of course, users deal directly with the Primary Database, but the Redo Data is sent directly to the Standby Database to be applied, but it should be noted that there are two types of Standby Database:

1- Physical Standby Database: It is a database created from the Primary Database (meaning that it is created from a backup of the Primary Database), the structure of the Physical Standby Database is completely similar to the structure of the Primary Database (Block-for-Block).

The Redo Data is sent from the Primary Database via the Log Writer Process (LGWR) or the Archiver Process (ARCH) to the Standby Database, the Redo Data is received in the Standby Database via the Remote File Server Process (RFS) and then the Redo Data is applied to the Physical Standby Database via the Managed Recovery Process (MRP) in what is known as Redo Apply (and this type we will use in the scenario).

2- Logical Standby Database: It is a database that is also created from the Primary Database, but its structure can be changed later, but the data in the Primary Database and the Logical Standby Database remain completely identical. Here, Redo Apply is not done as is the case in the Physical Standby Database, but SQL Apply is done so that the database is modified via SQL Statements. SQL Apply is done via the Logical Standby Process (LSP).

Database

DB_UNIQUE_NAME

Oracle Net Service Name

Primary

PRIM

PRIMNET

Physical standby

STAN

STANNET

 Initialize variables file in Primary Database: 

DB_NAME=PRIM 

DB_UNIQUE_NAME=PRIM

SERVICE_NAMES=PRIM

INSTANCE_NAME=PRIM 

LOG_ARCHIVE_CONFIG='DG_CONFIG= (PRIM, STAN)' 

LOG_ARCHIVE_DEST_1= 'LOCATION=D:\oracle\product\10.1.0\flash_recovery_area\VALID_FOR = (ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME=PRIM' 

LOG_ARCHIVE_DEST_2= 'SERVICE=STANNET VALID_FOR= (ONLINE_LOGFILES, PRIMARY_ROLE)

DB_UNIQUE_NAME=STAN'

LOG_ARCHIVE_DEST_STATE_1=ENABLE

LOG_ARCHIVE_DEST_STATE_2=ENABLE

REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE

FAL_SERVER=STAN

FAL_CLIENT=PRIM

STANDBY_FILE_MANAGEMENT=AUTO

Where:

DB_NAME: This is an 8-character name (use the same name for all Standby Databases)

DB_UNIQUE_NAME: To specify the unique name for each database, this name It remains in the database and does not change even if the roles change between the Primary and Standby Database.

INSTANCE_NAME: The Instance name must be different between the Primary and Standby Database if they are on the same machine.

LOG_ARCHIVE_CONFIG: Specifies the DB_UNIQUE_NAME for both Primary Database and Standby Databases, this variable basically enables the database to send and receive Redo.

LOG_ARCHIVE_DEST_1: Archives Redo Data created by Primary Database in Local Archived Redo Log Files

LOG_ARCHIVE_DEST_2: Specifies the Remote Physical Standby Database to which the Redo Data will be sent The Redo Data has.

LOG_ARCHIVED_DEST_STATE_n: Takes the value ENABLE to allow Redo Data to be moved in the specified direction.

REMOTE_LOGIN_PASSWORDFILE: This variable must take (EXCLUSIVE or Shared).

FAL_SERVER: Specifies the Oracle Net Service Name of the FAL Server (usually this is the database that is running as the Primary Database), when the PRIM is in the Standby Database role the STAN Database is used as the FAL SERVER, this variable is used in case the Primary Database(STAN) is unable to send Redo for Standby Database(PRIM) retrieves the missing Archived Log Files.

FAL_CLIENT: Specifies the Oracle Net Service Name for the PRIM Database, where the FAL Server (STAN) makes copies of the missing archive files for the PRIM Standby Database.

STANDBY_FILE_MANAGEMENT: If the value is AUTO in this variable, then if a Data File is added or deleted in the Primary Database, the Standby Database responds to the change automatically.

DB_FILE_NAME_CONVERT: This variable converts the paths of the Primary Database Datafiles to the Standby Database Datafiles Path Names. We need to configure this file if the Standby Database The Primary Database is on the same device or if the Standby Database and the Primary Database are on two different devices but differ in physical structure, but if the Standby Database and the Primary Database are on two different devices but similar in physical structure meaning that the Data Files in both databases are exactly the same as in The scenario we will follow is that in such a case we do not need to initialize this variable.

LOG_FILE_NAME_CONVERT: The same can be said about the previous variable, except that this variable is specific to Redo Log Files and not Data Files.


4- Activate the archive in the Primary Database:

SHUTDOWN IMMEDIATE;

STARTUP MOUNT;

ALTER DATABASE ARCHIVELOG;

ALTER DATABASE OPEN;

Tags : Data Guard

You May Also Like

Comments

no comment yet!