- 论坛徽章:
- 0
|
(1) isql -Usa -P to log into sql server and enter following commands
1> sp_role "grant","sybase_ts_role",sa
2> go
1>quit
2>go
(2) relogin into sql server with sa
(3) enter these commands in isql:
1> use your_database
2 > go
1> select first ,root ,indid from sysindexes
2> where id=object_id("table_name"
3>go
choose a line from the output of which the indid is neither 0 nor 1,
and pick up the value of its root. this is the root page number
of this index btree,next we will use root_page_number
to represent it and indid for its index id.
(4) find a page number which is on the data pages chain
1>dbcc prtipage(database_name,table_name, indid,root_page_number)
2>go
(4.1) read the last line of this dbcc output ,it is like:
index row at offset XX points to page XXXX.
take the page number xxxx and issue above command again :
1>dbcc prtipage(database_name,table_name,indid,XXXX)
2>go
repeat this step until the dbcc output looks like this:
leaf row at offset xxxxx points to data page nnnnn,row number xxxx.
this meens that we reach the leaf-level pages of this index btree,
so you choose a line from its output and read out the
page number, which is a data page of this table.
(5) from the data page (nnnn), you walk along the data page chain of this table
until we get to the begin, the first page of its database chain.
1>dbcc pglinkage(supportdb,nnnn,0,2,0,0)
2>go
the last number of this page number list is the first
page of this table. make sure the object id displayed is correct.
(6) update the first column of this table in sysindexes
1>update sysindexes set first=new_first_page where id=object_id('table_name')
2> and indid=0
3>go
(7) use select count(*) from table_name to test our work.
( select * into new_table from table_name.
(9) drop the old corrupt table. |
|