|
-
May 11th, 2006, 03:29 PM
#1
Thread Starter
Arabic Poster
[RESOLVED] Restore MS SQL Databse from a backup file
Hi everyone.
I'm not much of a database designer but I need to know how can I restore an MS SQL Database from a backed-up file.
Any help would be great. Thanks
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
May 11th, 2006, 03:48 PM
#2
Re: Restore MS SQL Databse from a backup file
What version of SQL Server? 2000, 2005, SQL Express?
-tg
-
May 11th, 2006, 03:50 PM
#3
Thread Starter
Arabic Poster
Re: Restore MS SQL Databse from a backup file
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
May 11th, 2006, 03:57 PM
#4
Re: Restore MS SQL Databse from a backup file
You can do it in Query analyzer with commands like this:
VB Code:
BACKUP DATABASE Acctfiles
TO DISK = 'c:\ACS DESKTOP\Acctfiles_D18.bak'
-- this does a backup
RESTORE FILELISTONLY
FROM DISK = 'c:\ACS DESKTOP\Acctfiles_D18.bak'
-- this displays the "files" in the backup
RESTORE DATABASE Acctfiles_D18
FROM DISK = 'c:\ACS DESKTOP\Acctfiles_D18.bak'
WITH MOVE 'Acctfiles_data' TO 'c:\Program Files\Microsoft SQL Server\MSSQL\DATA\Acctfiles_D18.mdf',
MOVE 'Acctfiles_log' TO 'c:\Program Files\Microsoft SQL Server\MSSQL\DATA\Acctfiles_D18.ldf'
-- this actually does a restore - you can restore to a different DB
-- name and specify the data and log locations
GO
Are you restoring a DB from backup to correct a problem or to move a production DB to another SERVER?
-
May 11th, 2006, 04:00 PM
#5
Thread Starter
Arabic Poster
Re: Restore MS SQL Databse from a backup file
Moving to another server.
Does it matter?
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
May 11th, 2006, 04:06 PM
#6
Re: Restore MS SQL Databse from a backup file
 Originally Posted by ComputerJy
Moving to another server.
Does it matter?
Then the SQL I gave you should be sufficient - we use this type of script to move DB's all over the place - from server to server - customer to development - test DB names...
The reason I asked is you should really "delete" the DB from the destination server before doing the RESTORE - you do not want to restore a DB into an existing DB - unless of course you are trying to recover from a production loss...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|