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.
| Author |
Topic |
|
token
Posting Yak Master
133 Posts |
Posted - 2005-11-04 : 13:08:52
|
Hi all,I'm new to this forum so I apologise if my question has been answered before (but i couldn't find anything on Search).Basically I made a database in SQL Server which I had to delete when I uninstalled and re-installed the software. I still have the .mdf data file for the database but I don't understand how to open it in SQL Server and get my database (with all data e.g. tables) back. Do I have to re-create my whole database again  |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2005-11-04 : 13:11:40
|
| Did you create a backup?You might be able to kake it out...but it certainly will be kludgy...and what about the other system databases?Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
token
Posting Yak Master
133 Posts |
Posted - 2005-11-04 : 13:16:08
|
| I didn't create any backup. I just made a database in the Databases folder (where Northwind and pubs are) and created the tables. But I lost the database in the Databases folder when I un-installed SQL Server. I still have the DATA and LOG files that were originally created. Isn't there some simple way to just tell SQL Server to make a database based on those files? |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2005-11-04 : 13:20:31
|
| Do this...Create a database in EMSupply the data file and log file as they are named from the ones you saved. Make sure they are in a different location than the creation of the new database location.Once the db is created, copy the mdf and ldf over the existing files.I'm not sure that that'll work, but it's worth a shot.next time make a backup.I'm also suprised there was no maintenance at all an dthat you don't have backups.That's quite unusual.Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-11-06 : 08:42:50
|
| You should be able to just ATTACH your files, shouldn't you?Keep the copies safe somewhere else, copy them to the appropriate location (as you say, where Pubs and Northwind are should do), then use ATTACH.Bretts route should be good too - but note that you'll need to STOP the SQL Service in order to be able to copy-over the newly made database files.If both those give you grief then have a search for "Single File Attach" which will allow you to attach the MDF file WITHOUT the LDF.NOTE: These methods are only likely to work if the copy of MDF/LDF you have was made either a) using the DETACH method or b) when SQL Service was stopped. If SQL was running at the time you will be lucky if your copy works at all.There is an option using the Maintenance Plan Wizard to backup ALL USER DATABASES - that would give you the safety net of ensuring that any newly created database was backed up in futureKristen |
 |
|
|
token
Posting Yak Master
133 Posts |
Posted - 2005-11-06 : 14:31:27
|
| Thanks for your help guys. The method of replacing the new files with the old ones of the same worked worked perfectly well. I'm new to SQL and have basically been using it without any training. So now I know that I must make back-ups regularly. I don't use the maintanence wizard because it backs up work at a particular time and day. My computer isn't on all the time, so I just back-up manually now.Thanks for the help, its much appreciated! |
 |
|
|
|
|
|