Download HyperSQL User Guide

Transcript
System Management and Deployment
Issues
• Names of tables, columns and indexes can be changed. These changes must be consistent regarding foreign key
constraints.
• CHECK
A check constraint can always be removed.
• NOT NULL
A not-null constraint can always be removed.
• PRIMARY KEY
A primary key constraint can be removed. It cannot be removed if there is a foreign key referencing the column(s).
• UNIQUE
A UNIQUE constraint can be removed if there is no foreign key referencing the column(s).
• FOREIGN KEY
A FOREIGN KEY constraint can always be removed.
• COLUMN TYPES
Some changes to column types are possible. For example an INTEGER column can be changed to BIGINT.
After completing the changes and saving the modified .script file, you can open the database as normal.
Backing Up Database Catalogs
The database engine saves the files containing all the data in a file catalog when a shutdown takes place. It automatically
recovers from an abnormal termination and preserves the data when the catalog is opened next time. In an ideal
operating environment, where there is no OS crash, disk failure, bugs in code, etc. there would be no need regularly
to backup a database. This is meant to say, the engine performs the routine shutdown procedure internally, therefore
backing up catalogs is an insurance policy against all sorts of misadventure that are not under the control of the database
engine.
The data for each catalog consists of up to 5 files in the same directory with the endings such as *.properties,
*.script, etc., as detailed in previous chapters.
HyperSQL 2.0 includes commands to backup the database files into a single .tar or .tar.gz file archive. The
backup can be performed by a command given in a JDBC session if the target database catalog is running, or on the
command-line if the target catalog has been shutdown.
Making Online Backups
To back up a running catalog, obtain a JDBC connection and issue a BACKUP DATABASE command in SQL. In its
most simple form, the command format below will backup the database as a single .tar.gz file to the given directory.
BACKUP DATABASE TO <directory name> BLOCKING
The directory name must end with a slash to distinguish it as a directory, and the whole string must be in single quotes
like so: 'subdir/nesteddir/'.
See the next section under Statements for details about the command and its options. See the sections below about
restoring a backup.
194