background image
<< Online backups | Backing up encrypted databases >>

Unlogged Operations

<< Online backups | Backing up encrypted databases >>
Derby Server and Administration Guide
62
Uncommitted transactions do not appear in the backed-up database.
Note: Do not back up different databases with the same name to the same backup
directory. If a database of the same name already exists in the backup directory, it is
assumed to be an older version and is overwritten.
Unlogged Operations
For some operations, Derby does not log because it can keep the database consistent
without logging the data.
The SYSCS_UTIL.SYSCS_BACKUP_DATABASE procedure will issue an error if there
are any unlogged operations in the same transaction as the backup procedure.
If any unlogged operations are in progress in other transactions in the system when
the backup starts, this procedure will block until those transactions are complete before
performing the backup.
Derby automatically converts unlogged operations to logged mode if they are started
while the backup is in progress (except operations that maintain application jar files in the
database). Procedures to install, replace, and remove jar files in a database are blocked
while the backup is in progress.
If you do not want backup to block until unlogged operations in other transactions are
complete, use the SYSCS_UTIL.SYSCS_BACKUP_DATABASE_NOWAIT procedure.
This procedure issues an error immediately at the start of the backup if there are
any transactions in progress with unlogged operations, instead of waiting for those
transactions to complete.
Unlogged operations include:
1. Index creation.
Only CREATE INDEX is logged, not all the data inserts into the index. The reason
inserts into the index are not logged is: if there is a failure , it will just drop the index.
If you create an index when the backup is in progress, it will be slower because it
has to be logged.
Foreign Keys , Primary Keys create backing indexes. Adding those keys to an
existing table with data will also run slower.
2. Import to an empty table or replacing all the data in a table.
In this case also, data inserts into table are not logged. Internally, Derby creates
a new table for the import and changes the catalogs to point to the new table and
drops the original table when import completes.
If you perform such an import operation when backup is in progress , it will be
slower because data is logged.
Using operating system commands with the freeze and unfreeze system
procedures to perform an online backup:
Typically, these procedures are used to speed up the copy operation involved in an
online backup. In this scenario, Derby does not perform the copy operation for you.
You use the SYSCS_UTIL.SYSCS_FREEZE_DATABASE procedure to lock the
database, and then you explicitly copy the database directory by using operating system
commands.
For example, because the UNIX tar command uses operating system file-copying
routines, and the SYSCS_UTIL.SYSCS_BACKUP_DATABASE procedure
uses java I/O calls with additional internal synchronization that allow updates
during the backup, the tar command might provide faster backups than the
SYSCS_UTIL.SYSCS_BACKUP_DATABASE procedure.