psGCopyTableData

Description

    This program copies table data from one database to another.   This program
assumes that the source and target databases are of different vendors.   For example,
you can copy table data from Oracle to Sybase, from Sybase to MySQL, from Postgres to
Sybase . . . .    Any combination is possible.
    This program writes an export and an import script.   The form of an export
script defaults to a DBPowerSuite psOSQL ODBC session.   You can change the default
ODBC form for Microsoft SQL Server and Sybase.   For Microsoft SQL server, you can
instead create a Windows batch file of bcp queryout commands.   For Sybase, you
create a DBPowerSuite psSQL Sybase Open-Client session.   Therefore, for Microsoft
and Sybase, you do not need their ODBC driver to export their data.
    For the import script, this program generates SQLLoader scripts for Oracle,
a Windows batch file of bcp commands for Microsoft SQL Server, and a UNIX shell
script of bcp commands for Sybase.   For other targets like MySQL and Postgres,
this program generates a UNIX ODBC psOLoader script.

 

Syntax

psGCopyTableData -Sserver -Uusername -Ppassword -Ddatabase
-Wowner -Nname
-sODBCdsn, -vODBCserver, -uODBCuser, -pODBCpass -aother_attributes
-Acolumn_delimiter_string -Xrow_terminator_string
-Jtarget_dsn -Qtarget_server -Rtarget_user -Ttarget_password -Vtarget_database -Ytarget_owner -Zattr
-FKorn_shell_script -Ooptions

 

Arguments

-S

Sybase Server Name

-U

Sybase User Name

-P

Sybase User's Password

-D

Sybase Database

-W

Use tables belonging to 'owner' only [dbo]

-N

Use tables having pattern 'name' [!rs%]

-s

ODBC Data Source Name (or MS SQL Server DB name--Windows batch file)

-v

ODBC Server Name (or MS SQL Server name)

-u

ODBC User Name (or MS SQL Server user name)

-p

ODBC Password (or MS SQL Server password)

-a

ODBC Other Attributes (or MS SQL Server owner name)

-J

Target Data Source (only for ODBC target)

-Q

Target Server

-R

Target User Name

-T

Target Password

-V

Target Database

-Y

Target Owner

-Z

Target Other Attributes (optional only for ODBC target)

-A

Column Delimiter String [|]

-X

Row Terminator String [standard OS record terminator]

-F

Name of output Korn Shell script [standard output]

-O

Options

 

Options

S

The originating data source is Sybase

M

The originating data source is Microsoft SQL Server

O

The originating data source is Oracle

R

The originating data source is Posgres

Y

The originating data source is MySQL

G

The originating data source is generic ODBC

s

The target data server is Sybase

m

The target data server is Microsoft SQL Server

o

The target data server is Oracle

r

The target data server is Postgres

y

The target data server is MySQL

g

The target data server is generic ODBC

w

Remove all leading and trailing white spaces

n

Make sure not-null columns will be not null.  Turn nulls to zeros or spaces.

N

For null columns as well, turn the values into zeros or spaces.

u

Use Data-Direct ODBC drivers.

k

For Sybase sources, write a psSQL session instead of a psOSQL ODBC session.

b

For MS SQL Server sources, write a Windows batch file of bcp queryout commands instead of a Korn/psOSQL script.

h

For Oracle targets, use hex notation for SQLLoader terminators.

8

For Oracle targets, use old 8 bit hex notation for SQLLoader terminators.

d

For Oracle targets, use SQLLoader direct path.  Conventional path in the default.

e

For Oracle targets, for SQLLoader direct path, reenable disabled constraints.

p

For generic ODBC targets, do NOT use prepared statements.  In any case, 'bind' with ODBC driver data type conversions . . . or . . .

a

For generic ODBC targets, use ad-hoc non-binding SQL inserts

x

For generic ODBC targets, REMOVE any 0x hex prefixes in binary column data

q

For generic ODBC targets, enclose binary data in quotes

 

Environment Variables Behind the Scenes

DSQUERY

When -S is not specified.

SYB_USER

When -U is not specified.

SYB_PASS

When -P is not specified.

SYB_DATABASE

When -D is not specified.

PS_SYSMSG_FILE

Name of the tool's messages file.

 

ODBC Requirements

     This program, psGCopyTableData, does not require ODBC drivers to be present to run.
The scripts the program generates require ODBC drivers to be present only when you opted to
use the ODBC export or import options.  For Sybase and Microsoft SQL Server sources, you do not
need ODBC.  For Oracle sources, you do.   For Sybase, Microsoft SQL Server or Oracle targets,
you do not need ODBC.   For other databases, like MySQL or Postgres, you do.   Remember that the
MySQL and Postgres ODBC drivers come with DBPowerSuite.
     You can buy a full set of production quality ODBC drivers for Sybase, Oracle, and Microsoft
which run on Solaris and Linux, from Data Direct Technologies.  DBPowerSuite readily works with
the Data Direct drivers.   These drivers are easy to install.  It is a one-step process.

Schema Definition

     psGCopyTableData depends on you first defining the schema using Sybase.
Sybase must be in the picture.   Your source and target databases can be different than
Sybase.  psGCopyTableData reads the Sybase system tables for the table definitions
as well as uses the RI constraints to determine which tables are parent tables and which
tables are child tables.  psGCopyTableData uses the parent/child relationships
to determine which table it loads first.  It loads parent tables first.
     The target schema must match the Sybase schema-definition.   The column order must be
the same.   However, the column order in the source database does not have to be the same.
psGCopyTableData rearranges the data from the source tables to match that of the target.

Database Location Independence

     The source and the target database can be on completely separated networks.  This
program generates scripts.   It is the scripts you take to the source or target environment
and run.   The export script generates table data files.   You can zip up those data files and
ftp them to the target environment.   Then you run the import script at the target location
against those data files.
     DBPowerSuite does not have to be present on the source database's network when
the source database is Microsoft SQL Server.   If the source database is not
Microsoft SQL Server, then you will need DBPowerSuite on the network somewhere.

 

Go to DBPowerSuite 7.9 List of Programs.


Updated: Thu Jun 18 21:12:26 2009