By Mouhamadou Diaw

In this previous blog, I have configured 2 DB systems with Oracle 21c in an ODA 19.14. Now let’s continue and show how we can configure a Data Guard between these 2 servers.
One option is to manually create the Data Guard as we do in a non-ODA environment. The second option that I am showing is to use the odacli command to configure the Data Guard.

All steps are described in Oracle documentation

The first step is to create the backup configuration. The /u01/backup can be a NFS share or not. In my case it’s just a local directory that I create in each server

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@mdidbi42 u01]# odacli create-backupconfig -n nfsbkup -w 10 -d NFS -c /u01/backup/
{
  "jobId" : "b051745b-702a-48ff-92c2-3c80a16e73f2",
  "status" : "Created",
  "message" : "backup config creation",
  "reports" : [ ],
  "createTimestamp" : "April 29, 2022 09:28:37 AM CEST",
  "resourceList" : [ {
    "resourceId" : "8da9a983-6afa-45b9-bd66-a66d1420e048",
    "resourceType" : null,
    "resourceNewType" : "BackupConfig",
    "jobId" : "b051745b-702a-48ff-92c2-3c80a16e73f2",
    "updatedTime" : null
  } ],
  "description" : "create backup config:nfsbkup",
  "updatedTime" : "April 29, 2022 09:28:37 AM CEST"
}
[root@mdidbi42 u01]#

Check the job status

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@mdidbi42 u01]# odacli describe-job -i "b051745b-702a-48ff-92c2-3c80a16e73f2"
Job details
----------------------------------------------------------------
                     ID:  b051745b-702a-48ff-92c2-3c80a16e73f2
            Description:  create backup config:nfsbkup
                 Status:  Success
                Created:  April 29, 2022 9:28:37 AM CEST
                Message:  backup config creation
Task Name                                Start Time                          End Time                            Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
Backup config metadata persist           April 29, 2022 9:28:37 AM CEST      April 29, 2022 9:28:37 AM CEST      Success
[root@mdidbi42 u01]#

After we have to associate the backup configuration with the database

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@mdidbi42 orabackups]# odacli modify-database -in MDIDB1 -bin nfsbkup
{
  "jobId" : "1220f80f-098e-4a3f-98db-e83f00a260a4",
  "status" : "Created",
  "message" : "Modify database",
  "reports" : [ ],
  "createTimestamp" : "April 29, 2022 09:30:03 AM CEST",
  "resourceList" : [ {
    "resourceId" : "f964b35e-7209-4d2d-9fca-5387c61c2148",
    "resourceType" : "DB",
    "resourceNewType" : null,
    "jobId" : "1220f80f-098e-4a3f-98db-e83f00a260a4",
    "updatedTime" : "April 29, 2022 09:30:03 AM CEST"
  } ],
  "description" : "Modify database : MDIDB1",
  "updatedTime" : "April 29, 2022 09:30:03 AM CEST"
}
[root@mdidbi42 orabackups]#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[root@mdidbi42 orabackups]# odacli describe-job -i "1220f80f-098e-4a3f-98db-e83f00a260a4"
Job details
----------------------------------------------------------------
                     ID:  1220f80f-098e-4a3f-98db-e83f00a260a4
            Description:  Modify database : MDIDB1
                 Status:  Success
                Created:  April 29, 2022 9:30:03 AM CEST
                Message:  Modify database
Task Name                                Start Time                          End Time                            Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
Validate OMF parameter values            April 29, 2022 9:30:09 AM CEST      April 29, 2022 9:30:11 AM CEST      Success
update db with backupconfig attributes   April 29, 2022 9:30:28 AM CEST      April 29, 2022 9:30:31 AM CEST      Success
Enable Database Autobackup               April 29, 2022 9:30:31 AM CEST      April 29, 2022 9:30:31 AM CEST      Success
Enable Archivelog Autobackup             April 29, 2022 9:30:31 AM CEST      April 29, 2022 9:30:31 AM CEST      Success
Configure Control file Auto Backup Format April 29, 2022 9:30:31 AM CEST      April 29, 2022 9:30:35 AM CEST      Success
Backup Current Control file              April 29, 2022 9:30:35 AM CEST      April 29, 2022 9:30:49 AM CEST      Success
Update metadata for database:MDIDB1      April 29, 2022 9:30:50 AM CEST      April 29, 2022 9:30:50 AM CEST      Success
[root@mdidbi42 orabackups]#

