How do I recreate my DASP database on my local dev machine?

Discussion in 'Databases' started by ColdCold, May 22, 2010.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hi all, I'm no DBA, so this is stumping me...

    All I want to do is create an exact replica of my DiscountASP database on my local machine. I'm running SQL Server 2008 in both locations. Originally I asked tech support if they could just send me my MDF file from the server and I was going to attach it locally - seemed like the easiest thing to do. They said they wouldn't give me the MDF file and I'd have to download the BAK file and restore it locally. They said that's what everyone else does. OK, fine. I'd love to be able to periodically download the BAK file and have a local replica of the DASP db whenever I want, so...

    Using SQL Server Management Studio I've been trying to create a local db that will let me restore the BAK file I've downloaded from the server. First I created a brand new local db and gave it the same name as my DASP db. Then I connected to my DASP db and went to Tasks > Generate Scripts, I selected my db and checked "Script all objects in the selected database". I kept all the default Script Options... create tables, stored procedures, constraints, keys, yadda yadda... everything seemed reasonable. I outputted the script as a single file to my local machine. Next I connected to my local db and ran the script. Great, everything went fine. So now I went to Tasks > Restore > Database, I selected "From Device" and specified the BAK file I had just unzipped from the download of my DASP db (found in the _database directory). Checked the restore checkbox and click OK, then I immediately got the following error:

    Restore failed for Server 'BlahBlah'. (Microsoft.SqlServer.SmoExtended)

    System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing 'SQL2008_xxxxxx_mysweetdb' database. (Microsoft.SqlServer.Smo)

    No matter how else I have tried to create the local database with all of its objects, I always get this same error. Can anyone help? What am I missing in this process? Clearly my local database is not adequately similar to the remote db on the DASP server, but how is it different?

    thanks much!
     
  2. This works for me:
    • Download the .bak/.zip file from the web server
    • Fire up SQL Management Studio 2008 locally
    • Connect to the instance of SQL Server on (local)
    • Don't bother attempting to create a new database on local for the restore to 'restore into'; just let the restore process create the db from scratch
    • Right click Databases and click restore
    • Put a relevant name in the To Database textbox
    • Click From Device radio, hit elipsis button, click the Add button and browse to the .bak you downloaded. Click ok.
    • Check the restore checkbox on the row in the 'backup sets to restore' grid for the db you want to restore
    • Change to Options and click the Overwrite existing database checkbox
    • Click Ok. The restore takes a short while and progress clicks up to 100%
     
  3. Solved!

    Thank you!!

    Your steps #4 and #9 were the key points I was missing.

    Piece of cake! :)

    Muchas gracias!
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page