Skip to content

Commit dcdf270

Browse files
author
Marcin Przepiorowski
committed
v.2.4.19
2 parents 0f8be40 + 77924d2 commit dcdf270

File tree

7 files changed

+190
-36
lines changed

7 files changed

+190
-36
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## 2.4.19
2+
3+
### Changes:
4+
- [bug #227](https://github.com/delphix/dxtoolkit/issues/227) - snapshot order fixed
5+
- [bug #226](https://github.com/delphix/dxtoolkit/issues/226) - link / unlink (attach / detech) works for vPDB and CDB
6+
- build fixes
7+
8+
### Added
9+
- [bug #225](https://github.com/delphix/dxtoolkit/issues/225) - support for vPDB/vCDB with TDE
10+
11+
112
## 2.4.18
213

314
### Added

bin/dx_ctl_dsource.pl

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@
117117

118118
if (! (($action eq 'detach') || ($action eq 'update')) ) {
119119

120-
if (defined($cdbcont) && ((!defined($cdbpass)) || (!defined($cdbuser)))) {
121-
print "Option -cdbcont required a cdbpass and cdbuser to be defined \n";
122-
pod2usage(-verbose => 1, -input=>\*DATA);
123-
exit (1);
124-
}
120+
# if (defined($cdbcont) && ((!defined($cdbpass)) || (!defined($cdbuser)))) {
121+
# print "Option -cdbcont required a cdbpass and cdbuser to be defined \n";
122+
# pod2usage(-verbose => 1, -input=>\*DATA);
123+
# exit (1);
124+
# }
125125

126126
if (!defined($type)) {
127127
print "Option -type is required for this action \n";
@@ -237,7 +237,8 @@
237237
print "Source database not found.\n";
238238
$ret = $ret + 1;
239239
next;
240-
}
240+
}
241+
241242

242243
for my $dbref (@{$source_ref}) {
243244

@@ -307,7 +308,7 @@
307308
my $source = ($databases->getDB($source_ref->[0]));
308309

309310
if ( $type eq 'oracle' ) {
310-
$jobno = $source->attach_dsource($sourcename,$sourceinst,$sourceenv,$source_os_user,$dbuser,$password,$stageenv,$stageinst,$stage_os_user, $backup_dir);
311+
$jobno = $source->attach_dsource($sourcename,$sourceinst,$sourceenv,$source_os_user,$dbuser,$password,$cdbcont);
311312
} else {
312313
$jobno = $source->attach_dsource($sourcename,$sourceinst,$sourceenv,$source_os_user,$dbuser,$password,$stageenv,$stageinst,$stage_os_user, $backup_dir, $validatedsync, $delphixmanaged, $compression, $dbusertype);
313314
}
@@ -345,7 +346,7 @@
345346
if ( $type eq 'oracle' ) {
346347
my $db = new OracleVDB_obj($engine_obj,$debug);
347348

348-
if (defined($cdbcont)) {
349+
if (defined($cdbcont) && defined($cdbuser)) {
349350
if ($db->discoverPDB($sourceinst,$sourceenv,$cdbcont,$cdbuser,$cdbpass)) {
350351
print "There was an error with PDB discovery \n";
351352
$ret = $ret + 1;
@@ -356,7 +357,7 @@
356357
$ret = $ret + 1;
357358
last;
358359
}
359-
$jobno = $db->addSource($sourcename,$sourceinst,$sourceenv,$source_os_user,$dbuser,$password,$dsourcename,$group,$logsync);
360+
$jobno = $db->addSource($sourcename,$sourceinst,$sourceenv,$source_os_user,$dbuser,$password,$dsourcename,$group,$logsync, $cdbcont);
360361
}
361362
elsif ($type eq 'sybase') {
362363
my $db = new SybaseVDB_obj($engine_obj,$debug);
@@ -736,6 +737,15 @@ =head1 EXAMPLES
736737
Waiting for all actions to complete. Parent action is ACTION-12691
737738
Action completed with success
738739
740+
741+
Attach Oracle PDB dsource
742+
743+
dx_ctl_dsource -d Landshark5 -action attach -type oracle -sourcename PDB1 -source_os_user delphix \
744+
-group Sources -dsourcename "PDB1" -cdbcont CDOML_A
745+
Waiting for all actions to complete. Parent action is ACTION-1023
746+
Action completed with success
747+
748+
739749
Adding an Oracle PDB dSource
740750
741751
dx_ctl_dsource -d Landshark5 -action create -sourcename PDB1 -type oracle -sourceinst /u01/app/oracle/12.2.0.1/db1 \

bin/dx_provision_vdb.pl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@
112112
'vcdbuniqname=s' => \(my $vcdbuniqname),
113113
'vcdbinstname=s' => \(my $vcdbinstname),
114114
'vcdbtemplate=s' => \(my $vcdbtemplate),
115+
'vdbtdepassword=s' => \(my $vdbtdepassword),
116+
'vcdbtdekeystore=s' => \(my $vcdbtdekeystore),
115117
'vcdbrac_instance=s@' => \(my $vcdbrac_instance),
116118
'customerenvfile=s@' => \(my $customerenvfile),
117119
'customerenvpair=s@' => \(my $customerenvpair),
@@ -593,7 +595,7 @@
593595

594596

595597
if (defined($vcdbname)) {
596-
$db->setupVCDB($vcdbname,$vcdbgroup,$vcdbdbname,$vcdbinstname,$vcdbuniqname,$vcdbtemplate, $vcdbrac_instance);
598+
$db->setupVCDB($vcdbname,$vcdbgroup,$vcdbdbname,$vcdbinstname,$vcdbuniqname,$vcdbtemplate, $vcdbrac_instance, $vdbtdepassword, $vcdbtdekeystore);
597599
}
598600

599601

@@ -767,6 +769,8 @@ =head1 SYNOPSIS
767769
[-vcdbinstname vcdb_instance_name]
768770
[-vcdbtemplate vcdb_template_name]
769771
[-vcdbrac_instance env_node,instance_name,instance_no]
772+
[-vdbtdepassword vcdb_TDE_keystore_password]
773+
[-vcdbtdekeystore vcdb_TDE_keystore_location]
770774
[-customerenvfile path_to_env_file[,nodename]]
771775
[-customerenvpair key,value[,nodename]]
772776
[-tdeparentpassword tde_parent_keystore_password
@@ -903,6 +907,12 @@ =head2 VDB arguments
903907
904908
ex. -vcdbrac_instance node1,vCBD1,1 -vcdbrac_instance node2,vCBD2,2
905909
910+
=item B<-vdbtdepassword vcdb_TDE_keystore_password>
911+
VCDB password for a new keystore
912+
913+
=item B<-vcdbtdekeystore vcdb_TDE_keystore_location>
914+
VCDB location of the new keystore
915+
906916
=item B<-noopen>
907917
Don't open database after provision (for Oracle)
908918

lib/OracleVDB_obj.pm

Lines changed: 114 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,20 @@ sub getConfig
145145

146146
my $config = '';
147147
my $joinsep;
148+
my $vcdb;
149+
150+
if (!defined($self->{_databases}->{_vcdblist})) {
151+
my %vcdblist;
152+
$self->{_databases}->{_vcdblist} = \%vcdblist;
153+
}
154+
148155

149156
if (defined($backup)) {
150157
$joinsep = ' ';
151158
} else {
152159
$joinsep = ',';
153160
}
154161

155-
156162
if ($self->getType() eq 'VDB') {
157163

158164
my $mntpoint = $self->getMountPoint();
@@ -171,16 +177,17 @@ sub getConfig
171177

172178
my $sourceobj = $self->{_source}->getSourceByConfig($cdbref);
173179

174-
if ($sourceobj->{type} eq 'OracleVirtualSource') {
180+
if (($sourceobj->{type} eq 'OracleVirtualSource') && (! defined($self->{_databases}->{_vcdblist}->{$cdbref}))) {
175181
# this is a vCDB
182+
# it is first time we see it
183+
$self->{_databases}->{_vcdblist}->{$cdbref} = 1;
176184

177185
if (defined($sourceobj->{configTemplate})) {
178186
my $vcdbtempname = $templates->getTemplate($sourceobj->{configTemplate})->{name};
179187
$config = join($joinsep,($config, "-vcdbtemplate \"$vcdbtempname\""));
180188
}
181189

182190

183-
184191
my $dbobj = $self->{_databases}->getDB($sourceobj->{container});
185192

186193
if (defined($dbobj)) {
@@ -204,6 +211,17 @@ sub getConfig
204211
}
205212
}
206213

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+
207225

208226
$config = join($joinsep,($config, "-vcdbname $vcdbname -vcdbdbname $vcdbdbname -vcdbuniqname $vcdbuniqname -vcdbgroup \"$vcdbgroupname\""));
209227
} else {
@@ -264,7 +282,7 @@ sub getConfig
264282
$config = join($joinsep,($config, $cust));
265283
}
266284

267-
my $tde = $self->getTDE($joinsep);
285+
my $tde = $self->getTDE($joinsep, $vcdb);
268286
if ($tde ne '') {
269287
$config = join($joinsep,($config, $tde));
270288
}
@@ -1599,6 +1617,55 @@ sub snapshot
15991617
return $self->VDB_obj::snapshot(\%snapshot_type) ;
16001618
}
16011619

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+
16021669
# Procedure attach_dsource
16031670
# parameters:
16041671
# - dbuser
@@ -1618,27 +1685,28 @@ sub attach_dsource
16181685
my $source_osuser = shift;
16191686
my $dbuser = shift;
16201687
my $password = shift;
1688+
my $cdbcont = shift;
16211689

16221690
logger($self->{_debug}, "Entering OracleVDB_obj::attach_dsource",1);
16231691

1624-
my $config = $self->setConfig($source, $source_inst, $source_env);
1692+
my $config = $self->setConfig($source, $source_inst, $source_env, $cdbcont);
16251693

16261694
if (! defined($config)) {
1627-
print "Source database $source not found\n";
16281695
return undef;
16291696
}
16301697

1631-
16321698
my $source_env_ref = $self->{_repository}->getEnvironment($config->{repository});
16331699
my $source_os_ref = $self->{_environment}->getEnvironmentUserByName($source_env_ref,$source_osuser);
16341700

16351701
my $authtype = $self->{_environment}->getEnvironmentUserAuth($source_env_ref, $source_os_ref);
16361702

16371703
if ($authtype ne 'kerberos') {
16381704
# 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+
}
16421710
}
16431711
}
16441712

@@ -1697,26 +1765,32 @@ sub attach_dsource
16971765
"attachData" => {
16981766
"type" => "OracleAttachData",
16991767
"config" => $config->{reference},
1700-
"oracleFallbackCredentials" => $password,
1701-
"oracleFallbackUser" => $dbuser,
17021768
"environmentUser" => $source_os_ref
17031769
}
17041770
);
1771+
1772+
if (defined($dbuser)) {
1773+
$attach_data{"attachData"}{"oracleFallbackUser"} = $dbuser;
1774+
$attach_data{"attachData"}{"oracleFallbackCredentials"} = $password;
1775+
}
1776+
17051777
} else {
17061778
# 6.0.4 and above so far
17071779
%attach_data = (
17081780
"type" => "AttachSourceParameters",
17091781
"attachData" => {
17101782
"type" => "OracleAttachData",
17111783
"config" => $config->{reference},
1712-
"oracleFallbackCredentials" => {
1713-
"type" => "PasswordCredential",
1714-
"password" => $password
1715-
},
1716-
"oracleFallbackUser" => $dbuser,
17171784
"environmentUser" => $source_os_ref
17181785
}
17191786
);
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+
17201794
}
17211795

17221796
if ($config->{type} eq 'OraclePDBConfig') {
@@ -1909,11 +1983,12 @@ sub addSource {
19091983
my $dsource_name = shift;
19101984
my $group = shift;
19111985
my $logsync = shift;
1986+
my $cdbcont = shift;
19121987

19131988

19141989
logger($self->{_debug}, "Entering OracleVDB_obj::addSource",1);
19151990

1916-
my $config = $self->setConfig($source, $source_inst, $source_env);
1991+
my $config = $self->setConfig($source, $source_inst, $source_env, $cdbcont);
19171992

19181993
if (! defined($config)) {
19191994
print "Source database $source not found\n";
@@ -2274,6 +2349,8 @@ sub setupVCDB {
22742349
my $vcdbuniqname = shift;
22752350
my $vcdbtemplate = shift;
22762351
my $vcdbrac_instance = shift;
2352+
my $vcdbtdepassword = shift;
2353+
my $vcdbtdekeystore = shift;
22772354
logger($self->{_debug}, "Entering OracleVDB_obj::setupVCDB",1);
22782355

22792356
$self->{_vcdbname} = $vcdbname;
@@ -2284,6 +2361,12 @@ sub setupVCDB {
22842361
$self->{_vcdbtemplate} = $vcdbtemplate;
22852362
$self->{_vcdbtemplate} = $vcdbtemplate;
22862363
$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+
22872370
}
22882371

22892372

@@ -2489,6 +2572,13 @@ sub createVDB {
24892572
$virtcdbhash{"source"}{"configTemplate"} = $vcdbtemplateref;
24902573
}
24912574

2575+
2576+
if (defined($self->{_vcdbtdepassword})) {
2577+
$self->{"NEWDB"}{"source"}{"targetVcdbTdeKeystorePath"} = $self->{_vcdbtdekeystore};
2578+
$virtcdbhash{"sourceConfig"}{"tdeKeystorePassword"} = $self->{_vcdbtdepassword};
2579+
}
2580+
2581+
24922582
$self->{"NEWDB"}->{"virtualCdb"} = \%virtcdbhash;
24932583

24942584
}
@@ -2685,18 +2775,21 @@ sub setupTDE {
26852775
sub getTDE {
26862776
my $self = shift;
26872777
my $separator = shift;
2778+
my $vcdb = shift;
26882779
logger($self->{_debug}, "Entering OracleVDB_obj::getTDE",1);
26892780
my $ret = '';
26902781
if (defined($self->{"source"}->{"parentTdeKeystorePath"})) {
26912782
$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+
}
26932788
if (defined($self->{"source"}->{"tdeKeyIdentifier"})) {
26942789
$ret = $ret . " -tdekeyid " . $self->{"source"}->{"tdeKeyIdentifier"};
26952790
}
26962791
}
26972792

2698-
2699-
27002793
return $ret;
27012794
}
27022795

0 commit comments

Comments
 (0)