Now it’s time to take a backup of your primary database

1
2
3
4
5
6
7
8
9
10
11
12
[root@mdidbi42 orabackups]# odacli create-backup --backupType Regular-L0 -in MDIDB1
{
  "jobId" : "be3e4d32-12f7-4b6e-8fc2-0d1d3f7d982e",
  "status" : "Created",
  "message" : null,
  "reports" : [ ],
  "createTimestamp" : "April 29, 2022 09:31:51 AM CEST",
  "resourceList" : [ ],
  "description" : "Create Regular-L0 Backup[TAG:auto][Db:MDIDB1][NFS:/u01/backup/orabackups/dbs0fab9fed3/database/3671723533/MDIDB1_42]",
  "updatedTime" : "April 29, 2022 09:31:51 AM CEST"
}
[root@mdidbi42 orabackups]#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[root@mdidbi42 orabackups]# odacli describe-job -i "be3e4d32-12f7-4b6e-8fc2-0d1d3f7d982e"
Job details
----------------------------------------------------------------
                     ID:  be3e4d32-12f7-4b6e-8fc2-0d1d3f7d982e
            Description:  Create Regular-L0 Backup[TAG:auto][Db:MDIDB1][NFS:/u01/backup/orabackups/dbs0fab9fed3/database/3671723533/MDIDB1_42]
                 Status:  Success
                Created:  April 29, 2022 9:31:51 AM CEST
                Message:
Task Name                                Start Time                          End Time                            Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
Validate backup config                   April 29, 2022 9:31:55 AM CEST      April 29, 2022 9:31:55 AM CEST      Success
NFS location existence validation        April 29, 2022 9:31:55 AM CEST      April 29, 2022 9:31:55 AM CEST      Success
Backup Validations                       April 29, 2022 9:31:55 AM CEST      April 29, 2022 9:32:02 AM CEST      Success
Recovery Window validation               April 29, 2022 9:32:02 AM CEST      April 29, 2022 9:32:04 AM CEST      Success
Archivelog deletion policy configuration April 29, 2022 9:32:04 AM CEST      April 29, 2022 9:32:07 AM CEST      Success
Database backup                          April 29, 2022 9:32:07 AM CEST      April 29, 2022 9:33:32 AM CEST      Success
[root@mdidbi42 orabackups]#

When the backup finished, save the backup report in a json file. First look for the backup id

1
2
3
[root@mdidbi42 ~]# odacli list-backupreports | grep Regular-L0
ce3b0eb9-3976-45f2-829e-c39cc5d21e43     e5fbd9e1-ccb6-4d3e-88cb-ece45007a549     3671906653    MDIDB1     MDIDB1_42      Regular-L0   auto         April 29, 2022 3:16:36 PM CEST      April 29, 2022 3:16:36 PM CEST      Configured
[root@mdidbi42 ~]

And save it

1
2
[root@mdidbi42 ~]# odacli describe-backupreport -i ce3b0eb9-3976-45f2-829e-c39cc5d21e43 > backup_report_mdidb1.json
[root@mdidbi42 ~]#

