Home » Databases » Sybase » ASE » Sybase ASE: dbcc dbrepair and writepage/readpage

Sybase ASE: dbcc dbrepair and writepage/readpage

Does anyone know the syntax for the dbcc dbrepair commands writepage and readpage for Sybase ASE?  These are being used by Whitesands’s ProActive DBA.

The equivalent on Microsoft SQL Server are:

dbcc readpage ({ dbid, 'dbname' }, fileid, pageid, 
    formatstr [, printopt = { 0 | 1} ])
dbcc writepage ({ dbid, 'dbname' }, fileid, pageid,
    offset, length, data)

UPDATE!
I’ve figured out readtext:

dbcc dbrepair(<database name|dbid>, readpage, <page number>)


original page from readpage:

0x0300000000000000010000000100000056f304000800000000008c02110142
00020000001800000000006100020000000080030000000000bf970000c75f9b
00bf970000c75f9b000000000000000000000000000000000000000000010000
0053205900737973737461746973746963730000000003555144020100001900
000000006120030000000080030000000000bf970000c75f9b00bf970000c75f
9b00000000000000000000000000000000000000000001000000532055007379
737874797065730000000003514d44020200001a000000000061200300000000
80030000000000bf970000c75f9b00bf970000c75f9b00000000000000000000
000000000000000000000001000000532053007379736a61727300000000034f
4b44020300001b00000000006100030000000080030000000000bf970000c75f
9b00bf970000c75f9b0000000000000000000000000000000000000000000100
0000532059007379737175657279706c616e7300000000035551440204000039
24f4000000430000000000408001000000000004980000fcafd50004980000fc
afd5000000000000000000000000000000000000000000010000005520660073
79625f6175746f5f64625f657874656e645f636f6e74726f6c0000000003625e
44020500001db5c4040000530002000000482001000000000090980000e162d8
0090980000e162d8000000000000000000000000000000000000000000010000
0055205c0073797375736572735f686f6c64696e670000000003585444020600
00f4a9fa2e00004300000001000022010000000000d39800004c60b400d39800
004c60b400000000000000000000000000000000000000000001000000552050
007465737400000000034c484402080000dac6f5430000430000000000002001
0000000000d39800007612dc00d39800007612dc000000000000000000000000
0000000000000000000100000055206a0023737064627573616765735f5f3031
30303333323030313138303634353500000000036662440209000013ebe94400
004300000000000020010000000000d39800007612dc00d39800007612dc0000
000000000000000000000000000000000000000100000055206a002373706462
617474725f5f5f5f303130303333323030313138303634353500000000036662
440209000013ebe94400004300000000000020010000000000d39800007612dc
00d39800007612dc000000000000000000000000000000000000000000010000
0055206a002373706462617474725f5f5f5f3031303033333230303131383036
343535000000000366624474293a2050726f6365737320256420697320612063
68696c642d70726f636573732e2043616e6e6f742061626f72742069742e024d
0c01060b06e30200000f00000080008001000000000000000000000000000000
00010812000c1d000002005a006c63745f61646d696e2861626f7274293a2055
6e61626c6520746f206f627461696e2044425441424c4520666f722070726f63
6573732025642e2043616e6e6f742061626f72742069742e02570c0000000000
0001070b07e30200000f000000d8008001000000000000000000000000000000
00010910000d1d00000200b1006c63745f61646d696e2861626f7274293a2059
6f75722070726f636573732c20776974682070726f636573732049442025642c
206973206e6f77206265696e672061626f727465642062792061646d696e6973
747261746f7220726571756573742e20497420686173206265656e2077616974
696e6720696e206c6f672d73757370656e6420737461746520696e2064617461
62617365202725535f44424944272e02ae0c2061626f72742001080b05e30200
000f0000009800800100000000000000000000000000000000010a0e00b11d00
00020073005065726d697373696f6e2064656e6965642e202053797374656d20
5365637572697479204f666669636572202853534f2920726f6c652069732072
6571756972656420746f206f70656e20616e206175646974696e672073797374
656d207461626c652e02700c64206d6f6401090b05e30200000f000000080180
0100000000000000000000000000000000010b1000b21d00000200e300546865
7265206973206e6f2073756368206175646974206f7074696f6e2e2020496620
796f752072656365697665642074686973206d657373616765207768696c6520
657865637574696e672061205379626173652d737570706c6965642061756469
74696e672073746f7265642070726f6365647572652c20746869732069732061
2073797374656d206572726f722c20616e6420796f752073686f756c6420636f
6e746163742061207573657220776974682053797374656d2041646d696e6973
747261746f72202853412920726f6c652e02e00c7420697320010a0b05e30200
000f000000b000800100000000000000000000000000000000010c0e00b31d00
0002008b005468652061645f686f635f6175646974206275696c74696e206675
6e6374696f6e2063616e6e6f742062652063616c6c6564206469726563746c79
2e2020596f75206d757374207573652073705f61646461756469747265636f72
6420746f2073656e6420616e2061642d686f63206175646974207265636f7264
2e02880c20796f75200000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000f8060000000000003c02e0017a012101ce007900200
00

