.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" 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" '' . ds C` . ds C' '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 >0, 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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Ora2Pg 3pm" .TH Ora2Pg 3pm "2016-12-02" "perl v5.24.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 "SYNOPSIS" .IX Header "SYNOPSIS" Ora2pg has a companion script called ora2pg. When use in conjonction with a custom version of ora2pg.conf they perform what I'm trying to explain bellow. See content of the ora2pg.conf file for more explanation on configuration directives. .PP .Vb 1 \& use Ora2Pg; \& \& # Create an instance of the Ora2Pg Perl module \& my $schema = new Ora2Pg (config => \*(Aq./ora2pg.conf\*(Aq); \& \& # Create a PostgreSQL representation of Oracle export \& # you\*(Aqve defined in ora2pg.conf. \& $schema\->export_schema(); \& \& exit(0); .Ve .PP You can always overwrite any configuration option set in ora2pg.conf by passing a hash where keys are the same that in configuration file but in lower case. For example, if you only want to extract only a selection of tables: .PP .Vb 10 \& my @tables = (\*(Aqt1\*(Aq, \*(Aqt2\*(Aq, \*(Aqt3\*(Aq); \& my $schema = new Ora2Pg ( \& datasource => $dbsrc, # Oracle DBD datasource \& user => $dbuser, # Database user \& password => $dbpwd, # Database password \& tables => \e@tables, \& # or \& # tables => [(\*(Aqtab1\*(Aq,\*(Aqtab2\*(Aq)], # Tables to extract \& debug => 1 # Verbose running. \& ); .Ve .PP To choose a particular Oracle schema to export just set the following option to your schema name: .PP .Vb 1 \& schema => \*(AqAPPS\*(Aq .Ve .PP This schema definition can also be needed when you want to export data. If export fails and complaining that the table doesn't exists use this directive to prefix the table name by the schema name. .PP If you want to use PostgreSQL 7.4+ schema support set the init option \&'export_schema' set to 1. Default is no schema export. .PP You can process multiple types of extractions at the same time by setting the value to a space separated list of the following keywords. .PP To extract all views set the type option as follows: .PP .Vb 1 \& type => \*(AqVIEW\*(Aq .Ve .PP To extract all grants set the type option as follows: .PP .Vb 1 \& type => \*(AqGRANT\*(Aq .Ve .PP To extract all sequences set the type option as follows: .PP .Vb 1 \& type => \*(AqSEQUENCE\*(Aq .Ve .PP To extract all triggers set the type option as follows: .PP .Vb 1 \& type => \*(AqTRIGGER\*(Aq .Ve .PP To extract all functions set the type option as follows: .PP .Vb 1 \& type => \*(AqFUNCTION\*(Aq .Ve .PP To extract all procedures set the type option as follows: .PP .Vb 1 \& type => \*(AqPROCEDURE\*(Aq .Ve .PP To extract all packages and packages bodies set the type option as follows: .PP .Vb 1 \& type => \*(AqPACKAGE\*(Aq .Ve .PP Default is table extraction: .PP .Vb 1 \& type => \*(AqTABLE\*(Aq .Ve .PP To extract table and index tablespaces (PostgreSQL >= v8): .PP .Vb 1 \& type => \*(AqTABLESPACE\*(Aq .Ve .PP To extract table range or list partition (PostgreSQL >= v8.4): .PP .Vb 1 \& type => \*(AqPARTITION\*(Aq .Ve .PP To extract user defined Oracle type .PP .Vb 1 \& type => \*(AqTYPE\*(Aq .Ve .PP To extract table datas as \s-1INSERT\s0 statements use: .PP .Vb 1 \& type => \*(AqDATA\*(Aq .Ve .PP To extract table datas as \s-1COPY\s0 statements use: .PP .Vb 1 \& type => \*(AqCOPY\*(Aq .Ve .PP and set data_limit => n to specify the bulk size of tuples to be return at once. If you set this option to 0 or nothing, data_limit will be forced to 10000. .PP Oracle export is done by calling method: .PP .Vb 1 \& $schema\->export_schema(); .Ve .PP The extracted data is dumped to filename specified in the \s-1OUTPUT\s0 configuration directive or to stdout if it's set to nothing. You can always overwrite this configuration value by specifying a filename as argument of this function. If you want to dump files to a specific directory set the \s-1OUTPUT_DIR\s0 directive to the destination directory. .PP You can also send the data directly to a PostgreSQL backend by setting \s-1PG_DSN, PG_USER\s0 and \s-1PG_PWD\s0 configuration directives. This feature is only available for \&\s-1COPY\s0 or \s-1DATA\s0 export types. The data will not be sent via DBD::Pg but will be loaded to the \s-1PG\s0 database using the psql command. Edit the \f(CW$PSQL\fR environment variable to specify the path of your psql command (nothing to edit if psql is in your path). .PP When copying tables, Ora2Pg normally exports constraints as they are; if they are non-deferrable they will be exported as non-deferrable. However, non-deferrable constraints will probably cause problems when attempting to import data to PostgreSQL. The option: .PP .Vb 1 \& fkey_deferrable => 1 .Ve .PP will cause all foreign key constraints to be exported as deferrable, even if they are non-deferrable. .PP In addition, for data export, setting: .PP .Vb 1 \& defer_fkey => 1 .Ve .PP will export all data in a transaction and set all constraints deferred. This imply that all constraints have been created 'deferrable' otherwise it will not works. Than if this fail the ultimate solution is: .PP .Vb 1 \& drop_fkey => 1 .Ve .PP will add a command to actually drop all foreign constraints before importing data and recreate them at the end of the import. .PP If you want to gain speed during fresh data import, use the following: .PP .Vb 1 \& drop_indexes => 1 .Ve .PP Ora2Pg will drop any table indexes that is not an automatic primary key index and recreate them at end of the import. .PP To non perl gurus, you can use the configuration file and run ora2pg as is. You will find all information into the ora2pg.conf to be able to set it correctly. .SH "DESCRIPTION" .IX Header "DESCRIPTION" Ora2Pg is a perl \s-1OO\s0 module used to export an Oracle database schema to a PostgreSQL compatible schema. .PP It simply connects to your Oracle database, extracts its structures and generates an \s-1SQL\s0 script that you can load into your PostgreSQL database. .PP Ora2Pg.pm dumps the database schema (tables, views, sequences, indexes, grants, etc.), with primary, unique and foreign keys into PostgreSQL syntax without need to edit the \s-1SQL\s0 code generated. .PP It can also dump Oracle data into a PostgreSQL database 'on the fly'. Also you can choose a selection of columns to be exported for each table. .PP The \s-1SQL\s0 and/or \s-1PL/SQL\s0 code generated for functions, procedures and triggers has to be reviewed to match the PostgreSQL syntax. You find some useful recommandations on porting Oracle \s-1PL/SQL\s0 code to PostgreSQL \s-1PL/PGSQL\s0 at \&\*(L"http://techdocs.postgresql.org/\*(R" under the topic \*(L"Converting from other Databases to PostgreSQL\*(R", Oracle. .PP Notice that the \fItrunc()\fR function in Oracle is the same for number and date types. Be carefull when porting to PostgreSQL to use \fItrunc()\fR for numbers and \fIdate_trunc()\fR for dates. .SH "ABSTRACT" .IX Header "ABSTRACT" The goal of the Ora2Pg Perl module is to cover everything needed to export an Oracle database to a PostgreSQL database without other thing than providing the parameters needed for connecting to the Oracle database. .PP Features include: .PP .Vb 10 \& \- Exporting the database schema (tables, views, sequences, indexes), \& with unique, primary and foreign key and check constraints. \& \- Exporting grants/privileges for users and groups. \& \- Exporting range and list table partition. \& \- Exporting a table selection (by specifying the table names or max \& tables). \& \- Exporting the Oracle schema to a PostgreSQL 7.3+ schema. \& \- Exporting predefined functions/triggers/procedures/packages. \& \- Exporting user defined data type. \& \- Exporting table data. \& \- Exporting Oracle views as PG tables. \& \- Providing basic help for converting PLSQL code to PLPGSQL (needs \& manual work). .Ve .PP See ora2pg.conf for more information on use. .PP My knowledge about database is really poor especially for Oracle \s-1RDBMS.\s0 Any contributions, particularly in this matter, are welcome. .SH "REQUIREMENTS" .IX Header "REQUIREMENTS" You just need the \s-1DBI,\s0 DBD::Pg and DBD::Oracle Perl module to be installed. DBD::Pg is optional and needed only for 'on the fly' migration. The PostgreSQL client (psql) must also be installed on the host running Ora2Pg. .PP If you want to compress output as a gzip file you need Compress::Zlib Perl module. And if you want to use bzip2 compression, program bzip2 must be available. .SH "PUBLIC METHODS" .IX Header "PUBLIC METHODS" .SS "new \s-1HASH_OPTIONS\s0" .IX Subsection "new HASH_OPTIONS" Creates a new Ora2Pg object. .PP The only required option is: .PP .Vb 1 \& \- config : Path to the configuration file (required). .Ve .PP All directives found in the configuration file can be overwritten in the instance call by passing them in lowercase as arguments. These supported options are (See ora2pg.conf for more details): .PP .Vb 10 \& \- datasource : Oracle DBD datasource (required) \& \- user : Oracle DBD user (optional with public access) \& \- password : Oracle DBD password (optional with public access) \& \- schema : Oracle internal schema to extract (optional) \& \- type : Type of data to extract, can be TABLE,VIEW,GRANT,SEQUENCE, \& TRIGGER,FUNCTION,PROCEDURE,DATA,COPY,PACKAGE,TABLESPACE,PARTTION \& or a combinaison of these keywords separated by blanks. \& \- debug : verbose mode. \& \- export_schema : Export Oracle schema to PostgreSQL >7.3 schema \& \- tables : Extract only the specified tables (arrayref) and set the \& extracting order \& \- exclude : Exclude the specified tables from extraction (arrayref) \& \- data_limit : bulk size of tuples to return at once during data extraction \& (defaults to 10000). \& \- case_sensitive: Allow to preserve Oracle object names as they are \& written. Default is not. \& \- skip_fkeys : Skip foreign key constraints extraction. Defaults to 0 \& (extraction) \& \- skip_pkeys : Skip primary keys extraction. Defaults to 0 (extraction) \& \- skip_ukeys : Skip unique column constraints extraction. Defaults to 0 \& (extraction) \& \- skip_indexes : Skip all other index types extraction. Defaults to 0 \& (extraction) \& \- skip_checks : Skip check constraints extraction. Defaults to 0 \& (extraction) \& \- keep_pkey_names : By default, primary key names in the source database \& are ignored, and default key names are created in the target database. \& If this is set to true, primary key names are preserved. \& \- bzip2: Path to the Bzip2 program to compress data export. Default \& /usr/bin/bzip2 \& \- gen_user_pwd : When set to 1 this will replace the default password \& \*(Aqchange_my_secret\*(Aq with a random string. \& \- fkey_deferrable: Force foreign key constraints to be exported as \& deferrable. Defaults to 0: export as is. \& \- defer_fkey : Force all foreign key constraints to be deferred before \& data import, this require that all fkeys are deferrable and that all \& datas can be imported in a single transaction. Defaults to 0, as is. \& \- drop_fkey : Force all foreign key constraints to be dropped before \& data import and recreated at the end. Defaults to 0: export as is. \& \- drop_indexes: Force deletion of non automatic index on tables before \& data import and recreate them at end of the import. Default 0, disabled. \& \- pg_numeric_type: Convert the Oracle NUMBER data type to adequate PG data \& types instead of using the slow numeric(p,s) data type. \& \- default_numeric: By default the NUMBER(x) type without precision is \& converted to bigint. You can overwrite this data type by any PG type. \& \- keep_pkey_names: Preserve oracle primary key names. The default is to \& ignore and use PostgreSQl defaults. \& Must be used with PostgreSQL > 8.1. Defaults to none support (backward \& compatibility). \& \- disable_triggers: Disable triggers on all tables in COPY and \& DATA mode. \& \- disable_sequence: Disables alter sequence on all tables in COPY or \& DATA mode. \& \- noescape: Disable character escaping during data export. \& \- datatype: Redefine Oracle to PostgreSQl data type conversion. \& \- binmode: Force Perl to use the specified binary mode for output. The \& default is \*(Aq:raw\*(Aq; \& \- sysusers: Add other system users to the default exclusion list \& (SYS,SYSTEM,DBSNMP,OUTLN,PERFSTAT,CTXSYS,XDB,WMSYS,SYSMAN,SQLTXPLAIN, \& MDSYS,EXFSYS,ORDSYS,DMSYS,OLAPSYS,FLOWS_020100,FLOWS_FILES,TSMSYS). \& \- ora_sensitive: Force the use of Oracle case sensitive table/view names. \& \- plsql_pgsql: Enable plsql to plpgsql conversion. \& \- pg_schema: Allow to specify a coma delimited list of PostgreSQL schema. \& \- file_per_constraint: Allow to create one output file containing all \& constraints during schema or table export. \& \- file_per_index: Allow to create one output file containing all indexes \& during schema or table export. \& \- file_per_table: Allow to create one output file per table loaded from \& output.sql. The table\*(Aqs files will be named ${table}_$output. \& \- pg_supports_when: allow WHEN clause on trigger definition (Pg >= 9.0). \& \- pg_supports_insteadof: allow INSTEAD OF usage on trigger definition \& (Pg >= 9.1). \& \- file_per_function: Allow to create one output file per function loaded \& from output.sql. The function\*(Aqs files will be named ${funcname}_$output. \& \- truncate_table: adds trunctate table instruction before loading data. \& \- xtable : used to specify a table name from which SHOW_COLUMN will work. \& Default is to show the column name of all table. \& \- force_owner: force to set the table and sequences owner. If set to 1 it \& will use the oracle owner else it will use the name given as value. \& \- input_file: force to use a given file as datasoure instead of an Oracle \& database connection. This file must contain either PL/SQL function or \& procedure or a package body source code. Ora2Pg will parse this code \& and outputed converted plpgsql. \& \- standard_conforming_strings: same as the PostgreSQL configuration option, \& string constants should be written as E\*(Aq...\*(Aq. Default is on, take care for \& backward compatibility, before v8.5 Ora2Pg do not use this syntax. \& \- compile_schema: used to force Oracle to compile all PL/SQL code before \& code extraction. \& \- export_invalid: force Ora2Pg to export all PL/SQL code event if it is \& maked as invalid by Oracle. \& \- allow_code_break: allow plsql to pgplsql conversion that could break the \& original code if they include complex subqueries. See decode() and substr() \& replacement. .Ve .PP Beware that this list may grow longer because all initialization is performed this way. .PP Special configuration options to handle character encoding: \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- .PP \&\s-1NLS_LANG\s0 .PP If you experience any issues where mutibyte characters are being substituted with 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. .PP \&\s-1BINMODE\s0 .PP 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. .PP \&\s-1CLIENT_ENCODING\s0 .PP If you experience \s-1ERROR:\s0 invalid byte sequence for encoding \*(L"\s-1UTF8\*(R":\s0 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. .PP For example, let's say you have an Oracle database with all data encoded in \&\s-1FRENCH_FRANCE.WE8ISO8859P15,\s0 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.WE8ISO8859P15\s0 and the \s-1CLIENT_ENCODING\s0 to \s-1LATIN9.\s0 .PP Exporting Oracle views as PostgreSQL tables: \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- .PP Since version 4.10 you can export Oracle views as PostgreSQL tables simply by setting \s-1TYPE\s0 configuration option to \s-1TABLE\s0 and \s-1COPY\s0 or \s-1DATA\s0 and specifying your views in the \s-1TABLES\s0 configuration option. Then if Ora2Pg does not find the name in Oracle table names it automatically deduces that it must search for it in the view names, and if it finds the view it will extract its schema (if TYPE=TABLE) into a \s-1PG\s0 create table form, then it will extract the data (if TYPE=COPY or \s-1DATA\s0) following the view schema. .PP Case sensitive table names in Oracle: \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- .PP Since version 4.10 you can extract/export Oracle databases with case sensitive table/view names. This requires the use of quoted table/view names during Oracle querying. Set the configuration option \s-1ORA_SENSITIVE\s0 to 1 to enable this feature. By default it is off. .SS "export_data \s-1FILENAME\s0" .IX Subsection "export_data FILENAME" \&\s-1OBSOLETE:\s0 you must use export_schema instead. Still here for backward compatibility. It simply callback \fIexport_schema()\fR. .SS "export_schema \s-1FILENAME\s0" .IX Subsection "export_schema FILENAME" Print \s-1SQL\s0 data output to a file name or to \s-1STDOUT\s0 if no file name is specified. .SS "export_file \s-1FILENAME\s0" .IX Subsection "export_file FILENAME" Open a file handle to a given filename. .SS "close_export_file \s-1FILEHANDLE\s0" .IX Subsection "close_export_file FILEHANDLE" Close a file handle. .SS "modify_struct \s-1TABLE_NAME ARRAYOF_FIELDNAME\s0" .IX Subsection "modify_struct TABLE_NAME ARRAYOF_FIELDNAME" Modify the table structure during the export. Only the specified columns will be exported. .SS "replace_tables \s-1HASH\s0" .IX Subsection "replace_tables HASH" Modify table names during the export. .SS "replace_cols \s-1HASH\s0" .IX Subsection "replace_cols HASH" Modify column names during the export. .SS "set_where_clause \s-1HASH\s0" .IX Subsection "set_where_clause HASH" Add a \s-1WHERE\s0 clause during data export on specific tables or on all tables .SH "PRIVATE METHODS" .IX Header "PRIVATE METHODS" .SS "_init \s-1HASH_OPTIONS\s0" .IX Subsection "_init HASH_OPTIONS" Initialize an Ora2Pg object instance with a connexion to the Oracle database. .SS "_send_to_pgdb \s-1DEST_DATASRC DEST_USER DEST_PASSWD\s0" .IX Subsection "_send_to_pgdb DEST_DATASRC DEST_USER DEST_PASSWD" Open a \s-1DB\s0 handle to a PostgreSQL database .SS "_grants" .IX Subsection "_grants" This function is used to retrieve all privilege information. .PP It extracts all Oracle's \s-1ROLES\s0 to convert them to Postgres groups (or roles) and searches all users associated to these roles. .SS "_sequences" .IX Subsection "_sequences" This function is used to retrieve all sequences information. .SS "_triggers" .IX Subsection "_triggers" This function is used to retrieve all triggers information. .SS "_functions" .IX Subsection "_functions" This function is used to retrieve all functions information. .SS "_procedures" .IX Subsection "_procedures" This function is used to retrieve all procedures information. .SS "_packages" .IX Subsection "_packages" This function is used to retrieve all packages information. .SS "_types" .IX Subsection "_types" This function is used to retrieve all custom types information. .SS "_tables" .IX Subsection "_tables" This function is used to retrieve all table information. .PP Sets the main hash of the database structure \f(CW$self\fR\->{tables}. Keys are the names of all tables retrieved from the current database. Each table information is composed of an array associated to the table_info key as array reference. In other way: .PP .Vb 1 \& $self\->{tables}{$class_name}{table_info} = [(OWNER,TYPE)]; .Ve .PP \&\s-1DBI TYPE\s0 can be \s-1TABLE, VIEW, SYSTEM TABLE, GLOBAL TEMPORARY, LOCAL TEMPORARY, ALIAS, SYNONYM\s0 or a data source specific type identifier. This only extracts the \s-1TABLE\s0 type. .PP It also gets the following information in the \s-1DBI\s0 object to affect the main hash of the database structure : .PP .Vb 2 \& $self\->{tables}{$class_name}{field_name} = $sth\->{NAME}; \& $self\->{tables}{$class_name}{field_type} = $sth\->{TYPE}; .Ve .PP It also calls these other private subroutines to affect the main hash of the database structure : .PP .Vb 4 \& @{$self\->{tables}{$class_name}{column_info}} = $self\->_column_info($class_name, $owner); \& %{$self\->{tables}{$class_name}{unique_key}} = $self\->_unique_key($class_name, $owner); \& @{$self\->{tables}{$class_name}{foreign_key}} = $self\->_foreign_key($class_name, $owner); \& %{$self\->{tables}{$class_name}{check_constraint}} = $self\->_check_constraint($class_name, $owner); .Ve .SS "_views" .IX Subsection "_views" This function is used to retrieve all views information. .PP Sets the main hash of the views definition \f(CW$self\fR\->{views}. Keys are the names of all views retrieved from the current database and values are the text definitions of the views. .PP It then sets the main hash as follows: .PP .Vb 2 \& # Definition of the view \& $self\->{views}{$table}{text} = $view_infos{$table}; .Ve .SS "_tablespaces" .IX Subsection "_tablespaces" This function is used to retrieve all Oracle Tablespaces information. .PP Sets the main hash \f(CW$self\fR\->{tablespaces}. .SS "_partitions" .IX Subsection "_partitions" This function is used to retrieve all Oracle partition information. .PP Sets the main hash \f(CW$self\fR\->{partition}. .SS "_get_sql_data" .IX Subsection "_get_sql_data" Returns a string containing the entire PostgreSQL compatible \s-1SQL\s0 Schema definition. .SS "_create_indexes" .IX Subsection "_create_indexes" This function return \s-1SQL\s0 code to create indexes of a table .SS "_drop_indexes" .IX Subsection "_drop_indexes" This function return \s-1SQL\s0 code to drop indexes of a table .SS "_create_unique_keys" .IX Subsection "_create_unique_keys" This function return \s-1SQL\s0 code to create unique and primary keys of a table .SS "_create_check_constraint" .IX Subsection "_create_check_constraint" This function return \s-1SQL\s0 code to create the check constraints of a table .SS "_create_foreign_keys" .IX Subsection "_create_foreign_keys" This function return \s-1SQL\s0 code to create the foreign keys of a table .SS "_drop_foreign_keys" .IX Subsection "_drop_foreign_keys" This function return \s-1SQL\s0 code to the foreign keys of a table .SS "_extract_sequence_info" .IX Subsection "_extract_sequence_info" This function retrieves the last value returned from the sequences in the Oracle database. The result is a \s-1SQL\s0 script assigning the new start values to the sequences found in the Oracle database. .SS "_get_data \s-1TABLE\s0" .IX Subsection "_get_data TABLE" This function implements an Oracle-native data extraction. .PP Returns a list of array references containing the data .SS "_sql_type \s-1INTERNAL_TYPE LENGTH PRECISION SCALE\s0" .IX Subsection "_sql_type INTERNAL_TYPE LENGTH PRECISION SCALE" This function returns the PostgreSQL datatype corresponding to the Oracle data type. .SS "_column_info \s-1TABLE OWNER\s0" .IX Subsection "_column_info TABLE OWNER" This function implements an Oracle-native column information. .PP Returns a list of array references containing the following information elements for each column the specified table .PP [( column name, column type, column length, nullable column, default value )] .SS "_unique_key \s-1TABLE OWNER\s0" .IX Subsection "_unique_key TABLE OWNER" This function implements an Oracle-native unique (including primary) key column information. .PP Returns a hash of hashes in the following form: ( constraintname => (type => '\s-1PRIMARY\s0', columns => ('a', 'b', 'c')), constraintname => (type => '\s-1UNIQUE\s0', columns => ('b', 'c', 'd')), etc. ) .SS "_check_constraint \s-1TABLE OWNER\s0" .IX Subsection "_check_constraint TABLE OWNER" This function implements an Oracle-native check constraint information. .PP Returns a hash of lists of all column names defined as check constraints for the specified table and constraint name. .SS "_foreign_key \s-1TABLE OWNER\s0" .IX Subsection "_foreign_key TABLE OWNER" This function implements an Oracle-native foreign key reference information. .PP Returns a list of hash of hash of array references. Ouf! Nothing very difficult. The first hash is composed of all foreign key names. The second hash has just two keys known as 'local' and 'remote' corresponding to the local table where the foreign key is defined and the remote table referenced by the key. .PP The foreign key name is composed as follows: .PP .Vb 1 \& \*(Aqlocal_table_name\->remote_table_name\*(Aq .Ve .PP Foreign key data consists in two arrays representing at the same index for the local field and the remote field where the first one refers to the second one. Just like this: .PP .Vb 2 \& @{$link{$fkey_name}{local}} = @local_columns; \& @{$link{$fkey_name}{remote}} = @remote_columns; .Ve .SS "_get_privilege" .IX Subsection "_get_privilege" This function implements an Oracle-native obkect priviledge information. .PP Returns a hash of all privilede. .SS "_get_indexes \s-1TABLE OWNER\s0" .IX Subsection "_get_indexes TABLE OWNER" This function implements an Oracle-native indexes information. .PP Returns a hash of an array containing all unique indexes and a hash of array of all indexe names which are not primary keys for the specified table. .SS "_get_sequences" .IX Subsection "_get_sequences" This function implements an Oracle-native sequences information. .PP Returns a hash of an array of sequence names with \s-1MIN_VALUE, MAX_VALUE, INCREMENT\s0 and \s-1LAST_NUMBER\s0 for the specified table. .SS "_get_views" .IX Subsection "_get_views" This function implements an Oracle-native views information. .PP Returns a hash of view names with the \s-1SQL\s0 queries they are based on. .SS "_alias_info" .IX Subsection "_alias_info" This function implements an Oracle-native column information. .PP Returns a list of array references containing the following information for each alias of the specified view: .PP [( column name, column id )] .SS "_get_triggers" .IX Subsection "_get_triggers" This function implements an Oracle-native triggers information. .PP Returns an array of refarray of all triggers information. .SS "_get_functions" .IX Subsection "_get_functions" This function implements an Oracle-native functions information. .PP Returns a hash of all function names with their \s-1PLSQL\s0 code. .SS "_get_procedures" .IX Subsection "_get_procedures" This procedure implements an Oracle-native procedures information. .PP Returns a hash of all procedure names with their \s-1PLSQL\s0 code. .SS "_get_packages" .IX Subsection "_get_packages" This function implements an Oracle-native packages information. .PP Returns a hash of all package names with their \s-1PLSQL\s0 code. .SS "_get_types" .IX Subsection "_get_types" This function implements an Oracle custom types information. .PP Returns a hash of all type names with their code. .SS "_table_info" .IX Subsection "_table_info" This function retrieves all Oracle-native tables information. .PP Returns a handle to a \s-1DB\s0 query statement. .SS "_get_tablespaces" .IX Subsection "_get_tablespaces" This function implements an Oracle-native tablespaces information. .PP Returns a hash of an array of tablespace names with their system file path. .SS "_get_partitions" .IX Subsection "_get_partitions" This function implements an Oracle-native partitions information. Return two hash ref with partition details and partition default. .SS "dump" .IX Subsection "dump" This function dump data to the right output (gzip file, file or stdout). .SS "read_config" .IX Subsection "read_config" This function read the specified configuration file. .SS "_convert_package" .IX Subsection "_convert_package" This function is used to rewrite Oracle \s-1PACKAGE\s0 code to PostgreSQL \s-1SCHEMA.\s0 Called only if \s-1PLSQL_PGSQL\s0 configuration directive is set to 1. .SS "_restore_comments" .IX Subsection "_restore_comments" This function is used to restore comments into \s-1SQL\s0 code previously remove for easy parsing .SS "_remove_comments" .IX Subsection "_remove_comments" This function is used to remove comments from \s-1SQL\s0 code to allow easy parsing .SS "_convert_function" .IX Subsection "_convert_function" This function is used to rewrite Oracle \s-1FUNCTION\s0 code to PostgreSQL. Called only if \s-1PLSQL_PGSQL\s0 configuration directive is set to 1. .SS "_convert_declare" .IX Subsection "_convert_declare" This function is used to rewrite Oracle \s-1FUNCTION\s0 declaration code to PostgreSQL. Called only if \s-1PLSQL_PGSQL\s0 configuration directive is set to 1. .SS "_format_view" .IX Subsection "_format_view" This function is used to rewrite Oracle \s-1VIEW\s0 declaration code to PostgreSQL. .SS "randpattern" .IX Subsection "randpattern" This function is used to replace the use of perl module String::Random and is simply a cut & paste from this module. .SS "logit" .IX Subsection "logit" This function log information to \s-1STDOUT\s0 or to a logfile following a debug level. If critical is set, it dies after writing to log. .SS "_convert_type" .IX Subsection "_convert_type" This function is used to rewrite Oracle \s-1PACKAGE\s0 code to PostgreSQL \s-1SCHEMA.\s0 Called only if \s-1PLSQL_PGSQL\s0 configuration directive is set to 1. .SS "escape_bytea" .IX Subsection "escape_bytea" This function return an escaped bytea entry for Pg. .SS "_show_infos" .IX Subsection "_show_infos" This function display a list of schema, table or column only to stdout. .SS "_schema_list" .IX Subsection "_schema_list" This function retrieves all Oracle-native user schema. .PP Returns a handle to a \s-1DB\s0 query statement. .SS "_get_encoding" .IX Subsection "_get_encoding" This function retrieves the Oracle database encoding .PP Returns a handle to a \s-1DB\s0 query statement. .SS "_compile_schema" .IX Subsection "_compile_schema" This function force Oracle database to compile a schema and validate or invalidate \s-1PL/SQL\s0 code .SH "AUTHOR" .IX Header "AUTHOR" Gilles Darold .SH "COPYRIGHT" .IX Header "COPYRIGHT" 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 "SEE ALSO" .IX Header "SEE ALSO" DBD::Oracle, DBD::Pg