|
89 | 89 | 'uniqname=s' => \(my $uniqname),
|
90 | 90 | 'template=s' => \(my $template),
|
91 | 91 | 'oracledbtype=s' => \(my $oracledbtype),
|
| 92 | + 'sourcehostname=s' => \(my $sourcehostname), |
| 93 | + 'sourceport=n' => \(my $sourceport), |
| 94 | + 'ingestiontype=s' => \(my $ingestiontype), |
| 95 | + 'singledbname=s' => \(my $singledbname), |
| 96 | + 'stagingport=n' => \(my $stagingport), |
| 97 | + 'dumpdir=s' => \(my $dumpdir), |
| 98 | + 'restorejobs=n' => \(my $restorejobs), |
| 99 | + 'dumpjobs=n' => \(my $dumpjobs), |
| 100 | + 'customparameters=s@' => \(my $customparameters), |
| 101 | + 'backup_dir_log=s' => \(my $backup_dir_log), |
| 102 | + 'keepinsync=s' => \(my $keepinsync), |
92 | 103 | 'dever=s' => \(my $dever),
|
93 | 104 | 'debug:n' => \(my $debug),
|
94 | 105 | 'all' => (\my $all),
|
|
134 | 145 | exit (1);
|
135 | 146 | }
|
136 | 147 |
|
137 |
| - if ( defined ($type) && ( ! ( ( lc $type eq 'oracle') || ( lc $type eq 'sybase') || ( lc $type eq 'mssql') || ( lc $type eq 'vfiles') || ( lc $type eq 'db2') ) ) ) { |
| 148 | + if ( defined ($type) && ( ! ( ( lc $type eq 'oracle') || ( lc $type eq 'sybase') || ( lc $type eq 'mssql') || ( lc $type eq 'vfiles') || ( lc $type eq 'db2') || ( lc $type eq 'postgresql') ) ) ) { |
138 | 149 | print "Option -type has invalid parameter - $type \n";
|
139 | 150 | pod2usage(-verbose => 1, -input=>\*DATA);
|
140 | 151 | exit (1);
|
141 | 152 | }
|
142 | 153 |
|
143 |
| - if (((lc $type eq 'vfiles') || (lc $type eq 'db2')) && (lc $action eq 'attach')) { |
| 154 | + if (((lc $type eq 'vfiles') || ( lc $type eq 'db2') || ( lc $type eq 'postgresql')) && (lc $action eq 'attach')) { |
144 | 155 | print "Can't attach $type dSource\n";
|
145 | 156 | exit (1);
|
146 | 157 | }
|
|
153 | 164 | exit (1);
|
154 | 165 | }
|
155 | 166 | }
|
156 |
| - elsif ( ( lc $type ne 'db2' ) && ( ! ( defined($type) && defined($sourcename) && defined($dsourcename) && defined($source_os_user) && defined($group) ) ) ) { |
| 167 | + elsif ( ( lc $type ne 'postgresql' ) && ( lc $type ne 'db2' ) && ( ! ( defined($type) && defined($sourcename) && defined($dsourcename) && defined($source_os_user) && defined($group) ) ) ) { |
157 | 168 | print "Options -sourcename, -dsourcename, -group, -source_os_user are required. \n";
|
158 | 169 | pod2usage(-verbose => 1, -input=>\*DATA);
|
159 | 170 | exit (1);
|
|
175 | 186 |
|
176 | 187 |
|
177 | 188 | } else {
|
178 |
| - if (defined ($type) && ((lc $type eq 'vfiles') || (lc $type eq 'db2') ) && (lc $action eq 'detach')) { |
| 189 | + if (defined ($type) && ((lc $type eq 'vfiles') || (lc $type eq 'db2') || ( lc $type eq 'postgresql') ) && (lc $action eq 'detach')) { |
179 | 190 | print "Can't deattach $type dSource\n";
|
180 | 191 | exit (1);
|
181 | 192 | }
|
|
229 | 240 | pod2usage(-verbose => 1, -input=>\*DATA);
|
230 | 241 | exit (1)
|
231 | 242 | }
|
| 243 | + } elsif (lc $type eq 'postgresql') { |
| 244 | + if ( lc $ingestiontype ne 'externalbackup' ) { |
| 245 | + print "Options -dbuser and -password are required for non vFiles dsources. \n"; |
| 246 | + pod2usage(-verbose => 1, -input=>\*DATA); |
| 247 | + exit (1); |
| 248 | + } |
232 | 249 | } else {
|
233 | 250 | print "Options -dbuser and -password are required for non vFiles dsources. \n";
|
234 | 251 | pod2usage(-verbose => 1, -input=>\*DATA);
|
|
410 | 427 | }
|
411 | 428 | $jobno = $db->addSource($sourcename,$sourceinst,$sourceenv,$source_os_user,$dbuser,$password,$dsourcename,$group,$logsync,$stageenv,$stageinst,$stage_os_user, $backup_dir, $hadr);
|
412 | 429 | }
|
| 430 | + elsif ($type eq 'postgresql') { |
| 431 | + my $db = new PostgresVDB_obj($engine_obj,$debug); |
| 432 | + if (addhooks($hooks, $db, $presync, $postsync)) { |
| 433 | + $ret = $ret + 1; |
| 434 | + last; |
| 435 | + } |
| 436 | + $jobno = $db->addSource($sourcename,$dbuser,$password,$dsourcename,$group,$logsync,$stageenv,$stageinst,$stage_os_user, $backup_dir, |
| 437 | + $sourcehostname, $sourceport, $ingestiontype, $dumpdir, $restorejobs, $dumpjobs, $stagingport, $singledbname, $mountbase, |
| 438 | + $customparameters, $backup_dir, $backup_dir_log, $keepinsync); |
| 439 | + |
| 440 | + } |
413 | 441 |
|
414 | 442 | # we are adding only one dSource - so one job
|
415 | 443 | $ret = $ret + Toolkit_helpers::waitForAction($engine_obj, $jobno, "Action completed with success", "There were problems with dSource action");
|
@@ -508,6 +536,17 @@ =head1 SYNOPSIS
|
508 | 536 | [-postsync [hookname,]template|filename[,OS_shell] ]
|
509 | 537 | [-stagingpush]
|
510 | 538 | [-oracledbtype nonmt|cdb|pdb]
|
| 539 | + [-customparameters (param_name=value)|(#param_name)] |
| 540 | + [-ingestiontype single|initalized|externalbackup ] |
| 541 | + [-sourcehostname hostname ] |
| 542 | + [-sourceport xxx] |
| 543 | + [-singledbname dbname] |
| 544 | + [-stagingport xxx ] |
| 545 | + [-dumpdir directory] |
| 546 | + [-restorejobs x] |
| 547 | + [-dumpjobs x] |
| 548 | + [-backup_dir_log directory] |
| 549 | + [-keepinsync yes|no] |
511 | 550 | [-debug ]
|
512 | 551 | [-version ]
|
513 | 552 | [-help|? ]
|
@@ -659,6 +698,40 @@ =head2 dSource arguments
|
659 | 698 | =item B<-hooks path_to_hooks>
|
660 | 699 | Import hooks exported using dx_get_hooks
|
661 | 700 |
|
| 701 | +=item B<-customparameters (param_name=value)|(#param_name)> |
| 702 | +Provide a custom parameter for Postgresql. For more then one parameter, use -customparameters multiple times. |
| 703 | +To comment an existing variable inside Postgresql VDB, put a # sign before a parameter. |
| 704 | +
|
| 705 | +=item B<-ingestiontype single|initalized|externalbackup > |
| 706 | +Postgresql dSource ingestion type |
| 707 | +
|
| 708 | +=item B<-sourcehostname hostname> |
| 709 | +Postgresql dSource source host |
| 710 | +
|
| 711 | +=item B<-sourceport xxx> |
| 712 | +Postgresql dSource source port |
| 713 | +
|
| 714 | +=item B<-singledbname dbname> |
| 715 | +Postgresql dSource single database name |
| 716 | +
|
| 717 | +=item B<-stagingport xxx> |
| 718 | +Postgresql dSource staging port |
| 719 | +
|
| 720 | +=item B<-dumpdir directory> |
| 721 | +Postgresql dSource single database dump directory |
| 722 | +
|
| 723 | +=item B<-restorejobs x> |
| 724 | +Postgresql dSource single database number of restore jobs |
| 725 | +
|
| 726 | +=item B<-dumpjobs x> |
| 727 | +Postgresql dSource single database number of dump joba |
| 728 | +
|
| 729 | +=item B<-backup_dir_log> |
| 730 | +Location of WAL logs for external Postgresql ingestion |
| 731 | +
|
| 732 | +=item B<-keepinsync yes|no-> |
| 733 | +Keep a dSource in sync using Postgresql replication. If value set to yes, replication parameters are mandatory |
| 734 | +
|
662 | 735 | =back
|
663 | 736 |
|
664 | 737 | =head2 Hooks
|
@@ -808,6 +881,27 @@ =head1 EXAMPLES
|
808 | 881 | Waiting for all actions to complete. Parent action is ACTION-2919
|
809 | 882 | Action completed with success
|
810 | 883 |
|
| 884 | +Adding a Posgresql dSource using Delphix initialized backup |
| 885 | +
|
| 886 | + dx_ctl_dsource -d dxtest -action create -group "Untitled" -creategroup -dsourcename "postdsource" -type postgresql -sourcename "postdsource" -stageinst "Postgres vFiles (15.2)" \ |
| 887 | + -stageenv "POSTSTG" -stage_os_user "postgres" -mountbase "/mnt/provision/postdsource" -password xxxxxxxxx -stagingport 5433 -ingestiontype initiated \ |
| 888 | + -dbuser "delphix" -sourcehostname "sourceserver" -sourceport 5432 -customparameters "deadlock_timeout=123s" |
| 889 | + Waiting for all actions to complete. Parent action is ACTION-734 |
| 890 | + Action completed with success |
| 891 | +
|
| 892 | +Adding a Posgresql dSource using single database ingestion |
| 893 | +
|
| 894 | +dx_ctl_dsource -d dxtest -action create -group "Untitled" -creategroup -dsourcename "postdsource" -type postgresql -sourcename "postdsource_cluster" -stageinst "Postgres vFiles (15.2)" \ |
| 895 | + -stageenv "POSTSTG" -mountbase "/mnt/provision/pioro" -dbuser "postgres" -password xxxxxxxxx -stagingport 5433 -sourcehostname "sourceserver" \ |
| 896 | + -ingestiontype single -sourceport 5432 -singledbname "singleDB" -dumpdir "/home/postgres" -restorejobs 2 -dumpjobs 2 |
| 897 | +
|
| 898 | +Adding a Postgresql dSource using external backup |
| 899 | +
|
| 900 | + dx_ctl_dsource -d dxtest -action create -group "Untitled" -creategroup -dsourcename "extbac" -type postgresql -sourcename "extbac" -stageinst "Postgres vFiles (15.2)" \ |
| 901 | + -stageenv "POSTSTG" -mountbase "/mnt/provision/extbac" -stagingport 5434 -ingestiontype externalbackup \ |
| 902 | + -backup_dir "/home/postgres/backup" -backup_dir_log "/home/postgres/backup" -keepinsync no |
| 903 | +
|
| 904 | +
|
811 | 905 | Updating a backup path and validated sync mode for Sybase
|
812 | 906 |
|
813 | 907 | dx_ctl_dsource -d Landshark5 -action update -validatedsync ENABLED -backup_dir "/u02/sybase_back" -dsourcename pubs3
|
@@ -839,4 +933,6 @@ =head1 EXAMPLES
|
839 | 933 | Action completed with success
|
840 | 934 |
|
841 | 935 |
|
| 936 | +
|
| 937 | +
|
842 | 938 | =cut
|
0 commit comments