@@ -145,14 +145,20 @@ sub getConfig
145
145
146
146
my $config = ' ' ;
147
147
my $joinsep ;
148
+ my $vcdb ;
149
+
150
+ if (!defined ($self -> {_databases }-> {_vcdblist })) {
151
+ my %vcdblist ;
152
+ $self -> {_databases }-> {_vcdblist } = \%vcdblist ;
153
+ }
154
+
148
155
149
156
if (defined ($backup )) {
150
157
$joinsep = ' ' ;
151
158
} else {
152
159
$joinsep = ' ,' ;
153
160
}
154
161
155
-
156
162
if ($self -> getType() eq ' VDB' ) {
157
163
158
164
my $mntpoint = $self -> getMountPoint();
@@ -171,16 +177,17 @@ sub getConfig
171
177
172
178
my $sourceobj = $self -> {_source }-> getSourceByConfig($cdbref );
173
179
174
- if ($sourceobj -> {type } eq ' OracleVirtualSource' ) {
180
+ if (( $sourceobj -> {type } eq ' OracleVirtualSource' ) && (! defined ( $self -> { _databases } -> { _vcdblist } -> { $cdbref })) ) {
175
181
# this is a vCDB
182
+ # it is first time we see it
183
+ $self -> {_databases }-> {_vcdblist }-> {$cdbref } = 1;
176
184
177
185
if (defined ($sourceobj -> {configTemplate })) {
178
186
my $vcdbtempname = $templates -> getTemplate($sourceobj -> {configTemplate })-> {name };
179
187
$config = join ($joinsep ,($config , " -vcdbtemplate \" $vcdbtempname \" " ));
180
188
}
181
189
182
190
183
-
184
191
my $dbobj = $self -> {_databases }-> getDB($sourceobj -> {container });
185
192
186
193
if (defined ($dbobj )) {
@@ -204,6 +211,17 @@ sub getConfig
204
211
}
205
212
}
206
213
214
+ $vcdb = 1;
215
+
216
+ if (defined ($dbobj -> {sourceConfig }-> {" tdeKeystorePassword" })) {
217
+ $config = join ($joinsep ,($config , " -vdbtdepassword xxxxxxxx" ));
218
+ }
219
+
220
+
221
+ if (defined ($self -> {" source" }-> {" targetVcdbTdeKeystorePath" })) {
222
+ $config = join ($joinsep ,($config , " -vcdbtdekeystore " . $self -> {" source" }-> {" targetVcdbTdeKeystorePath" }));
223
+ }
224
+
207
225
208
226
$config = join ($joinsep ,($config , " -vcdbname $vcdbname -vcdbdbname $vcdbdbname -vcdbuniqname $vcdbuniqname -vcdbgroup \" $vcdbgroupname \" " ));
209
227
} else {
@@ -264,7 +282,7 @@ sub getConfig
264
282
$config = join ($joinsep ,($config , $cust ));
265
283
}
266
284
267
- my $tde = $self -> getTDE($joinsep );
285
+ my $tde = $self -> getTDE($joinsep , $vcdb );
268
286
if ($tde ne ' ' ) {
269
287
$config = join ($joinsep ,($config , $tde ));
270
288
}
@@ -1599,6 +1617,55 @@ sub snapshot
1599
1617
return $self -> VDB_obj::snapshot(\%snapshot_type ) ;
1600
1618
}
1601
1619
1620
+
1621
+ sub setConfig {
1622
+ my $self = shift ;
1623
+ my $name = shift ;
1624
+ my $source_inst = shift ;
1625
+ my $source_env = shift ;
1626
+ my $cdbcont = shift ;
1627
+
1628
+ logger($self -> {_debug }, " Entering OracleVDB_obj::setConfig" ,1);
1629
+
1630
+ logger($self -> {_debug }, " name: " . Dumper $name , 2);
1631
+ logger($self -> {_debug }, " source_inst: " . Dumper $source_inst , 2);
1632
+ logger($self -> {_debug }, " source_env: " . Dumper $source_env , 2);
1633
+ logger($self -> {_debug }, " cdbcont: " . Dumper $cdbcont , 2);
1634
+
1635
+
1636
+ my $dlpxObject = $self -> {_dlpxObject };
1637
+ my $debug = $self -> {_debug };
1638
+
1639
+ my $sourceconfig ;
1640
+
1641
+
1642
+ if (!defined ($self -> {_sourceconfig })) {
1643
+ $sourceconfig = new SourceConfig_obj($dlpxObject , $debug );
1644
+ $self -> {_sourceconfig } = $sourceconfig ;
1645
+ }
1646
+
1647
+ my $ret ;
1648
+
1649
+
1650
+ if (defined ($cdbcont )) {
1651
+ my $container_obj = $self -> {_sourceconfig }-> getSourceConfigByName($cdbcont );
1652
+ $ret = $self -> {_sourceconfig }-> getSourceByCDB($name , $container_obj -> {reference });
1653
+ } else {
1654
+ my $sourceconfig_db = $self -> {_sourceconfig }-> getSourceConfigByName($name );
1655
+ if ($sourceconfig_db -> {" type" } ne ' OraclePDBConfig' ) {
1656
+ if (!defined ($sourceconfig_db )) {
1657
+ print " Source database $name not found\n " ;
1658
+ } else {
1659
+ $ret = $sourceconfig_db ;
1660
+ }
1661
+ } else {
1662
+ print " Oracle PDB specified without CDB. Please add -cdbcont parameter\n " ;
1663
+ }
1664
+ }
1665
+
1666
+ return $ret
1667
+ }
1668
+
1602
1669
# Procedure attach_dsource
1603
1670
# parameters:
1604
1671
# - dbuser
@@ -1618,27 +1685,28 @@ sub attach_dsource
1618
1685
my $source_osuser = shift ;
1619
1686
my $dbuser = shift ;
1620
1687
my $password = shift ;
1688
+ my $cdbcont = shift ;
1621
1689
1622
1690
logger($self -> {_debug }, " Entering OracleVDB_obj::attach_dsource" ,1);
1623
1691
1624
- my $config = $self -> setConfig($source , $source_inst , $source_env );
1692
+ my $config = $self -> setConfig($source , $source_inst , $source_env , $cdbcont );
1625
1693
1626
1694
if (! defined ($config )) {
1627
- print " Source database $source not found\n " ;
1628
1695
return undef ;
1629
1696
}
1630
1697
1631
-
1632
1698
my $source_env_ref = $self -> {_repository }-> getEnvironment($config -> {repository });
1633
1699
my $source_os_ref = $self -> {_environment }-> getEnvironmentUserByName($source_env_ref ,$source_osuser );
1634
1700
1635
1701
my $authtype = $self -> {_environment }-> getEnvironmentUserAuth($source_env_ref , $source_os_ref );
1636
1702
1637
1703
if ($authtype ne ' kerberos' ) {
1638
1704
# assuming we have kerberos and no dbuser is enabled
1639
- if ($self -> {_sourceconfig }-> validateDBCredentials($config -> {reference }, $dbuser , $password )) {
1640
- print " Username or password is invalid.\n " ;
1641
- return undef ;
1705
+ if (defined ($dbuser )) {
1706
+ if ($self -> {_sourceconfig }-> validateDBCredentials($config -> {reference }, $dbuser , $password )) {
1707
+ print " Username or password is invalid.\n " ;
1708
+ return undef ;
1709
+ }
1642
1710
}
1643
1711
}
1644
1712
@@ -1697,26 +1765,32 @@ sub attach_dsource
1697
1765
" attachData" => {
1698
1766
" type" => " OracleAttachData" ,
1699
1767
" config" => $config -> {reference },
1700
- " oracleFallbackCredentials" => $password ,
1701
- " oracleFallbackUser" => $dbuser ,
1702
1768
" environmentUser" => $source_os_ref
1703
1769
}
1704
1770
);
1771
+
1772
+ if (defined ($dbuser )) {
1773
+ $attach_data {" attachData" }{" oracleFallbackUser" } = $dbuser ;
1774
+ $attach_data {" attachData" }{" oracleFallbackCredentials" } = $password ;
1775
+ }
1776
+
1705
1777
} else {
1706
1778
# 6.0.4 and above so far
1707
1779
%attach_data = (
1708
1780
" type" => " AttachSourceParameters" ,
1709
1781
" attachData" => {
1710
1782
" type" => " OracleAttachData" ,
1711
1783
" config" => $config -> {reference },
1712
- " oracleFallbackCredentials" => {
1713
- " type" => " PasswordCredential" ,
1714
- " password" => $password
1715
- },
1716
- " oracleFallbackUser" => $dbuser ,
1717
1784
" environmentUser" => $source_os_ref
1718
1785
}
1719
1786
);
1787
+
1788
+ if (defined ($dbuser )) {
1789
+ $attach_data {" attachData" }{" oracleFallbackUser" } = $dbuser ;
1790
+ $attach_data {" attachData" }{" oracleFallbackCredentials" }{" type" } = " PasswordCredential" ;
1791
+ $attach_data {" attachData" }{" oracleFallbackCredentials" }{" password" } = $password ;
1792
+ }
1793
+
1720
1794
}
1721
1795
1722
1796
if ($config -> {type } eq ' OraclePDBConfig' ) {
@@ -1909,11 +1983,12 @@ sub addSource {
1909
1983
my $dsource_name = shift ;
1910
1984
my $group = shift ;
1911
1985
my $logsync = shift ;
1986
+ my $cdbcont = shift ;
1912
1987
1913
1988
1914
1989
logger($self -> {_debug }, " Entering OracleVDB_obj::addSource" ,1);
1915
1990
1916
- my $config = $self -> setConfig($source , $source_inst , $source_env );
1991
+ my $config = $self -> setConfig($source , $source_inst , $source_env , $cdbcont );
1917
1992
1918
1993
if (! defined ($config )) {
1919
1994
print " Source database $source not found\n " ;
@@ -2274,6 +2349,8 @@ sub setupVCDB {
2274
2349
my $vcdbuniqname = shift ;
2275
2350
my $vcdbtemplate = shift ;
2276
2351
my $vcdbrac_instance = shift ;
2352
+ my $vcdbtdepassword = shift ;
2353
+ my $vcdbtdekeystore = shift ;
2277
2354
logger($self -> {_debug }, " Entering OracleVDB_obj::setupVCDB" ,1);
2278
2355
2279
2356
$self -> {_vcdbname } = $vcdbname ;
@@ -2284,6 +2361,12 @@ sub setupVCDB {
2284
2361
$self -> {_vcdbtemplate } = $vcdbtemplate ;
2285
2362
$self -> {_vcdbtemplate } = $vcdbtemplate ;
2286
2363
$self -> {_vcdbrac_instance } = $vcdbrac_instance ;
2364
+
2365
+ if (version-> parse($self -> {_dlpxObject }-> getApi()) >= version-> parse(1.11.18)) {
2366
+ $self -> {_vcdbtdepassword } = $vcdbtdepassword ;
2367
+ $self -> {_vcdbtdekeystore } = $vcdbtdekeystore ;
2368
+ }
2369
+
2287
2370
}
2288
2371
2289
2372
@@ -2489,6 +2572,13 @@ sub createVDB {
2489
2572
$virtcdbhash {" source" }{" configTemplate" } = $vcdbtemplateref ;
2490
2573
}
2491
2574
2575
+
2576
+ if (defined ($self -> {_vcdbtdepassword })) {
2577
+ $self -> {" NEWDB" }{" source" }{" targetVcdbTdeKeystorePath" } = $self -> {_vcdbtdekeystore };
2578
+ $virtcdbhash {" sourceConfig" }{" tdeKeystorePassword" } = $self -> {_vcdbtdepassword };
2579
+ }
2580
+
2581
+
2492
2582
$self -> {" NEWDB" }-> {" virtualCdb" } = \%virtcdbhash ;
2493
2583
2494
2584
}
@@ -2685,18 +2775,21 @@ sub setupTDE {
2685
2775
sub getTDE {
2686
2776
my $self = shift ;
2687
2777
my $separator = shift ;
2778
+ my $vcdb = shift ;
2688
2779
logger($self -> {_debug }, " Entering OracleVDB_obj::getTDE" ,1);
2689
2780
my $ret = ' ' ;
2690
2781
if (defined ($self -> {" source" }-> {" parentTdeKeystorePath" })) {
2691
2782
$ret = " -tdeparentpath " . $self -> {" source" }-> {" parentTdeKeystorePath" };
2692
- $ret = $ret . " -tdeparentpassword xxxxxx -tdeexportsecret xxxxxxx -tdecdbpassword xxxxxxx" ;
2783
+ $ret = $ret . " -tdeparentpassword xxxxxx -tdeexportsecret xxxxxxx " ;
2784
+ if (defined ($vcdb )) {
2785
+ } else {
2786
+ $ret = $ret . " -tdecdbpassword xxxxxxx" ;
2787
+ }
2693
2788
if (defined ($self -> {" source" }-> {" tdeKeyIdentifier" })) {
2694
2789
$ret = $ret . " -tdekeyid " . $self -> {" source" }-> {" tdeKeyIdentifier" };
2695
2790
}
2696
2791
}
2697
2792
2698
-
2699
-
2700
2793
return $ret ;
2701
2794
}
2702
2795
0 commit comments