Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 How to fix a database corruption?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-03-28 : 17:09:06
Sridharan writes "Hi All,

I am working in a test environment where I need to corrupt a database for test purpose/R&D.
After corrupting the database, I ran the DBCC CHECKDB (pubs, repair_fast) and then DBCC
CHECKDB (pubs, repair_rebuild) commands. But it's not fixing the corrupt database.

My question is why DBCC is not fixing the corrupted Database? Is that a limitation of DBCC
or is there any other way/command or tool to fix the corrupted database other then restoring
from the previously backed up file.

The following are the steps that I followed to corrupt the database:
I used the following script (available in the script section of www.swynk.com) to corrupt
the pubs database.

sp_configure allow, 1
go
reconfigure with override
go
update sysindexes set FirstIAM = 1234
where id = OBJECT_ID('roysched')
go
sp_configure allow, 0
go
reconfigure with override
go

Then I did a select * from roysched. I got the error:
Server: Msg 5180, Level 22, State 1, Line 1
Could not open FCB for invalid file ID 53764 in database 'pubs'. Table or database may be
corrupted.

The pubs database got corrupted. Now, I want to fix this error. So I set the pubs database
to single user mode and ran the DBCC command :
DBCC CHECKDB (pubs, repair_fast) that doesn't help so I ran the DBCC CHECKDB (pubs,
repair_rebuild) command.

I got big DBCC output. I doesn't seems to fix the pubs database. When I did a select * from
roysched again it gave the same corruption error.

I would appreciate any help in this issue.

Thanks
Sri"
   

- Advertisement -