Skip to content

Commit 8bb5795

Browse files
author
Marcin Przepiorowski
committed
v2p for sybase
1 parent 3e41691 commit 8bb5795

File tree

2 files changed

+119
-24
lines changed

2 files changed

+119
-24
lines changed

bin/dx_v2p.pl

Lines changed: 70 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
'all' => (\my $all),
7676
'version' => \(my $print_version),
7777
'configfile|c=s' => \(my $config_file)
78-
);
78+
) or pod2usage(-verbose => 1, -input=>\*DATA);
7979

8080

8181

@@ -93,8 +93,8 @@
9393
exit (1);
9494
}
9595

96-
if ( ! ( defined($type) && defined($sourcename) && defined($targetDirectory) && defined($dbname) && defined($environment) && defined($timestamp) && defined($envinst) ) ) {
97-
print "Options -type, -sourcename, -targetDirectory, -dbname, -environment, -timestamp and -envinst are required. \n";
96+
if ( ! ( defined($type) && defined($sourcename) && defined($dbname) && defined($environment) && defined($timestamp) && defined($envinst) ) ) {
97+
print "Options -type, -sourcename, -dbname, -environment, -timestamp and -envinst are required. \n";
9898
pod2usage(-verbose => 1, -input=>\*DATA);
9999
exit (1);
100100
}
@@ -106,6 +106,13 @@
106106
}
107107

108108

109+
if ( ( ( $type eq 'oracle') || ( $type eq 'mssql') ) && (! defined($targetDirectory)) ) {
110+
print "Option targetDirectory is required. \n";
111+
pod2usage(-verbose => 1, -input=>\*DATA);
112+
exit (1);
113+
}
114+
115+
109116
# this array will have all engines to go through (if -d is specified it will be only one engine)
110117
my $engine_list = Toolkit_helpers::get_engine_list($all, $dx_host, $engine_obj);
111118

@@ -166,13 +173,15 @@
166173
}
167174

168175
$db->setName($dbname, $dbname);
169-
if ( $db->setFileSystemLayout($targetDirectory,$archiveDirectory,$dataDirectory,$externalDirectory,$scriptDirectory,$tempDirectory) ) {
170-
print "Problem with export file system layout. Is targetDiretory and dataDirectory set ?\n";
171-
exit(1);
172-
}
173176

174177

