Solved

copying one sql database into different database

Posted on 2011-09-06
2
177 Views
Last Modified: 2012-05-12
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
Comment
Question by:dankyle67
2 Comments
 
LVL 25

Accepted Solution

by:
Lee Savidge earned 500 total points
ID: 36491026
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
 

Author Comment

by:dankyle67
ID: 36495599
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question