Below the contents of the json file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
[root@mdidbi42 ~]# cat backup_report_mdidb1.json
{
  "id" : "ce3b0eb9-3976-45f2-829e-c39cc5d21e43",
  "dbResId" : "e5fbd9e1-ccb6-4d3e-88cb-ece45007a549",
  "tag" : "auto",
  "dbId" : "3671906653",
  "dbName" : "MDIDB1",
  "dbUniqueName" : "MDIDB1_42",
  "backupType" : "Regular-L0",
  "keepDays" : null,
  "backupLocation" : "/u01/backup/orabackups/dbs0fab9fed3/database/3671906653/MDIDB1_42/db",
  "cfBackupHandle" : "/u01/backup/orabackups/dbs0fab9fed3/database/3671906653/MDIDB1_42/db/c-3671906653-20220429-05",
  "spfBackupHandle" : "/u01/backup/orabackups/dbs0fab9fed3/database/3671906653/MDIDB1_42/db/c-3671906653-20220429-05",
  "pitrTimeStamp" : "April 29, 2022 15:17:33 PM CEST",
  "pitrSCN" : "1842740",
  "resetLogsTimeStamp" : "April 29, 2022 14:05:17 PM CEST",
  "resetLogsSCN" : "1712336",
  "oraHomeVersion" : "21.5.0.0.220118",
  "sqlPatches" : null,
  "backupLogLoc" : "/u01/backup/orabackups/dbs0fab9fed3/database/3671906653/MDIDB1_42/rmanlog/2022-04-29/rman_backup_auto_2022-04-29_15-16-40.0579.log",
  "tdeWalletLoc" : null,
  "dbConfigLoc" : "/u01/backup/orabackups/dbs0fab9fed3/database/3671906653/MDIDB1_42/dbconfig/2022-04-29/DBCONFIG_auto_2022-04-29_15-17-50.0845.tar.gz",
  "name" : "Backup_Report_MDIDB1",
  "createTime" : "April 29, 2022 15:16:36 PM CEST",
  "state" : {
    "status" : "CONFIGURED"
  },
  "updatedTime" : "April 29, 2022 15:16:36 PM CEST",
  "backupReportLogDetail" : "/u01/backup/orabackups/dbs0fab9fed3/database/3671906653/MDIDB1_42/rmandetaillogreport/2022-04-29/rman_list_backup_detail_auto_2022-04-29_15-17-44.0692.log",
  "dbInfo" : {
    "dbClass" : "OLTP",
    "dbType" : "SI",
    "dbShape" : "odb2",
    "dbEdition" : "EE",
    "dbStorage" : "ASM",
    "dbRedundancy" : null,
    "pdbName" : "PDB1",
    "isCdb" : true
  },
  "dbDataSize" : "4202M",
  "dbRedoSize" : "12306M",
  "rmanBackupPieces" : "/u01/backup/orabackups/dbs0fab9fed3/database/3671906653/MDIDB1_42/backuppieces/2022-04-29/backupPieces_auto_e5fbd9e1-ccb6-4d3e-88cb-ece45007a549_20220429151749.json",
  "compressionAlgo" : "BASIC",
  "cpuPool" : null,
  "numberOfCores" : null
}
[root@mdidbi42 ~]#

Now Copy backups on the same location in the standby DB system
Also copy the backup report to the standby system and restore the backup to a standby database. Don’t forget to give access to backup files to user oracle

1
2
3
4
5
[root@mdidbi42 backup]# pwd
/u01/backup
[root@mdidbi42 backup]# scp -r orabackups/ mdidbi43:$PWD
FIPS mode initialized
root@mdidbi43's password:
1
scp -r backup_report_mdidb1.json  mdidbi43:$PWD

