Reference Manual
CHAPTER 4. Database Administration Utilities
With the Log Translation utility, you can translate a transaction log into a SQL command file.
You can access the Log Translation utility in the following ways:
From Sybase Central, for interactive use under Windows 95 or NT.
From the system command line, using the dbtran command-line utility. This is useful for incorporating into batch or command files.
Open the Database Utilities folder in the left panel.
Double-click Translate Log in the right panel. The Translate Log wizard is displayed
Follow the instructions in the wizard.
Running against a transaction log.
dbtran [ switches ] transaction-log [ sql-file ] ]
Running against a database server.
dbtran [ switches ]
Running against a transaction log.
dbtranw [ switches ] transaction-log [ sql-file ] ]
Running against a database server.
dbtranw [ switches ]
Switch |
Description |
---|---|
-a |
Include uncommitted transactions |
-c "keyword=value; ..." |
Supply database connection parameters. Cannot be used with a transaction log name. |
-f |
Output only since the last checkpoint |
-g |
Include audit records in output |
-j date/time |
Output from the last checkpoint prior to the given time |
-n filename |
Output SQL file, when used against a database server. |
-o filename |
Log output messages to file |
-q |
Run quietly, do not print messages |
-r |
Remove uncommitted transactions (default) |
-s |
Produce ANSI standard SQL UPDATE transactions |
-t |
Include trigger-generated transactions in output |
-u userid,... |
Translate transactions for listed users only |
-x userid,... |
Exclude transactions for listed users |
-y |
Replace file without confirmation |
-z |
Include trigger-generated transactions as comments only |
transaction-log |
Log file to be translated. Cannot be used together with -c or -n. |
sql-file |
Output file containing the translated information. For use with transaction-log only. |
The dbtran utility takes the information in a transaction log and places it as a set of SQL statements and comments into an output file. The utility can be run in the following ways:
Against a database server Run in this way, the utility is a standard client application. It connects to the database server using the connection string specified following the -c option, and places output in a file specified with the -n option.
The following command translates log information from the server asademo and places the output in a file named asademo.sql.
dbtran -c "eng=asademo;uid=dba;pwd=sql" -n asademo.sql
DBA authority is required to run in this way.
Against a transaction log file Run in this way, the utility acts directly against a transaction log file. You should protect your transaction log file from general access if you wish to prevent users from having the capability of running this statement.
dbtran asademo.log asademo.sql
When the dbtran utility runs, it displays the earliest log offset in the transaction log. This can be an effective method for determining the order in which multiple log files where generated.
For more information about the command-line switches, see Log translation utility options
Include uncommitted transactions (-a ) The transaction log contains any changes made before the most recent COMMIT by any transaction. Changes made after the most recent commit are not present in the transaction log.
Connection string (-c) When running the command-line utility against a database server, this parameter specifies the connection string.
DBA authority is required to run dbtran.
For a description of the connection parameters, see Connection parameters.
Translate from last checkpoint only (-f ) Only transactions that were completed since the last checkpoint are translated.
Include audit information (-g) If the AUDITING database option is turned on, auditing information is added to the transaction log. You can include this information as comments in the output file using this option.
For more information, see AUDITING option.
Output from the last checkpoint prior to a given date (-j ) Only transactions from the most recent checkpoint prior to the given date and/or time are translated. The user-provided argument can be a date, time or date and time enclosed in quotes. If the time is omitted, the time is assumed to be the beginning of the day. If the date is omitted, the current day is assumed. The following is an acceptable format for the date and time: "YY/MMM/DD HH:MM".
Output file (-n) When you run the dbtran command-line utility against a database server, use this option to specify the output file that holds the SQL statements.
Output log messages to file (-o ) Redirect log messages to the named file.
Operate quietly (-q ) Do not display log messages. This option is available only from the command-line utility.
Do not include uncommitted transactions (-r ) Remove any transactions that were not committed and the default operation.
Generate ANSI standard SQL UPDATE (-s ) If is no primary key or unique index on a table, the Translation utility generates UPDATE statements with a non-standard FIRST keyword in case of duplicate rows. The ANSI standard UPDATE flag does not output this keyword.
Include transactions generated by triggers (-t ) By default, actions carried out by triggers are not included in the command file. If the matching trigger is in place in the database, when the command file is run against the database, the trigger will carry out the actions automatically. Trigger actions should be included if the matching trigger does not exist in the database against which the command file is to be run.
Translate transactions for listed users only (-u )
Translate transactions except for listed users (-x )
Operate without confirming actions (-y ) Without this option, you are prompted to confirm the replacement of an existing command file.
Include transactions generated by triggers as comments only (-z ) Transactions that were generated by triggers will be included only as comments in the output file.