Solved

How to Clone a live MS SQL database for testing purposes

Posted on 2010-11-22
7
777 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 41 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 10

Accepted Solution

by:
Humpdy earned 42 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 42 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

743 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now