I modify the page here adding the sequence “12345678901234567890” to the middle of the page:

dbcc dbrepair(tempdb,writepage,3,0,2048,
0x0300000000000000010000000100000056f304000800000000008c02110142
00020000001800000000006100020000000080030000000000bf970000c75f9b
00bf970000c75f9b000000000000000000000000000000000000000000010000
0053205900737973737461746973746963730000000003555144020100001900
000000006120030000000080030000000000bf970000c75f9b00bf970000c75f
9b00000000000000000000000000000000000000000001000000532055007379
737874797065730000000003514d44020200001a000000000061200300000000
80030000000000bf970000c75f9b00bf970000c75f9b00000000000000000000
000000000000000000000001000000532053007379736a61727300000000034f
4b44020300001b00000000006100030000000080030000000000bf970000c75f
9b00bf970000c75f9b0000000000000000000000000000000000000000000100
0000532059007379737175657279706c616e7300000000035551440204000039
24f4000000430000000000408001000000000004980000fcafd50004980000fc
afd5000000000000000000000000000000000000000000010000005520660073
79625f6175746f5f64625f657874656e645f636f6e74726f6c0000000003625e
44020500001db5c4040000530002000000482001000000000090980000e162d8
0090980000e162d8000000000000000000000000000000000000000000010000
0055205c0073797375736572735f686f6c64696e670000000003585444020600
00f4a9fa2e00004300000001000022010000000000d39800004c60b400d39800
004c60b400000000000000000000000000000000000000000001000000552050
007465737400000000034c484402080000dac6f5430000430000000000002001
0000000000d39800007612dc00d39800007612dc000000000000000000000000
0000000000000000000100000055206a0023737064627573616765735f5f3031
30303333323030313138303634353500000000036662440209000013ebe94400
004300000000000020010000000000d39800007612dc00d39800007612dc0000
000000000000000000000000000000000000000100000055206a002373706462
617474725f5f5f5f303130303333323030313138303634353500000000036662
440209000013ebe94400004300000000000020010000000000d39800007612dc
00d39800007612dc000000000000000000000000000000000000000000010000
0055206a002373706462617474725f5f5f5f3031303033333230303131383036
343535000000000366624474293a2050726f6365737320256420697320612063
68696c642d70726f636573732e2043616e6e6f742061626f72742069742e024d
0c01060b06e30200000f00000080008001000000000000000000000000000000
00010812000c1d000002005a006c63745f61646d696e2861626f7274293a2055
6e61626c6520746f206f627461696e2044425441424c4520666f722070726f63
6573732025642e2043616e6e6f742061626f72742069742e02570c0000000000
0001070b07e30200000f000000d8008001000000000000000000000000000000
00010910000d1d00000200b1006c63745f61646d696e2861626f7274293a2059
6f75722070726f636573732c20776974682070726f636573732049442025642c
206973206e6f77206265696e672061626f727465642062792061646d696e6973
747261746f7220726571756573742e2049742068617320626560000000000000
0000000000000000000000000000000000000001234567890123456789000000
00617365202725535f44424944272e02ae0c2061626f72742001080b05e30200
000f0000009800800100000000000000000000000000000000010a0e00b11d00
00020073005065726d697373696f6e2064656e6965642e202053797374656d20
5365637572697479204f666669636572202853534f2920726f6c652069732072
6571756972656420746f206f70656e20616e206175646974696e672073797374
656d207461626c652e02700c64206d6f6401090b05e30200000f000000080180
0100000000000000000000000000000000010b1000b21d00000200e300546865
7265206973206e6f2073756368206175646974206f7074696f6e2e2020496620
796f752072656365697665642074686973206d657373616765207768696c6520
657865637574696e672061205379626173652d737570706c6965642061756469
74696e672073746f7265642070726f6365647572652c20746869732069732061
2073797374656d206572726f722c20616e6420796f752073686f756c6420636f
6e746163742061207573657220776974682053797374656d2041646d696e6973
747261746f72202853412920726f6c652e02e00c7420697320010a0b05e30200
000f000000b000800100000000000000000000000000000000010c0e00b31d00
0002008b005468652061645f686f635f6175646974206275696c74696e206675
6e6374696f6e2063616e6e6f742062652063616c6c6564206469726563746c79
2e2020596f75206d757374207573652073705f61646461756469747265636f72
6420746f2073656e6420616e2061642d686f63206175646974207265636f7264
2e02880c20796f75200000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000f8060000000000003c02e0017a012101ce00790020
00

Unfortunately, it doesn’t seem to stick. I’m missing something here….

 0x0300000000000000010000000100000056f304000800000000008c02110142
 00020000001800000000006100020000000080030000000000bf970000c75f9b
 00bf970000c75f9b000000000000000000000000000000000000000000010000
 0053205900737973737461746973746963730000000003555144020100001900
 000000006120030000000080030000000000bf970000c75f9b00bf970000c75f
 9b00000000000000000000000000000000000000000001000000532055007379
 737874797065730000000003514d44020200001a000000000061200300000000
 80030000000000bf970000c75f9b00bf970000c75f9b00000000000000000000
 000000000000000000000001000000532053007379736a61727300000000034f
 4b44020300001b00000000006100030000000080030000000000bf970000c75f
 9b00bf970000c75f9b0000000000000000000000000000000000000000000100
 0000532059007379737175657279706c616e7300000000035551440204000039
 24f4000000430000000000408001000000000004980000fcafd50004980000fc
 afd5000000000000000000000000000000000000000000010000005520660073
 79625f6175746f5f64625f657874656e645f636f6e74726f6c0000000003625e
 44020500001db5c4040000530002000000482001000000000090980000e162d8
 0090980000e162d8000000000000000000000000000000000000000000010000
 0055205c0073797375736572735f686f6c64696e670000000003585444020600
 00f4a9fa2e00004300000001000022010000000000d39800004c60b400d39800
 004c60b400000000000000000000000000000000000000000001000000552050
 007465737400000000034c484402080000dac6f5430000430000000000002001
 0000000000d39800007612dc00d39800007612dc000000000000000000000000
 0000000000000000000100000055206a0023737064627573616765735f5f3031
 30303333323030313138303634353500000000036662440209000013ebe94400
 004300000000000020010000000000d39800007612dc00d39800007612dc0000
 000000000000000000000000000000000000000100000055206a002373706462
 617474725f5f5f5f303130303333323030313138303634353500000000036662
 440209000013ebe94400004300000000000020010000000000d39800007612dc
 00d39800007612dc000000000000000000000000000000000000000000010000
 0055206a002373706462617474725f5f5f5f3031303033333230303131383036
 343535000000000366624474293a2050726f6365737320256420697320612063
 68696c642d70726f636573732e2043616e6e6f742061626f72742069742e024d
 0c01060b06e30200000f00000080008001000000000000000000000000000000
 00010812000c1d000002005a006c63745f61646d696e2861626f7274293a2055
 6e61626c6520746f206f627461696e2044425441424c4520666f722070726f63
 6573732025642e2043616e6e6f742061626f72742069742e02570c0000000000
 0001070b07e30200000f000000d8008001000000000000000000000000000000
 00010910000d1d00000200b1006c63745f61646d696e2861626f7274293a2059
 6f75722070726f636573732c20776974682070726f636573732049442025642c
 206973206e6f77206265696e672061626f727465642062792061646d696e6973
 747261746f7220726571756573742e20497420686173206265656e2077616974
 696e6720696e206c6f672d73757370656e6420737461746520696e2064617461
 62617365202725535f44424944272e02ae0c2061626f72742001080b05e30200
 000f0000009800800100000000000000000000000000000000010a0e00b11d00
 00020073005065726d697373696f6e2064656e6965642e202053797374656d20
 5365637572697479204f666669636572202853534f2920726f6c652069732072
 6571756972656420746f206f70656e20616e206175646974696e672073797374
 656d207461626c652e02700c64206d6f6401090b05e30200000f000000080180
 0100000000000000000000000000000000010b1000b21d00000200e300546865
 7265206973206e6f2073756368206175646974206f7074696f6e2e2020496620
 796f752072656365697665642074686973206d657373616765207768696c6520
 657865637574696e672061205379626173652d737570706c6965642061756469
 74696e672073746f7265642070726f6365647572652c20746869732069732061
 2073797374656d206572726f722c20616e6420796f752073686f756c6420636f
 6e746163742061207573657220776974682053797374656d2041646d696e6973
 747261746f72202853412920726f6c652e02e00c7420697320010a0b05e30200
 000f000000b000800100000000000000000000000000000000010c0e00b31d00
 0002008b005468652061645f686f635f6175646974206275696c74696e206675
 6e6374696f6e2063616e6e6f742062652063616c6c6564206469726563746c79
 2e2020596f75206d757374207573652073705f61646461756469747265636f72
 6420746f2073656e6420616e2061642d686f63206175646974207265636f7264
 2e02880c20796f75200000000000000000000000000000000000000000000000
 0000000000000000000000000000000000000000000000000000000000000000
 000000000000000000000f8060000000000003c02e0017a012101ce007900200
 00

Share Button

Comments

  1. Brian Hert says:

    Hi, I know this is a very old post but I’m hoping you can help me out with the syntax of the writepage command. I have a database with a 2525 error and the only corruption that I can find is that the objid on the page is wrong – which should be easy to fix in theory.

    Thanks

    1. Unfortunately, the writepage dbcc command doesn’t really work on Sybase ASE. Years ago tools like sybedit would manipulate the page directly in the file/raw partition. If you really need to patch the database, White Sands Technology makes this possible with their ProActive DBA product.

      As far as the 2525 error goes, did you try the options in the error guide?

  2. Brian Hert says:

    Unfortunately the objectid’s do not match. The id in the page is 5 (sysprocedures) and the object in the extent is the correct one for the table.

    The recommended solutions for that is to bcp out the data, which fails with a 605 and or to select into a new table, which also fails with a 605 message. I was hoping to avoid a call to Sybase but it seems like it may be the only option since I have this on more than one database and the clients backups contain the error (I didn’t get called until this was the case).

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*

Facebook login by WP-FB-AutoConnect