Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to Clone a live MS SQL database for testing purposes

Posted on 2010-11-22
7
Medium Priority
?
825 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
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

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
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.
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.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

715 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