Now it’s time to restore the backups on the standby server. Personally, I have deleted the existing database which comes with the DB system creation on the standby server

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@mdidbi43 ~]#  odacli irestore-database -r backup_report_mdidb1.json -u MDIDB2_43 -ro STANDBY -dh b3da570b-acd1-41fa-8c8c-1c16fd66                                                                                                      abb3
Enter SYS user password:
Retype SYS user password:
{
  "jobId" : "aa280ddf-f215-452a-833c-4912d68aa2e5",
  "status" : "Created",
  "message" : null,
  "reports" : [ ],
  "createTimestamp" : "April 29, 2022 15:26:56",
  "resourceList" : [ ],
  "description" : "Database service recovery with db name: MDIDB1",
  "updatedTime" : "April 29, 2022 15:26:56"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
[root@mdidbi43 ~]# odacli describe-job -i "aa280ddf-f215-452a-833c-4912d68aa2e5"
Job details
----------------------------------------------------------------
                     ID:  aa280ddf-f215-452a-833c-4912d68aa2e5
            Description:  Database service recovery with db name: MDIDB1
                 Status:  Success
                Created:  April 29, 2022 3:26:56 PM CEST
                Message:
Task Name                                Start Time                          End Time                            Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
Check if cluster ware is running         April 29, 2022 3:26:58 PM CEST      April 29, 2022 3:26:58 PM CEST      Success
Creating DbStorage for DbRestore         April 29, 2022 3:26:58 PM CEST      April 29, 2022 3:27:00 PM CEST      Success
Validating DiskSpace for DATA            April 29, 2022 3:26:58 PM CEST      April 29, 2022 3:26:59 PM CEST      Success
Generating SSH key                       April 29, 2022 3:26:59 PM CEST      April 29, 2022 3:27:00 PM CEST      Success
SSH key                                  April 29, 2022 3:27:00 PM CEST      April 29, 2022 3:27:00 PM CEST      Success
SSH key scan                             April 29, 2022 3:27:00 PM CEST      April 29, 2022 3:27:00 PM CEST      Success
Audit directory creation                 April 29, 2022 3:27:00 PM CEST      April 29, 2022 3:27:00 PM CEST      Success
Create pfile for Auxiliary Instance      April 29, 2022 3:27:01 PM CEST      April 29, 2022 3:27:01 PM CEST      Success
Deleting FRA                             April 29, 2022 3:27:01 PM CEST      April 29, 2022 3:27:02 PM CEST      Success
Rman duplicate                           April 29, 2022 3:27:02 PM CEST      April 29, 2022 3:29:10 PM CEST      Success
Creating pfile from spfile               April 29, 2022 3:29:11 PM CEST      April 29, 2022 3:29:11 PM CEST      Success
Set PFile Ownership                      April 29, 2022 3:29:11 PM CEST      April 29, 2022 3:29:11 PM CEST      Success
Customize Db Parameters                  April 29, 2022 3:29:11 PM CEST      April 29, 2022 3:29:12 PM CEST      Success
Shutdown And Start database              April 29, 2022 3:29:12 PM CEST      April 29, 2022 3:29:33 PM CEST      Success
Create spfile for restore db             April 29, 2022 3:29:33 PM CEST      April 29, 2022 3:29:33 PM CEST      Success
Set PFile Ownership                      April 29, 2022 3:29:33 PM CEST      April 29, 2022 3:29:33 PM CEST      Success
Shutdown And Mount database              April 29, 2022 3:29:33 PM CEST      April 29, 2022 3:29:51 PM CEST      Success
Register Database taskflow               April 29, 2022 3:29:55 PM CEST      April 29, 2022 3:31:33 PM CEST      Success
Create SPFile in shared loc              April 29, 2022 3:29:55 PM CEST      April 29, 2022 3:30:03 PM CEST      Success
Delete Local Spfile                      April 29, 2022 3:30:03 PM CEST      April 29, 2022 3:30:03 PM CEST      Success
Register DB with clusterware             April 29, 2022 3:30:03 PM CEST      April 29, 2022 3:30:31 PM CEST      Success
Set SysPassword and Create PwFile        April 29, 2022 3:30:31 PM CEST      April 29, 2022 3:30:33 PM CEST      Success
Enable block change tracking             April 29, 2022 3:30:33 PM CEST      April 29, 2022 3:30:37 PM CEST      Success
Creating pfile                           April 29, 2022 3:30:37 PM CEST      April 29, 2022 3:30:38 PM CEST      Success
Updating db env                          April 29, 2022 3:30:38 PM CEST      April 29, 2022 3:30:39 PM CEST      Success
Enable DbSizing Template                 April 29, 2022 3:30:39 PM CEST      April 29, 2022 3:31:06 PM CEST      Success
Create tns entry                         April 29, 2022 3:31:06 PM CEST      April 29, 2022 3:31:07 PM CEST      Success
Running datapatch                        April 29, 2022 3:31:07 PM CEST      April 29, 2022 3:31:08 PM CEST      Success
Set CPU pool                             April 29, 2022 3:31:08 PM CEST      April 29, 2022 3:31:08 PM CEST      Success
Reset Associated Networks                April 29, 2022 3:31:34 PM CEST      April 29, 2022 3:31:38 PM CEST      Success
Set log_archive_dest for Database        April 29, 2022 3:31:38 PM CEST      April 29, 2022 3:31:43 PM CEST      Success
Copy Pwfile to Shared Storage            April 29, 2022 3:31:43 PM CEST      April 29, 2022 3:31:49 PM CEST      Success
[root@mdidbi43 ~]#

After the restore we can connect on the standby database and can see that it’s in a MOUNT STATE

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[oracle@mdidbi43 ~]$ . oraenv
ORACLE_SID = [MDIDB1] ?
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@mdidbi43 ~]$ sqlplus / as sysdba
SQL*Plus: Release 21.0.0.0.0 - Production on Fri Apr 29 10:01:23 2022
Version 21.5.0.0.0
Copyright (c) 1982, 2021, Oracle.  All rights reserved.
Connected to:
Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.5.0.0.0
SQL> select db_unique_name ,open_mode from v$database;
DB_UNIQUE_NAME                 OPEN_MODE
------------------------------ --------------------
MDIDB2_43                      MOUNTED
SQL>

