|
3.1 How do I set TS Role in order
to run certain DBCCs...?
3.2 What are some of the hidden/trick DBCC
commands?
3.3 Other sites with DBCC information.
3.4 Fixing a Munged Log
Performing any of the above may corrupt your ASE
installation. Please do not call Sybase Technical Support after
screwing up ASE. Remember, always take a dump of the master
database and any other databases that are to be affected.
Some DBCC commands require that you set TS Role in order
to run them. Here's how to set it:
Login to Server as sa and perform the following:
sp_role "grant", sybase_ts_role, sa
go
set role "sybase_ts_role" on
go
Back to top
Here is the list of DBCC commands that have been sent into the FAQ. If
you know of any more or have more information, then please send it in to dowen@midsomer.org,
this is, after all, a resource for us all.
As ASE develops, so some of the dbcc's change. I have pointed out major
changes from one release to another that I know about. However, a couple
of changes are so common that it will save a lot of space if I say it
once. Where there is an option to specify dbid or dbname, in previous
releases only dbid would be accepted.
| DBCC Name |
Argument List |
Comments |
Risk Level/
Supported? |
| allocdump |
( dbid | dbname, page ) |
|
|
| bhash |
( { print_bufs | no_print }, bucket_limit ) |
Format prior to ASE 11. |
|
| |
Format prior to ASE 12. |
|
| ( cname [, clet_id [, { print_bufs | no_print },bucket_limit]] ) |
Format ASE 12 and later. |
|
| buffer |
( [ dbid ][, objid ][, nbufs ], printopt = {0 | 1 | 2},buftype) |
Format prior to ASE 11. |
|
[ (dbid | dbname [, objid | objname [, nbufs [, printopt = { 0 | 1 | 2 }
[, buftype = { kept | hashed | nothashed | ioerr} [, cachename ] ] ] ] ] ) ] |
Format prior to ASE 12. |
|
[ (dbid | dbname [, objid | objname [, nbufs [, printopt = { 0 | 1 | 2 }
[, buftype = { kept | hashed | nothashed | ioerr} [, cachename [, cachelet_id ]
] ] ] ] ] ) ] |
Format ASE 12 and later. |
|
| bytes |
( startaddress, length ) |
Format prior to ASE 12. |
|
| (startaddress, length [, showlist | STRUCT_NAME]) |
Format ASE 12 and later. |
|
| cacheremove |
(dbid|dbname, objid|objname) |
Uninstall and Uncache descriptor for an object from cache |
|
| checkalloc |
[( dbname [, fix | nofix ] ) ] |
|
|
| checkcatalog |
[( dbname )] |
|
|
| checkdb |
[( dbname [, skip_ncindex ] ) ] |
|
|
| checktable |
( tablename | tabid [, skip_ncindex ] ) |
|
|
| corrupt |
( tablename, indid, error ) |
Error can take one of the following values:
- 1133 error demonstrates that a page we think is an oam is not
- 2502 error shows multiple references to the same page
- 2503 error shows a breakage in the page linkage
- 2521 error shows that the page is referenced but is not allocated on the extent page
- 2523 error shows that the page number in the page or catalog entries are out-of-range
for the database
- 2525 error shows that an extent objid/indid do not match what is on the page
- 2529 error shows a page number out-of-range for the database or a 605 style scenario
- 2540 error occurs when a page is allocated on an extent but the page is not referenced
in the page chain
- 2546 error occurs when an extent is found for an object without an of its pages being
referenced (a stranded extent)
- 7939 error occurs when an allocation page which has extents for an object are not
reflected on the OAM page
- 7940 error occurs when the total counts in the OAM page differ from the actual count of
pages in the chain
- 7949 error is similar to a 7940 except that the counts are on an allocation page basis
|
|
| cursorinfo |
(cursor_level, cursor_name) |
cursor_level - level of nesting. -1 is all nesting levels |
|
| dbinfo |
( [ dbname ] ) |
|
|
| dbrepair |
( dbid, option = { dropdb | fixindex | fixsysindex }, table, indexid ) |
|
|
| dbrepair |
( dbid, ltmignore) |
|
|
| dbtable |
( dbid ) |
|
|
| delete_row |
( dbid, pageid, delete_by_row = { 1 | 0 }, rownum ) |
|
|
| des |
( [ dbid ][, objid ] ) |
|
|
| engine |
(eng_func) |
eng func may be:
- "online"
- "offline", ["<engine number>"]
|
|
| extentcheck |
( dbid, objid, indexid, sort = {1|0} ) |
|
|
| extentdump |
( dbid, page ) |
|
|
| extentzap |
( dbid, objid, indexid, sort ) |
|
|
| findnotfullextents |
( dbid, objid, indexid, sort = { 1 | 0 } ) |
|
|
| fix_al |
( [ dbname ] ) |
|
|
| help |
( dbcc_command ) |
|
|
| ind |
( dbid, objid, printopt = { 0 | 1 | 2 } ) |
|
|
| indexalloc |
(tablename|tabid, indid, [full | optimized | fast],[fix |
nofix]) |
|
|
| listoam |
(dbid | dbname, tabid | tablename, indid) |
|
|
| locateindexpgs |
( dbid, objid, page, indexid, level ) |
|
|
| lock |
|
print out lock chains |
|
| log |
( [dbid][,objid][,page][,row][,nrecords][,type={-1..36}],printopt={0|1} ) |
|
|
| memusage |
|
|
|
| netmemshow |
( option = {1 | 2 | 3} ) |
|
|
| netmemusage |
|
|
|
| newalloc |
( dbname, option = { 1 | 2 | 3 } ) |
|
|
| page |
( dbid, pagenum [, printopt={0|1|2} ][, cache={0|1} ][, logical={1|0} ] ) |
|
|
| pglinkage |
( dbid, start, number, printopt={0|1|2}, target, order={1|0} ) |
|
|
| pktmemshow |
( option = {spid} ) |
|
|
| procbuf |
( dbid, objid, nbufs, printopt = { 0 | 1 } ) |
|
|
| prtipage |
( dbid, objid, indexid, indexpage ) |
|
|
| pss |
( suid, spid, printopt = { 1 | 0 } ) |
|
|
| rebuildextents |
( dbid, objid, indexid ) |
|
|
| rebuild_log |
( dbid, 1, 1) |
careful as this will cause large jumps in your timestamp
values used by log recovery. |
|
| remap |
|
Only available prior to 12. |
|
| resource |
|
|
|
| setkeepalive |
(# minutes) |
for use on Novell with TCP/IP. |
|
| settrunc |
('ltm','ignore') |
Not needed with more recent versions of ASE, use the
supplied stored procs. On older versions of ASE (pre-11?) this command may be
useful for a dba who is dumping and
loading a database that has replication set on for the original db. |
|
| sqltext |
(spid) |
Shows the sql that the spid is currently running.
Blank if idle. |
|
| stacktrace |
(spid) |
Not Linux, yet :-) |
|
| show_bucket |
( dbid, pageid, lookup_type ) |
|
|
| tab |
( dbid, objid, printopt = { 0 | 1 | 2 } ) |
|
|
| tablealloc |
(tablename|tabid, [full | optimized | fast],[fix | nofix]) |
|
|
| traceoff |
( tracenum [, tracenum ... ] ) |
|
|
| traceon |
( tracenum [, tracenum ... ] ) |
|
|
| tune |
( option, value ) |
Used to switch on/off certain options. Some are
supported and listed in the docs, others correspond to the buildmaster
-yall name minus the c prefix.
Supported:
- ascinserts ('value' is again two values, 1|0 for on or off and the
table name).
- cpuaffinity ('value' in this case is two values, the
starting cpu number and "on" or "off".)
- maxwritedes
Unsupported:
- indextrips
- oamtrips
- datatrips
- schedspins
- bufwashsize
- sortbufsize
- sortpgcount
- maxscheds
- max_retries
|
|
| undo |
( dbid, pageno, rowno ) |
|
|
| usedextents |
( dbid|dbname, type = {0|1}, display_opts = {0|1} [, bypiece = {0|1}]) |
If sp_helpdb is returning negative free space, try:
usedextents(dbid, 0, 1, 1) |
|
Back to top
Back to top
Sybase Technical Support states that this is extremely dangerous as it
"jacks up the value of the timestamp" which is used for recovery purposes. This
may cause potential database corruption if the system fails while the timestamp rolls
over.
In 4.9.2, you could only run the dbcc rebuild_log command once and after that you would
have to use bcp to rebuild the database
In System 10, you can run this command about 10 times.
In System 11 I (Pablo, previous editor) tried it about 20 times and no problem.
1> use master
2> go
1> select count(*) from your_database..syslogs
2> go
-----------
some number
1> sp_configure "allow updates",1
2> go
1> reconfigure with override /* for system 10 and below only*/
2> go
1> begin tran
2> go
/* Save the following status to be used later... */
1> select saved_status=status from sysdatabases where name = "your_database"
2> go
1> update sysdatabases set status = -32768 where name = "your_database"
2> go
1> commit tran
2> go
1> shutdown
2> go
1> dbcc rebuild_log (your_database, 0, 0)
2> go
DB-LIBRARY error (severity 9):
Unexpected EOF from SQL Server.
1> dbcc rebuild_log (your_database, 1, 1)
2> go
DBCC execution completed. If DBCC printed error messages, see your System
Administrator.
1> use your_database
2> go
1> select count(*) from syslogs
2> go
-----------
1
1> begin tran
2> go
1> update sysdatabases set status = saved_status where name = "your_database"
2> go
(1 row affected)
1> commit tran
2> go
1> shutdown
2> go
Back to top
|