background image
<< Part II - Derby Administration Guide | Online backups >>

Backing up and restoring databases

<< Part II - Derby Administration Guide | Online backups >>
Derby Server and Administration Guide
60
If the index refers to a row that does not exist in the base table, error message X0X62 is
issued:
ERROR X0X62: Inconsistency found between table 'APP.T1' and index
'T1_I'. Error when trying to retrieve row location '(1,6)' from the
table. The full index key,including the row location, is '{ 1, (1,6) }'.
The suggested corrective action is to recreate the index.
If a key column value differs between the base table and the index, error message X0X61
is issued:
ERROR X0X61: The values for column 'C10' in index 'T1_C10' and
table 'APP.T1' do not match for row location (1,7). The value in the
index is '2 2 ', while the value in the base table is 'NULL'. The full
index key, including the row location, is '{ 2 2 , (1,7) }'. The
suggested corrective action is to recreate the index.
Sample SYSCS_CHECK_TABLE queries
This section provides examples that illustrate how to use the
SYSCS_UTIL.SYSCS_CHECK_TABLE function in queries.
To check the consistency of a single table, run a query that is similar to the one shown in
the following example:
VALUES SYSCS_UTIL.SYSCS_CHECK_TABLE('APP', 'FLIGHTS')
To check the consistency of all of the tables in a schema, stopping at the first failure, run
a query that is similar to the one shown in the following example:
SELECT tablename, SYSCS_UTIL.SYSCS_CHECK_TABLE(
'SAMP', tablename)
FROM sys.sysschemas s, sys.systables t
WHERE s.schemaname = 'SAMP' AND s.schemaid = t.schemaid
To check the consistency of an entire database, stopping at the first failure, run a query
that is similar to the one shown in the following example::
SELECT schemaname, tablename,
SYSCS_UTIL.SYSCS_CHECK_TABLE(schemaname, tablename)
FROM sys.sysschemas s, sys.systables t
WHERE s.schemaid = t.schemaid
Backing up and restoring databases
Derby provides a way to back up a database while it is online. You can also restore a full
backup from a specified location.
Backing up a database
The topics in this section describe how to back up a database.
Offline backups
To perform an offline backup of a database, use operating system commands to copy
the database directory. You must shut down the database prior to performing an offline
backup.
For example, on Windows systems, the following operating system command backs up
a (closed) database that is named sample and that is located in
d:\mydatabases
by
copying it to the directory
c:\mybackups\2005-06-01
: