oradelete – Deleting all records
Purpose
oradelete prints the delete statements for all tables in an Oracle database schema in the correct order (i.e. records will be deleted so that no errors happen during script execution). oradelete can also be used to actually make all tables empty.
Options
oradelete supports the following options:
- -v <flag>, --verbose <flag>
Produces output (on stderr) while the database is read or written. (Valid flag values are
false
,no
,0
,true
,yes
or1
)
- -c <flag>, --color <flag>
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
.
- -s <flag>, --sequences <flag>
Should sequences be reset to their initial values? (Valid flag values are
false
,no
,0
,true
,yes
or1
)
- -x <flag>, --execute <flag>
When the
-x
argument is given the SQL script isn’t printed on stdout, but is executed directly in the schema specified via theconnectstring
option. Be careful with this: You will have empty tables afteroradelete -x
. (Valid flag values arefalse
,no
,0
,true
,yes
or1
)
- -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
)
- -i <flag>, --ignore <flag>
If true, any exception that occurs while the database is read or written will be ignored. (Valid flag values are
false
,no
,0
,true
,yes
or1
)
- -t <flag>, --truncate <flag>
If given the script uses the
TRUNCATE
command instead of theDELETE
command. (Valid flag values arefalse
,no
,0
,true
,yes
or1
)
- --format <format>
If
--execute
is not given, this determines the output format: Plain SQL (formatsql
), or PySQL (formatpysql
) which can be piped intoll.pysql
.
- --include <regexp>
Only include objects in the output if their name contains the regular expression.
- --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.