• No results found

ON CLIENT SERVER

In document SQLBase. SQLTalk Command Reference (Page 52-57)

BACKUP

• The SET SERVER command must come before the BACKUP command. • You must be logged in as DBA or SYSADM.

You do not need to be logged on as SYSADM to perform a BACKUP SNAPSHOT. This allows users other than SYSADM to backup the MAIN database.

Once you backup a database or log files to a directory, you can transfer the backup files to archival media and then delete them from the hard disk.

You can backup a partitioned database and restore it to a non-partitioned database, and vice-versa.

If you have a database greater than 2 gigabytes, you must perform backups to multiple segments. Each segment must be 2 gigabytes or less in size. To perform the backup operation in segments, you must specify a control file databasename.BCF. This control file describes the location and size of the segments to which you want to restore your database. Read the Database Administrator’s Guide for details on the format of the control file.

Note that there is no need to explicitly provide the name of the file in the BACKUP command’s syntax. If a control file (databasename.BCF) is present in the directory specified in the TO and FROM clause of the BACKUP command, SQLBase performs a segmented backup operation. If a control file is not present, SQLBase backs up the database to a single databasename.BKP file.

Note the following when you use the BACKUP command:

• SQLBase issues an error if you try to back up databases in segments larger than 2 gigabytes.

• If you do not include a segmented backup control file (databasename.BCF) in the directory that you specified in the TO and FROM clause of the command, an unsegmented backup file is created (if less than the 2 gigabytes limit). • SQLBase issues an error if the control file you specify does not have a

minimum aggregate size to account for the total database size.

Read the Database Administrator’s Guide for details on setting the SIZE parameter for the control file.

• SQLBase does not verify the existence of disk space availability for any of the files you create.

Be sure that the directories you designate in the BACKUP command and in the control file have sufficient space. For backup commands with the snapshot option, also be sure that the directory specified in the command contains sufficient space for the backup of the log files involved in the operation.

To back up a database encrypted with a different server security password than the one currently set, you must first give an ALTER EXPORTKEY command. For more, read ALTER EXPORTKEY on page 2-37.

Warning: You cannot rollforward past a change in the security configuration, including

changing the server security password, the database page encryption, and database page alteration protection. If you try to do this, the restore stops just before the security change. After making a security change, you should restart your backup procedure by making a fresh backup of the database and its logs because previous versions of the database cannot be recovered beyond the security change. Therefore, do this after making a security change:

1. Shut down the server. 2. Perform an offline backup

OR

Start the server and perform an online backup.

Clauses

DATABASE

Copies the database (.dbs) file from its current directory to the specified backup directory.

LOGBACKUP must be ON to perform BACKUP DATABASE. You should never back up a database without also backing up the log files with it. LOGS

Copies unpinned log files from the current log directory (by default, the database directory) to the specified backup directory. Once this completes successfully, SQLBase deletes the log files that were backed up from the current log directory. You should back up log files from different databases to different directories since their file names could conflict.

LOGBACKUP must be ON to perform BACKUP LOGS. SNAPSHOT

Copies the database and the associated log files from their current directory to the specified backup directory. Since BACKUP SNAPSHOT backs up a single recoverable database, it is suggested that you perform this function into an empty directory.

BACKUP SNAPSHOT is the recommended way to backup a database and its log files. There is only one step (RESTORE SNAPSHOT) needed to bring a database and its log files to a consistent state.

BACKUP

Alternatively, the files produced by BACKUP SNAPSHOT can be restored and recovered with the individual commands RESTORE DATABASE,

ROLLFORWARD, and RESTORE LOGS.

The SNAPSHOT option does not require the SYSADM logon and password. This means that other users besides SYSADM can backup the MAIN database by using BACKUP SNAPSHOT.

This command causes a log rollover which closes the current log file so that it can be backed up. This means that a RELEASE LOG command is not necessary. If LOGBACKUP mode is turned on, the log file is pinned until it is backed up using BACKUP LOGS. The backup command unpins the log, not BACKUP SNAPSHOT.

You cannot perform a BACKUP SNAPSHOT while in Read-Only (RO) isolation level.

Note that BACKUP SNAPSHOT does not backup a single file; you must provide directory name, not a file name.

FROM database name

This clause specifies the name of the database.

If the FROM clause is omitted, the database is assumed to be the one currently connected to the active cursor.

TO directory name

This specifies the destination directory for the backed up files.

This backup directory pathname can refer to the client or the server computer. You can specify the pathname with the ON SERVER or ON CLIENT clauses. If you omit the TO clause, the current directory on the client computer is used as the backup directory.

If the destination files of the backup already exist (and the PAUSE option is turned ON), you are prompted with the following message before the files are overwritten:

Backup file already exists. Overwrite it (Y/N)?

It is a good idea to place the backup on a different drive or device to isolate it from failure of the drive on which the database is located.

ON CLIENT or ON SERVER

Example

The following example assumes that you have already entered a SET SERVER command.

BACKUP DATABASE TO \DEMOBKUP; DATABASE BACKED UP

RELEASE LOG;

RELEASE LOG COMPLETED BACKUP LOGS TO \DEMOBKUP; 2 LOGS BACKED UP

See also

RELEASE LOG RESTORE SET SERVER

BEGIN CONNECTION

This command establishes a new connection to a specified database. When you supply the name of the database along with the username and password required for its access, this opens a connection handle which identifies the specified database. You can create cursors to perform specific SQL commands within the connection handle. A connection handle represents a single database connection and transaction. If the databasename, username, and password are not specified, SQLTalk uses the databasename, username, and password of the current cursor connection.

The beginning of a new connection does not modify the current cursor. SQLTalk always maintains what it considers to be the current cursor, which is the cursor used for any SQL command execution. For details, read Chapter 3, Connection Handles of the SQL/API Programming Language Reference.

BEGIN CONNECTION connection_name

In document SQLBase. SQLTalk Command Reference (Page 52-57)

Related documents