Use the sybdumptran utility to dump the most recent transactions when the database and the server have suffered a catastrophic failure.
sybdumptran [-m file_name | -g | -d database_name | -f first_page_num ] -o output_file | -h dump_history_file_name
or:
sybdumptran --help
Use the most recent database dump/transaction log to ensure that the information is current, including the location of the log segment relative to the rest of the database, the dump sequencing information, and the location of the active log within the log segment. If it is not possible to use the most recent backup, then use a backup that was taken when the database had the same layout as it currently has. This means that the sequencing information and log location will be incorrect. In this case, the sybdumptran utility automatically tries to determine the location of the active log, and the sequencing must be overridden when the transaction log is loaded using the dump tran with override=sequence command.
The long parameter option displays when you use --help, so you can use either -m filename or --metadata-file=filename.
If the most recent database or transaction log dump is unavailable, or when you use -g to generate a metadata file, you can use an older database or transaction log dump as the information source for providing the layout of the database if it was identical at the time the dump was performed, to compare with the metadata file you just generated. The dump from which it is generated, however, should be the most recent.
The -g option to generate metadata is useful when the last database or transaction log dump is located on an entirely different system. The created metadata file is a subset of the database dump or transaction log dump from which it was created, containing only the information needed by sybdumptran. Because it is smaller, it is easier to copy to the system on which you are creating the transaction log.
The entry is generated for the database named by the -d option. No entry is added in the dump history file if this database has no existing entries.
The sybdumptran -m option uses the metadata file to locate the first page of the log within the log devices. If the metadata file is not the most recent transaction log or database dump, then the first page of the log is incorrect, and sybdumptran automatically tries to locate the first page of the log. If this fails, and sybdumptran exits and reports that it cannot locate the first log page, use the -f option to manually specify the first log page.
Usage: sybdumptran <option list> Valid options: -d, --databasename=database_name - name of database in dump history -h, --dump history file=filename - dump history file name -f, --first-log-page=page_number - to overwrite the first page from meta data -g, --generatemetadata - create compact meta data file from dump -H, --help=[{0|1|2|3}[,display_width]] - print this help message, and exit -m, --metadatafile=filename - meta data file used to locate devices -o, --outputfile=filename - name of output file -V, --sbssav - print a short version string, and exit -T, --trace=number - for debugging -v, --version - print version message, and exit
Use the last transaction log dump as a metadata file (-m for sybdumptran):
> sybdumptran -o /dumps/db.trn_sdt -m /dumps/db.trn2 Opening output-file '/dumps/db.trn_sdt'. Opening metadata-file '/dumps/db.trn2'. Opening log devices used by database: Opening device "db_log1", path "/sdc1_eng/devices/db.log1". Opening device "db_log2", path "/sdc1_eng/devices/db.log2". Building run-lists using first log page=10888. Finished building run-lists, number of log pages=7, first log page=10888, last log page=10894. Dumping log pages to output file "/dumps/db.trn_sdt". Finished dumping 7 log pages. Sybdumptran completed without errors.
Load the database dump, the two transaction log dumps, and the dump generated by sybdumptran:
1> load database db from '/dumps/db.dmp' 2> go 1> load tran db from '/dumps/db.trn1' 2> go 1> load tran db from '/dumps/db.trn2' 2> go 1> load tran db from '/dumps/db.trn_sdt' 2> go 1> online database db 2> go
When you do not use the most recent dump as metadata file, the dump generated by sybdumptran contain the wrong sequence date. This example uses /dumps/db.trn1 as the metadata file:
> sybdumptran -o /dumps/db.trn_sdt -m /dumps/db.trn1 Opening output-file '/dumps/db.trn_sdt'. Opening metadata-file '/dumps/db.trn1'. Opening log devices used by database: Opening device "db_log1", path "/sdc1_eng/devices/db.log1". Opening device "db_log2", path "/sdc1_eng/devices/db.log2". Building run-lists using first log page=10253. Found new first log page=10888. Restarting the building of run-lists. Building run-lists using first log page=10888. Finished building run-lists, number of log pages=7, first log page=10888, last log page=10894. Dumping log pages to output file "/dumps/db.trn_sdt". Finished dumping 7 log pages. Sybdumptran completed without errors. 1> load database db from '/dumps/db.dmp' 2> go 1> load tran db from '/dumps/db.trn1' 2> go 1> load tran db from '/dumps/db.trn2' 2> go 1> load tran db from '/dumps/db.trn_sdt' 2> go Backup Server session id is: 69. Use this value when executing the 'sp_volchanged' system stored procedure after .. Msg 4305, Level 16, State 1: Server 'marslinux1_asecarina_smp', Line 1: Specified file 'dump device' is out of sequence. Current time stamp is Nov 30 2012 1:59:59:423AM while dump was from Nov 30 2012 1:59:59:296AM.
To be able to load this dump, use the override option:
1> load tran db from '/dumps/db.trn_sdt' 2> with override = sequence 3> go Backup Server session id is: 83. Use this value when executing the 'sp_volchanged' system stored procedure after fulfilling any volume change request from the Backup Server. Backup Server: 6.28.1.1: Dumpfile name 'db1233501C1F ' section number 1 mounted on disk file '/dumps/db.trn_sdt' Backup Server: 4.58.1.1: Database db: 22 kilobytes LOADED. ... 1> online database db 2> go Started estimating recovery log boundaries for database 'db'. ...
Enable the dump history file:
1> sp_configure 'dump history filename', 1, '/dumps/dump_hist' 2> go 1> sp_configure 'enable dump history', 1 2> go
Dump database is then added to the history file:
1> dump database db to '/dumps/db.dmp' 2> go
Any user who has read permissions on the log devices of the database, and write permission to the output file can use sybdumptran.