Locking While Unloading a Database
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.
Inconsistent Database During an Unload
There are two major ways that a database can become inconsistent during the unloading of a database:
• By default the database is not exclusively locked while the unload database scripts are being created or the unload command file is running. Because of this default, a user can alter tables that are not locked during this time.
• A user can alter the database after you have created the unload database scripts but before you have executed the unload command file.
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:
– Adds or deletes rows from a table
– Adds a table
To ensure the consistency of the database while it is being unloaded, lock it exclusively.
Lock Database Exclusively During Unload
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.
Last modified date: 04/03/2024