Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2015
    Posts
    1

    Unanswered: Restoring a database alongside existing DB

    Hi there,
    I need to recover some data in a table but i'm not 100% sure the right way to do this safely.
    I'll need to query the two tables to compare the before and after but how do i go about restoring/attaching the backup database to SQL without causing conflicts?

    if i restore, i assume this would just overwrite which is obviously the worst thing that can happen. if i attach the backup, how does this affect the current live DB? how do i make sure that it's not getting accessed and mistaken for the live DB?

    the SQL server is 2008 R2 running as a VM.

    Many thanks,
    JV

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Restore the database using a different database name, and different Windows file names. This can be as simple as appending a "2" to the file name, or completely changing the name and restoring it as "Uhoh" or a similar name.

    If you use Transact-SQL, simply edit the appropriate values before you submit the command.

    If you use SSMS:
    1. Right-click on the Databases container
    2. Click on the Restore Database
    3. Click on the General page (in the left hand pane of the Window)
    4. Select the backup you want to restore.
    5. Edit the database name to the new value
    6. Click on the Files page (in the left hand pane of the Window)
    7. Edit the names of all of the files
    8. Click the Ok button


    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Jan 2009
    Location
    United Kingdom
    Posts
    77
    Make sure you don't use the REPLACE option. SQL Server has some good safety options in place.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •