Perform Following Steps On Primary Database:: SQL Select Log - Mode From V$database OR SQL Archive Log List
Perform Following Steps On Primary Database:: SQL Select Log - Mode From V$database OR SQL Archive Log List
step by step
Note:- Oracle Database RDBMS software installed with one database on the PRIMARY server
and on STANDBYserver installed only RDBMS software without any Database. Following below
details:
Primary:
IP Address: 192.168.1.10
DB_NAME=db11g
DB_UNIQUE_NAME=db11g
Standby:
IP Address: 192.168.1.20
DB_NAME=db11g
DB_UNIQUE_NAME=std
Required parameters:
DB_NAME – Must be same on primary and on all standby
DB_UNIQUE_NAME – Must be different on primary and all standby
LOG_ARCHIVE_CONFIG – This parameter includes db_unique_name which are the part of
Dataguard configuration
LOG_ARCHIVE_DEST_n – Define local and remote archive log file location
LOG_ARCHIVE_DEST_STATE_n – Define state of archiving (ENABLE or DIFER)
REMOTE_LOGIN_PASSWORDFILE – Must be in EXCLUSIVE mode
FAL_SERVER – Use for archivelog gap resolution (required only in
physical standby server)
DB_FILE_NAME_CONVERT – Required when directory structure is different datafile
LOG_FILE_NAME_CONVERT – Required when directory structure is different logfile
STANDBY_FILE_MANAGEMENT – Keep auto to create file automatically on standby
If your database is not runing in archivelog mode use following command to change to archive mode.
SQL> SHU IMMEDIATE;
SQL> STARTUP MOUNT;
SQL> ALTER DATABASE ARCHIVELOG;
SQL> ALTER DATABASE OPEN;
Now Make DB_UNIQUE_NAME to be part of dataguard. (std service we will create soon)
(db11g primary service name & std standby service name) Then create
SQL> host
$netmgr –> service add for std (+) –> net service name std –> hostname standby machine ip –> service name std –> save
$lsnrctl start
$rman target=/
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
$vi /u01/initstd.ora
$mkdir -p /u01/app/oracle/admin/std/adump
$mkdir -p /u01/app/oracle/oradata/std
$mkdir -p /u01/app/oracle/fast_recovery_area/std
std.__db_cache_size=318767104 std.__java_pool_size=4194304
std.__large_pool_size=4194304 std.__oracle_base='/u01/app/oracle'#ORACLE_BASE
set from environment std.__pga_aggregate_target=335544320
std.__sga_target=503316480 std.__shared_io_pool_size=0
std.__shared_pool_size=159383552 std.__streams_pool_size=4194304
*.audit_file_dest='/u01/app/oracle/admin/std/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/std/control01.ctl','/u01/app/oracle/fast_recovery_area/std/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_file_name_convert='db11g','std'
*.db_name='db11g'
*.db_unique_name='std'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4322230272
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=db11gXDB)'
*.fal_server='DB11G'
*.log_archive_config='DG_CONFIG=(db11g,std)'
*.log_archive_dest_2='SERVICE=db11g VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAM
E=db11g'
*.log_archive_dest_state_2='ENABLE'
*.log_file_name_convert='db11g','std'
*.memory_target=836763648
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'
After creating appropriate directory on physical standby and copy backupset, archivelog, pfile, standby controlfile and password file to
physical standby database.
$export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/db_1
$netmgr
=>service naming
+ add new
Net service name (db11g)
Host name (server ip)
Service name (db11g)
Test your connection then finish
Add one more service for standby server
+ add new
Net service name (std)
Host name (standby ip)
Service name (std)
Then finish
start listner
$lsnrctl start
Std:/u01/app/oracle/product/11.2.0.4/db_1:N
$export ORACLE_SID=std
$sqlplus / as sysdba
Sql> create spfile from pfile=’/u01/initstd.ora’;
Now exit from SQL prompt and login with RMAN then restore backup Sql> exit
$rman target=/
RMAN>startup mount
RMAN> restore database;
RMAN> exit
Note:- After finishing restore database we need to create standby redo log file on standby server, and it should be one extra either then
online redo log file.
$sqlplus / as sysdab
SQL> alter database add standby logfile (‘/u01/app/oracle/oradata/std/standby_redo01.log’) size 50m;
SQL> alter database add standby logfile (‘/u01/app/oracle/oradata/std/standby_redo02.log’) size 50m;
SQL> alter database add standby logfile (‘/u01/app/oracle/oradata/std/standby_redo03.log’) size 50m;
SQL> alter database add standby logfile (‘/u01/app/oracle/oradata/std/standby_redo04.log’) size 50m;
Note:- we have needed to add four redo log files because we have three online redo log file.
Now check your log members and you can confirm using this command
Note:- Now we need to create same online redolog files on PRIMARY machine also in case you planing switch the role so if your primary
become STANDBY then you need to have STANDBY redolog files.
Now CHECK….
Note: before applying redolog files, open alert logfile on different terminal
On standby machine
SQL> alter database recover managed standby database disconnect from session;
On primary server
Now switch the log file using following command and check it’s applying on standby server or not.
Then going on STANDBY machine and check redo are going on standby machine or not.
STANDBY:-
Now going on PRIMARY machine and run switch logfile command one more time.
Now check DB mode and protection mode run below command on both machines
On STANDBY machine
Now I’m going to convert physical standby database into read only standby database.
In this case what happen your database will be in read only mode. Let me show you how to convert physical standby server into read
only mode.
SQL>Shu immediate
SQL>startup mount;
SQL>alter database open read only;
After running these all commands your database will be open in read only mode.
Check…
Now login on PRIMARY machine and run switch log file command
SQL>alter system switch logfile;
So if you’re standby database in read only mode then redo are not applying.
In ACTIVE DATAGUARD feature we can open standby database in read only mode and also can apply log files.
SQL>shu immediate
SQL>startup mount;
SQL>alter database open read only;
SQL>alter database recover managed standby database disconnect from session;
Now you can check open mode