175178
if ( $type eq 'oracle' ) {
179+
180+
if ( $db->setFileSystemLayout($targetDirectory,$archiveDirectory,$dataDirectory,$externalDirectory,$scriptDirectory,$tempDirectory) ) {
181+
print "Problem with export file system layout. Is targetDiretory and dataDirectory set ?\n";
182+
exit(1);
183+
}
184+
176185
if ( defined($template) ) {
177186
if ( $db->setTemplate($template) ) {
178187
print "Template $template not found. V2P process won't be created\n";
@@ -208,6 +217,12 @@
208217

209218
}
210219
elsif ($type eq 'mssql') {
220+
221+
if ( $db->setFileSystemLayout($targetDirectory,$archiveDirectory,$dataDirectory,$externalDirectory,$scriptDirectory,$tempDirectory) ) {
222+
print "Problem with export file system layout. Is targetDiretory and dataDirectory set ?\n";
223+
exit(1);
224+
}
225+
211226
if (defined($norecovery)) {
212227
$db->setNoRecovery();
213228
}
@@ -235,18 +250,24 @@ =head1 SYNOPSIS
235250
-sourcename src_name
236251
-dbname db_name
237252
-environment environment_name
238-
-type oracle|mssql
239-
-envinst OracleHome/MSSQLinstance
240-
-targetDirectory target_directory
241-
[ -timestamp LATEST_SNAPSHOT|LATEST_POINT|time_stamp]
242-
[ -template template_name]
243-
[ -mapfile mapping_file]
244-
[ -instname SID]
245-
[ -uniqname db_unique_name]
246-
[ -archiveDirectory arch_directory]
247-
[ -dataDirectory data_dir]
248-
[ -externalDirectory external_dir]
249-
[ -tempDirectory temp_dir]
253+
-type oracle|mssql|sybase
254+
-envinst OracleHome/MSSQLinstance/SybaseInstance
255+
[ -targetDirectory target_directory ]
256+
[ -timestamp LATEST_SNAPSHOT|LATEST_POINT|time_stamp ]
257+
[ -template template_name ]
258+
[ -mapfile mapping_file ]
259+
[ -norecovery ]
260+
[ -noopen ]
261+
[ -instname SID ]
262+
[ -uniqname db_unique_name ]
263+
[ -archiveDirectory arch_directory ]
264+
[ -dataDirectory data_dir ]
265+
[ -externalDirectory external_dir ]
266+
[ -tempDirectory temp_dir ]
267+
[ -dspconnections=n ]
268+
[ -dspusecompression ]
269+
[ -dspuseencryption ]
270+
[ -concurrentfiles=n ]
250271
[ -help]
251272
[ -debug]
252273
@@ -277,13 +298,13 @@ =head2 V2P arguments
277298
Type (oracle|mssql)
278299
279300
=item B<-sourcename>
280-
dSource/VDB Name
301+
dSource/VDB Name of database being move to physical
281302
282303
=item B<-targetDirectory>
283-
Target directory
304+
Target directory (mandatory for an Oracle and MS SQL)
284305
285306
=item B<-dbname>
286-
Target database name
307+
Physical database name
287308
288309
=item B<-timestamp>
289310
Time stamp for export format (YYYY-MM-DD HH24:MI:SS) or LATEST_POINT or LATEST_SNAPSHOT
@@ -319,6 +340,25 @@ =head2 V2P arguments
319340
=item B<-temp>
320341
Temp directory
321342
343+
=item B<-norecovery>
344+
Do not run recovery (for MS SQL and Sybase only)
345+
346+
=item B<-noopen>
347+
Do not open a database after migration (for an Oracle only)
348+
349+
=item B<-dspconnections=n>
350+
Set number of DSP connections (for an Oracle only)
351+
352+
=item B<-dspusecompression>
353+
Enable DSP compression (for an Oracle only)
354+
355+
=item B<-dspuseencryption>
356+
Enable DSP encryption (for an Oracle only)
357+
358+
=item B<-concurrentfiles=n>
359+
Set number of concurrent files being copy (for an Oracle only)
360+
361+
322362
=back
323363
324364
@@ -344,14 +384,21 @@ =head1 EXAMPLES
344384
Job JOB-231 finised with state: COMPLETED
345385
V2P job finished with COMPLETED status.
346386
347-
MS SQL V2P proces
387+
MS SQL V2P process
348388
349389
dx_v2p -d Landshark43 -sourcename autotest -environment WINDOWSTARGET -type mssql -envinst MSSQL2012 -dbname v2p -targetDirectory "c:\temp"
350390
Starting provisioning job - JOB-832
351391
0 - 1 - 5 - 10 - 20 - 80 - 100
352392
Job JOB-832 finised with state: COMPLETED
353393
V2P job finished with COMPLETED status.
354394
395+
Sybase V2P process ( database SYBV2P has to be precreated with for load option )
396+
397+
dx_v2p -d Landshark51 -type sybase -timestamp LATEST_SNAPSHOT -sourcename testsys -dbname SYBV2P -environment LINUXTARGET -envinst LINUXTARGET
398+
Starting provisioning job - JOB-5025
399+
0 - 8 - 9 - 30 - 60 - 90 - 92 - 100
400+
Job JOB-5025 finished with state: COMPLETED
401+
V2P finished..
355402
356403
=cut
357404

lib/SybaseVDB_obj.pm

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
1313
#
14-
# Copyright (c) 2015,2016 by Delphix. All rights reserved.
14+
# Copyright (c) 2015,2017 by Delphix. All rights reserved.
1515
#
1616
# Program Name : OracleVDB_obj.pm
1717
# Description : Delphix Engine Database objects
@@ -511,6 +511,54 @@ sub createVDB {
511511
}
512512

513513

514+
# Procedure v2p
515+
# parameters:
516+
# - env - new DB environment
517+
# - inst - new DB instance
518+
# Start job for v2p Sybase VBD
519+
# all above parameters are required. Additional parameters should by set by setXXXX procedures before this one is called
520+
# Return job number if provisioning has been started, otherwise return undef
521+
522+
sub v2p {
523+
my $self = shift;
524+
525+
my $env = shift;
526+
my $inst = shift;
527+
528+
logger($self->{_debug}, "Entering SybaseVDB_obj::v2p",1);
529+
530+
531+
if ( $self->setEnvironment($env) ) {
532+
print "Environment $env not found. VDB won't be created\n";
533+
return undef;
534+
}
535+
536+
if ( $self->setHome($inst) ) {
537+
print "Instance $inst in environment $env not found. VDB won't be created\n";
538+
return undef;
539+
}
540+
541+
if ( $self->setHost() ) {
542+
print "Host is not set. VDB won't be created\n";
543+
return undef;
544+
}
545+
546+
if ( ! defined($self->{"NEWDB"}->{"container"}->{"name"} ) ) {
547+
print "Set name using setName procedure before calling create VDB. VDB won't be created\n";
548+
return undef;
549+
}
550+
551+
$self->{"NEWDB"}->{"type"} = "ASEExportParameters";
552+
553+
554+
delete $self->{"NEWDB"}->{"truncateLogOnCheckpoint"};
555+
delete $self->{"NEWDB"}->{"container"};
556+
delete $self->{"NEWDB"}->{"source"};
557+
my $operation = 'resources/json/delphix/database/export';
558+
my $json_data = $self->getJSON();
559+
return $self->runJobOperation($operation,$json_data);
560+
561+
}
514562

515563

516564

0 commit comments

Comments
 (0)