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
 New to SQL Server Administration
 attach and deattach problem

Author  Topic 

shinobigoh
Starting Member

13 Posts

Posted - 2010-04-13 : 22:15:16
I have a problem
My sql server 2000 database crashed but data files are still there.
I want to reinstall the sql server 2000 on a new hard disk and want to try attach the data files without detach them but I would like to know any impacts of attaching the data files without detaching them in the first place

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-04-13 : 22:32:31
Well the database might be corrupt as the files weren't closed during the server crashing. You'll know if it's corrupt if during the attach it errors out about the files being a problem or if after they attach successfully and you run DBCC CHECKDB which comes up with errors. If the attach works successfully and DBCC CHECKDB comes up clean, then the database is good. Good luck!

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

shinobigoh
Starting Member

13 Posts

Posted - 2010-04-13 : 23:40:47
if I am unable to attach the data files, any other way to restore the database?

thank you
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-04-13 : 23:44:20
Yes from your backups. If you don't have any backups and the files can't attach (or the database is corrupt), then you are screwed or need to hire one of those 3rd party data recovery companies.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

shinobigoh
Starting Member

13 Posts

Posted - 2010-04-13 : 23:47:43
my customer did not have backups for the database
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-04-13 : 23:50:26
Hopefully the files attach then.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

shinobigoh
Starting Member

13 Posts

Posted - 2010-04-14 : 03:54:54
Is it possible for me to get the structure of the tables using the data files
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-04-14 : 04:33:54
If you cannot attach the files try:

After reinstall SQL Server etc / on new machine / etc.

Create a new database with the same name as the old one, and the same filenames as before.

STOP the SQL service.

Copy the files you rescued to overwrite the MDF and LDF files that were created for the new database

Restart SQL Service - maybe your original database will show up

If the database appears then use DBCC CHECKDB to check if it is healthy. Do NOT use the repair option at this stage.

If the database is healthy you are good to go if not then you may be able to export data from some (and maybe "all") tables. You may also be able to see the structure from some/maybe-all tables. Try creating a Script of the DDL - that would allow you to create a clean database with identical structure, and you could then try copying over the data table-by-table.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-04-14 : 11:57:39
quote:
Originally posted by shinobigoh

Is it possible for me to get the structure of the tables using the data files



Only if they can be attached.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tosscrosby
Aged Yak Warrior

676 Posts

Posted - 2010-04-16 : 10:21:42
And if it's your customer (I'm assuming a paying customer!), why did you not ensure a backup routine was in place? That is one of the most basic of steps as a service provider, whether a developer or DBA. You surely cannot use a customer who may be totally screwed by your lack of attention to detail as a reference for future, potential customers, now can you?

Sorry, my Friday morning rant is now officially over! (Beware Monday mornings!)

Terry

-- The problem with socialism is that you eventually run out of other people’s money. -- Margaret Thatcher
Go to Top of Page
   

- Advertisement -