[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • Last Modified:

copying one sql database into different database

Hi,

wanted to create a test company within sql 2008 that has all the same data as our live company.  I created a backup of the live company and actually have the mdf file and also the bak file from backup within the sql management studio.  I went to detach the test company and renamed the file called 850.mdf to 850.mdd.  I then copied the copy of live company mdf into same directory as where the 850.mdd currently is.  I then tried to do an attach of the copy of live company but got errors.  I actually renamed the copy of live data to 850.mdf.  Was this necessary and could i have done a restore of the bak file instead?  The restore actually said that i am trying to restore data that is from a different company structure so forth.  thanks
0
dankyle67
Asked:
dankyle67
1 Solution
 
Lee SavidgeCommented:
Put the live database as it was so that is working. Create a blank new one then restore your backup over the top. When restoring ensure that you point the restore to the blank database location as it will default to the live database.

Lee
0
 
dankyle67Author Commented:
Found out that key is you have to select option to restore over existing database which i didnt do first time.  Worked after doing this, thanks.
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now