@@ -44,7 +44,6 @@ import (
44
44
"fmt"
45
45
"strings"
46
46
"time"
47
-
48
47
"github.com/go-logr/logr"
49
48
corev1 "k8s.io/api/core/v1"
50
49
apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -543,8 +542,8 @@ func (r *DataguardBrokerReconciler) setupDataguardBrokerConfigurationForGivenDB(
543
542
}
544
543
log .Info ("DB Admin pwd file created" )
545
544
545
+ // ORA-16532: Oracle Data Guard broker configuration does not exist , so create one
546
546
if strings .Contains (out , "ORA-16532" ) {
547
- // ORA-16532: Oracle Data Guard broker configuration does not exist , so create one
548
547
if m .Spec .ProtectionMode == "MaxPerformance" {
549
548
// Construct the password file and dgbroker command file
550
549
out , err := dbcommons .ExecCommand (r , r .Config , standbyDatabaseReadyPod .Name , standbyDatabaseReadyPod .Namespace , "" , ctx , req , false , "bash" , "-c" ,
@@ -565,7 +564,6 @@ func (r *DataguardBrokerReconciler) setupDataguardBrokerConfigurationForGivenDB(
565
564
}
566
565
log .Info ("DgConfigurationMaxPerformance Output" )
567
566
log .Info (out )
568
-
569
567
} else if m .Spec .ProtectionMode == "MaxAvailability" {
570
568
// ## DG CONFIGURATION FOR PRIMARY DB || MODE : MAX AVAILABILITY ##
571
569
out , err := dbcommons .ExecCommand (r , r .Config , standbyDatabaseReadyPod .Name , standbyDatabaseReadyPod .Namespace , "" , ctx , req , false , "bash" , "-c" ,
@@ -586,7 +584,6 @@ func (r *DataguardBrokerReconciler) setupDataguardBrokerConfigurationForGivenDB(
586
584
}
587
585
log .Info ("DgConfigurationMaxAvailability Output" )
588
586
log .Info (out )
589
-
590
587
} else {
591
588
log .Info ("SPECIFY correct Protection Mode . Either MaxAvailability or MaxPerformance" )
592
589
return requeueY
@@ -602,10 +599,11 @@ func (r *DataguardBrokerReconciler) setupDataguardBrokerConfigurationForGivenDB(
602
599
log .Info ("ShowConfiguration Output" )
603
600
log .Info (out )
604
601
}
605
- // Set DG Configured status to true for this standbyDatabase. so that in next reconcilation, we dont configure this again
602
+ // Set DG Configured status to true for this standbyDatabase and primary Database. so that in next reconcilation, we dont configure this again
603
+ n .Status .DgBrokerConfigured = true
606
604
standbyDatabase .Status .DgBrokerConfigured = true
607
605
r .Status ().Update (ctx , standbyDatabase )
608
-
606
+ r . Status (). Update ( ctx , n )
609
607
// Remove admin pwd file
610
608
_ , err = dbcommons .ExecCommand (r , r .Config , standbyDatabaseReadyPod .Name , standbyDatabaseReadyPod .Namespace , "" , ctx , req , true , "bash" , "-c" ,
611
609
dbcommons .RemoveAdminPasswordFile )
@@ -1173,6 +1171,9 @@ func (r *DataguardBrokerReconciler) cleanupDataguardBroker(req ctrl.Request, ctx
1173
1171
r .Status ().Update (ctx , standbyDatabase )
1174
1172
}
1175
1173
1174
+ singleInstanceDatabase .Status .DgBrokerConfigured = false
1175
+ r .Status ().Update (ctx , singleInstanceDatabase )
1176
+
1176
1177
log .Info ("Successfully cleaned up Dataguard Broker" )
1177
1178
return requeueN , nil
1178
1179
}
0 commit comments