Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

suspect database

Status
Not open for further replies.

georgia51390

Programmer
May 17, 2001
13
US
Due to hard drive space issues, I was told to delete some transaction logs on my database after truncating the logs. The data file (.mdf) file is still intact, however, my database is now marked "suspect". I have tried to reset the status without success. The error logs report that some transaction logs are not valid (the ones that were deleted). We have NO BACK-UP. Is there anything we can do to restore the database? Or is there a way to create a new database and have it use the bad database's .mdf data file?
 
Try this.

sp_detachdb 'dbname'

sp_attach_single_file_db 'dbname', 'physical_file_name'

'physical_file_name' will be the path and name of the MDF file.

I'm not sure if this will work at this point. For future reference, what you should have done is

1- Full backup of database
2- Use sp_detachdb to free the database
3- Delete the LDF file
4- Use sp_attach_single_file_db to reattach the database.
Terry

;-) The single biggest challenge to learning SQL programming is unlearning procedural programming. -Joe Celko

SQL Article links:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top