Copying SQL Server DB to CD

Author
Discussion

mikey_p

Original Poster:

1,273 posts

215 months

Tuesday 1st May 2007
quotequote all
I need to copy a SQL Server database to a CD and was wondering how the hell I do it as i've looked around but can't find a way of doing it.

I'm using SQL Server 2005 and SQL Server Management Studio Express, and the DB isn't particularly large or complicated. Do any of you know a way to do this?

Cheers
Mike

pdV6

16,442 posts

262 months

Tuesday 1st May 2007
quotequote all
Either detach the database from the server and then copy the data and log files onto CD (don't forget to re-attach the originals back to the server after)

or

Back it up to a file and copy the resulting file to CD.

mikey_p

Original Poster:

1,273 posts

215 months

Tuesday 1st May 2007
quotequote all
I am complete ING TWAT. Being the idiot that I am and without thinking I thought DROP DB TO or whatever it says would to the trick, so dropped it to a folder in My Documents. I've now deleted the database and I can't connect to AGETHA (my computer) because the default DB is not longer there.

Is there a way to undo this or recover it? I have what ever file I created in the folder I sent it to but have no idea what it is for. This is for my final year university project and I have to demonstrate my work in a week .

pdV6

16,442 posts

262 months

Tuesday 1st May 2007
quotequote all
What files are you left with in that folder?

mikey_p

Original Poster:

1,273 posts

215 months

Tuesday 1st May 2007
quotequote all
It's just called RF_Medi_ID_2.sql. Just spoke to a friend and apparently the database will be pretty much completely gone now. Oh well, I have a week to re-create the DB and Stored Procedures and make sure every file name matches up with the file names in my code for a mobile Web Form cry.

This absolutely typical, it always happens right before hand-in hehe.

pdV6

16,442 posts

262 months

Tuesday 1st May 2007
quotequote all
What was the database called before you inadvertently dropped it from the server?

Have a look in c:\program files\microsoft sql server\mssql\data or thereabouts and see if there are any *.mdf and *.ldf files with familiar looking names kicking around.

mikey_p

Original Poster:

1,273 posts

215 months

Tuesday 1st May 2007
quotequote all
Yea I checked in there and there is nothing. I've been to see a database lecturer and apparently it is completely gone so i'll have to re-create it. whoopy.

Cheers for the replies though.

pdV6

16,442 posts

262 months

Tuesday 1st May 2007
quotequote all
Unfortunately it seems that he's right - when you drop a database it helpfully deletes the data and log files for you as well.

Maybe you can recover them using an undelete-type program and then re-attach them?

spivvy

1,534 posts

255 months

Tuesday 1st May 2007
quotequote all

SneakyNeil

9,243 posts

238 months

Tuesday 1st May 2007
quotequote all
That was unfortunate.

mikey_p

Original Poster:

1,273 posts

215 months

Tuesday 1st May 2007
quotequote all
SneakyNeil said:
That was unfortunate.


Yea it was a bit laugh. Could have been worse though, I could have lost all my written work the day before deadline. At least I only have to go about re-creating a database which doesn't require much of an artistic license when you have the designs. And I have a week before I have to display my product anway.

Cheers spiccy I may as well try that undelete product. Fingers crossed eh.

john_p

7,073 posts

251 months

Tuesday 1st May 2007
quotequote all
I'm sorry .. but not realising what DROP DATABASE does is pretty funny hehe

I hope you'll look back and laugh on this. Good luck getting it all in on time anyway.

BliarOut

72,857 posts

240 months

Tuesday 1st May 2007
quotequote all
Restore from backup?

judas

5,992 posts

260 months

Tuesday 1st May 2007
quotequote all
mikey_p said:
It's just called RF_Medi_ID_2.sql.

What does the .sql file contain? If you're lucky it will contain the a complete sql script to rebuild the db.

mikey_p

Original Poster:

1,273 posts

215 months

Tuesday 1st May 2007
quotequote all
Yeah not knowing what DROP FROM DATABASE means is pretty bloody stupid, but I click before thinking. I know DROP TABLE and that but just wasn't thinking. I'm already laughing about it though. In between the bitter resentment of my own stupidity hehe.

BlairOut it was trying to create a backup that caused me to delete it (hows that for sounding like an idiot), and the only part of my project I hadn't previously backed up (the other work was backed up religously on several different media).

Judas, the script it created was the SQL Query to delete the database, which I did execute about 30 seconds before my housemate phoned me back and told me DROP means delete laugh.

It's OK though, i've had a nice pint of Cruzcampo and am back at work to fix this bloody error with the database which is causing me to not to be able to create a new database. It never rains, it only pours .

sybaseian

1,826 posts

276 months

Thursday 3rd May 2007
quotequote all
mikey_p said:
Yeah not knowing what DROP FROM DATABASE means is pretty bloody stupid, but I click before thinking. I know DROP TABLE and that but just wasn't thinking. I'm already laughing about it though. In between the bitter resentment of my own stupidity hehe.

BlairOut it was trying to create a backup that caused me to delete it (hows that for sounding like an idiot), and the only part of my project I hadn't previously backed up (the other work was backed up religously on several different media).

Judas, the script it created was the SQL Query to delete the database, which I did execute about 30 seconds before my housemate phoned me back and told me DROP means delete laugh.

It's OK though, i've had a nice pint of Cruzcampo and am back at work to fix this bloody error with the database which is causing me to not to be able to create a new database. It never rains, it only pours .



don't laugh - one of our remote support teams in Mumbai was trying to clear a databases' users and accidently deleted the system logins - he then logged out of the system and wondered why no one could login again........

To compound the matter even more, the same person then decided to rebuild the master database. When he then logged in there were still no user logins (there wouldn't be any by default) and now there were no user databases - thankfully we don't let them loose on our Production systems.......