Ok now we can configure the Data Guard by running the configure-dataguard command from the primary.
You will have some questions to fill

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
[root@mdidbi42 ~]# odacli configure-dataguard
Standby site address: mdidbi43
BUI username for Standby site. If Multi-user Access is disabled on Standby site, enter 'oda-admin'; otherwise, enter the name of the use who has irestored the Standby database (default: oda-admin):
BUI password for Standby site:
root@mdidbi43's password:
Database name for Data Guard configuration: MDIDB1
Primary database SYS password:
*******************************************************************************************
Data Guard default settings
Primary site network for Data Guard configuration: Public-network
Standby site network for Data Guard configuration: Public-network
Primary database listener port: 1521
Standby database listener port: 1521
Transport type: ASYNC
Protection mode: MAX_PERFORMANCE
Data Guard configuration name: MDIDB1_42_MDIDB2_43
Active Data Guard: disabled
Do you want to edit this Data Guard configuration? (Y/N, default:N): Y
*******************************************************************************************
Primary site network for Data Guard configuration [Public-network] (default: Public-network):
Standby site network for Data Guard configuration [Public-network] (default: Public-network):
Primary database listener port (default: 1521):
Standby database listener port (default: 1521):
Transport type [ASYNC, FASTSYNC, SYNC] (default: ASYNC):
Protection mode [MAX_PROTECTION, MAX_PERFORMANCE, MAX_AVAILABILITY] (default: MAX_PERFORMANCE):
Data Guard configuration name (default: MDIDB1_42_MDIDB2_43):
Primary database is missing certain archivelogs for Data Guard configuration. We need to restore those from backup.
Enter RMAN backup encryption password:
Do you want to provide another RMAN backup encryption password? [y/n] (default 'n'): n
Enable Active Data Guard? (Y/N, default:N):
Standby database's SYS password will be set to Primary database's after Data Guard configuration. Ignore warning and proceed with Data Gard configuration? (Y/N, default:N): Y
*******************************************************************************************
Configure Data Guard MDIDB1_42_MDIDB2_43 started
*******************************************************************************************
Step 1: Validate Data Guard configuration request (Primary site)
Description: Validate DG Config Creation for db MDIDB1
Job ID: eb1c048d-4a26-44f6-972d-d0923b43a30c
Started April 29, 2022 15:36:13 PM CEST
Validate create Data Guard configuration request
Finished April 29, 2022 15:36:17 PM CEST
*******************************************************************************************
Step 2: Validate Data Guard configuration request (Standby site)
Description: Validate DG Config Creation for db MDIDB1
Job ID: 81d48002-8478-4c4b-a49c-89f7babe8764
Started April 29, 2022 15:36:18 PM CEST
Validate create Data Guard configuration request
Finished April 29, 2022 15:36:23 PM CEST
*******************************************************************************************
Step 3: Restore missing archivelog (Primary site)
Description: Create Archivelog Restore for db:MDIDB1
Job ID: ca35287b-e306-4372-a1ad-84ed61185b55
Started April 29, 2022 15:36:24 PM CEST
Restore Archivelog validation
Restore Archivelog
Finished April 29, 2022 15:36:43 PM CEST
*******************************************************************************************
Step 4: Download password file from Primary database (Primary site)
Description: Download orapwd file from Primary database
Started April 29, 2022 15:36:43 PM CEST
Prepare orapwd file for Primary database MDIDB1
Finished April 29, 2022 15:36:45 PM CEST
*******************************************************************************************
Step 5: Upload password file to Standby database (Standby site)
Description: Upload orapwd file to Standby database
Started April 29, 2022 15:36:45 PM CEST
Write orapwd file to Standby database MDIDB1
Finished April 29, 2022 15:36:58 PM CEST
*******************************************************************************************
Step 6: Configure Primary database (Primary site)
Description: DG Config service for db MDIDB1 - ConfigurePrimary
Job ID: 55c4622f-3190-4ac6-9344-9e551075bc21
Started April 29, 2022 15:36:59 PM CEST
Configure host DNS on primary env
Configure Data Guard Tns on primary env
Enable Data Guard related Db parameters for primary env
Enable force logging and archivelog mode in primary env
Enable FlashBack
Configure network parameters for local listener on primary env
Restart listener on primary env
Create services for primary db
Finished April 29, 2022 15:37:26 PM CEST
*******************************************************************************************
Step 7: Configure Standby database (Standby site)
Description: DG Config service for db MDIDB1 - ConfigureStandby
Job ID: 642866cc-c2e3-49fd-99af-7017bcf23ae2
Started April 29, 2022 15:37:27 PM CEST
Configure Data Guard Tns on standby env
Configure host DNS on standby env
Clear Data Guard related Db parameters for standby env
Enable Data Guard related Db parameters for standby env
Enable force logging and archivelog mode in standby env
Populate standby database metadata
Configure network parameters for local listener on standby env
Reset Db sizing and hidden parameters for ODA best practice
Restart Listener on standby env
Create services for standby db
Finished April 29, 2022 15:38:39 PM CEST
*******************************************************************************************
Step 8: Configure and enable Data Guard (Primary site)
Description: DG Config service for db MDIDB1 - ConfigureDg
Job ID: e6882484-c946-4b4e-b51e-ddca8886449d
Started April 29, 2022 15:38:40 PM CEST
Config and enable Data Guard
Post check Data Guard configuration
Finished April 29, 2022 15:40:22 PM CEST
*******************************************************************************************
Step 9: Enable Flashback (Standby site)
Description: DG Config service for db MDIDB1 - EnableFlashback
Job ID: e9e0d091-7bc2-4185-901d-7914168f32bb
Started April 29, 2022 15:40:23 PM CEST
Enable FlashBack
Finished April 29, 2022 15:40:36 PM CEST
*******************************************************************************************
Step 10: Re-enable Data Guard (Primary site)
Description: DG Config service for db MDIDB1 - ReenableDg
Job ID: d83d2779-f7fd-4d90-b5eb-58fda4792f15
Started April 29, 2022 15:40:37 PM CEST
Re-enable Data Guard if inconsistent properties found
Post check Data Guard configuration
Finished April 29, 2022 15:40:39 PM CEST
*******************************************************************************************
Step 11: Create Data Guard status (Primary site)
Description: DG Status operation for db MDIDB1 - NewDgconfig
Job ID: cb590d03-3795-4dfe-b374-69212f8aecd8
Started April 29, 2022 15:40:40 PM CEST
Create Data Guard status
Finished April 29, 2022 15:40:42 PM CEST
*******************************************************************************************
Step 12: Create Data Guard status (Standby site)
Description: DG Status operation for db MDIDB1 - NewDgconfig
Job ID: ba68bda7-f705-4a6e-9e96-d37d042603f0
Started April 29, 2022 15:40:43 PM CEST
Create Data Guard status
Finished April 29, 2022 15:40:44 PM CEST
*******************************************************************************************
Configure Data Guard MDIDB1_42_MDIDB2_43 completed
*******************************************************************************************
[root@mdidbi42 ~]#

