oradiff – Diffing two schemas
Purpose
oradiff can be used to find the difference between two Oracle database schemas.
Options
oradiff supports the following options:
- -v <flag>, --verbose <flag>
Produces output (on stderr) while the database is read. (Valid flag values are
false
,no
,0
,true
,yes
or1
)
- -c <mode>, --color <mode>
Should the output (when the
-v
option is used) be colored? Ifauto
is specified (the default) then the output is colored if stderr is a terminal. Valid modes areyes
,no
orauto
.
- -m <mode>, --mode <mode>
Specifies how the differences should be shown.
brief
only prints whether objects are different (or which ones exist in only one of the databases);udiff
outputs the differences in “unified diff” format andfull
outputs the object from the second schema if they differ (i.e. it outputs the script that must be executed to copy the differences from schema 2 to schema 1).
- --format <format>
If
--mode
isfull
, this determines the output format: Plain SQL (formatsql
), or PySQL (formatpysql
) which can be piped intoll.pysql
.
- -n <context>, --context <context>
The number of context lines in unified diff mode (i.e. the number of unchanged lines above and below each block of changes; the default is 2)
- -k <flag>, --keepjunk <flag>
If false (the default), database objects that have
$
orSYS_EXPORT_SCHEMA_
in their name will be skipped (otherwise these objects will be included in the output). (Valid flag values arefalse
,no
,0
,true
,yes
or1
)
- -b <mode>, --blank <mode>
The
-b
option specifies how whitespace in the database objects should be compared. Withliteral
all whitespace is significant, withtrail
trailing whitespace will be ignore, withlead
leading whitespace will be ignored, withboth
trailing and leading whitespace will be ignored and withcollapse
trailing and leading whitespace will be ignored and stretches of whitespace will be treated as a single space.
- --thick <flag>
If true, use
oracledb
s thick mode. (Valid flag values arefalse
,no
,0
,true
,yes
or1
)
- --config_dir <directory>
In
oracledb
s thin mode, specify the directory that contains thetnsnames.ora
file. This can be used if “Connect Descriptor Strings” fromtnsnames.ora
must be used buttnsnames.ora
can’t be found in its default location.
Example
Compare the schemas user@db
and user2@db2
, collapsing whitespace and
using unified diff mode with 5 context lines:
$ oradiff user/pwd@db user2/pwd2@db2 -bcollapse -mudiff -n5 -v >db.diff