Search code examples
sql-servercopydatabase-restore

Copy Existing Database to New Database


I'm trying to figure out the "best" or common ways to copy a...reference database over an existing database.

Basically, I'm going to be teaching some CIS Majors some MVC4(C#)/EF and wanted to provide a database to do DB first development off of.

Something I'm anticipating needing is a process to easily restore the data in case they screw something up.

I'm really trying to figure out the least resource intensive option for doing this. As it will simply be off my home server while I'm demonstrating this and don't want it to put a huge drain on the resources as it's a relatively low powered box (AMD 3core/4gig/raid1). I don't normally run SQL Server on there and normally simply use it for tinkering with different server technologies. If it matters I'm running Server 2012 at the moment.

The solution could be....

  • Batch file ran occasionally
  • Powershell script ( I would need guidance on this as I've never done much at all in Powershell)
  • SQL Management Studio
  • C# program
  • (Really anything that is available to run on Server 2012)

I have found a couple of posts on here that talk about doing a backup of one and a restore, but didn't know if this would be the ideal option for the scenario that I have.

EDIT: I would like the solution to be something that I can schedule and be hands off once it's setup.


Solution

  • The easiest, and likely least cpu intensive is going to be a plain vanilla backup/restore database - quick, easy and painless.

    Easy enough to find scripts that will do this for you, and once you have the script, easy enough to schedule it to run thru the scheduler of your choice.