How to export SQL Server data from corrupted database (with disk write error)

Posted by damitamit on Server Fault See other posts from Server Fault or by damitamit
Published on 2010-05-18T13:24:07Z Indexed on 2010/05/18 13:31 UTC
Read the original article Hit count: 273

Filed under:

IT realised there was a disk write error on our production SQL Server 2005 and hence was causing the backups to fail. By the time they had realised this the nightly backup was old, so were not able to just restore the backup on another server.

The database is still running and being used constantly. However DBCC CheckDB fails. Also the SQL Server backup task fails, Copy Database fails, Export Data Wizard fails. However it seems all the data can be read from the tables (i.e using bcp etc)

Another observation I have made is that the Transaction Log is nearly double the size of the Database. (Does that mean all the changes arent being written to the MDF?)

What would be the best plan of attack to get the database to a state where backups are working and the data is safe?

  • Take the database offline and use the MDF/LDF to somehow create the database on another sql server?
  • Export the data from the database using bcp. Create the database (use the Generate Scripts function on the corrupt db to create the schema on the new db) on another sql server and use bcp again to import the data.
  • Some other option that is the right course of action in this situation?

The IT manager says the data is safe as if the server fails, the data can be restored from the mdf/ldf. I'm not sure so insisted that we start exporting the data each night as a failsafe (using bcp for example).

IT are also having issues on the hardware side of things as supposedly the disk error in on a virtualized disk and can't be rebuilt like a normal raid array (or something like that).

Please excuse my use of incorrect terminology and incorrect assumptions on how Sql Server operates. I'm the application developer and have been called to help (as it seems IT know less about SQL Server than I do).

Many Thanks, Amit

© Server Fault or respective owner

Related posts about sql-server-2005