2001-05-10 23:51:05 +08:00
|
|
|
<HTML>
|
|
|
|
<HEAD>
|
|
|
|
<TITLE>Ora2Pg - Oracle to PostgreSQL database schema converter</TITLE>
|
2001-06-23 10:56:23 +08:00
|
|
|
<LINK REV="made" HREF="mailto:root@porky.devel.redhat.com">
|
2001-05-10 23:51:05 +08:00
|
|
|
</HEAD>
|
|
|
|
|
|
|
|
<BODY>
|
|
|
|
|
|
|
|
<!-- INDEX BEGIN -->
|
|
|
|
|
|
|
|
<UL>
|
|
|
|
|
2001-06-23 10:56:23 +08:00
|
|
|
<LI><A HREF="#NAME">NAME</A>
|
|
|
|
<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
|
|
|
|
<LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
|
|
|
|
<LI><A HREF="#ABSTRACT">ABSTRACT</A>
|
|
|
|
<LI><A HREF="#REQUIREMENT">REQUIREMENT</A>
|
|
|
|
<LI><A HREF="#PUBLIC_METHODS">PUBLIC METHODS</A>
|
2001-05-10 23:51:05 +08:00
|
|
|
<UL>
|
|
|
|
|
2001-06-23 10:56:23 +08:00
|
|
|
<LI><A HREF="#new_HASH_OPTIONS">new HASH_OPTIONS</A>
|
|
|
|
<LI><A HREF="#export_sql_FILENAME">export_sql FILENAME</A>
|
2001-05-10 23:51:05 +08:00
|
|
|
</UL>
|
|
|
|
|
2001-06-23 10:56:23 +08:00
|
|
|
<LI><A HREF="#PRIVATE_METHODS">PRIVATE METHODS</A>
|
2001-05-10 23:51:05 +08:00
|
|
|
<UL>
|
|
|
|
|
2001-06-23 10:56:23 +08:00
|
|
|
<LI><A HREF="#_init_HASH_OPTIONS">_init HASH_OPTIONS</A>
|
|
|
|
<LI><A HREF="#_grants">_grants</A>
|
|
|
|
<LI><A HREF="#_sequences">_sequences</A>
|
|
|
|
<LI><A HREF="#_triggers">_triggers</A>
|
|
|
|
<LI><A HREF="#_functions">_functions</A>
|
|
|
|
<LI><A HREF="#_tables">_tables</A>
|
|
|
|
<LI><A HREF="#_views">_views</A>
|
|
|
|
<LI><A HREF="#_get_sql_data">_get_sql_data</A>
|
|
|
|
<LI><A HREF="#_sql_type_INTERNAL_TYPE_LENGTH">_sql_type INTERNAL_TYPE LENGTH</A>
|
|
|
|
<LI><A HREF="#_column_info_TABLE">_column_info TABLE</A>
|
|
|
|
<LI><A HREF="#_primary_key_TABLE">_primary_key TABLE</A>
|
|
|
|
<LI><A HREF="#_unique_key_TABLE">_unique_key TABLE</A>
|
|
|
|
<LI><A HREF="#_foreign_key_TABLE">_foreign_key TABLE</A>
|
|
|
|
<LI><A HREF="#_get_users">_get_users</A>
|
|
|
|
<LI><A HREF="#_get_roles">_get_roles</A>
|
|
|
|
<LI><A HREF="#_get_all_grants">_get_all_grants</A>
|
|
|
|
<LI><A HREF="#_get_indexes_TABLE">_get_indexes TABLE</A>
|
|
|
|
<LI><A HREF="#_get_sequences">_get_sequences</A>
|
|
|
|
<LI><A HREF="#_get_views">_get_views</A>
|
|
|
|
<LI><A HREF="#_get_triggers">_get_triggers</A>
|
|
|
|
<LI><A HREF="#_get_functions">_get_functions</A>
|
|
|
|
<LI><A HREF="#_table_info">_table_info</A>
|
2001-05-10 23:51:05 +08:00
|
|
|
</UL>
|
|
|
|
|
2001-06-23 10:56:23 +08:00
|
|
|
<LI><A HREF="#AUTHOR">AUTHOR</A>
|
|
|
|
<LI><A HREF="#COPYRIGHT">COPYRIGHT</A>
|
|
|
|
<LI><A HREF="#BUGS">BUGS</A>
|
|
|
|
<LI><A HREF="#SEE_ALSO">SEE ALSO</A>
|
2001-05-10 23:51:05 +08:00
|
|
|
</UL>
|
|
|
|
<!-- INDEX END -->
|
|
|
|
|
|
|
|
<HR>
|
|
|
|
<P>
|
2001-06-23 10:56:23 +08:00
|
|
|
<H1><A NAME="NAME">NAME</A></H1>
|
|
|
|
<P>
|
|
|
|
Ora2Pg - Oracle to PostgreSQL database schema converter
|
|
|
|
|
2001-05-10 23:51:05 +08:00
|
|
|
<P>
|
|
|
|
<HR>
|
2001-06-23 10:56:23 +08:00
|
|
|
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
|
|
|
|
<P>
|
|
|
|
<PRE> BEGIN {
|
2001-05-10 23:51:05 +08:00
|
|
|
$ENV{ORACLE_HOME} = '/usr/local/oracle/oracle816';
|
2001-06-23 10:56:23 +08:00
|
|
|
}
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
<PRE> use strict;
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
<PRE> use Ora2Pg;
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
<PRE> # Init the database connection
|
2001-05-10 23:51:05 +08:00
|
|
|
my $dbsrc = 'dbi:Oracle:host=testdb.samse.fr;sid=TEST;port=1521';
|
|
|
|
my $dbuser = 'system';
|
2001-06-23 10:56:23 +08:00
|
|
|
my $dbpwd = 'manager';
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
<PRE> # Create an instance of the Ora2Pg perl module
|
2001-05-10 23:51:05 +08:00
|
|
|
my $schema = new Ora2Pg (
|
|
|
|
datasource => $dbsrc, # Database DBD datasource
|
|
|
|
user => $dbuser, # Database user
|
|
|
|
password => $dbpwd, # Database password
|
2001-06-23 10:56:23 +08:00
|
|
|
);
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
<PRE> # Create the POSTGRESQL representation of all objects in the database
|
|
|
|
$schema->export_schema("output.sql");
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
<PRE> exit(0);
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
or if you only want to extract some tables:
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> # Create an instance of the Ora2Pg perl module
|
2001-05-13 10:10:00 +08:00
|
|
|
my @tables = ('tab1', 'tab2', 'tab3');
|
|
|
|
my $schema = new Ora2Pg (
|
|
|
|
datasource => $dbsrc, # Database DBD datasource
|
|
|
|
user => $dbuser, # Database user
|
|
|
|
password => $dbpwd, # Database password
|
2001-06-23 10:56:23 +08:00
|
|
|
tables => \@tables,
|
|
|
|
or # Tables to extract
|
|
|
|
tables => [('tab1','tab2')],
|
2001-05-13 10:10:00 +08:00
|
|
|
debug => 1 # To show somethings when running
|
2001-06-23 10:56:23 +08:00
|
|
|
);
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
or if you only want to extract the 10 first tables:
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> # Create an instance of the Ora2Pg perl module
|
2001-05-13 10:10:00 +08:00
|
|
|
my $schema = new Ora2Pg (
|
|
|
|
datasource => $dbsrc, # Database DBD datasource
|
|
|
|
user => $dbuser, # Database user
|
|
|
|
password => $dbpwd, # Database password
|
|
|
|
max => 10 # 10 first tables to extract
|
2001-06-23 10:56:23 +08:00
|
|
|
);
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
or if you only want to extract tables 10 to 20:
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> # Create an instance of the Ora2Pg perl module
|
2001-05-13 10:10:00 +08:00
|
|
|
my $schema = new Ora2Pg (
|
|
|
|
datasource => $dbsrc, # Database DBD datasource
|
|
|
|
user => $dbuser, # Database user
|
|
|
|
password => $dbpwd, # Database password
|
2001-06-23 10:56:23 +08:00
|
|
|
min => 10, # Begin extraction at indice 10
|
2001-05-13 10:10:00 +08:00
|
|
|
max => 20 # End extraction at indice 20
|
2001-06-23 10:56:23 +08:00
|
|
|
);
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
To choose a particular schema just set the following option to your schema
|
|
|
|
name :
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> schema => 'APPS'
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
To know at which indices table can be found during extraction use the
|
|
|
|
option:
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> showtableid => 1
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
To extract all views set the option type as follow:
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> type => 'VIEW'
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
To extract all grants set the option type as follow:
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> type => 'GRANT'
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
To extract all sequences set the option type as follow:
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> type => 'SEQUENCE'
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
To extract all triggers set the option type as follow:
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> type => 'TRIGGER'
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
To extract all functions set the option type as follow:
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> type => 'FUNCTION'
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
To extract all procedures set the option type as follow:
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> type => 'PROCEDURE'
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
Default is table schema extraction
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> type => 'TABLE'
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
|
|
|
|
<P>
|
|
|
|
Ora2Pg is a perl OO module used to export an Oracle database schema to a
|
|
|
|
PostgreSQL compatible schema.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
It simply connect to your Oracle database, extract its structure and
|
|
|
|
generate a SQL script that you can load into your PostgreSQL database.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
I'm not a Oracle DBA so I don't really know something about its internal
|
2001-05-10 23:51:05 +08:00
|
|
|
structure so you may find some incorrect things. Please tell me what is
|
2001-06-23 10:56:23 +08:00
|
|
|
wrong and what can be better.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
It currently dump the database schema (tables, views, sequences, indexes,
|
|
|
|
grants), with primary, unique and foreign keys into PostgreSQL syntax
|
|
|
|
without editing the SQL code generated.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Functions, procedures and triggers PL/SQL code generated must be reviewed
|
|
|
|
to match the PostgreSQL syntax. Some usefull recommandation on porting
|
|
|
|
Oracle to PostgreSQL can be found at <A
|
|
|
|
HREF="http://techdocs.postgresql.org/">http://techdocs.postgresql.org/</A>
|
|
|
|
under the ``Converting from other Databases to PostgreSQL'' Oracle part. I
|
|
|
|
just notice one thing more is that the <CODE>trunc()</CODE> function in
|
|
|
|
Oracle is the same for number or date so be carefull when porting to
|
|
|
|
PostgreSQL to use <CODE>trunc()</CODE> for number and
|
|
|
|
<CODE>date_trunc()</CODE> for date.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H1><A NAME="ABSTRACT">ABSTRACT</A></H1>
|
|
|
|
<P>
|
|
|
|
The goal of the Ora2Pg perl module is to cover all part needed to export an
|
|
|
|
Oracle database to a PostgreSQL database without other thing that provide
|
|
|
|
the connection parameters to the Oracle database.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Features must include:
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> - Database schema export (tables, views, sequences, indexes),
|
|
|
|
with unique, primary and foreign key.
|
2001-05-13 10:10:00 +08:00
|
|
|
- Grants/privileges export by user and group.
|
2001-06-23 10:56:23 +08:00
|
|
|
- Table selection (by name and max table) export.
|
|
|
|
- Predefined functions/triggers/procedures export.
|
|
|
|
- Sql query converter (todo)
|
2001-05-13 10:10:00 +08:00
|
|
|
- Data export (todo)
|
2001-06-23 10:56:23 +08:00
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
My knowledge regarding database is really poor especially for Oracle so
|
|
|
|
contribution is welcome.
|
|
|
|
|
2001-05-10 23:51:05 +08:00
|
|
|
<P>
|
|
|
|
<HR>
|
2001-06-23 10:56:23 +08:00
|
|
|
<H1><A NAME="REQUIREMENT">REQUIREMENT</A></H1>
|
|
|
|
<P>
|
|
|
|
You just need the DBI and DBD::Oracle perl module to be installed
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H1><A NAME="PUBLIC_METHODS">PUBLIC METHODS</A></H1>
|
2001-05-10 23:51:05 +08:00
|
|
|
<P>
|
|
|
|
<HR>
|
2001-06-23 10:56:23 +08:00
|
|
|
<H2><A NAME="new_HASH_OPTIONS">new HASH_OPTIONS</A></H2>
|
2001-05-10 23:51:05 +08:00
|
|
|
<P>
|
2001-06-23 10:56:23 +08:00
|
|
|
Creates a new Ora2Pg object.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Supported options are:
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> - datasource : DBD datasource (required)
|
2001-05-10 23:51:05 +08:00
|
|
|
- user : DBD user (optional with public access)
|
|
|
|
- password : DBD password (optional with public access)
|
2001-06-23 10:56:23 +08:00
|
|
|
- schema : Oracle internal schema to extract
|
|
|
|
- type : Type of data to extract, can be TABLE,VIEW,GRANT,SEQUENCE,TRIGGER,FUNCTION,PROCEDURE
|
2001-05-13 10:10:00 +08:00
|
|
|
- debug : Print the current state of the parsing
|
|
|
|
- tables : Extract only the given tables (arrayref)
|
|
|
|
- showtableid : Display only the table indice during extraction
|
|
|
|
- min : Indice to begin extraction. Default to 0
|
2001-06-23 10:56:23 +08:00
|
|
|
- max : Indice to end extraction. Default to 0 mean no limits
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
Attempt that this list should grow a little more because all initialization
|
|
|
|
is done by this way.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H2><A NAME="export_sql_FILENAME">export_sql FILENAME</A></H2>
|
|
|
|
<P>
|
|
|
|
Print SQL conversion output to a filename or to STDOUT if no file is given.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H1><A NAME="PRIVATE_METHODS">PRIVATE METHODS</A></H1>
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H2><A NAME="_init_HASH_OPTIONS">_init HASH_OPTIONS</A></H2>
|
|
|
|
<P>
|
|
|
|
Initialize a Ora2Pg object instance with a connexion to the Oracle
|
|
|
|
database.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H2><A NAME="_grants">_grants</A></H2>
|
|
|
|
<P>
|
|
|
|
This function is used to retrieve all privilege information.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
It extract all Oracle's ROLES to convert them as Postgres groups and search
|
|
|
|
all users associated to these roles.
|
|
|
|
|
2001-05-13 10:10:00 +08:00
|
|
|
<P>
|
2001-06-23 10:56:23 +08:00
|
|
|
Set the main hash $self->{groups}. Set the main hash
|
|
|
|
$self->{grantss}.
|
|
|
|
|
2001-05-10 23:51:05 +08:00
|
|
|
<P>
|
|
|
|
<HR>
|
2001-06-23 10:56:23 +08:00
|
|
|
<H2><A NAME="_sequences">_sequences</A></H2>
|
|
|
|
<P>
|
|
|
|
This function is used to retrieve all sequences information.
|
|
|
|
|
2001-05-10 23:51:05 +08:00
|
|
|
<P>
|
2001-06-23 10:56:23 +08:00
|
|
|
Set the main hash $self->{sequences}.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H2><A NAME="_triggers">_triggers</A></H2>
|
|
|
|
<P>
|
|
|
|
This function is used to retrieve all triggers information.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Set the main hash $self->{triggers}.
|
|
|
|
|
2001-05-10 23:51:05 +08:00
|
|
|
<P>
|
2001-06-23 10:56:23 +08:00
|
|
|
<HR>
|
|
|
|
<H2><A NAME="_functions">_functions</A></H2>
|
|
|
|
<P>
|
|
|
|
This function is used to retrieve all functions information.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Set the main hash $self->{functions}.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
2001-05-10 23:51:05 +08:00
|
|
|
<H2><A NAME="_tables">_tables</A></H2>
|
2001-05-13 10:10:00 +08:00
|
|
|
<P>
|
2001-06-23 10:56:23 +08:00
|
|
|
This function is used to retrieve all table information.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Set the main hash of the database structure $self->{tables}. Keys are
|
|
|
|
the names of all tables retrieved from the current database. Each table
|
|
|
|
information compose an array associated to the table_info key as array
|
|
|
|
reference. In other way:
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> $self->{tables}{$class_name}{table_info} = [(OWNER,TYPE)];
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
DBI TYPE can be TABLE, VIEW, SYSTEM TABLE, GLOBAL TEMPORARY, LOCAL
|
|
|
|
TEMPORARY, ALIAS, SYNONYM or a data source specific type identifier. This
|
|
|
|
only extract TABLE type.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
It also get the following informations in the DBI object to affect the main
|
|
|
|
hash of the database structure :
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> $self->{tables}{$class_name}{field_name} = $sth->{NAME};
|
|
|
|
$self->{tables}{$class_name}{field_type} = $sth->{TYPE};
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
It also call these other private subroutine to affect the main hash of the
|
|
|
|
database structure :
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> @{$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);
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
<HR>
|
2001-05-13 10:10:00 +08:00
|
|
|
<H2><A NAME="_views">_views</A></H2>
|
2001-06-23 10:56:23 +08:00
|
|
|
<P>
|
|
|
|
This function is used to retrieve all views information.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Set the main hash of the views definition $self->{views}. Keys are the
|
|
|
|
names of all views retrieved from the current database values are the text
|
|
|
|
definition of the views.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
It then set the main hash as follow:
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> # Definition of the view
|
2001-05-13 10:10:00 +08:00
|
|
|
$self->{views}{$table}{text} = $view_infos{$table};
|
2001-06-23 10:56:23 +08:00
|
|
|
</PRE>
|
2001-05-10 23:51:05 +08:00
|
|
|
<P>
|
2001-06-23 10:56:23 +08:00
|
|
|
<HR>
|
2001-05-10 23:51:05 +08:00
|
|
|
<H2><A NAME="_get_sql_data">_get_sql_data</A></H2>
|
2001-05-13 10:10:00 +08:00
|
|
|
<P>
|
2001-06-23 10:56:23 +08:00
|
|
|
Returns a string containing the entire SQL Schema definition compatible
|
|
|
|
with PostgreSQL
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H2><A NAME="_sql_type_INTERNAL_TYPE_LENGTH">_sql_type INTERNAL_TYPE LENGTH</A></H2>
|
|
|
|
<P>
|
|
|
|
This function return the PostgreSQL datatype corresponding to the Oracle
|
|
|
|
internal type.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H2><A NAME="_column_info_TABLE">_column_info TABLE</A></H2>
|
|
|
|
<P>
|
|
|
|
This function implements a Oracle-native column information.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Return a list of array reference containing the following informations for
|
|
|
|
each column the given a table
|
|
|
|
|
|
|
|
<P>
|
|
|
|
[( column name, column type, column length, nullable column, default value
|
|
|
|
)]
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H2><A NAME="_primary_key_TABLE">_primary_key TABLE</A></H2>
|
|
|
|
<P>
|
|
|
|
This function implements a Oracle-native primary key column information.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Return a list of all column name defined as primary key for the given
|
|
|
|
table.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H2><A NAME="_unique_key_TABLE">_unique_key TABLE</A></H2>
|
|
|
|
<P>
|
|
|
|
This function implements a Oracle-native unique key column information.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Return a list of all column name defined as unique key for the given table.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H2><A NAME="_foreign_key_TABLE">_foreign_key TABLE</A></H2>
|
|
|
|
<P>
|
|
|
|
This function implements a Oracle-native foreign key reference information.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Return a list of hash of hash of array reference. Ouuf! Nothing very
|
|
|
|
difficult. The first hash is composed of all foreign key name. The second
|
|
|
|
hash just have two key known as 'local' and remote' corresponding to the
|
|
|
|
local table where the foreign key is defined and the remote table where the
|
|
|
|
key refer.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
The foreign key name is composed as follow:
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> 'local_table_name->remote_table_name'
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
Foreign key data consist in two array representing at the same indice the
|
|
|
|
local field and the remote field where the first one refer to the second.
|
|
|
|
Just like this:
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<PRE> @{$link{$fkey_name}{local}} = @local_columns;
|
|
|
|
@{$link{$fkey_name}{remote}} = @remote_columns;
|
|
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H2><A NAME="_get_users">_get_users</A></H2>
|
|
|
|
<P>
|
|
|
|
This function implements a Oracle-native users information.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Return a hash of all users as an array.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
2001-05-13 10:10:00 +08:00
|
|
|
<H2><A NAME="_get_roles">_get_roles</A></H2>
|
|
|
|
<P>
|
2001-06-23 10:56:23 +08:00
|
|
|
This function implements a Oracle-native roles information.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Return a hash of all groups (roles) as an array of associated users.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H2><A NAME="_get_all_grants">_get_all_grants</A></H2>
|
|
|
|
<P>
|
|
|
|
This function implements a Oracle-native user privilege information.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Return a hash of all tables grants as an array of associated users.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H2><A NAME="_get_indexes_TABLE">_get_indexes TABLE</A></H2>
|
|
|
|
<P>
|
|
|
|
This function implements a Oracle-native indexes information.
|
|
|
|
|
|
|
|
<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 given table.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H2><A NAME="_get_sequences">_get_sequences</A></H2>
|
|
|
|
<P>
|
|
|
|
This function implements a Oracle-native sequences information.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Return a hash of array of sequence name with MIN_VALUE, MAX_VALUE,
|
|
|
|
INCREMENT and LAST_NUMBER for the given table.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
2001-05-13 10:10:00 +08:00
|
|
|
<H2><A NAME="_get_views">_get_views</A></H2>
|
2001-06-23 10:56:23 +08:00
|
|
|
<P>
|
|
|
|
This function implements a Oracle-native views information.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Return a hash of view name with the SQL query it is based on.
|
|
|
|
|
2001-05-10 23:51:05 +08:00
|
|
|
<P>
|
|
|
|
<HR>
|
2001-06-23 10:56:23 +08:00
|
|
|
<H2><A NAME="_get_triggers">_get_triggers</A></H2>
|
|
|
|
<P>
|
|
|
|
This function implements a Oracle-native triggers information.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Return an array of refarray of all triggers informations
|
|
|
|
|
2001-05-10 23:51:05 +08:00
|
|
|
<P>
|
|
|
|
<HR>
|
2001-06-23 10:56:23 +08:00
|
|
|
<H2><A NAME="_get_functions">_get_functions</A></H2>
|
|
|
|
<P>
|
|
|
|
This function implements a Oracle-native functions information.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Return a hash of all function name with their PLSQL code
|
|
|
|
|
2001-05-10 23:51:05 +08:00
|
|
|
<P>
|
|
|
|
<HR>
|
2001-06-23 10:56:23 +08:00
|
|
|
<H2><A NAME="_table_info">_table_info</A></H2>
|
|
|
|
<P>
|
|
|
|
This function retrieve all Oracle-native tables information.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Return a handle to a DB query statement
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H1><A NAME="AUTHOR">AUTHOR</A></H1>
|
|
|
|
<P>
|
|
|
|
Gilles Darold <<A
|
|
|
|
HREF="mailto:gilles@darold.net">gilles@darold.net</A>>
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H1><A NAME="COPYRIGHT">COPYRIGHT</A></H1>
|
|
|
|
<P>
|
|
|
|
Copyright (c) 2001 Gilles Darold - All rights reserved.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
This program is free software; you can redistribute it and/or modify it
|
|
|
|
under the same terms as Perl itself.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<H1><A NAME="BUGS">BUGS</A></H1>
|
|
|
|
<P>
|
|
|
|
This perl module is in the same state as my knowledge regarding database,
|
2001-05-10 23:51:05 +08:00
|
|
|
it can move and not be compatible with older version so I will do my best
|
2001-06-23 10:56:23 +08:00
|
|
|
to give you official support for Ora2Pg. Your volontee to help construct it
|
|
|
|
and your contribution are welcome.
|
|
|
|
|
2001-05-10 23:51:05 +08:00
|
|
|
<P>
|
|
|
|
<HR>
|
2001-06-23 10:56:23 +08:00
|
|
|
<H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
|
|
|
|
<P>
|
|
|
|
<EM>DBI</EM>, <A HREF="/DBD/Oracle.html">DBD::Oracle</A>
|
|
|
|
|
|
|
|
|
2001-05-10 23:51:05 +08:00
|
|
|
|
|
|
|
</BODY>
|
|
|
|
|
|
|
|
</HTML>
|