Previous Topic

Next Topic

Book Contents

Book Index

Scripting - Schema Compare

This runs the Compare Schemas function.

The parameters required by this function are similar to the options on the Compare Schemas Options tab.

The Compare Schemas window has a function Tools > Genenerate Batch Control Statement which will generate this script control statement for you, based on the options specified. It is recommended that this is used, rather then coding the Compschema function from scratch.

When this is function is run, a tab-delimited report is sent to the file specified by the parameter File.

Parameter

Description

Note

Schema1*

The schema you are comparing.

 

Schema2*

Schema you are comparing to.

 

Dbs1*

The name of the database containing Schema1

You must already have signed onto this database.

Dbs2*

The name of the database containing Schema2.

 

Object1

The type of object you are comparing.

This must correspond to the name of an object in the Database Explorer.

For many databases this can only be one value: Tables and Views.

For some other databases (such as Oracle), this can be one of several values such as: Tables, Views, Synonyms.

This parameter is optional. If not given, or the name supplied is not a valid object-name, the first object in the Database Explorer will be used.

Object2

The type of object you are comparing to.

If not given, the same as Object1.

Filter

A filter string for comparing a subset of the tables in the Schema.

 

DBName2

 

You would use this if the Schema you are comparing to is in a different Sybase/SQL Server database to one signed onto.

Method

The compare method.

Values:

FAST (default) or FULL.

ColMethod

When the compare method is FULL, this specifies how the columns in the tables will be compared.

Options are

  • COLNO – compare by column number (default)
  • NAME – compare by column name.

File*

Name of the file the Compare Schema report is written to.

 

FileMode

Whether the report is to APPEND to or REPLACE the contents of File.

Default is APPEND.

Report

Specifies whether the report is to include ALL tables (ALL), or just those that are different (DIFF).

Default is ALL.

Parameters marked * are mandatory

Example:

--aqt compschema,dbs1=ora_tst,object1=Tables,schema1=DEMO,dbs2=ora_prod,

object2=Tables,schema2=DEMO,method=fast,file=compschema.txt,filemode=replace