The unload database operation allows you to completely unload a database and reload it. You can unload an entire database or merely the objects owned by a particular user.
The unload database operation destroys the extended system catalogs and recreates them before loading the data. This is done to guarantee that the data is loaded into system catalogs identical to the ones from which they were unloaded.
The unload database operation unloads all of the objects and system catalogs in your database, including:
When iidbdb (the Ingres master database) is the database being unloaded, the following objects are also included:
You can unload and reload a database using VDBA or system commands.
In VDBA, start by using the Generate unload.ing and reload.ing dialog. This dialog is invoked by selecting a database and choosing the Database menu, Generate Scripts, and Unloaddb. For the detailed steps for performing unload and reload in VDBA, see online help.
At the command line, you can accomplish these tasks using the unloaddb and sql commands. For more information, see the Command Reference Guide.
Some of the options that are available for unloading and reloading are:
When you unload a database, several files are created. To ensure compatibility across all systems, the names of the generated files are truncated to twelve characters.
The generated files are as follows:
Contains operating system commands to invoke a terminal monitor and execute the copy.out script
Contains copy statements to copy out system catalogs and all user objects
Contains operating system commands to invoke a terminal monitor and execute the copy.in script
Contains statements to destroy, create and copy in system catalogs and all user objects
The unload and reload command files have the .bat extension on Windows systems and the .ing extension on UNIX and VMS systems.
When unloading a database, you should unload the files in ASCII format unless you are copying the database to another instance on the same machine or to a binary-compatible machine. In these cases, use binary format.
If you are not sure, use ASCII format.
Unloading in ASCII format allows you to:
To unload the database files in ASCII format, specify the -c option (create printable data files) on the copydb command. (In VDBA, use the Create Printable Data Files option in the Generate copy.in and copy.out dialog.)
To unload the database files in binary format, do not specify the -c option.
Note: The -c option can affect the value of floating point numbers. More information can be found in Floating Point Specification for Unload.
Note: Copying between releases of Ingres with different major release identifiers can cause problems if new columns were added to a later release to support new features. If you have made use of these new features in the later release and attempt to unload and reload into an earlier release that did not support the new feature, the reload produces an error. A simple editing of the reload scripts to avoid loading the non-existent columns avoids this problem.
Caution! If you unload the files in binary format, do not edit them. Editing prevents you from reloading them.
In the unload and reload command files, the floating point specification defaults to maximum precision and length (f8F79.38).
To reduce precision or length, edit the floating point specification in these files. If you do not, zeros with no significance can consume disk space in the external data files. If overflow occurs, you can specify another flag for the output format, for example, N instead of F in the floating point specification.
Precision of formatted character output of floating point numbers is also controlled with the -f flag of the sql command. For details, see the Command Reference Guide.
When you unload a database with the Destination Directory and/or Source Directory options specified in the Generate unload.ing and reload.ing dialog, direct where the data is copied to and from. This can be on the same machine or a different machine.
When you run the unload command file, the copy.out script is executed. The copy.out script generates the data files in the destination directory. If you have specified a source directory, you must move the copy.in script and the data files to this directory. When you run the copy.in script, the user objects are created and the tables are populated with the data from the source directory.
When you perform the unload database operation or execute the unload command file, the locking system takes shared locks on the system catalogs and tables being unloaded.
When you execute the reload command file, the locking system takes exclusive locks on the system catalogs and user tables being reloaded.
There are two major ways that a database can become inconsistent during the unloading of a database:
If a user drops a table in this interval, it generates an error message. However, if a user makes either of the following changes during this time, no error message is generated, and you do not know about the change:
To ensure the consistency of the database while it is being unloaded, lock it exclusively.
To lock the database exclusively during an unload operation, edit the unload script and add the sql command -l flag to the script, before running the unload command file.
Doing this ensures the consistency of the database.