Reference Manual
CHAPTER 4. Database Administration Utilities
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:
From Sybase Central, for interactive use under Windows 95 or Windows NT.
From the system command line, using the dbbackup utility. This is useful for incorporating backup procedures into batch or command files.
The Backup utility makes a backup copy of all the files for 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, with each file as 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. Thus, you can back up the database while other applications or users are using it.
For a description of suggested backup procedures, see Backup and Data Recovery.
Connect to the database.
Right-click the database and click Backup in the popup menu. The Backup wizard is displayed.
Follow the instructions in the wizard.
Open the Database Utilities folder in the left panel.
Double-click Backup Database in the right panel.
Follow the instructions in the wizard.
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
dbbackup [switches] directory
dbbackw [switches] directory
Switch |
Description |
---|---|
-c "keyword=value; ..." |
Supply database connection parameters |
-d |
Only back up the main database file |
-l file |
Live backup of the transaction log to a file |
-n |
Change the naming convention for the back up transaction log |
-o file |
Log output messages to a file |
-q |
Quiet mode—do not print messages |
-r |
Rename and start a new transaction log |
-t |
Only back up the transaction log |
-w |
Only back up the write file |
-x |
Delete and restart the 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.
Directory The directory to which the backup files are copied. If the directory does not exist, it is created. However, the parent directory must exist.
Connection parameters (-c ) For a description of the connection parameters, see Connection parameters. If the connection parameters are not specified, connection parameters from the SQLCONNECT environment variable are used, if set. The user ID must have DBA authority.
For example, the following statement backs up the asademo database running on the server sample_server, connecting as user ID DBA with password SQL:
dbbackup -c "eng=sample_server;dbn=asademo;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.
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.
Change backup transaction log naming convention (-n) 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 that is being backed up.
When using the -n option, you must also use the -r or -t options.
The two-digit year notation does not cause any year 2000 problems. The names are used solely for identification, not for ordering.
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:
Step 1 The current working transaction log file is copied and saved to the directory specified in the command line.
Step 2 The current transaction log remains in its current directory, but is renamed using the format yymmddxx.log, where xx is a number from 00 to 99 and yymmdd represents the current year, month and day. This file is then no longer the current transaction log.
Step 3 A new transaction log file is generated that contains no transactions. It is given the name of the file that was previously considered the current transaction log, and is used by the database server as the current transaction log.
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 (-w) For a description of database write files, see The Write File utility.
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.