Commit a24104eb authored by Bruce Momjian's avatar Bruce Momjian

Upgrade to even newer ora2pg 2.0.

parent ffab4fdf
......@@ -60,7 +60,34 @@
- Fix a problem with local settings regarding decimal separator (all ,
are changed to .) Thank to Jan Kester.
Thanks for all congratulation message and bug report I received.
2002 09 27 - Version 1.11
- Fix a problem when retrieving package+package body. Thanks to Mike WILHELM-HILTZ
- Set LongReadLen to 100000 when exporting table information. Many users reports
this kind of error: A-01406 LongReadLen too small and/or LongTruncOk not set
This should fix the problem else you must increase the value (around line 422 of Ora2Pg.pm.
- Filtering by owner for better performance when retreiving database schema. Thanks to Jefferson MEDEIROS
2002 12 03 - Version 1.12
I have fixed 2 bugs when using it against Oracle 817R3 on linux.
- Fix problem regarding RI constraints, the owner name was not
getting into the sql statement. Thank to Ian Boston.
- Moved all the RI constraints out of the create table statement.
Thank to Ian Boston for this contribution. This was a major request
from Ora2pg users.
2002 12 26 - Version 2.0
- Clean code.
- Fix COPY output on column value with end of line and add column naming.
- Add support to the PostgreSQL 7.3 schema. So Oracle schema can now be exported.
(see export_schema init option)
- Remove data extraction limit (old default: 10) so each tuple will be dump by default.
Thanks for all congratulation message and bug report+fix I received.
Gilles DAROLD <gilles@darold.net>
This diff is collapsed.
......@@ -76,6 +76,9 @@ SYNOPSIS
If export failed and complain that the table doesn't exists use this to
prefix the table name by the schema name.
If you want to use PostgreSQL 7.3 schema support activate the init
option 'export_schema' set to 1. Default is no schema export
To know at which indices tables can be found during extraction use the
option:
......@@ -184,6 +187,7 @@ ABSTRACT
with unique, primary and foreign key.
- Grants/privileges export by user and group.
- Table selection (by name and max table) export.
- Export Oracle schema to PostgreSQL 7.3 schema.
- Predefined functions/triggers/procedures/packages export.
- Data export.
- Sql query converter (todo)
......@@ -209,11 +213,12 @@ PUBLIC METHODS
- type : Type of data to extract, can be TABLE,VIEW,GRANT,SEQUENCE,
TRIGGER,FUNCTION,PROCEDURE,DATA,COPY,PACKAGE
- debug : Print the current state of the parsing
- export_schema : Export Oracle schema to PostgreSQL 7.3 schema
- tables : Extract only the given tables (arrayref)
- showtableid : Display only the table indice during extraction
- min : Indice to begin extraction. Default to 0
- max : Indice to end extraction. Default to 0 mean no limits
- data_limit : Number max of tuples to return during data extraction (default 10)
- data_limit : Number max of tuples to return during data extraction (default 0 no limit)
Attempt that this list should grow a little more because all
initialization is done by this way.
......@@ -306,10 +311,10 @@ PRIVATE METHODS
It also call these other private subroutine to affect the main hash of
the database structure :
@{$self->{tables}{$class_name}{column_info}} = $self->_column_info($class_name);
@{$self->{tables}{$class_name}{primary_key}} = $self->_primary_key($class_name);
@{$self->{tables}{$class_name}{unique_key}} = $self->_unique_key($class_name);
@{$self->{tables}{$class_name}{foreign_key}} = $self->_foreign_key($class_name);
@{$self->{tables}{$class_name}{column_info}} = $self->_column_info($class_name, $owner);
@{$self->{tables}{$class_name}{primary_key}} = $self->_primary_key($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);
_views
......@@ -340,7 +345,7 @@ PRIVATE METHODS
This function return the PostgreSQL datatype corresponding to the Oracle
internal type.
_column_info TABLE
_column_info TABLE OWNER
This function implements a Oracle-native column information.
......@@ -350,21 +355,21 @@ PRIVATE METHODS
[( column name, column type, column length, nullable column, default
value )]
_primary_key TABLE
_primary_key TABLE OWNER
This function implements a Oracle-native primary key column information.
Return a list of all column name defined as primary key for the given
table.
_unique_key TABLE
_unique_key TABLE OWNER
This function implements a Oracle-native unique key column information.
Return a list of all column name defined as unique key for the given
table.
_foreign_key TABLE
_foreign_key TABLE OWNER
This function implements a Oracle-native foreign key reference
information.
......@@ -404,7 +409,7 @@ PRIVATE METHODS
Return a hash of all tables grants as an array of associated users.
_get_indexes TABLE
_get_indexes TABLE OWNER
This function implements a Oracle-native indexes information.
......
The following need your contribution :
- Fix problem regarding table/constraint output order.
- SQL queries converter.
- PL/SQL code converter.
<HTML>
<HEAD>
<TITLE>Ora2Pg - Oracle to PostgreSQL database schema converter</TITLE>
<LINK REV="made" HREF="mailto:darold@localhost.localdomain">
</HEAD>
<BODY>
......@@ -40,14 +39,14 @@
<LI><A HREF="#_get_sql_data">_get_sql_data</A></LI>
<LI><A HREF="#_get_data table">_get_data TABLE</A></LI>
<LI><A HREF="#_sql_type internal_type length precision scale">_sql_type INTERNAL_TYPE LENGTH PRECISION SCALE</A></LI>
<LI><A HREF="#_column_info table">_column_info TABLE</A></LI>
<LI><A HREF="#_primary_key table">_primary_key TABLE</A></LI>
<LI><A HREF="#_unique_key table">_unique_key TABLE</A></LI>
<LI><A HREF="#_foreign_key table">_foreign_key TABLE</A></LI>
<LI><A HREF="#_column_info table owner">_column_info TABLE OWNER</A></LI>
<LI><A HREF="#_primary_key table owner">_primary_key TABLE OWNER</A></LI>
<LI><A HREF="#_unique_key table owner">_unique_key TABLE OWNER</A></LI>
<LI><A HREF="#_foreign_key table owner">_foreign_key TABLE OWNER</A></LI>
<LI><A HREF="#_get_users">_get_users</A></LI>
<LI><A HREF="#_get_roles">_get_roles</A></LI>
<LI><A HREF="#_get_all_grants">_get_all_grants</A></LI>
<LI><A HREF="#_get_indexes table">_get_indexes TABLE</A></LI>
<LI><A HREF="#_get_indexes table owner">_get_indexes TABLE OWNER</A></LI>
<LI><A HREF="#_get_sequences">_get_sequences</A></LI>
<LI><A HREF="#_get_views">_get_views</A></LI>
<LI><A HREF="#_alias_info">_alias_info</A></LI>
......@@ -141,6 +140,8 @@ to your schema name:</P>
<P>This schema definition can also be needed when you want to export data. If export
failed and complain that the table doesn't exists use this to prefix the table name
by the schema name.</P>
<P>If you want to use PostgreSQL 7.3 schema support activate the init option
'export_schema' set to 1. Default is no schema export</P>
<P>To know at which indices tables can be found during extraction use the option:</P>
<PRE>
showtableid =&gt; 1</PRE>
......@@ -224,6 +225,7 @@ the connection parameters to the Oracle database.</P>
with unique, primary and foreign key.
- Grants/privileges export by user and group.
- Table selection (by name and max table) export.
- Export Oracle schema to PostgreSQL 7.3 schema.
- Predefined functions/triggers/procedures/packages export.
- Data export.
- Sql query converter (todo)</PRE>
......@@ -248,11 +250,12 @@ so contribution is welcome.</P>
- type : Type of data to extract, can be TABLE,VIEW,GRANT,SEQUENCE,
TRIGGER,FUNCTION,PROCEDURE,DATA,COPY,PACKAGE
- debug : Print the current state of the parsing
- export_schema : Export Oracle schema to PostgreSQL 7.3 schema
- tables : Extract only the given tables (arrayref)
- showtableid : Display only the table indice during extraction
- min : Indice to begin extraction. Default to 0
- max : Indice to end extraction. Default to 0 mean no limits
- data_limit : Number max of tuples to return during data extraction (default 10)</PRE>
- data_limit : Number max of tuples to return during data extraction (default 0 no limit)</PRE>
<P>Attempt that this list should grow a little more because all initialization is
done by this way.</P>
<P>
......@@ -328,10 +331,10 @@ main hash of the database structure :</P>
<P>It also call these other private subroutine to affect the main hash
of the database structure :</P>
<PRE>
@{$self-&gt;{tables}{$class_name}{column_info}} = $self-&gt;_column_info($class_name);
@{$self-&gt;{tables}{$class_name}{primary_key}} = $self-&gt;_primary_key($class_name);
@{$self-&gt;{tables}{$class_name}{unique_key}} = $self-&gt;_unique_key($class_name);
@{$self-&gt;{tables}{$class_name}{foreign_key}} = $self-&gt;_foreign_key($class_name);</PRE>
@{$self-&gt;{tables}{$class_name}{column_info}} = $self-&gt;_column_info($class_name, $owner);
@{$self-&gt;{tables}{$class_name}{primary_key}} = $self-&gt;_primary_key($class_name, $owner);
@{$self-&gt;{tables}{$class_name}{unique_key}} = $self-&gt;_unique_key($class_name, $owner);
@{$self-&gt;{tables}{$class_name}{foreign_key}} = $self-&gt;_foreign_key($class_name, $owner);</PRE>
<P>
<H2><A NAME="_views">_views</A></H2>
<P>This function is used to retrieve all views information.</P>
......@@ -354,7 +357,7 @@ database values are the text definition of the views.</P>
<P>This function return the PostgreSQL datatype corresponding to the
Oracle internal type.</P>
<P>
<H2><A NAME="_column_info table">_column_info TABLE</A></H2>
<H2><A NAME="_column_info table owner">_column_info TABLE OWNER</A></H2>
<P>This function implements a Oracle-native column information.</P>
<P>Return a list of array reference containing the following informations
for each column the given a table</P>
......@@ -366,19 +369,19 @@ for each column the given a table</P>
default value
)]</P>
<P>
<H2><A NAME="_primary_key table">_primary_key TABLE</A></H2>
<H2><A NAME="_primary_key table owner">_primary_key TABLE OWNER</A></H2>
<P>This function implements a Oracle-native primary key column
information.</P>
<P>Return a list of all column name defined as primary key
for the given table.</P>
<P>
<H2><A NAME="_unique_key table">_unique_key TABLE</A></H2>
<H2><A NAME="_unique_key table owner">_unique_key TABLE OWNER</A></H2>
<P>This function implements a Oracle-native unique key column
information.</P>
<P>Return a list of all column name defined as unique key
for the given table.</P>
<P>
<H2><A NAME="_foreign_key table">_foreign_key TABLE</A></H2>
<H2><A NAME="_foreign_key table owner">_foreign_key TABLE OWNER</A></H2>
<P>This function implements a Oracle-native foreign key reference
information.</P>
<P>Return a list of hash of hash of array reference. Ouuf! Nothing very difficult.
......@@ -409,7 +412,7 @@ information.</P>
information.</P>
<P>Return a hash of all tables grants as an array of associated users.</P>
<P>
<H2><A NAME="_get_indexes table">_get_indexes TABLE</A></H2>
<H2><A NAME="_get_indexes table owner">_get_indexes TABLE OWNER</A></H2>
<P>This function implements a Oracle-native indexes information.</P>
<P>Return hash of array containing all unique index and a hash of
array of all indexes name which are not primary keys for the
......
#!/usr/bin/perl
#------------------------------------------------------------------------------
# Project : Oracle2Postgresql
# Project : Oracle to Postgresql converter
# Name : ora2pg.pl
# Language : 5.006 built for i686-linux
# OS : linux RedHat 6.2 kernel 2.2.14-5
# Language : perl, v5.6.1
# OS : linux RedHat 7.3 kernel 2.4.18-17.7.xsmp
# Author : Gilles Darold, gilles@darold.net
# Copyright: Copyright (c) 2000 : Gilles Darold - All rights reserved -
# Function : Script used to convert Oracle Database schema to PostgreSQL
# Copyright: Copyright (c) 2000-2002 : Gilles Darold - All rights reserved -
# Function : Script used to convert Oracle Database to PostgreSQL
#------------------------------------------------------------------------------
# Version : 1.1
# Version : 2.0
#------------------------------------------------------------------------------
BEGIN {
......@@ -20,17 +20,18 @@ use strict;
use Ora2Pg;
# Initialyze the database connection
my $dbsrc = 'dbi:Oracle:host=test.mydomain.com;sid=TEST;port=1521';
my $dbsrc = 'dbi:Oracle:host=localhost;sid=TEST';
my $dbuser = 'system';
my $dbpwd = 'manager';
# Create an instance of the XSD::DBISchema perl module
# Create an instance of the Ora2Pg perl module
my $schema = new Ora2Pg (
datasource => $dbsrc, # Database DBD datasource
user => $dbuser, # Database user
password => $dbpwd, # Database password
debug => 1, # Verbose mode
schema => 'ALICIA7', # Extract only APPS schema
# export_schema => 1, # Export Oracle schema to Postgresql 7.3 schema
# schema => 'APPS', # Extract only the given schema namespace
type => 'TABLE', # Extract table
# type => 'PACKAGE', # Extract PACKAGE information
# type => 'DATA', # Extract data with output as INSERT statement
......@@ -41,17 +42,14 @@ my $schema = new Ora2Pg (
# type => 'TRIGGER', # Extract triggers
# type => 'FUNCTION', # Extract functions
# type => 'PROCEDURE', # Extract procedures
# tables => [('FND_USER_PREFERENCES')], # unique index + users
# tables => [('CUSTOMER_DATA')], # Unique and primary key
# tables => [('TX_DATA')], # simple indexes
# tables => [('NDW_BROWSER_ATTRIBUTES')], # view
# tables => [('TRIP_DATA')], # Foreign key
# tables => [('JO_TMP')], # Foreign key
# showtableid => 1, # Display only table indice during extraction
# min => 1, # Extract begin at indice 3
# max => 10, # Extract ended at indice 5
# data_limit => 1000, # Extract all data by dump of 1000 tuples
# data_limit => 0, # Extract all data in one pass. Be sure to have enougth memory
# data_limit => 0, # Extract all data in one pass. Be sure to have enougth memory.
);
# Just export data of the following fields from table 's_txcot'
......@@ -59,11 +57,10 @@ my $schema = new Ora2Pg (
#### Function to use for extraction when type option is set to DATA or COPY
# Send exported data to a PostgreSQL database
#$schema->send_to_pgdb('dbi:Pg:dbname=template1;host=localhost;port=5432','test','test');
# Send exported data directly to a PostgreSQL database
#$schema->send_to_pgdb('dbi:Pg:dbname=test_db;host=localhost;port=5432','test','test');
# Output the data extracted from Oracle DB to a file or to STDOUT if no argument.
# If you set the send_to_pgdb() method the output is given to PG database. See above
#$schema->export_data("output.sql");
#### Function to use for extraction of other type
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment