Solved

How to copy online SQL Database for current data developmental database

Posted on 2008-06-22
3
252 Views
Last Modified: 2013-11-30
I have a Access 2003 FE with a MS SQL 2005 backend.  I need to be able to copy the backend database at night to be able to update the data in an developmental database that we use to test against.  The developmental database can be on the same or a different server.  I have tried to use the replication (snapshot) but it is read only, I need to be able to have read write capabilities.  
Currently I am taking the database offline at night and manually copying the file group to a different server and renaming it and then attaching/renaming it to the developmental database, then putting the production database back online.  
I know that there is a way to automate this process (Scripts, Maintenance plan) but I am not sure were to begin.  I have very limited knowledge of SQL as we just upsized from a Access backend.  
0
Comment
Question by:jagwynn
  • 2
3 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 21841693
just a plain BACKUP DATABASE <dbname> TO DISK ...  and a RESTORE DATABASE <copy_of_database> FROM DISK ... WITH REPLACE, MOVE ... will do it.
please check out the syntax, if you need help, just ask.

this way you don't need to take the db offline.
0
 
LVL 1

Author Comment

by:jagwynn
ID: 21842055
Thank you,  I assume that the commands are correct to backup and restore the files.  I will be able to test this out tonight and respond if it works correctly.  And again thanks for the help!

RESTORE DATABASE <DatabaseName>
FROM DISK='<SourceBackupFile>'
WITH Recovery, Replace,
MOVE '<LogicalDataFileName>' TO '<DestinationDataFileName>',
MOVE '<LogicalLogFileName>' TO '<DestinationLogFileName>'


And just so that I understand it correctly
RESTORE DATABASE <DatabaseName> - The test database
FROM DISK='<SourceBackupFile>'  The backup from production database
WITH Recovery, Replace,  - Drop database and then restore file
MOVE '<LogicalDataFileName>' TO '<DestinationDataFileName>', - Move Data file
MOVE '<LogicalLogFileName>' TO '<DestinationLogFileName>'  Move Log file
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 125 total points
ID: 21842062
>And just so that I understand it correctly
yes, understood correctly

note: the logical and physical file name associations in the prod database can be queried by the sysfiles (or sys.files) view in the relevant database
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
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…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

747 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

14 Experts available now in Live!

Get 1:1 Help Now