Solved

SQL Restore

Posted on 2012-04-11
9
59 Views
Last Modified: 2015-05-24
I need to restore a backup from an old database.  I had to do a wipe and re-install on our Windows 2003 SBS box.  How can I restore the database to the new instance of SQL?  We are using Backup Exec 2010.

Thanks
0
Comment
Question by:chasmx1
  • 2
  • 2
  • 2
  • +1
9 Comments
 
LVL 2

Accepted Solution

by:
SE-Pneumatic earned 250 total points
Comment Utility
First thing is that you would need to reinstall SQL server on the server if it was just wiped out. Once it is reinstalled, you can do a "restore" from Backup Exec that will get the files back that you had before. This won't just magically make the database work though. You will need to find the database file (wherever it was stored before in the backup files) and then do a restore in SQL. If you are using MS SQL management studio (versions are basically the same so it doesn't matter), you will create a database (name isn't important if this is just to pull data and not to run a business just like it was before), and then right click on it, click tasks, and then restore. It will give you prompts at this point to walk you through restoring it to that database.
0
 

Author Comment

by:chasmx1
Comment Utility
We are using Backup Exec 2010 and I can seem to find the database files when I use the Restore Wizard.  Is there a way to search the backups in Backup Exec 2010?  All I see is the various backups on our NAS and I'm not sure exactly which one I need.  I just need the database file and log file right?  I've already installed a new OS including SQL 2005.
0
 
LVL 23

Expert Comment

by:Mysidia
Comment Utility
You need SQL server re-installed as a pre-requisite for starting a SQL restore.

If you have a good database data and log file,  you can re-attach the database,
after restoring the database and log files to a path on the DB server.

Another option is to run the restore wizard against a .BKF file  obtained by running
the SQL backup command against the SQL server.

Which version of Microsoft SQL Server are you using?

Here's an explanation of what you do in SQL Server 2012:
http://msdn.microsoft.com/en-us/library/ms190209.aspx

In old versions of SQL server, it used to be
a matter of running a T-SQL statement  on the SQL server

EXEC sp_attach_db @dbname = 'mydatabasename',
     @filename1 = 'C:\MSSQL\data\Example1.mdf',
     @filename2 = 'C:\MSSQL\data\Example1_log.ldf'


sp_attach was deprecated as of SQL 2005.

In SQL 2003 and higher, you can use SQL Server Management Studio

Open management studio,  Right click Databases
choose the 'Attach Database'  option

add the restored files.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:chasmx1
Comment Utility
Okay I got Backup Exec to restore my database under a different name since the application created a new blank database with the correct name. Now what I need to do is rename the current database to xxsomething and rename oldDb to corrected. I tried just to right mouse on each database and use The rename menu item but that generated an error. How can I change the name of these two databases running on the same instance of SQL Server 2005.

Thanks again
0
 
LVL 2

Expert Comment

by:SE-Pneumatic
Comment Utility
Make sure you have the appropriate Alter permissions on the databases in order to rename them. Right clicking on them and selecting Rename should work.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
Comment Utility
Right clicking on them and selecting Rename should work.
I suspect the author is talking about renaming the actual database files and they do not realize that they cannot do that as they are open by SQL Server.
0
 
LVL 23

Assisted Solution

by:Mysidia
Mysidia earned 250 total points
Comment Utility
Indeed,  we really need the text of the error message at least

Renaming a database is to be done by the SQL server, either through the SQL management console or by running an ALTER DATABASE mydatabase MODIFY NAME='blah blah blah'  
SQL statement.

Don't move or rename the underlying files around using file management tools.
There are ALTER statements you can use to change filenames as well.


You should shut down all other applications, tools, and services attempting to access this database,  before attempting to rename it;   if there are other users/apps connected to the database performing queries,  renaming may fail with an error.
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
When posting a question about a Cisco ASA, Cisco Router or Cisco Switch, it can aid diagnosis if a suitably sanitised copy of the config is provided. It is much better to leave as much of the configuration as original as possible, as it could be tha…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

763 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

7 Experts available now in Live!

Get 1:1 Help Now