1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061
|
.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "ORA2PG 1"
.TH ORA2PG 1 "2012-03-11" "perl v5.10.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Ora2Pg \- Oracle to PostgreSQL database schema converter
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
Ora2Pg is a free tool used to migrate an Oracle database to a
PostgreSQL compatible schema. It connects your Oracle database, scan it
automatically and extracts its structure or data, it then generates \s-1SQL\s0
scripts that you can load into your PostgreSQL database.
.PP
Ora2Pg can be used from reverse engineering Oracle database to huge enterprise
database migration or simply to replicate some Oracle data into a PostgreSQL
database. It is really easy to used and doesn't need any Oracle database
knowledge than providing the parameters needed to connect to the Oracle
database.
.SH "FEATURES"
.IX Header "FEATURES"
Ora2Pg consist of a Perl script (ora2pg) and a Perl module (Ora2Pg.pm), the
only thing you have to modify is the configuration file ora2pg.conf by setting
the \s-1DSN\s0 to the Oracle database and optionaly the name of a schema. Once that's
done you just have to set the type of export you want: \s-1TABLE\s0 with constraints,
\&\s-1VIEW\s0, \s-1TABLESPACE\s0, \s-1SEQUENCE\s0, \s-1INDEXES\s0, \s-1TRIGGER\s0, \s-1GRANT\s0, \s-1FUNCTION\s0, \s-1PROCEDURE\s0,
\&\s-1PACKAGE\s0, \s-1PARTITION\s0, \s-1TYPE\s0, and \s-1DATA\s0.
.PP
By default Ora2Pg exports to a file that you can load into PostgreSQL with the
psql client, but you can also import directly into a PostgreSQL database by
setting its \s-1DSN\s0 into the configuration file. With all configuration options of
ora2pg.conf you have full control of what should be exported and how.
.PP
Features included:
.PP
.Vb 10
\& \- Export full database schema (tables, views, sequences, indexes), with
\& unique, primary, foreign key and check constraints.
\& \- Export grants/privileges for users and groups.
\& \- Export range and list partition.
\& \- Export a table selection (by specifying the table names).
\& \- Export Oracle schema to a PostgreSQL 8.4+ schema.
\& \- Export predefined functions, triggers, procedures, packages and
\& package bodies.
\& \- Export full datas or following a WHERE clause.
\& \- Full support of Oracle BLOB object as PG BYTEA.
\& \- Export Oracle views as PG tables.
\& \- Export Oracle user defined types.
\& \- Provide some basic automatic conversion of PLSQL code to PLPGSQL.
\& \- Works on any plateform.
.Ve
.PP
Ora2Pg do its best to automatically convert your Oracle database to PostgreSQL
but there's still manual works to do. The Oracle specific \s-1PL/SQL\s0 code generated
for functions, procedures, packages and triggers has to be reviewed to match
the PostgreSQL syntax. You will find some useful recommandations on porting
Oracle \s-1PL/SQL\s0 code to PostgreSQL \s-1PL/PGSQL\s0 at \*(L"Converting from other Databases
to PostgreSQL\*(R", section: Oracle (http://wiki.postgresql.org/wiki/Main_Page).
.SH "INSTALLATION"
.IX Header "INSTALLATION"
All Perl modules can always be found at \s-1CPAN\s0 (http://search.cpan.org/). Just
type the full name of the module (ex: DBD::Oracle) into the search input box,
it will brings you the page for download.
.PP
Releases of Ora2Pg stay at \s-1SF\s0.net (https://sourceforge.net/projects/ora2pg/).
.SS "Requirement"
.IX Subsection "Requirement"
You need a modern Perl distribution (perl 5.6 and more), the \s-1DBI\s0 and DBD::Oracle
Perl modules to be installed. These are used to connect to the Oracle database.
To install DBD::Oracle and have it working you need to have the Oracle client
libraries installed and the \s-1ORACLE_HOME\s0 environment variable must be defined.
.SS "Optional"
.IX Subsection "Optional"
By default Ora2Pg dumps export to flat files, to load them into your PostgreSQL
database you need the PostgreSQL client (psql). If you don't have it on the
host running Ora2Pg you can always transfer these files to a host with the psql
client installed. If you prefer to load export 'on the fly', the perl module
DBD::Pg is required.
.PP
Ora2Pg allow to dump all output int a compressed gzip file, to do that you need
the Compress::Zlib Perl module or if you prefer using bzip2 compression, the
program bzip2 must be available in your \s-1PATH\s0.
.SS "Installing Ora2Pg"
.IX Subsection "Installing Ora2Pg"
Like any other Perl Module Ora2Pg can be installed with the following commands:
.PP
.Vb 4
\& tar xzf ora2pg\-8.x.tar.gz
\& cd ora2pg\-8.x/
\& perl Makefile.PL
\& make && make install
.Ve
.PP
This will install Ora2Pg.pm into your site Perl repository, ora2pg into
/usr/local/bin/ and ora2pg.conf into /etc/ora2pg/.
.SS "Packaging"
.IX Subsection "Packaging"
If you want to build binary package for your preferred Linux distribution take a
look at the packaging/ directory of the source tarball. There's everything to
build \s-1RPM\s0, Slackware and Debian packages. See \s-1README\s0 file in that directory.
.SH "CONFIGURATION"
.IX Header "CONFIGURATION"
Ora2Pg configuration can be as simple as choose the Oracle database to export
and choose the export type. This can be done in the minute.
.PP
By reading this documentation you will also be able to:
.PP
.Vb 6
\& \- Select only certain tables and/or column for export.
\& \- Rename some tables and/or column during export.
\& \- Select datas to export following a WHERE clause per table.
\& \- Delay database constraints during data loading.
\& \- Compress exported data to save disk space.
\& \- and much more.
.Ve
.PP
The full control of the Oracle database migration is taken though a single
configuration file named ora2pg.conf. The format of this file consist in a
directive name in upper case followed by tab character and a value.
Comments are lines beginning with a #.
.SS "Ora2Pg usage"
.IX Subsection "Ora2Pg usage"
By default Ora2Pg will look for /etc/ora2pg/ora2pg.conf configuration file, if
the file exist you can simply execute:
.PP
.Vb 1
\& /usr/local/bin/ora2pg
.Ve
.PP
If you want to call another configuration file, just give the path as command
line argument:
.PP
.Vb 1
\& /usr/local/bin/ora2pg \-\-config /etc/ora2pg/new_ora2pg.conf
.Ve
.PP
Here are all command line parameters available since version 6.0:
.PP
Usage: ora2pg [\-dhvp] [\-\-option value]
.PP
.Vb 10
\& \-d | \-\-debug : Enable verbose output.
\& \-h | \-\-help : Print this short help.
\& \-v | \-\-version : Show Ora2Pg Version and exit.
\& \-c | \-\-conf file : Used to set an alternate configuration file than the
\& default /etc/or2pg/ora2pg.conf.
\& \-l | \-\-log file : Used to set a log file. Default is stdout.
\& \-o | \-\-out file : Used to set the path to the output file where SQL will
\& be written. Default: output.sql in running directory.
\& \-t | \-\-type export: Used to set the export type. It will override the one
\& given in the configuration file (TYPE).
\& \-p | \-\-plsql : Enable PLSQL to PLPSQL code conversion.
\& \-s | \-\-source dsn : Allow to set the Oracle DBI datasource.
\& \-u | \-\-user user : Used to set the Oracle database connection user.
\& \-w | \-\-password pass: Used to set the password of the Oracle database user.
\& \-n | \-\-namespace schema: Used to set the Oracle schema to extract from.
\& \-x | \-\-xtable relname: Used to display columns names of the given table,
\& could be used with SHOW_COLUMN type only.
\& \-f | \-\-forceowner : if set to 1 force ora2pg to set tables and sequences
\& owner. If the value is set to a username this one will
\& be set as the objects owner.
\& \-\-nls_lang code: use this to set the Oracle NLS_LANG client encoding.
\& \-\-client_encoding code: Use this to set the PostgreSQL client encoding.
\& \-i | \-\-input_file file: File containing Oracle PL/SQL code to convert with
\& no Oracle database connection initiated.
.Ve
.PP
Previous version do not accept any command line parameter than the path to the
configuration file.
.SS "Oracle database connection"
.IX Subsection "Oracle database connection"
There's 5 configuration directives to control the access to the Oracle database.
.IP "\s-1ORACLE_HOME\s0" 4
.IX Item "ORACLE_HOME"
Used to set \s-1ORACLE_HOME\s0 environment variable to the Oracle libraries required
by the DBD::Oracle Perl module.
.IP "\s-1ORACLE_DSN\s0" 4
.IX Item "ORACLE_DSN"
This directive is used to set the data source name in the form standard \s-1DBI\s0 \s-1DSN\s0.
For example:
.Sp
.Vb 1
\& dbi:Oracle:host=oradb_host.mydom.dom;sid=TEST
.Ve
.Sp
or
.Sp
.Vb 1
\& dbi:Oracle:DB_SID
.Ve
.Sp
The \s-1SID\s0 must be declared in the \f(CW$ORACLE_HOME\fR/network/admin/tnsnames.ora file.
.IP "\s-1ORACLE_USER\s0 et \s-1ORACLE_PWD\s0" 4
.IX Item "ORACLE_USER et ORACLE_PWD"
These two directives are used to define the user and password for the Oracle
database connection. Note that if you can it is better to login as Oracle super
admin to avoid grants problem during the database scan and be sure that nothing
is missing.
.IP "\s-1USER_GRANTS\s0" 4
.IX Item "USER_GRANTS"
Set this directive to 1 if you connect the Oracle database as simple user and
do not have enough grants to extract things from the \s-1DBA_\s0... tables. It will
use tables \s-1ALL_\s0... instead.
.Sp
Warning: if you use export type \s-1GRANT\s0, you must set this configuration option
to 0 or it will not works.
.IP "\s-1TRANSACTION\s0" 4
.IX Item "TRANSACTION"
This directive may be used if you want to change the default isolation level of
the data export transaction. Default is now to set the level to a serializable
transaction to ensure data consistency. The allowed values for this directive
are:
.Sp
.Vb 4
\& readonly: \*(AqSET TRANSACTION READ ONLY\*(Aq,
\& readwrite: \*(AqSET TRANSACTION READ WRITE\*(Aq,
\& serializable: \*(AqSET TRANSACTION ISOLATION LEVEL SERIALIZABLE\*(Aq
\& committed: \*(AqSET TRANSACTION ISOLATION LEVEL READ COMMITTED\*(Aq,
.Ve
.Sp
Releases before 6.2 used to set the isolation level to \s-1READ\s0 \s-1ONLY\s0 transaction
but in some case this was breaking data consistency so now default is set to
\&\s-1SERIALIZABLE\s0.
.IP "\s-1INPUT_FILE\s0" 4
.IX Item "INPUT_FILE"
This directive did not control the Oracle database connection or unless it
purely disable the use of any Oracle database by accepting a file as argument.
Set this directive to a file containing \s-1PL/SQL\s0 Oracle Code like function,
procedure or full package body to prevent Ora2Pg from connecting to an
Oracle database end just apply his convertion tool to the content of the
file. This can only be used with the following export type: \s-1PROCEDURE\s0,
\&\s-1FUNCTION\s0 or \s-1PACKAGE\s0. If you don't know what you do don't use this directive, I
use it to find \s-1PL/SQL\s0 parser and \s-1PL/PGSQL\s0 converter issues.
.SS "Testing"
.IX Subsection "Testing"
Once you have set the Oracle database \s-1DSN\s0 you can execute ora2pg to see if
it works. By default the configuration file will export the database schema to
a file called 'output.sql'. Take a look in it to see if the schema has been
exported.
.PP
Take some time here to test your installation as most of the problem take place
here, the other configuration step are more technical.
.SS "Trouble shooting"
.IX Subsection "Trouble shooting"
If the output.sql file has not exported anything else than the Pg transaction
header and footer there's two possible reasons. The perl script ora2pg dump
an ORA-XXX error, that mean that you \s-1DSN\s0 or login information are wrong, check
the error and your settings and try again. The perl script says nothing and the
output file is empty: the user has not enough right to extract something from
the database. Try to connect Oracle as super user or take a look at directive
\&\s-1USER_GRANTS\s0 above and at next section, especiallly the \s-1SCHEMA\s0 directive.
.SS "Oracle schema to export"
.IX Subsection "Oracle schema to export"
The Oracle database export can be limited to a specific Schema or Namespace,
this can be mandatory following the database connection user.
.IP "\s-1SCHEMA\s0" 4
.IX Item "SCHEMA"
This directive is used to set the schema name to use during export. Take care that this directive is case sensitive. For example:
.Sp
.Vb 1
\& SCHEMA APPS
.Ve
.Sp
will only extract objects associated to the \s-1APPS\s0 schema.
.IP "\s-1EXPORT_SCHEMA\s0" 4
.IX Item "EXPORT_SCHEMA"
By default the Oracle schema is not exported into the PostgreSQL database and
all objects are created under the default Pg namespace. If you want to also
export this schema and create all objects under this namespace, set the
\&\s-1EXPORT_SCHEMA\s0 directive to 1. This will set the schema search_path at top of
export \s-1SQL\s0 file to the schema name set in the \s-1SCHEMA\s0 directive with the default
pg_catalog schema. If you want to change this path, use the directive \s-1PG_SCHEMA\s0.
.IP "\s-1COMPILE_SCHEMA\s0" 4
.IX Item "COMPILE_SCHEMA"
By default Ora2Pg will only export valid \s-1PL/SQL\s0 code. You can force Oracle to
compile again the invalidated code to get a chance to have it obtain the valid
status and then be able to export it.
.Sp
Enable this directive to force Oracle to compile schema before exporting code.
This will ask to Oracle to validate the \s-1PL/SQL\s0 that could have been invalidate
after a export/import for example. If you set the value to 1 it will exec:
\&\s-1DBMS_UTILITY\s0.compile_schema(schema => sys_context('\s-1USERENV\s0', '\s-1SESSION_USER\s0'));
but if you provide the name of a particular schema it will use the following
command: \s-1DBMS_UTILITY\s0.compile_schema(schema => 'schemaname');
The '\s-1VALID\s0' or '\s-1INVALID\s0' status applies to functions, procedures, packages and
user defined types.
.IP "\s-1EXPORT_INVALID\s0" 4
.IX Item "EXPORT_INVALID"
If the above configuration directive is not enough to validate your \s-1PL/SQL\s0 code
enable this configuration directive to allow export of all \s-1PL/SQL\s0 code even if
it is marked as invalid. The '\s-1VALID\s0' or '\s-1INVALID\s0' status applies to functions,
procedures, packages and user defined types.
.IP "\s-1PG_SCHEMA\s0" 4
.IX Item "PG_SCHEMA"
Allow you to defined/force the PostgreSQL schema to use. The value can be a
coma delimited list of schema name. By default if you set \s-1EXPORT_SCHEMA\s0 to 1,
the PostgreSQL schema search_path will be set to the schema name set as value of
the \s-1SCHEMA\s0 directive plus the default pg_catalog schema as follow:
.Sp
.Vb 1
\& SET search_path = $SCHEMA, pg_catalog;
.Ve
.Sp
If you set \s-1PG_SCHEMA\s0 to something like \*(L"user_schema, public\*(R" for example the
search path will be set like this:
.Sp
.Vb 2
\& SET search_path = $PG_SCHEMA;
\& \-\- SET search_path = user_schema, public;
.Ve
.Sp
This will force to not use the Oracle schema set in the \s-1SCHEMA\s0 directive.
.IP "\s-1SYSUSERS\s0" 4
.IX Item "SYSUSERS"
Without explicit schema, Ora2Pg will export all objects that not belongs to
system schema or role: \s-1SYS\s0, \s-1SYSTEM\s0, \s-1DBSNMP\s0, \s-1OUTLN\s0, \s-1PERFSTAT\s0, \s-1CTXSYS\s0, \s-1XDB\s0, \s-1WMSYS\s0,
\&\s-1SYSMAN\s0, \s-1SQLTXPLAIN\s0, \s-1MDSYS\s0, \s-1EXFSYS\s0, \s-1ORDSYS\s0, \s-1DMSYS\s0, \s-1OLAPSYS\s0, \s-1FLOWS_020100\s0,
\&\s-1FLOWS_FILES\s0, \s-1TSMSYS\s0. Following your Oracle installation you may have several
other system role defined. To append these users to the schema exclusion list,
just set the \s-1SYSUSERS\s0 configuration directive to a coma separated list of system
user to exclude. For example:
.Sp
.Vb 1
\& SYSUSERS INTERNAL,SYSDBA
.Ve
.Sp
will add users \s-1INTERNAL\s0 and \s-1SYSDBA\s0 to the schema exclusion list.
.IP "\s-1FORCE_OWNER\s0" 4
.IX Item "FORCE_OWNER"
By default the owner of the database objects is the one you're using to connect
to PostgreSQL using the psql command. If you use an other user (postgres for exemple)
you can force Ora2Pg to set the object owner to be the one used in the Oracle database
by setting the directive to 1, or to a completely different username by setting the
directive value to that username.
.SS "Export type"
.IX Subsection "Export type"
The export action is perform following a single configuration directive '\s-1TYPE\s0',
some other add more control on what should be really exported.
.IP "\s-1TYPE\s0" 4
.IX Item "TYPE"
Here are the different values of the \s-1TYPE\s0 directive, default is \s-1TABLE:\s0
.Sp
.Vb 10
\& \- TABLE: Extract all tables with indexes, primary keys, unique keys,
\& foreign keys and check constraints.
\& \- VIEW: Extract only views.
\& \- GRANT: Extract roles converted to Pg groups, users and grants on all
\& objects.
\& \- SEQUENCE: Extract all sequence and their last position.
\& \- TABLESPACE: Extract storage spaces for tables and indexes (Pg >= v8).
\& \- TRIGGER: Extract triggers defined following actions.
\& \- FUNCTION: Extract functions.
\& \- PROCEDURE: Extract procedures.
\& \- PACKAGE: Extract packages and package bodies.
\& \- DATA: Extract datas as INSERT statement.
\& \- COPY: Extract datas as COPY statement.
\& \- PARTITION: Extract range and list Oracle partitioning.
\& \- TYPE: Extract user defined Oracle type.
.Ve
.Sp
Only one type of export can be perform at the same time so the \s-1TYPE\s0 directive
must be unique. If you have more than one only the last found in the file will
be registered.
.Sp
Some export type can not or should not be load directly into the PostgreSQL
database and still require little manual editing. This is the case for \s-1GRANT\s0,
\&\s-1TABLESPACE\s0, \s-1TRIGGER\s0, \s-1FUNCTION\s0, \s-1PROCEDURE\s0, \s-1TYPE\s0 and \s-1PACKAGE\s0 export types
especially if you have \s-1PLSQL\s0 code or Oracle specific \s-1SQL\s0 in it.
.Sp
For \s-1TABLESPACE\s0 you must ensure that file path exist on the system.
.Sp
Note that you can chained multiple export by giving to the \s-1TYPE\s0 directive a
coma separated list of export type.
.Sp
The \s-1PARTITION\s0 export is a work in progress as table partition support is not
yet implemented into PostgreSQL. Ora2Pg will convert Oracle partition using
table inheritence, trigger and function workaround. See document at Pg site:
http://www.postgresql.org/docs/current/interactive/ddl\-partitioning.html
This new feature in Ora2Pg has not been widly tested so feel free to report
any bug and patch.
.Sp
The \s-1TYPE\s0 export allow export of user defined Oracle type. If you don't use the
\&\-\-plsql command line parameter it simply dump Oracle user type asis else Ora2Pg
will try to convert it to PostgreSQL syntax.
.Sp
Since Ora2Pg v8.1 there's three new export types:
.Sp
.Vb 3
\& SHOW_SCHEMA : display the list of schema available in the database.
\& SHOW_TABLE : display the list of tables available.
\& SHOW_COLUMN : display the list of tables columns available.
.Ve
.Sp
Since Ora2Pg v8.2 there's a new export type:
.Sp
.Vb 1
\& SHOW_ENCODING : display the Oracle session encoding, useful to set NSL_LANG.
.Ve
.Sp
Those extraction keyword are use to only display the requested information and exit.
This allow you to quickly know on what you are going to work. The \s-1SHOW_COLUMN\s0 allow
a new ora2pg command line option: '\-\-xtable relname' or '\-x relname' to limit the
displayed information to the given table.
.IP "\s-1THREAD_COUNT\s0" 4
.IX Item "THREAD_COUNT"
This configuration directive adds multi-threading support to data export type, the
value is the number of threads to use. Default to zero, disabled multi-threading.
It is only used to do the escaping to convert LOBs to byteas, as it is very \s-1CPU\s0
hungry. Putting 6 threads will only triple your throughput, if your machine has
enough cores. If zero do not use threads, do not waste \s-1CPU\s0, but be slower with bytea.
Performance seems to peak at 5 threads, if you have enough cores, and triples throughput
on tables having \s-1LOB\s0. Another important thing: because of the way threading works in
perl, threads consume a lot of memory. Put a low (5000 for instance) \s-1DATA_LIMIT\s0 if
you activate threading.
.Sp
If your Perl installation do not support threads, multi-threading will not be enabled.
This configuration directive is available since Ora2Pg v8.7 thanks to the work of
Marc Cousin.
.SS "Limiting object to export"
.IX Subsection "Limiting object to export"
You may want to export only a part of an Oracle database, here are a set of configuration
directives that will allow you to control what parts of the database should be exported.
.IP "\s-1TABLES\s0" 4
.IX Item "TABLES"
This directive allow you to set a list of tables on witch the export must be
limited, excluding all other tables. The value is a space separated list of
table name to export.
.IP "\s-1EXCLUDE\s0" 4
.IX Item "EXCLUDE"
This directive is the opposite of the previous, it allow you to define a space
separated list of table name to exclude from the export.
.IP "\s-1WHERE\s0" 4
.IX Item "WHERE"
This directive allow you to specify a \s-1WHERE\s0 clause filter when dumping the
contents of tables. Value is construct as follow: TABLE_NAME[\s-1WHERE_CLAUSE\s0], or
if you have only one where clause for each table just put the where clause as
value. Both are possible too. Here are some examples:
.Sp
.Vb 2
\& # Global where clause applying to all tables included in the export
\& WHERE 1=1
\&
\& # Apply the where clause only on table TABLE_NAME
\& WHERE TABLE_NAME[ID1=\*(Aq001\*(Aq]
\&
\& # Applies two different clause on tables TABLE_NAME and OTHER_TABLE
\& # and a generic where clause on DATE_CREATE to all other tables
\& WHERE TABLE_NAME[ID1=\*(Aq001\*(Aq AND ID1=\*(Aq002] DATE_CREATE > \*(Aq2001\-01\-01\*(Aq OTHER_TABLE[NAME=\*(Aqtest\*(Aq]
.Ve
.Sp
Any where clause not included into a table name bracket clause will be applied
to all exported table including the tables defined in the where clause. These
\&\s-1WHERE\s0 clauses are very useful if you want to archive some data or at the
opposite only export some recent data.
.SS "Modifying object structure"
.IX Subsection "Modifying object structure"
One of the great usage of Ora2Pg is its flexibility to replicate Oracle database
into PostgreSQL database with a different structure or schema. There's three
configuration directives that allow you to map those differences.
.IP "\s-1MODIFY_STRUCT\s0" 4
.IX Item "MODIFY_STRUCT"
This directive allow you to limit the columns to extract for a given table. The
value consist in a space separated list of table name with a set of column
between parenthesis as follow:
.Sp
.Vb 1
\& MODIFY_STRUCT NOM_TABLE(nomcol1,nomcol2,...) ...
.Ve
.Sp
for example:
.Sp
.Vb 1
\& MODIFY_STRUCT T_TEST1(id,dossier) T_TEST2(id,fichier)
.Ve
.Sp
This will only extract columns 'id' and 'dossier' from table T_TEST1 and columns
\&'id' and 'fichier' from the T_TEST2 table.
.IP "\s-1REPLACE_TABLES\s0" 4
.IX Item "REPLACE_TABLES"
This directive allow you to remap a list of Oracle table name to a PostgreSQL table name during export. The value is a list of space separated values with the following structure:
.Sp
.Vb 1
\& REPLACE_TABLES ORIG_TBNAME1:DEST_TBNAME1 ORIG_TBNAME2:DEST_TBNAME2
.Ve
.Sp
Oracle tables \s-1ORIG_TBNAME1\s0 and \s-1ORIG_TBNAME2\s0 will be respectively renamed into
\&\s-1DEST_TBNAME1\s0 and \s-1DEST_TBNAME2\s0
.IP "\s-1REPLACE_COLS\s0" 4
.IX Item "REPLACE_COLS"
Like table name, the name of the column can be remapped to a different name
using the following syntaxe:
.Sp
.Vb 1
\& REPLACE_COLS ORIG_TBNAME(ORIG_COLNAME1:NEW_COLNAME1,ORIG_COLNAME2:NEW_COLNAME2)
.Ve
.Sp
For example:
.Sp
.Vb 1
\& REPLACE_COLS T_TEST(dico:dictionary,dossier:folder)
.Ve
.Sp
will rename Oracle columns 'dico' and 'dossier' from table T_TEST into new name
\&'dictionary' and 'folder'.
.SS "PostgreSQL Import"
.IX Subsection "PostgreSQL Import"
By default conversion to PostgreSQL format is written to file 'output.sql'.
The command:
.PP
.Vb 1
\& psql mydb < output.sql
.Ve
.PP
will import content of file output.sql into PostgreSQL mydb database.
.IP "\s-1DATA_LIMIT\s0" 4
.IX Item "DATA_LIMIT"
When you are performing \s-1DATA/COPY\s0 export Ora2Pg proceed by chunks of \s-1DATA_LIMIT\s0
tuples for speed improvement. Tuples are stored in memory before being written
to disk, so if you want speed and have enough system resources you can grow
this limit to an upper value for example: 100000 or 1000000. Before release 7.0
a value of 0 mean no limit so that all tuples are stored in memory before being
flushed to disk. In 7.x branch this has been remove and chunk will be set to the
default: 10000
.IP "\s-1OUTPUT\s0" 4
.IX Item "OUTPUT"
The Ora2Pg output filename can be changed with this directive. Default value is
output.sql. if you set the file name with extension .gz or .bz2 the output will
be automatically compressed. This require that the Compress::Zlib Perl module
is installed if the filename extension is .gz and that the bzip2 system command
is installed for the .bz2 extension.
.IP "\s-1OUTPUT_DIR\s0" 4
.IX Item "OUTPUT_DIR"
Since release 7.0, you can define a base directory where wfile will be written.
The directory must exists.
.IP "\s-1BZIP2\s0" 4
.IX Item "BZIP2"
This directive allow you to specify the full path to the bzip2 program if it
can not be found in the \s-1PATH\s0 environment variable.
.IP "\s-1FILE_PER_CONSTRAINT\s0" 4
.IX Item "FILE_PER_CONSTRAINT"
Allow object constraints to be saved in a separate file during schema export.
The file will be named \s-1CONSTRAINTS_OUTPUT\s0, where \s-1OUTPUT\s0 is the value of the
corresponding configuration directive. You can use .gz xor .bz2 extension to
enable compression. Default is to save all data in the \s-1OUTPUT\s0 file. This
directive is usable only with \s-1TABLE\s0 export type.
.IP "\s-1FILE_PER_INDEX\s0" 4
.IX Item "FILE_PER_INDEX"
Allow indexes to be saved in a separate file during schema export. The file
will be named \s-1INDEXES_OUTPUT\s0, where \s-1OUTPUT\s0 is the value of the corresponding
configuration directive. You can use .gz xor .bz2 file extension to enable
compression. Default is to save all data in the \s-1OUTPUT\s0 file. This directive
is usable only with \s-1TABLE\s0 export type.
.IP "\s-1FILE_PER_TABLE\s0" 4
.IX Item "FILE_PER_TABLE"
Allow data export to be saved in one file per table/view. The files will be
named as tablename_OUTPUT, where \s-1OUTPUT\s0 is the value of the corresponding
configuration directive. You can still use .gz xor .bz2 extension in the \s-1OUTPUT\s0
directive to enable compression. Default 0 will save all data in one file, set
it to 1 to enable this feature. This is usable only during \s-1DATA\s0 or \s-1COPY\s0 export
type.
.IP "\s-1FILE_PER_FUNCTION\s0" 4
.IX Item "FILE_PER_FUNCTION"
Allow functions, procedures and triggers to be saved in one file per object.
The files will be named as objectname_OUTPUT. Where \s-1OUTPUT\s0 is the value of the
corresponding configuration directive. You can still use .gz xor .bz2 extension
in the \s-1OUTPUT\s0 directive to enable compression. Default 0 will save all in one
single file, set it to 1 to enable this feature. This is usable only during the
corresponding export type, the package body export has a special behavior.
.Sp
When export type is \s-1PACKAGE\s0 and you've enabled this directive, Ora2Pg will
create a directory per package, named with the lower case name of the package,
and will create one file per function/procedure into that directory. If the
configuration directive is not enabled, it will create one file per package as
packagename_OUTPUT, where \s-1OUTPUT\s0 is the value of the corresponding directive.
.IP "\s-1TRUNCATE_TABLE\s0" 4
.IX Item "TRUNCATE_TABLE"
If this directive is set to 1, a \s-1TRUNCATE\s0 \s-1TABLE\s0 instruction will be add before
loading data. This is usable only during \s-1DATA\s0 or \s-1COPY\s0 export type.
.PP
If you want to import data on the fly to the PostgreSQL database you have three
configuration directives to set the PostgreSQL database connection. This is only
possible with '\s-1COPY\s0' or '\s-1DATA\s0' export type as for database schema there's no
real interest to do that.
.IP "\s-1PG_DSN\s0" 4
.IX Item "PG_DSN"
Use this directive to set the PostgreSQL data source namespace using DBD::Pg
Perl module as follow:
.Sp
.Vb 1
\& dbi:Pg:dbname=pgdb;host=localhost;port=5432
.Ve
.Sp
will connect to database 'pgdb' on localhost at tcp port 5432.
.IP "\s-1PG_USER\s0 and \s-1PG_PWD\s0" 4
.IX Item "PG_USER and PG_PWD"
These two directives are used to set the login user and password.
.SS "Taking export under control"
.IX Subsection "Taking export under control"
The following other configuration directives interact directly with the export process and give you fine granuality in database export control.
.IP "\s-1SKIP\s0" 4
.IX Item "SKIP"
For \s-1TABLE\s0 export you may not want to export all schema constraints, the \s-1SKIP\s0
configuration directive allow you to specify a space separated list of
constraints that should not be exported. Possible values are:
.Sp
.Vb 5
\& \- fkeys: turn off foreign key constraints
\& \- pkeys: turn off primary keys
\& \- ukeys: turn off unique column constraints
\& \- indexes: turn off all other index types
\& \- checks: turn off check constraints
.Ve
.Sp
For example:
.Sp
.Vb 1
\& SKIP indexes,checks
.Ve
.Sp
will removed indexes ans check constraints from export.
.IP "\s-1KEEP_PKEY_NAMES\s0" 4
.IX Item "KEEP_PKEY_NAMES"
By default names of the primary key in the source Oracle database are ignored
and key names are created in the target PostgreSQL database with the PostgreSQL
internal default naming rules. If you want to preserve Oracle primary key names
set this option to 1.
.IP "\s-1FKEY_DEFERRABLE\s0" 4
.IX Item "FKEY_DEFERRABLE"
When exporting tables, Ora2Pg normally exports constraints as they are, if they
are non-deferrable they are exported as non-deferrable. However, non-deferrable
constraints will probably cause problems when attempting to import data to Pg.
The \s-1FKEY_DEFERRABLE\s0 option set to 1 will cause all foreign key constraints to
be exported as deferrable.
.IP "\s-1DEFER_FKEY\s0" 4
.IX Item "DEFER_FKEY"
In addition, when exporting data the \s-1DEFER_FKEY\s0 option set to 1 will add a
command to defer all foreign key constraints during data export. Constraints
will then be checked at the end of each transaction. Note that this will works
only if foreign keys are deferrable and that all datas can stay in a single
transaction.
.Sp
Since release 7.0 Ora2Pg will first try to ordered data export following the
tables foreign keys. If it fails (some cases can not be handle), Ora2Pg will
set constraint all deferrable if \s-1DEFER_FKEY\s0 is activated and \s-1DROP_FKEY\s0 disabled.
.IP "\s-1DROP_FKEY\s0" 4
.IX Item "DROP_FKEY"
New since release 7.0 this directive enabled force the deletion of all foreign
keys before data import and to recreate them at end of the import.
.IP "\s-1DROP_INDEXES\s0" 4
.IX Item "DROP_INDEXES"
This direction is also introduce since version 7.0 and allow you to gain lot of
speed improvement during data import by removing all indexes that are not an
automatic index (ex: indexes of primary keys) and recreate them at the end of
data import.
.IP "\s-1DISABLE_TABLE_TRIGGERS\s0" 4
.IX Item "DISABLE_TABLE_TRIGGERS"
This directive is used to disables triggers on all tables in \s-1COPY\s0 or \s-1DATA\s0 export
modes during data migration. The possible values are 0 to enable triggers, \s-1USER\s0
to disable userdefined triggers and \s-1ALL\s0 to disable userdefined triggers as well
as includes \s-1RI\s0 system triggers.
.IP "\s-1DISABLE_SEQUENCE\s0" 4
.IX Item "DISABLE_SEQUENCE"
If set to 1 disables alter of sequences on all tables during \s-1COPY\s0 or \s-1DATA\s0 export
mode. This is used to prevent the update of sequence during data migration.
Default is 0, alter sequences.
.IP "\s-1NOESCAPE\s0" 4
.IX Item "NOESCAPE"
By default all datas exported as \s-1INSERT\s0 statement are escaped, if you experience
any problem with that set it to 1 to disable character escaping during data
export.
.IP "\s-1PG_NUMERIC_TYPE\s0" 4
.IX Item "PG_NUMERIC_TYPE"
This directive set to 1 replace portable numeric type into PostgreSQL internal
type as numeric(p,s) type is much slower than the different PostgreSQL numeric
types. Oracle data type \s-1NUMBER\s0(p,s) is approximatively converted to smallint,
integer, bigint, real and float PostgreSQL numeric type following the precision.
If you have lot of monetary fields you should preserve the numeric(p,s) Pg data
type if you need very good precision. \s-1NUMBER\s0 without precision are set to float
unless you redefine it with the \s-1DEFAULT_NUMERIC\s0 configuration option.
.IP "\s-1DEFAULT_NUMERIC\s0" 4
.IX Item "DEFAULT_NUMERIC"
\&\s-1NUMBER\s0 without precision are converted by default to bigint if \s-1PG_NUMERIC_TYPE\s0
is true. You can overwrite this value to any \s-1PG\s0 numeric type, like smallint or
integer. Note that before release 7.0 the value was wrongly set to float.
.IP "\s-1DATA_TYPE\s0" 4
.IX Item "DATA_TYPE"
If you're experiencing any problem in data type schema conversion with this
directive you can take full control of the correspondence between Oracle and
PostgreSQL types to redefine data type translation used in Ora2pg. The syntax
is a coma separated list of \*(L"Oracle datatype:Postgresql datatype\*(R". Here are
the default list used:
.Sp
.Vb 1
\& DATA_TYPE DATE:timestamp,LONG:text,LONG RAW:text,CLOB:text,NCLOB:text,BLOB:bytea,BFILE:bytea,RAW:bytea,ROWID:oid,FLOAT:double precision,DEC:decimal,DECIMAL:decimal,DOUBLE PRECISION:double precision,INT:integer,INTEGER:integer,REAL:real,SMALLINT:smallint,BINARY_FLOAT:double precision,BINARY_DOUBLE:double precision,TIMESTAMP:timestamp
.Ve
.Sp
Note that the directive and the list definition must be a single line.
.IP "\s-1CASE_SENSITIVE\s0" 4
.IX Item "CASE_SENSITIVE"
By default Ora2P convert all object names to lower case as PostgreSQL is case
insensitive. If you want to preserve the case of Oracle object name set this
directive to 1. I do not recommand this unless you always quote object names
on all your scripts.
.IP "\s-1ORA_SENSITIVE\s0" 4
.IX Item "ORA_SENSITIVE"
Since version 4.10 you can export Oracle databases with case sensitive table or
view names. This requires the use of quoted table/view names during Oracle
querying. Set this configuration option to 1 to enable this feature. By default
it is off.
.IP "\s-1ORA_RESERVED_WORDS\s0" 4
.IX Item "ORA_RESERVED_WORDS"
Allow escaping of column name using Oracle reserved words. Value is a list of
coma separated reserved word. Default is audit,comment.
.IP "\s-1GEN_USER_PWD\s0" 4
.IX Item "GEN_USER_PWD"
Set this directive to 1 to replace default password by a random password for all
extracted user during a \s-1GRANT\s0 export.
.IP "\s-1PG_SUPPORTS_ROLE\s0 (Deprecated)" 4
.IX Item "PG_SUPPORTS_ROLE (Deprecated)"
This option is deprecated since Ora2Pg release v7.3.
.Sp
By default Oracle roles are translated into PostgreSQL groups. If you have
PostgreSQL 8.1 or more consider the use of \s-1ROLES\s0 and set this directive to 1
to export roles.
.IP "\s-1PG_SUPPORTS_INOUT\s0 (Deprecated)" 4
.IX Item "PG_SUPPORTS_INOUT (Deprecated)"
This option is deprecated since Ora2Pg release v7.3.
.Sp
If set to 0, all \s-1IN\s0, \s-1OUT\s0 or \s-1INOUT\s0 parameters will not be used into the generated
PostgreSQL function declarations (disable it for PostgreSQL database version
lower than 8.1), This is now enable by default.
.IP "\s-1PG_SUPPORTS_DEFAULT\s0" 4
.IX Item "PG_SUPPORTS_DEFAULT"
This directive enable or disable the use of default parameter value in function export. Until PostgreSQL 8.4 such a default value was not supported, this feature is now enable by default.
.IP "\s-1PG_SUPPORTS_WHEN\s0" 4
.IX Item "PG_SUPPORTS_WHEN"
Add support to \s-1WHEN\s0 clause on triggers as PostgreSQL v9.0 now support it. This directive is disabled by default, set it to 1 enable this feature.
.IP "\s-1PG_SUPPORTS_INSTEADOF\s0" 4
.IX Item "PG_SUPPORTS_INSTEADOF"
Add support to \s-1INSTEAD\s0 \s-1OF\s0 usage on triggers (for incoming \s-1PG\s0 >= 9.1), if this directive is not enabled the \s-1INSTEAD\s0 \s-1OF\s0 triggers will be rewritten as Pg rules.
.IP "\s-1LONGREADLEN\s0" 4
.IX Item "LONGREADLEN"
Use this directive to set the database handle's 'LongReadLen' attribute to a value that will be the larger than the expected size of the LOBs. The default is 1Mb witch may not be enough to extract BLOBs or CLOBs. If the size of the \s-1LOB\s0 exceeds the 'LongReadLen' DBD::Oracle will return a '\s-1ORA\-24345:\s0 A Truncation' error. Default: 1023*1024 bytes.
.Sp
Take a look at this page to learn more: http://search.cpan.org/~pythian/DBD\-Oracle\-1.22/Oracle.pm#Data_Interface_for_Persistent_LOBs
.IP "\s-1LONGTRUNKOK\s0" 4
.IX Item "LONGTRUNKOK"
If you want to bypass the '\s-1ORA\-24345:\s0 A Truncation' error, set this directive to 1, it will truncate the data extracted to the LongReadLen value. Disable by default.
.SS "Special options to handle character encoding"
.IX Subsection "Special options to handle character encoding"
.IP "\s-1NLS_LANG\s0" 4
.IX Item "NLS_LANG"
If you experience any issues where mutibyte characters are being substituted
with some replacement characters during the export try to set the \s-1NLS_LANG\s0
configuration directive to the Oracle encoding. This may help a lot especially
with \s-1UTF8\s0 encoding. For example:
.Sp
.Vb 1
\& NLS_LANG AMERICAN_AMERICA.UTF8
.Ve
.Sp
This will set \f(CW$ENV\fR{\s-1NLS_LANG\s0} to the given value.
.IP "\s-1BINMODE\s0" 4
.IX Item "BINMODE"
If you experience the Perl warning: \*(L"Wide character in print\*(R", it means that
you tried to write a Unicode string to a non-unicode file handle. You can force
Perl to use binary mode for output by setting the \s-1BINMODE\s0 configuration option
to the specified encoding. If you set it to 'utf8', it will force printing like
this: binmode \s-1OUTFH\s0, \*(L":utf8\*(R"; By default Ora2Pg opens the output file in 'raw'
binary mode.
.IP "\s-1CLIENT_ENCODING\s0" 4
.IX Item "CLIENT_ENCODING"
If you experience \s-1ERROR:\s0 invalid byte sequence for encoding \*(L"\s-1UTF8\s0\*(R": 0xe87472
when loading data you may want to set the encoding of the PostgreSQL client.
By default it is not set and it will depend of you system client encoding.
.Sp
For example, let's say you have an Oracle database with all data encoded in
\&\s-1FRENCH_FRANCE\s0.WE8ISO8859P15, your system use fr_FR.UTF\-8 as console encoding
and your PostgreSQL database is encoded in \s-1UTF8\s0. What you have to do is set the
\&\s-1NLS_LANG\s0 to \s-1FRENCH_FRANCE\s0.WE8ISO8859P15 and the \s-1CLIENT_ENCODING\s0 to \s-1LATIN9\s0.
.Sp
You can take a look at the PostgreSQL supported character sets here: http://www.postgresql.org/docs/9.0/static/multibyte.html
.SS "\s-1PLSQL\s0 to \s-1PLPSQL\s0 convertion"
.IX Subsection "PLSQL to PLPSQL convertion"
Automatic code convertion from Oracle \s-1PLSQL\s0 to PostgreSQL \s-1PLPGSQL\s0 is a work in
progress in Ora2Pg and surely you will always have manual work. The Perl code
used for automatic conversion is all stored in a specific Perl Module named
Ora2Pg/PLSQL.pm feel free to modify/add you own code and send me patches. The
main work in on function, procedure, package and package body headers and
parameters rewrite.
.IP "\s-1PLSQL_PGSQL\s0" 4
.IX Item "PLSQL_PGSQL"
Enable/disable \s-1PLSQL\s0 to \s-1PLPSQL\s0 convertion. Enabled by default since 8.x.
.IP "\s-1ALLOW_CODE_BREAK\s0" 4
.IX Item "ALLOW_CODE_BREAK"
This directive is use to enable/disable the plsql to pgplsql conversion part
that could break the original code if they include complex subqueries.
Default is enabled, you must disabled if to preserve backward compatibility.
This concern the following replacement: \fIdecode()\fR, \fIsubstr()\fR
.Sp
For example code like this:
.Sp
.Vb 1
\& substr(decode("db_status",\*(Aqactive\*(Aq,"dbname",null),1,128)
.Ve
.Sp
can easily be replaced by the PostgreSQL equivalent:
.Sp
.Vb 1
\& substring((CASE WHEN "db_status"=\*(Aqactive\*(Aq THEN "dbname" ELSE NULL END) from 1 for 128))
.Ve
.Sp
The problem could comes when you introduce subquery into one of the \fIsubstr()\fR
or \fIdecode()\fR parameter. For example the replacement of
.Sp
.Vb 1
\& substr(decode("db_status",(select status from dbcluster where lbl=substr("dbname",1,3)),"dbname",null),1,128)
.Ve
.Sp
will break the code. You can still compare to the original Oracle code and
solve the problem, but if you want you can disable this unsecure replacement.
.SS "Other configuration directives"
.IX Subsection "Other configuration directives"
.IP "\s-1DEBUG\s0" 4
.IX Item "DEBUG"
Set it to 1 will enable verbose output.
.IP "\s-1IMPORT\s0" 4
.IX Item "IMPORT"
You can define common Ora2Pg configuration directives into a single file that can be imported into other configuration files with the \s-1IMPORT\s0 configuration directive as follow:
.Sp
.Vb 1
\& IMPORT commonfile.conf
.Ve
.Sp
will import all configuration directives defined into commonfile.conf into the
current configuration file.
.SH "SUPPORT"
.IX Header "SUPPORT"
.SS "Author / Maintainer"
.IX Subsection "Author / Maintainer"
Gilles Darold <gilles \s-1AT\s0 darold \s-1DOT\s0 net>
.PP
Please report any bugs, patches, help, etc. to <gilles \s-1AT\s0 darold \s-1DOT\s0 net>.
.SS "Feature request"
.IX Subsection "Feature request"
If you need new features let me know at <gilles \s-1AT\s0 darold \s-1DOT\s0 net>. This help
a lot to develop a better/useful tool.
.SS "How to contribute ?"
.IX Subsection "How to contribute ?"
Any contribution to build a better tool is welcome, you just have to send me
your ideas, features request or patches and there will be applied.
.SH "LICENSE"
.IX Header "LICENSE"
Copyright (c) 2000\-2011 Gilles Darold \- All rights reserved.
.PP
.Vb 4
\& This program is free software: you can redistribute it and/or modify
\& it under the terms of the GNU General Public License as published by
\& the Free Software Foundation, either version 3 of the License, or
\& any later version.
\&
\& This program is distributed in the hope that it will be useful,
\& but WITHOUT ANY WARRANTY; without even the implied warranty of
\& MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\& GNU General Public License for more details.
\&
\& You should have received a copy of the GNU General Public License
\& along with this program. If not, see < http://www.gnu.org/licenses/ >.
.Ve
.SH "ACKNOWLEDGEMENT"
.IX Header "ACKNOWLEDGEMENT"
I must thanks a lot all the great contributors:
.PP
.Vb 10
\& Guillaume Lelarge
\& Stephane Schildknecht
\& Jean\-Paul Argudo
\& Jan Kester
\& Paolo Mattioli
\& Mike Wilhelm\-hiltz
\& Jefferson Medeiros
\& Ian Boston
\& Thomas Wegner
\& Andreas Haumer
\& Marco Lombardo
\& Adam Sah and Zedo Inc
\& Antonios Christofide and National Technical University of Athens
\& Josian Larcheveque
\& Stephane Silly
\& David Cotter \- Alatto Technologies Ltd
\& Wojciech Szenajch
\& Richard Chen
\& Sergio Freire
\& Matt Miller
\& Rene Bentzen
\& Schnabl Andrea
\& Ugo Brunel \- Bull
\& Bernd Helmle \- credativ GmbH
\& Peter Eisentraut
\& Marc Cousin
\& Daniel Scott
\& Luca DallOlio
\& Ali Pouya
\& Olivier Mazain
\& Brendan Richards
\& Andrea Agosti
\& Reto Buchli (WSL IT)
\& Leonardo Cezar
\& Herve Girres
\& Daniel Scott
\& Alexander Korotkov
\& Philippe Rimbault
\& Sam Nelson
\& Krasi Zlatev
\& Henk Enting
.Ve
.PP
and all others who help me to build a useful and reliable product:
.PP
.Vb 10
\& Jason Servetar
\& Jean\-Francois Ripouteau
\& Octavi Fors
\& Adriano Bonat
\& Thomas Reiss
\& Bozkurt Erkut from SONY
\& Igor MII
\& Julian Moreno Patino \- Debian Maintainer
\& Mathieu Wingel
\& Mindy Markowitz
\& Jehan Guillaume de Rorthais
\& Aaron Culich
\& Sriram Chandrasekaran
\& ...
.Ve
|