The configuration finished successfully, we can list the status of the Data Guard

1
2
3
4
5
6
[root@mdidbi42 ~]# odacli list-dataguardstatus
Updated about 4 minute(s) ago
ID                                       Name                             Database Name        Role       Protection Mode    Apply Lag       Transport Lag   Apply Rate      Status
---------------------------------------- -------------------------------- -------------------- ---------- ------------------ --------------- --------------- --------------- ----------
b297b32d-987e-407d-9422-6d3748481907     MDIDB1_42_MDIDB2_43              MDIDB1               PRIMARY    MAX_PERFORMANCE    18 seconds      0 seconds       19.00 KByte/s   CONFIGURED
[root@mdidbi42 ~]#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@mdidbi42 ~]# odacli describe-dataguardstatus -i b297b32d-987e-407d-9422-6d3748481907
Updated about 4 minute(s) ago
Dataguard Status details
----------------------------------------------------------------
                     ID: b297b32d-987e-407d-9422-6d3748481907
                   Name: MDIDB1_42_MDIDB2_43
          Database Name: e5fbd9e1-ccb6-4d3e-88cb-ece45007a549
                   Role: PRIMARY
        Protection Mode: MAX_PERFORMANCE
              Apply Lag: 0 seconds
          Transport Lag: 0 seconds
             Apply Rate: 1.00 KByte/s
                 Status: CONFIGURED
           Updated Time: April 29, 2022 3:45:05 PM CEST
