The nzdumpschema command

Use the nzdumpschema command to generate a shell script with SQL statements that duplicate a database by extracting its object definitions and statistics.

Note: Because no actual data is dumped, you cannot use this command to back up a database.

Syntax

The nzdumpschema command uses the following syntax:
nzdumpschema [-h] [-R] database [outfile] [outdir] 
[datadir][schemaList] 
The nzdumpschema command takes the following inputs:
Table 1. The nzdumpschema inputs
Option Description
-h Displays this help
-R Create a script by using the actual database name. Otherwise, the script uses the placeholder name SHADOW.
database Specifies the name of a database for which you want statistics and the schema.
outfile Specifies a file to which the command output is written. If you do not specify an output file, the output is written to standard output.
outdir Specifies the output directory where UDX object files registered in the database are written.
datadir Specifies the location of the data directory, which is typically /nz/data. The default is /nz/data. This option is used only when outdir is specified.
schemaList For a Release 7.0.3 or later system, specifies one or more schemas within the database. By default, the command dumps information for all the schemas in a database. You can specify one or more schemas in a space-separated list to dump only the contents of the specified schemas.

Description

Privileges required
You must be the admin user to run the nzdumpschema command.
Common tasks
Use the nzdumpschema command to dump the table and view definitions, the database statistical information, and optionally, any UDXs that are registered within the database. It is a diagnostic tool that you can use to troubleshoot various problems that relate to a query. The nzdumpschema command is a troubleshooting tool and should not be used on a regular basis in a production system. The command requires significant memory resources to run, and if used at the same time as other memory-consuming commands such as nzbackup, the host could run out of memory and restart.
  • You must run it from the host system.
  • You cannot use -u, -pw, -host, or other nz CLI options.
  • You must set the NZ_USER and NZ_PASSWORD environment variables. However, the command ignores the NZ_SCHEMA setting.
  • You must specify a database.
  • If the database includes registered user-defined objects (UDXs), you can also dump copies of the object files that were registered for use with those routines.
  • If you do not specify an output file, the nzdumpschema command writes to standard output.

Usage

The following provides sample usage:
  • To dump table and view definitions to the file named empDBOut, enter:
    nzdumpschema empDB empDBOut
  • To dump the sales database to the file salesSchema and its user-defined objects to the directory /tmp/UdxObjs, enter:
    nzdumpschema sales salesSchema /tmp/UdxObjs

    If you relocate the object files in /tmp/UdxObjs to another location, be sure to edit the object path names that are used in the salesSchema file to reflect the new location of the object files.