When you backup database structure, R:BASE puts commands in the file to rebuild the structure from scratch. There is always a CREATE SCHEMA command to create or open the database. The CREATE SCHEMA command automatically creates all system tables in R:BASE. The table and column definitions are backed up to CREATE TABLE commands. Views become CREATE VIEW commands. Indexes are CREATE INDEX commands and so on.
If you are transferring information to a different database, you need to edit or remove the CREATE SCHEMA command. It is better to edit the command line to change the database name instead of removing the line. A DISCONNECT command is included in the backup file so that database setting such as STATICDB and ROWLOCKS can be set. If the CREATE SCHEMA line is deleted, the following lines must also be deleted
DISCONNECT
SET STATICDB OFF
SET ROWLOCKS ON
SET FASTLOCK OFF
Many converted databases contain table and column names that are reserved words but not illegal. Many times, even illegal names continue to work, depending on where they are used. The CREATE TABLE command, however, errors out on illegal names and the database does not restore. Often, all that is necessary is to use the setting SET ANSI OFF. This limits the reserved word list. It does not allow illegal names or names like OWNER. If you have backed up your database structure to a separate file it is a relatively simple process to edit the file and change the reserved or illegal name. The name is changed not only in the CREATE TABLE command, but in CREATE VIEW commands, in CREATE INDEX and GRANT commands, in RULES definitions, in AUTONUMBER definitions, in ALTER TABLE commands that define constraints, and in comments.
The following sequence of commands backs up database structure, including forms, reports and labels. Forms, reports, and labels would be backed up again each time they are modified or new ones added.
OUTPUT dbname.str
UNLOAD STRUCTURE
OUTPUT SCREEN
OUTPUT dbname.frm
UNLOAD DATA FROM SYS_FORM3
OUTPUT SCREEN
OUTPUT dbname.rep
UNLOAD DATA FROM SYS_REPORTS3
OUTPUT SCREEN
OUTPUT dbname.lab
UNLOAD DATA FROM SYS_LABELS3
OUTPUT SCREEN
This backs up all the database structure elements to separate files making it easy to restore individual elements. Structure can be backed up for individual tables or views. Backing up structure for an individual table includes other structure elements defined for that table such as rules, auto-number and comments. Defined constraints, indexes, access rights autonumbered definitions, comments, rules and triggers can also be backed up separately.
Note that the created file is an ASCII file and contains the database owner password on the CREATE SCHEMA command. If you do not utilize the OUTPUT <filename> ENCRYPT method, store your R:BASE backup files in a secure location to protect that password.