[root@mdidbi42 ~]#

We can also connect via dgmgrl and verify

1
<br>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
DGMGRL> show configuration
Configuration - MDIDB1_42_MDIDB2_43
  Protection Mode: MaxPerformance
  Members:
  MDIDB1_42 - Primary database
    MDIDB2_43 - Physical standby database
Fast-Start Failover:  Disabled
Configuration Status:
SUCCESS   (status updated 58 seconds ago)
DGMGRL>

To do a switchover run following command on the primary server

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@mdidbi42 ~]#  odacli switchover-dataguard -i b297b32d-987e-407d-9422-6d3748481907 -u MDIDB2_43
Password for target database:
{
  "jobId" : "758d015e-c208-4313-b989-5ffb4fd9fa7c",
  "status" : "Created",
  "message" : null,
  "reports" : [ ],
  "createTimestamp" : "April 29, 2022 15:59:47 PM CEST",
  "resourceList" : [ ],
  "description" : "Dataguard operation for MDIDB1_42_MDIDB2_43 - SwitchoverDg",
  "updatedTime" : "April 29, 2022 15:59:47 PM CEST"
}
[root@mdidbi42 ~]#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@mdidbi42 ~]# odacli describe-job -i "758d015e-c208-4313-b989-5ffb4fd9fa7c"
Job details
----------------------------------------------------------------
                     ID:  758d015e-c208-4313-b989-5ffb4fd9fa7c
            Description:  Dataguard operation for MDIDB1_42_MDIDB2_43 - SwitchoverDg
                 Status:  Success
                Created:  April 29, 2022 3:59:47 PM CEST
                Message:
Task Name                                Start Time                          End Time                            Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
Precheck switchover DataGuard            April 29, 2022 3:59:47 PM CEST      April 29, 2022 3:59:58 PM CEST      Success
Switchover DataGuard                     April 29, 2022 3:59:58 PM CEST      April 29, 2022 4:01:07 PM CEST      Success
Postcheck switchover DataGuard           April 29, 2022 4:01:07 PM CEST      April 29, 2022 4:01:08 PM CEST      Success
Check if DataGuard config is updated     April 29, 2022 4:01:09 PM CEST      April 29, 2022 4:01:19 PM CEST      Success
[root@mdidbi42 ~]#

We can validate the switchover while connected to the broker

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
DGMGRL> show configuration
Configuration - MDIDB1_42_MDIDB2_43
  Protection Mode: MaxPerformance
  Members:
  MDIDB2_43 - Primary database
    MDIDB1_42 - Physical standby database
Fast-Start Failover:  Disabled
Configuration Status:
SUCCESS   (status updated 19 seconds ago)
DGMGRL>

To switchback to MDIDB1_42 just run the switchover command on the actual primary server

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@mdidbi43 ~]#  odacli switchover-dataguard -i b297b32d-987e-407d-9422-6d3748481907 -u MDIDB1_42
Password for target database:
{
  "jobId" : "17eef433-7e8e-4d4d-95e3-defe8724cb99",
  "status" : "Created",
  "message" : null,
  "reports" : [ ],
  "createTimestamp" : "April 29, 2022 16:05:49 PM CEST",
  "resourceList" : [ ],
  "description" : "Dataguard operation for MDIDB1_42_MDIDB2_43 - SwitchoverDg",
  "updatedTime" : "April 29, 2022 16:05:49 PM CEST"
}
[root@mdidbi43 ~]#

After the switchback

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
DGMGRL> show configuration
Configuration - MDIDB1_42_MDIDB2_43
  Protection Mode: MaxPerformance
  Members:
  MDIDB1_42 - Primary database
    MDIDB2_43 - Physical standby database
Fast-Start Failover:  Disabled
Configuration Status:
SUCCESS   (status updated 70 seconds ago)
DGMGRL>

We can also perfom a failover by running following command on the standby server

1
2
3
4
[root@mdidbi42 ~]# odacli failover-dataguard -i 96e5c5cf-f710-4a14-a506-9024e4952ba4 -u MDIDB2_43
Password for target database:
DCS-10001:Internal error encountered: Invalid role for FailoverDg:Primary. Execute this command on the Standby site mdidbi43.dbi-lab.ch.
[root@mdidbi42 ~]#

