Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to Clone a live MS SQL database for testing purposes

Posted on 2010-11-22
7
Medium Priority
?
831 Views
Last Modified: 2012-10-27
Hi
I want to clone a  MS SQL 2008 R2 database  onto the same server under a new DB instance / name. What is simplest way to achieve this ?

Also Db has a Spatial table with GIS data in it - any special actions to cater for this ?

THX

Kevin
0
Comment
Question by:kabutz
7 Comments
 
LVL 16

Assisted Solution

by:EvilPostIt
EvilPostIt earned 164 total points
ID: 34188203
Backup then restore. Dependant on what you actually want to do then you may have to re-link the logins again.
0
 

Author Comment

by:kabutz
ID: 34188565
Tried that

I get a message instance already exists if I just do a restore.  I want a clone on same server to do testing on without affecting original instance.

Where do i set a new instance name ?

kevin
0
 
LVL 16

Expert Comment

by:EvilPostIt
ID: 34188601
You will have to do a new installation of SQL Server.
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
LVL 10

Accepted Solution

by:
Humpdy earned 168 total points
ID: 34188827
As Dr. Evil said, if you want to have a new instance, then you'll need to install SQL Server and have a separate instance.

I get the feeling though you just need to replicate the database within the same sql installation/instance you already have.
If that's the case, you just create a blank database, take a backup of your existing database, and restore to the newly created database. When doing the restore, click in options, and click on override existing database, and make sure you point the data file and log file to the newly created database.
I think you're restore you're trying to do is using the same name for the transaction logs and data file as your existing database is using.
0
 

Author Comment

by:kabutz
ID: 34189020
Aha.. Yes -- will try that -

apologies my use of the term "instance " was misleading -
yes I want a cloned DB within the same SQL instance / installation.
0
 
LVL 18

Expert Comment

by:lludden
ID: 34189065
Just do a backup and restore it with a different name.
0
 
LVL 11

Assisted Solution

by:mattibutt
mattibutt earned 168 total points
ID: 34191143
You are not selecting new database this is a default settings when you select backup file it automatically selects the original database file change both log file as well data file from file option
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

877 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