Saturday, December 31, 2022
Tuesday, April 19, 2022
Standby RFS & MRP Process
Standby RFS & MRP Process
select process, status,sequence#,block#,blocks, delay_mins from v$managed_standby;PROCESS STATUS SEQUENCE# BLOCK# BLOCKS DELAY_MINS
--------- ------------ ---------- ---------- ---------- ----------
ARCH CONNECTED 0 0 0 0
ARCH CLOSING 23760 813056 1925 0
ARCH CLOSING 23713 567296 1119 0
ARCH CLOSING 23759 958464 656 0
ARCH CLOSING 23715 1 116 0
RFS IDLE 0 0 0 0
RFS IDLE 0 0 0 0
RFS IDLE 23761 200510 1 0
MRP0 APPLYING_LOG 23761 200510 1024000 0
RFS IDLE 0 0 0 0
10 rows selected.
Here RFS process is idle its mean there is no archive log generation on primary.
SQL> select thread#, process,status,sequence#, block#,blocks from v$managed_standby where process='RFS';
THREAD# PROCESS STATUS SEQUENCE# BLOCK# BLOCKS
---------- --------- ------------ ---------- ---------- ----------
0 RFS IDLE 0 0 0
0 RFS IDLE 0 0 0
1 RFS IDLE 23761 204221 1
0 RFS IDLE 0 0 0
SQL> select process,pid,status from v$managed_standby;
PROCESS PID STATUS
--------- ------------------------ ------------
ARCH 9352 CONNECTED
ARCH 9354 CLOSING
ARCH 9356 CLOSING
ARCH 9358 CLOSING
ARCH 9360 CLOSING
RFS 1468 IDLE
RFS 1462 IDLE
RFS 1464 IDLE
MRP0 9376 APPLYING_LOG
RFS 1466 IDLE
10 rows selected.
SQL> !ps -ef|grep 9376
oraprod 7178 7176 0 12:09:19 pts/1 0:00 grep 9376
oraprod 9376 1 0 Mar 06 ? 1:30 ora_mrp0_QASKDR
oraprod 7176 7149 0 12:09:19 pts/1 0:00 /usr/bin/bash -c ps -ef|grep 9376
SQL> !ps -ef|grep 1466
oraprod 7181 7179 0 12:09:49 pts/1 0:00 grep 1466
oraprod 1466 1 0 Apr 15 ? 0:00 oracleQASKDR (LOCAL=NO)
oraprod 7179 7149 0 12:09:49 pts/1 0:00 /usr/bin/bash -c ps -ef|grep 1466
SQL>
Sunday, March 27, 2022
Oracle Dataguard Troubleshooting Steps
Oracle Dataguard Troubleshooting Steps
Tuesday, March 8, 2022
Manual Switchover In Oracle Database (19c)
Manual Switchover In Oracle Database (19c)
Primary Database:
tnsping QPROD
tnsping QPRODR
echo $ORACLE_SIDsqlplus / as sysdba
SQL> select name,status,database_role,open_mode from v$instance,v$database;
SQL> select switchover_status from v$database;
SQL> alter database commit to switchover to physical standby with session shutdown;
SQL> !ps -ef|grep pmon
SQL> exit
(or)
SQL> shutdown immediate;
SQL> startup mount;
SQL> select name,instance_name,status,database_role,open_mode from v$instance,v$database;
SQL> recover managed standby database disconnect from session;
Standby Database:
tnsping QPROD
echo $ORACLE_SID
SQL> select name,instance_name,status,database_role,open_mode from v$instance,v$database;
SQL> alter database commit to switchover to primary;
SQL> select name,instance_name,status,database_role,open_mode from v$instance,v$database;
SQL> select name,instance_name,status,database_role,open_mode from v$instance,v$database;
Sunday, March 6, 2022
Manual Switchover Activity in Oracle Database 12c
Manual Switchover In Oracle Database (12c)
Monday, April 12, 2021
Switchover and Switchback Using Dataguard Broker For Oracle 11.2.0.3.0 Database
Switchover and Switchback Using Dataguard Broker For Oracle 11.2.0.3.0 Database
---Primary---
[oracle@host01 ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/Welcome1
Connected.
DGMGRL> show configuration
Configuration - gtp2prod
Protection Mode: MaxPerformance
Databases:
gtp2_live - Primary database
gtp2_stdy - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
To check the PRIMARY status:
DGMGRL> show database verbose gtp2_live
Database - gtp2_live
Role: PRIMARY
Intended State: TRANSPORT-ON
Instance(s):
GTP2PROD
Properties:
DGConnectIdentifier = 'gtp2_live'
ObserverConnectIdentifier = ''
LogXptMode = 'ASYNC'
DelayMins = '0'
Binding = 'optional'
MaxFailure = '0'
MaxConnections = '1'
ReopenSecs = '300'
NetTimeout = '30'
RedoCompression = 'DISABLE'
LogShipping = 'ON'
PreferredApplyInstance = ''
ApplyInstanceTimeout = '0'
ApplyParallel = 'AUTO'
StandbyFileManagement = 'AUTO'
ArchiveLagTarget = '0'
LogArchiveMaxProcesses = '30'
LogArchiveMinSucceedDest = '1'
DbFileNameConvert = 'GTP2_STDY, GTP2_LIVE'
LogFileNameConvert = 'GTP2_STDY, GTP2_LIVE'
FastStartFailoverTarget = ''
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
SidName = 'GTP2PROD'
StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.7)(PORT=1523))(CONNECT_DATA=(SERVICE_NAME=GTP2_LIVE_DGMGRL)(INSTANCE_NAME=GTP2PROD)(SERVER=DEDICATED)))'
StandbyArchiveLocation = '/u01/app/oracle/arch'
AlternateLocation = ''
LogArchiveTrace = '0'
LogArchiveFormat = 'arch%s%t%r.arc'
TopWaitEvents = '(monitor)'
Database Status:
SUCCESS
To check the STANDBY status:
DGMGRL> show database verbose gtp2_stdy
Database - gtp2_stdy
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds
Apply Lag: 0 seconds
Real Time Query: ON
Instance(s):
GTP2PROD
Properties:
DGConnectIdentifier = 'gtp2_stdy'
ObserverConnectIdentifier = ''
LogXptMode = 'ASYNC'
DelayMins = '0'
Binding = 'OPTIONAL'
MaxFailure = '0'
MaxConnections = '1'
ReopenSecs = '300'
NetTimeout = '30'
RedoCompression = 'DISABLE'
LogShipping = 'ON'
PreferredApplyInstance = ''
ApplyInstanceTimeout = '0'
ApplyParallel = 'AUTO'
StandbyFileManagement = 'AUTO'
ArchiveLagTarget = '0'
LogArchiveMaxProcesses = '30'
LogArchiveMinSucceedDest = '1'
DbFileNameConvert = 'GTP2_LIVE, GTP2_STDY'
LogFileNameConvert = 'GTP2_LIVE, GTP2_STDY'
FastStartFailoverTarget = ''
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
SidName = 'GTP2PROD'
StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.8)(PORT=1524))(CONNECT_DATA=(SERVICE_NAME=GTP2_STDY_DGMGRL)(INSTANCE_NAME=GTP2PROD)(SERVER=DEDICATED)))'
StandbyArchiveLocation = '/u01/app/oracle/arch'
AlternateLocation = ''
LogArchiveTrace = '0'
LogArchiveFormat = 'arch%s%t%r.arc'
TopWaitEvents = '(monitor)'
Database Status:
SUCCESS
Check the current status:
DGMGRL> show configuration
Configuration - gtp2prod
Protection Mode: MaxPerformance
Databases:
gtp2_live - Primary database
gtp2_stdy - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
Switchover
It is always advised to view the alert.log files for both PRIMARY and STANDBY databases.
Issue the below command:
DGMGRL> switchover to gtp2_stdy
Performing switchover NOW, please wait...
New primary database "gtp2_stdy" is opening...
Operation requires shutdown of instance "GTP2PROD" on database "gtp2_live"
Shutting down instance "GTP2PROD"...
ORACLE instance shut down.
Operation requires startup of instance "GTP2PROD" on database "gtp2_live"
Starting instance "GTP2PROD"...
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "gtp2_stdy"
Check the current status:
DGMGRL> show configuration
Configuration - gtp2prod
Protection Mode: MaxPerformance
Databases:
gtp2_stdy - Primary database
gtp2_live - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
Switchback
To revert (switch back) to the previous situation, perform the same action. Remember now your primary is your previous STANDBY and standby is previous PRIMARY.
Issue the below command:
DGMGRL> swtichover to gtp2_live
Unrecognized command "swtichover", try "help"
DGMGRL> switchover to gtp2_live
Performing switchover NOW, please wait...
New primary database "gtp2_live" is opening...
Operation requires shutdown of instance "GTP2PROD" on database "gtp2_stdy"
Shutting down instance "GTP2PROD"...
ORACLE instance shut down.
Operation requires startup of instance "GTP2PROD" on database "gtp2_stdy"
Starting instance "GTP2PROD"...
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "gtp2_live"
Check the current status:
DGMGRL> show configuration
Configuration - gtp2prod
Protection Mode: MaxPerformance
Databases:
gtp2_live - Primary database
gtp2_stdy - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
Wednesday, February 17, 2021
Check Whether Physical Standby Is In Sync With The Primary Or NOT
Friday, November 6, 2020
Friday, August 28, 2020
Data Guard Physical Standby Setup Using Active Duplicate
Data Guard Physical Standby Setup Using Active Duplicate
VM Machine Details:
node1.oracle.com (147.43.0.15)
node2.oracle.com (147.43.0.16)
Note:
1. Both VM machines should be ping each, Network adapter setting choose "Host-Only".
2. Configure or add both machine ip addresses in /etc/hosts file.
3. Check or test the connectivity using ping or ssh commands.
Database Details:
Database Name :- PRODUAT
Primary db_unique_name :- PRODUAT
standby db_unique_name :- PRODSIT
Steps:
1. Ensure that the database is in archivelog mode.
SQL> select log_mode from v$database;
LOG_MODE
------------
ARCHIVELOG
2. Enable force logging.
SQL> ALTER DATABASE FORCE LOGGING;
Database altered.
-- Make sure at least one logfile is present.
ALTER SYSTEM SWITCH LOGFILE;
SQL> select force_logging from v$database;
FORCE_LOGGING
---------------------------------------
YES
3. Create standby redologs.
Minimally, the configuration should have one more standby redo log file group than the number of online redo log file groups on the primary database. However, the recommended number of standby redo log file groups is dependent on the number of threads on the primary database. Use the following equation to determine an appropriate number of standby redo log file groups:
(maximum number of logfiles for each thread + 1) * maximum number of threads
SQL> select bytes from v$standby_log;
no rows selected
SQL> SELECT * FROM V$LOGFILE;
SQL> select group#,thread#,bytes from v$log;
GROUP# THREAD# BYTES
---------- ---------- ----------
1 1 52428800
2 1 52428800
3 1 52428800
alter database add standby logfile '/u01/app/oracle/fast_recovery_area/PRODUAT/stbyredo03.log' size 50M;
alter database add standby logfile '/u01/app/oracle/fast_recovery_area/PRODUAT/stbyredo04.log' size 50M;
alter database add standby logfile '/u01/app/oracle/fast_recovery_area/PRODUAT/stbyredo05.log' size 50M;
SQL> select bytes from v$standby_log;
BYTES
----------
52428800
52428800
52428800
52428800
Note: We no need to create standby redo log files on standby and Oracle take cares of it during RMAN duplicate.
4. Modify the primary initialization parameter for dataguard on primary.
SQL> alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(PRODUAT,PRODSIT)';
System altered.
SQL> alter system set LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/oracle/fast_recovery_area/PRODUAT/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=PRODUAT';
System altered.
SQL> alter system set LOG_ARCHIVE_DEST_2='SERVICE=PRODSIT LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PRODSIT';
System altered.
SQL> alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE;
System altered.
SQL> alter system set standby_file_management=auto scope=both;
System altered.
SQL> alter system set FAL_SERVER=PRODSIT;
System altered.
SQL> alter system set FAL_CLIENT=PRODUAT;
System altered.
SQL> alter system set DB_FILE_NAME_CONVERT='PRODUAT','PRODSIT' scope=spfile; System altered.
SQL> alter system set LOG_FILE_NAME_CONVERT='PRODUAT','PRODSIT' scope=spfile;
System altered.
5. Create the necessary directories on the standby server.
mkdir -p /u01/app/oracle/oradata/PRODSIT
chown -R oracle:oinstall /u01/app/oracle/oradata/PRODSIT
6. Configure Oracle net service/TNS names for standby system using NETCA or NETMGR
Make sure tnsnames.ora file contains both entries in Primary and Standby servers
Primary:
[oracle@node1 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/MTEST/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
PRODUAT =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1.oracle.com)(PORT = 1522))
)
(CONNECT_DATA =
(SERVICE_NAME = PRODUAT)
)
)
PRODSIT =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = node2.oracle.com)(PORT = 1522))
)
(CONNECT_DATA =
(SERVICE_NAME = PRODSIT)
)
)
Standby:
[oracle@node2 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
PRODSIT =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = node2.oracle.com)(PORT = 1522))
)
(CONNECT_DATA =
(SERVICE_NAME = PRODSIT)
)
)
PRODUAT =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1.oracle.com)(PORT = 1522))
)
(CONNECT_DATA =
(SERVICE_NAME = PRODUAT)
)
)
7. Check with the SQL*Net configuration using the following commands on the Primary and Standby
tnsping MQMPROD
tnsping MQMDR
8. Create the standby database
-Copy the password file from the primary $ORACLE_HOME/dbs and rename it to the standby database name.
-Create a initialization parameter with only one parameter DB_NAME.
DB_NAME=PRODUAT
DB_UNIQUE_NAME=PRODSIT
compatible='12.1.0.2.0'
log_file_name_convert='PRODUAT','PRODSIT'
9. Create the necessary directories in the standby location to place database files and trace files ($ADR_HOME)
mkdir -p /u01/app/oracle/admin/MQMDR/adump
10. Set the environment variable ORACLE_SID to the standby service and start the standby-instance.
export ORACLE_SID=MQMDR
sqlplus "/ as sysdba"
SQL> startup nomount pfile=$ORACLE_HOME/dbs/initPRODSIT.ora
11. Verify if the connection 'AS SYSDBA' is working
sqlplus /nolog
SQL> connect sys/Welcome1@MQMDR AS SYSDBA
Connected.
SQL> connect sys/Welcome1@MQMPROD AS SYSDBA
Connected.
12. Connect to RMAN, specifying a full connect string for both the TARGET and AUXILIARY instances ( Issue on Standby )
Connect RMAN using target and auxiliary should connected as “not mounted” only.
[oracle@node2 ~]$ rman target sys/Welcome1@PRODUAT auxiliary sys/Welcome1@PRODSIT
Recovery Manager: Release 12.1.0.2.0 - Production on Fri Aug 28 05:23:39 2020
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
connected to target database: PRODUAT (DBID=1381890412)
connected to auxiliary database: PRODUAT (not mounted)
RMAN> duplicate target database for standby from active database nofilenamecheck dorecover;
An explanation of the above RMAN command.
FOR STANDBY: This tells the DUPLICATE command is to be used for a standby, so it will not force a DBID change.
FROM ACTIVE DATABASE: The DUPLICATE will be created directly from the source datafile, without an additional backup step.
DORECOVER: The DUPLICATE will include the recovery step, bringing the standby up to the current point in time.
NOFILENAMECHECK: Destination file locations are not checked.
Once the command is complete, we can start the apply process.
Output:
Starting Duplicate Db at 28-AUG-20
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=23 device type=DISK
current log archived
contents of Memory Script:
{
backup as copy reuse
targetfile '/u01/MTEST/dbs/orapwPRODUAT' auxiliary format
'/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwPRODSIT' ;
}
executing Memory Script
Starting backup at 28-AUG-20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=55 device type=DISK
Finished backup at 28-AUG-20
contents of Memory Script:
{
restore clone from service 'PRODUAT' standby controlfile;
}
executing Memory Script
Starting restore at 28-AUG-20
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PRODUAT
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
output file name=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/cntrlPRODSIT.dbf
Finished restore at 28-AUG-20
contents of Memory Script:
{
sql clone 'alter database mount standby database';
}
executing Memory Script
sql statement: alter database mount standby database
contents of Memory Script:
{
set newname for tempfile 1 to
"/u01/app/oracle/oradata/PRODUAT/datafile/o1_mf_temp_hnkbdtkj_.tmp";
switch clone tempfile all;
set newname for datafile 1 to
"/u01/app/oracle/oradata/PRODUAT/datafile/o1_mf_system_hnkb8mqx_.dbf";
set newname for datafile 3 to
"/u01/app/oracle/oradata/PRODUAT/datafile/o1_mf_sysaux_hnkb68cx_.dbf";
set newname for datafile 4 to
"/u01/app/oracle/oradata/PRODUAT/datafile/o1_mf_undotbs1_hnkbcn7x_.dbf";
set newname for datafile 6 to
"/u01/app/oracle/oradata/PRODUAT/datafile/o1_mf_users_hnkbcm4m_.dbf";
restore
from service 'PRODUAT' clone database
; sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /u01/app/oracle/oradata/PRODUAT/datafile/o1_mf_temp_hnkbdtkj_.tmp in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 28-AUG-20
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PRODUAT
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PRODUAT/datafile/o1_mf_system_hnkb8mqx_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PRODUAT
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PRODUAT/datafile/o1_mf_sysaux_hnkb68cx_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PRODUAT
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PRODUAT/datafile/o1_mf_undotbs1_hnkbcn7x_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PRODUAT
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PRODUAT/datafile/o1_mf_users_hnkbcm4m_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 28-AUG-20
sql statement: alter system archive log current
current log archived
contents of Memory Script:
{
restore clone force from service 'PRODUAT'
archivelog from scn 1618367;
switch clone datafile all;
}
executing Memory Script
Starting restore at 28-AUG-20
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service PRODUAT
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=14
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service PRODUAT
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=15
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 28-AUG-20
datafile 1 switched to datafile copy
input datafile copy RECID=1 STAMP=1049648103 file name=/u01/app/oracle/oradata/PRODUAT/datafile/o1_mf_system_hnkb8mqx_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=1049648103 file name=/u01/app/oracle/oradata/PRODUAT/datafile/o1_mf_sysaux_hnkb68cx_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=1049648103 file name=/u01/app/oracle/oradata/PRODUAT/datafile/o1_mf_undotbs1_hnkbcn7x_.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=4 STAMP=1049648103 file name=/u01/app/oracle/oradata/PRODUAT/datafile/o1_mf_users_hnkbcm4m_.dbf
contents of Memory Script:
{
set until scn 1618687;
recover
standby
clone database
delete archivelog
;}
executing Memory Script
executing command: SET until clause
Starting recover at 28-AUG-20
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 14 is already on disk as file /u01/app/oracle/product/12.1.0/dbhome_1/dbs/arch1_14_1049631726.dbf
archived log for thread 1 with sequence 15 is already on disk as file /u01/app/oracle/product/12.1.0/dbhome_1/dbs/arch1_15_1049631726.dbf
archived log file name=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/arch1_14_1049631726.dbf thread=1 sequence=14
archived log file name=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/arch1_15_1049631726.dbf thread=1 sequence=15
media recovery complete, elapsed time: 00:00:00
Finished recover at 28-AUG-20
Finished Duplicate Db at 28-AUG-20
12. Start managed recovery
Connect to standby using SQL*Plus and start the MRP (Managed Recovery Process). Compare the primary last sequence and MRP (Managed Recovery Process) applying sequence.
SQL> alter database recover managed standby database disconnect from session;
Database altered.
SQL> select NAME,CONTROLFILE_TYPE,OPEN_MODE,DATABASE_ROLE,PROTECTION_MODE from v$database;
NAME CONTROL OPEN_MODE DATABASE_ROLE PROTECTION_MODE
--------- ------- -------------------- ---------------- --------------------
PRODUAT STANDBY MOUNTED PHYSICAL STANDBY MAXIMUM PERFORMANCE
SQL> host
[oracle@node2 ~]$ ps -ef|grep mrp
oracle 10077 1 0 17:17 ? 00:00:02 ora_mrp0_PRODSIT
oracle 10158 10129 0 17:23 pts/1 00:00:00 grep mrp
The Managed Recovery Process (MRP) applies information from the archived redo logs to the standby database. When performing managed recovery operations, log apply services automatically apply archived redo logs to maintain transactional synchronization with the primary database.
Alertlog:
Fri Aug 28 17:17:52 2020
alter database recover managed standby database disconnect from session
Fri Aug 28 17:17:52 2020
Attempt to start background Managed Standby Recovery process (PRODSIT)
Starting background process MRP0
Fri Aug 28 17:17:52 2020
MRP0 started with pid=21, OS id=10077
Fri Aug 28 17:17:52 2020
MRP0: Background Managed Standby Recovery process started (PRODSIT)
Fri Aug 28 17:17:57 2020
Serial Media Recovery started
Managed Standby Recovery starting Real Time Apply
Fri Aug 28 17:17:57 2020
Waiting for all non-current ORLs to be archived...
Fri Aug 28 17:17:57 2020
All non-current ORLs have been archived.
Media Recovery Waiting for thread 1 sequence 16
Completed: alter database recover managed standby database disconnect from session
Note:
If you face any SYNC issue, try to set the standby related parameters.
Tuesday, July 21, 2020
Dataguard Broker Configuration In Oracle 12c
Dataguard Broker Configuration In Oracle 12c
Primary side:
oracle@mqm-testdb1:~$ export ORACLE_SID=QPROD
oracle@mqm-testdb1:~$ sqlplus "/ as sysdba"
SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 9 12:30:27 2020
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
Check the dgbroker config files:
SQL> show parameter dg_broker_config
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
dg_broker_config_file1 string /u01/app/oracle/product/12.1.0.2/db_1/dbs/dr1QPROD.dat
dg_broker_config_file2 string /u01/app/oracle/product/12.1.0.2/db_1/dbs/dr2QPROD.dat
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
oracle@mqm-testdb1:~$
DGMGRL> exit
oracle@mqm-testdb1:~$ ps -ef|grep pmon
grid 12699 1 0 Oct 22 ? 35:04 asm_pmon_+ASM1
grid 23378 1 0 Oct 22 ? 28:37 mdb_pmon_-MGMTDB
oracle 28481 1 0 Jan 07 ? 23:02 ora_pmon_OGGSRC1
oracle 14556 1 0 Feb 18 ? 9:15 ora_pmon_QPROD1
oracle 24956 11452 0 12:34:49 pts/13 0:00 grep pmon
De-activate the log shipping:
oracle@mqm-testdb1:~$ sqlplus "/ as sysdba"
SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 9 13:10:15 2020
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2='defer' SCOPE=BOTH sid='*';
System altered.
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
QPROD1
SQL> select password from sys.user$ where name like 'SYS';
PASSWORD
--------------------------------------------------------------------------------
27889DA827C33694
Check the passwordfile parameters:
SQL> show parameter remote
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_dependencies_mode string TIMESTAMP
remote_listener string mqm-testscan.local:1521
remote_login_passwordfile string EXCLUSIVE
remote_os_authent boolean FALSE
remote_os_roles boolean FALSE
result_cache_remote_expiration integer 0
SQL>
Change the sys password from sql level:
SQL> alter user sys identified by sys_1234;
User altered.
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
Check the passwordfile status:
oracle@mqm-testdb1:~$ srvctl config database -d QPROD
Database unique name: QPROD
Database name: QPROD
Oracle home: /u01/app/oracle/product/12.1.0.2/db_1
Oracle user: oracle
Spfile: +DATA/QPROD/spfilerac2.ora
Password file: +DATA/QPROD/PASSWORD/pwdprQPROD/
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: DATA,REDO
Mount point paths:
Services: QUATRAC,ANSQ
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: dba
Database instances: QPROD1,QPROD2
Configured nodes: mqm-testdb1,mqm-testdb2
Database is administrator managed
oracle@mqm-testdb1:~$
oracle@mqm-testdb1:~$
oracle@mqm-testdb1:~$ sqlplus "/ as sysdba"
SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 9 13:19:37 2020
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
Create the passwordfile using orapwd utility:
oracle@mqm-testdb1:~$ orapwd file='+DATA/QPROD/PASSWORD/pwdQPROD' dbuniquename='QPROD' password=sys_1234 entries=10
Add the passwordfile using srvctl:
oracle@mqm-testdb1:~$ srvctl modify database -d QPROD -pwfile '+DATA/QPROD/PASSWORD/pwdQPROD'
oracle@mqm-testdb1:~$ srvctl config database -d QPROD
Database unique name: QPROD
Database name: QPROD
Oracle home: /u01/app/oracle/product/12.1.0.2/db_1
Oracle user: oracle
Spfile: +DATA/QPROD/spfilerac2.ora
Password file: +DATA/QPROD/PASSWORD/pwdQPROD
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: DATA,REDO
Mount point paths:
Services: QUATRAC,ANSQ
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: dba
Database instances: QPROD1,QPROD2
Configured nodes: mqm-testdb1,mqm-testdb2
Database is administrator managed
Test the new passwordfile:
oracle@mqm-testdb1:~$ sqlplus sys/sys_1234@QPROD as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 9 13:25:36 2020
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
SQL> exit
Activate the log shipping:
oracle@mqm-testdb1:~$ sqlplus "/ as sysdba"
SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 9 13:40:07 2020
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2='enable' SCOPE=BOTH sid='*';
System altered.
Check the config file status:
oracle@mqm-testdb1:~$ sqlplus "/ as sysdba"
SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 9 13:49:21 2020
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
SQL> show parameter dg_broker_config
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
dg_broker_config_file1 string /u01/app/oracle/product/12.1.0.2/db_1/dbs/dr1QPROD.dat
dg_broker_config_file2 string /u01/app/oracle/product/12.1.0.2/db_1/dbs/dr2QPROD.dat
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
QPROD1
Move the config files to ASM:
oracle@mqm-testdb1:~$ sqlplus "/ as sysdba"
SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 9 13:49:21 2020
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
SQL> alter system set dg_broker_start=FALSE scope=both sid='*';
System altered.
SQL> alter system set dg_broker_config_file1='+DATA/QPROD/DGBROKERCONFIGFILE/dr1QPROD.dat' scope=both sid='*';
System altered.
SQL> alter system set dg_broker_config_file2='+DATA/QPROD/DGBROKERCONFIGFILE/dr2QPROD.dat' scope=both sid='*';
System altered.
SQL> alter system set dg_broker_start=TRUE scope=both sid='*';
System altered.
SQL> alter system set LOG_ARCHIVE_DEST_2='' scope=both;
System altered.
Create the configuration:
oracle@mqm-testdb1:~$ dgmgrl
DGMGRL for Solaris: Version 12.1.0.2.0 - 64bit Production
Copyright (c) 2000, 2013, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/sys_1234@QPROD
Connected as SYSDBA.
DGMGRL> CREATE CONFIGURATION UATRAC_DG AS PRIMARY DATABASE IS QPROD CONNECT IDENTIFIER IS QPROD;
Configuration "UATRAC_DG" created with primary database "QPROD"
DGMGRL> ADD DATABASE QPRODN AS CONNECT IDENTIFIER IS QPRODN MAINTAINED AS PHYSICAL;
Database "QPRODN" added
Enable the configuration:
DGMGRL> ENABLE CONFIGURATION;
Enabled.
DGMGRL> show configuration;
Configuration - UATRAC_DG
Protection Mode: MaxPerformance
Members:
QPROD - Primary database
QPRODn - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS (status updated 6 seconds ago)
Check the status:
oracle@mqm-testdb1:~$ dgmgrl
DGMGRL for Solaris: Version 12.1.0.2.0 - 64bit Production
Copyright (c) 2000, 2013, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/sys_1234@QPROD
Connected as SYSDBA.
DGMGRL> show configuration;
Configuration - UATRAC_DG
Protection Mode: MaxPerformance
Members:
QPROD - Primary database
QPRODn - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS (status updated 47 seconds ago)
DGMGRL> show database QPROD
Database - QPROD
Role: PRIMARY
Intended State: TRANSPORT-ON
Instance(s):
QPROD1
QPROD2
Database Status:
SUCCESS
DGMGRL> show database QPRODN
Database - QPRODn
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 0 seconds ago)
Apply Lag: 0 seconds (computed 0 seconds ago)
Average Apply Rate: 66.00 KByte/s
Real Time Query: ON
Instance(s):
QPRODN1 (apply instance)
QPRODN2
Database Status:
SUCCESS
Stop and Start Log Shipping for an Oracle Standby Database
Stop and Start Log Shipping for an Oracle Standby Database
DEACTIVATE THE LOG SHIPPING:
SQL> alter system set log_archive_dest_state_2=defer scope=both; (If RAC sid = '*';)
System altered.
SQL> show parameter log_archive_dest_state_2
NAME TYPE VALUE
------------------------------------ ----------- -----
log_archive_dest_state_2 string DEFER
SQL> select max(sequence#) from v$log_history;
54276
SQL> alter system switch logfile;
SQL> select max(sequence#) from v$log_history;
24277
ACTIVATE THE LOG SHIPPING:
SQL> alter system set log_archive_dest_state_2=enable scope=both; (If RAC sid = '*';)
SQL> show parameter log_archive_dest_state_2
NAME TYPE VALUE
------------------------------------ ----------- -----
log_archive_dest_state_2 string ENABLE
SQL> select max(sequence#) from v$log_history;
54279
SQL> alter system switch logfile;
SQL> select max(sequence#) from v$log_history;
54280