Check the job status

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@mdidbi43 ~]# odacli describe-job -i "7c0dd208-1fca-4c03-99e1-7d896f79c1b5"
Job details
----------------------------------------------------------------
                     ID:  7c0dd208-1fca-4c03-99e1-7d896f79c1b5
            Description:  Dataguard operation for MDIDB1_42_MDIDB2_43 - FailoverDg
                 Status:  Success
                Created:  April 29, 2022 4:11:09 PM CEST
                Message:
Task Name                                Start Time                          End Time                            Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
Precheck failover DataGuard              April 29, 2022 4:11:09 PM CEST      April 29, 2022 4:11:12 PM CEST      Success
Failover DataGuard                       April 29, 2022 4:11:12 PM CEST      April 29, 2022 4:11:33 PM CEST      Success
Postcheck DataGuard status               April 29, 2022 4:11:33 PM CEST      April 29, 2022 4:11:37 PM CEST      Success
Check if DataGuard config is updated     April 29, 2022 4:11:37 PM CEST      April 29, 2022 4:11:47 PM CEST      Success
[root@mdidbi43 ~]#

Check the Data Guard status
On mdidbi43

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
DGMGRL> show configuration
Configuration - MDIDB1_42_MDIDB2_43
  Protection Mode: MaxPerformance
  Members:
  MDIDB2_43 - Primary database
    MDIDB1_42 - Physical standby database (disabled)
      ORA-16661: the standby database needs to be reinstated
Fast-Start Failover:  Disabled
Configuration Status:
SUCCESS   (status updated 59 seconds ago)
DGMGRL>

On the former primary mdidbi42

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
DGMGRL> show configuration
Configuration - MDIDB1_42_MDIDB2_43
  Protection Mode: MaxPerformance
  Members:
  MDIDB1_42 - Primary database
    MDIDB2_43 - Physical standby database
Fast-Start Failover:  Disabled
Configuration Status:
DISABLED
DGM-17290: Role change detected. This database may no longer be the primary database.
DGMGRL>

Let’s reinstate the former primary database MDIDB1_42. So connected to mdidbi43 run the following command

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@mdidbi43 ~]# odacli reinstate-dataguard   -i b297b32d-987e-407d-9422-6d3748481907 -u MDIDB1_42
Password for target database:
{
  "jobId" : "cfe917c4-85f6-4469-b8e0-e6c6e602c54e",
  "status" : "Created",
  "message" : null,
  "reports" : [ ],
  "createTimestamp" : "April 29, 2022 16:16:56 PM CEST",
  "resourceList" : [ ],
  "description" : "Dataguard operation for MDIDB1_42_MDIDB2_43 - ReinstateDg",
  "updatedTime" : "April 29, 2022 16:16:56 PM CEST"
}
[root@mdidbi43 ~]#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@mdidbi43 ~]# odacli describe-job -i "cfe917c4-85f6-4469-b8e0-e6c6e602c54e"
Job details
----------------------------------------------------------------
                     ID:  cfe917c4-85f6-4469-b8e0-e6c6e602c54e
            Description:  Dataguard operation for MDIDB1_42_MDIDB2_43 - ReinstateDg
                 Status:  Success
                Created:  April 29, 2022 4:16:56 PM CEST
                Message:
Task Name                                Start Time                          End Time                            Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
Precheck reinstate DataGuard             April 29, 2022 4:16:56 PM CEST      April 29, 2022 4:16:59 PM CEST      Success
Reinstate DataGuard                      April 29, 2022 4:16:59 PM CEST      April 29, 2022 4:18:13 PM CEST      Success
Postcheck DataGuard status               April 29, 2022 4:18:13 PM CEST      April 29, 2022 4:18:17 PM CEST      Success
Check if DataGuard config is updated     April 29, 2022 4:18:17 PM CEST      April 29, 2022 4:18:27 PM CEST      Success
[root@mdidbi43 ~]#

and the new status

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
DGMGRL> show configuration
Configuration - MDIDB1_42_MDIDB2_43
  Protection Mode: MaxPerformance
  Members:
  MDIDB2_43 - Primary database
    MDIDB1_42 - Physical standby database
Fast-Start Failover:  Disabled
Configuration Status:
SUCCESS   (status updated 19 seconds ago)
DGMGRL>

Conclusion

Hope this help