Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Dekaron > Dekaron Private Server
You last visited: Today at 03:03

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[TUTORIAL] Restore a SQL Server database

Discussion on [TUTORIAL] Restore a SQL Server database within the Dekaron Private Server forum part of the Dekaron category.

Reply
 
Old   #1
 
janvier123's Avatar
 
elite*gold: 20
Join Date: Nov 2007
Posts: 2,853
Received Thanks: 1,876
[TUTORIAL] Restore a SQL Server database

# Date: June 20th, 2007
# Author: Steven Warren
# Category: Backup, Data Recovery
# Tags: Database, Microsoft SQL Server, Backup, Server

As a DBA, I have been in many situations where I had to move
databases to a new server due to old hardware, failed hardware, failed
drives, etc. You have two options you could use to carry out this task:
-SQL Server Management Studio (GUI)
-T-SQL (Command line)

The method I prefer is T-SQL. It is simple and easy and avoids
clicking the mouse all over the screen. This How do I will show
you both methods and allow you to choose the one you prefer.
Moving a database with Microsoft SQL Server Management Studio
We will begin by opening SQL Server Management Studio from the Start
Menu by choosing Start and typing SQL Server in the Instant Search
field (Figure A) The SQL Server Management Studio appears (Figure B) and it will be the main area you use to restore your backups.
Figure A

Search field
Figure B

SQL Server Management Studio
Note: I am going to assume that you
already know how to backup a SQL Server database and that you have
placed the backups on a file server or copied the backups to the new
server. We will continue the tutorial from this point.
Now that you have the Management Studio opened, right-click on Databases and choose Restore Database (Figure C).
Figure C

Restore Database
The Restore Database window appears and we will begin by typing the name of the Database we want to restore in the To Database field (Figure D) and choosing the From Device radio button to choose where your backup file is, shown in Figure E.
Figure D

To Database
Figure E

From Device
Your file now appears in the Select backups to restore text box. Place a check in the checkbox to continue as shown in Figure F.
Figure F

Select backups
You are now at the critical point of the restore where you choose Options from Select a Page.
This is where you specify a new path for your database files. It is the
same as the move option that will be discussed later in this tutorial.
Simply type a new path to the database and log file (Figure G). For example, the current structure is the following:


C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\Database_Name_Here.mdf
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\Database_Name_Here_1.ldf
</ul>
Figure G

New path
We want to move these database files to a new path. Simply type the new path (Figure H). For purposes of this tutorial, we will move it to the following:

D:\ SQL\DATA\Database_Name_Here.mdf
D:\SQL\Logs\Database_Name_Here_1.ldf


Figure H

Move to path
You are now ready to click OK and let the database be restored (Figure I).
Figure I

Progress
You have now successfully restored and moved the database files as shown in Figure J and Figure K.
Figure J

Restored
Figure K

Database moved
Let&rsquo;s move on to my preferred method which eliminates all the
point and clicking. You can do this same thing using a TSQL Restore
with move statement.
Moving a database with T-SQL
Let&rsquo;s begin by opening up SQL Server Management Studio and clicking the New Query button (Figure L).
Figure L

New query
Our first step will be to run the following query:
Restore FILELISTONLY FROM DISK='d:\Business_Data.bak'
This query allows us to find out the logical name of the database
and log file which is needed to appropriately restore a database to a
new path (Figure M).
Figure M

Logical names
Once we have these names, we will use the following query to restore a database to a new location.
RESTORE DATABASE Business_Data_TSQL
FROM DISK='d:\Business_Data.bak'
WITH
MOVE 'Business_Data' TO 'D:\TSQL\Business_Data.mdf',
MOVE 'Business_Data_log' TO 'D:\TSQL\Business_Data_log.ldf'
This query will restore the database to a new path (Figure N).
Figure N

Restore to new path
You can see where the logical name and the physical name are necessary for the Restore FileListOnly TSQL statement. You can also add the stats clause if it is a big database to know the percentage finished (Figure O).
RESTORE DATABASE Business_Data_TSQL
FROM DISK='d:\Business_Data.bak'
WITH
MOVE 'Business_Data' TO 'D:\TSQL\Business_Data.mdf',
MOVE 'Business_Data_log' TO 'D:\TSQL\Business_Data_log.ldf', STATS=5
Figure O

Percentage finished
In this tutorial, I restored Full Backups. If you are restoring
differential or transactions log backups, do not forget to use the With
NORECOVERY clause in your statement.


i found it very usefull, and it helped me allot !
janvier123 is offline  
Thanks
5 Users
Old 01/31/2010, 10:39   #2
 
elite*gold: 0
Join Date: Mar 2008
Posts: 262
Received Thanks: 40
why so troublesome. just make a copy of the old database. restore the new com with a new database after that just replace the old database into the New database folder and done..
abelwang is offline  
Old 01/31/2010, 11:43   #3
 
janvier123's Avatar
 
elite*gold: 20
Join Date: Nov 2007
Posts: 2,853
Received Thanks: 1,876
well some ppl have a IQ of 1 so ....
janvier123 is offline  
Old 08/21/2011, 18:24   #4
 
elite*gold: 0
Join Date: Jun 2010
Posts: 34
Received Thanks: 1
WERE DOWLOAD LDF MDF ?
aldrul10 is offline  
Old 08/22/2011, 10:17   #5
 
4the's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 231
Received Thanks: 57
Is this MS-SQL2005 tutorial??
4the is offline  
Reply


Similar Threads Similar Threads
Cant restore database
01/28/2010 - Dekaron Private Server - 10 Replies
Hm who is using sql 2008? I cant seem to restore the billing database,account database restores succesfull but billing does not work. Any one stumped to this error to and how did you fix it? :mad:
hat wer hier ein tutorial für database hack?
07/12/2008 - Kal Online - 4 Replies
ich suche tutorial für einen database hack... pls answer
acc restore
05/08/2007 - Conquer Online 2 - 3 Replies
anyone have or know how to get to the page where u can restore accs? search but only came up with a scam thread
restore button
09/09/2005 - Conquer Online 2 - 4 Replies
is there a way to put restore button always even in hotkeys?



All times are GMT +2. The time now is 03:03.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.