Solved

SQL Server Restore Script

Posted on 2013-05-14
9
310 Views
Last Modified: 2014-10-28
Evening all!

I was wondering who would be kind enough to assist me with my predicament today!

I am currently migrating an application that has a SQL instance dependance. The instance is local and I already have a script that backs it up, its extremely lengthy so if you have a script that is short and to the point that will back it up, i will take that also!!. My main requirement now is for a script that can restore the backup back into SQL Server. The backup is from a SQL Server 2005 database and the restore will be to a SQL Server 2008 database.

If there is a GUI based script I can use that I can select A)Backup - which will take all of the required information (instance name, permissions, tables etc) and another option B)Restore - which will put it all back.


I'm a SQL noob and need to get this right, which is why I am seeking your assistance!

Any help is appreciated!
0
Comment
Question by:Amarjot Singh
9 Comments
 
LVL 8

Accepted Solution

by:
didnthaveaname earned 500 total points
Comment Utility
I would give this a read (it lets you select logins/users so you don't have orphaned users) and it's, in my approximation, the easiest way to do this with the least amount of SQL knowledge: http://msdn.microsoft.com/en-us/library/ms188664%28v=sql.105%29.aspx.  I would make absolutely certain you don't use the move option and stay with the copy option, since if you detach/attach you are going to upgrade the db to a different version and there would be no going back.
0
 
LVL 4

Expert Comment

by:mikosha
Comment Utility
Pretty easy way to detach-attach databases.
Take a look on this article, it has simple 3 steps to completa this operation:
http://www.packtpub.com/article/moving-a-database-from-sql-server-2005-to-sql-server-2008-in-three-steps

Very important note from this article as well: "The simple procedure outlined in this tutorial is adequate if you need to transfer databases from MS SQL Server 2005 to MS SQL Server 2008. If you need to selectively transfer logins, or choose objects to transfer perhaps the Copy Database Wizard may be better suited."

So make sure it's suitable to your case.
0
 

Author Comment

by:Amarjot Singh
Comment Utility
Thanks Mikosha, I think i agree with didnthaveaname though. Detach-Attach introduces far too many risks than I'd be willing to take. I would say that copy would be a better method which decreased risks.

Didnthaveaname - I'll have a read over the MS notes you sent now! Thanks


EDIT:

Sorry guys - i dont think i made myself clear - I am upgrading machines from XP to Win 7 - the databases are being backed up from the XP OS and then restored on the Win 7 OS so I dont think i can use either detach-attach or copy db... i think?
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 8

Expert Comment

by:didnthaveaname
Comment Utility
If I am understanding what you were saying, both methods should be independent of the host OS.  For instance, if I were upgrading from SQL 2005 on Server 2003 to SQL 2012 on Server 2012, this would be no problem.  The OS will limit the version of SQL Server that you can install, but beyond that, it shouldn't have any impact on either of our suggestions.  Is that what you were concerned about?
0
 

Author Comment

by:Amarjot Singh
Comment Utility
Not necessarily what I meant.

I require a solution that will backup/export the database to a network resource and then once the machine has been rebuilt and SQL server reinstalled, the restore/import will pull from the network resource and place back in place with all or as much of the metadata intact.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
Comment Utility
Either solution (Backup/Restore or Detach Copy Attach) can be used in your case for your user databases.  However, you will not be able to do this with your master database as they are different versions.  So you will have to script out all your logins and if you do it right (include the SID) you should not have any orphaned users.
0
 

Author Comment

by:Amarjot Singh
Comment Utility
Thanks guys, I'm going to be working on this from tomorrow onwards.
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

11 Experts available now in Live!

Get 1:1 Help Now