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
 General SQL Server Forums
 Data Corruption Issues
 My db in sql server fix

Author  Topic 

TsonsiHons
Starting Member

1 Post

Posted - 2014-08-12 : 15:37:24
After the failure of electricity, and my database in sql server corrupted. Tried to return the backup, but when importing, there is an error that the database is corrupted. What should I do, tell me?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-08-12 : 15:39:40
If you have a SQL Server backup, then you should be running the RESTORE DATABASE command using that backup. I am not sure what you are trying to import. Please define what you mean by backup.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-08-12 : 15:40:23
Also, how do you know the database is corrupted? Have you run DBCC CHECKDB against it? If so, please post the entire output.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

prett
Posting Yak Master

212 Posts

Posted - 2014-08-13 : 01:47:05
What is the error message when you try to restore database from backup?

Without knowing error message, it is very hard to reply.
Go to Top of Page

Lincolnburrows
Yak Posting Veteran

52 Posts

Posted - 2014-08-21 : 06:46:58
There might be other options out there. This is something that worked for me once but there are no guarantees that it will work at all times.

Stop SQL Server instance -> Copy MDF and LDF files to another location -> Delete original MDF and LDF files -> Start SQL Server instance again -> Create new database with exact same name and file names -> Stop SQL Server -> overwrite newly created MDF and LDF.

After this your database should be back online. If it is then go ahead and put it into EMERGANCY mode and SINGLE USER mode.

Finally go ahead and execute DBCC CHECKDB like this

DBCC CHECKDB (databaseName, REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS

If you can get to this and execute last command successfully you should be good. If not then your only options are restoring from backup and/or using 3rd party tools.

Go to Top of Page
   

- Advertisement -