With the Backup utility, you can back up running databases, database files, transaction logs, and write files.
You can access the Backup utility in the following ways:
The Backup utility makes a backup copy of all the files making up a single database. A simple database consists of two files: the main database file and the transaction log. More complicated databases can store tables in multiple files. Each file is a separate dbspace. All backup filenames are the same as the database filenames.
Running the Backup utility on a running database is equivalent to copying the database files when the database is not running. It is provided to allow a database to be backed up while other applications or users are using the database.
For a description of suggested backup procedures, see the chapter "Backup and Data Recovery".
For full information on backing up a database from Sybase Central, see the Sybase Central online Help. For more information about options, see "Backup utility options"
The syntax to access the Backup utility from the ISQL DBTOOL statement is as follows:
DBTOOL BACKUP TO directory
... [DBFILE] [ WRITE FILE ][ [ TRANSACTION ] LOG ]
| [ ALL FILES ]
... | [ RENAME [ TRANSACTION ] LOG ]
| [ TRUNCATE [ TRANSACTION ] LOG ]
... [ NOCONFIRM ] USING connection-string
The following statement connects to and backs up the sample database, to directory C:\TEMP.
DBTOOL BACKUP TO 'c:\temp' DBFILE
USING 'dbf=c:\sqlany50\sademo.db;uid=dba;pwd=sql'
dbbackup [switches] directory
dbbackw [switches] directory
Switch | Description |
---|---|
-c"keyword=value; ..." | Supply database connection parameters |
-d | Only back up main database file |
-k | Change backup transaction log naming convention |
-lfile | Live backup of transaction log to file |
-ofile | Log output messages to file |
-q | Quiet mode---do not print messages |
-r | Rename and start new transaction log |
-t | Only back up transaction log |
-w | Only back up write file |
-x | Delete and restart transaction log |
-y | Replace files without confirmation |
If none of the switches -d, -t, or -w are used, all database files are backed up.
For more information about the command-line switches, see "Backup utility options".
Connection parameters (-c ) For a description of the connection parameters, see "Database connection parameters". If the connection parameters are not specified, connection paremeters from the SQLCONNECT environment variable are used, if set. The user ID must have DBA authority.
For example, the following statement backs up the sademo database running on the server sample_server, connecting as user ID DBA with password SQL:
dbbackup -c "eng=sample_server;dbn=sademo;uid=dba;pwd=sql"
Backup main database only (-d ) Back up the main database files only, without backing up the transaction log file or a write file, if one exists.
Change backup transaction log naming convention (-k) This option changes the naming convention of the backup transaction log file to YYMMDDxx.LOG, where xx is a number from 00 to 99 and YYMMDD represents the current year, month and day. By default the name used for the backup transaction log file is identical to the file name of the transaction log being backed up.
Live backup (-l lower-case L) This option is provided to enable a secondary system to be brought up rapidly in the event of a server crash. A live backup does not terminate, but continues running while the server runs. It runs until the primary server crashes. At that point it is shut down, but the backed up log file is intact and can be used to bring a secondary system up quickly.
Output messages to log (-o ) Sends backup messages to a named log file.
Operate quietly (-q ) Do not display messages on a window. This option is available only from the command-line utility.
Rename and start new transaction log (-r ) This option forces a checkpoint and the following three steps to occur:
Back up the transaction log file only (-t ) This can be used as an incremental backup since the transaction log can be applied to the most recently backed up copy of the database file(s).
Back up the database write file only See DBWRITE for a description of database write files. For the DBBACKUP command-line utility, this is the -w command-line switch.
Delete and restart the transaction log (-x ) With this option, the existing transaction log is backed up, then the original is deleted and a new transaction log is started with the same name. This option causes the backup to wait for a point when all transactions from all connections are committed.
Operate without confirming actions (-y ) Without this option, you are prompted to confirm the creation of the backup directory or the replacement of a previous backup file in the directory.