psGDeleteRIViolators

Description

     This program writes a SQL script which drops all rows that
violate referential integrity constraints.   This program asks a Sybase
database about its RI constraints, and then it generates a SQL script
for a Sybase, MS SQL Server, Oracle or any generic ODBC database.
     There are many reasons why the referential integrity of a database
may have been compromised.   For Sybase and MS SQL Server, any bulk copy
operation into a table will bypass RI checks.  For Oracle, somebody may
have disabled the RI constraints using an ALTER TABLE statement.  Or the
reason may be even simpler:  RI constraints that should have been in the
database were never put there in the first place, and now you want to
make sure referential integrity is present and enforced.   The problem,
is, is that before you can add the RI constraints again, you first have to
drop all the orphaned rows.
     See also programs psGAddRIConstraints and psGCheckRIConstraints.

 

Syntax

psGDeleteRIViolators -Sserver -Uusername -Ppassword -Ddatabase
-Wowner -Nname -FSQL_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

-N

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

-F

Name of output SQL script [standard output]

-O

Options

 

Options

s

Generate a Sybase SQL script

m

Generate a Microsoft SQL script

o

Generate an Oracle SQL script

g

Generate an ODBC SQL script

r

Check normal RI based constraints

k

Check foreign keys defined by sp_foreignkey

j

Check keys defined with sp_commonkey

c

Delete rows from tables in table creation order

 

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.

 

Go to DBPowerSuite 7.9 List of Programs.


Updated: Thu Jun 18 21:12:26 2009