|
|
|
In this article I will show you the most common backup/restore commands.
- How to take full backup of a SQL Server database. - How to resore full backup over the existing/new database. - How to restore full backup at different path over existing/new database.
How to take full backup of a SQL Server database. |
How to resore full backup over the existing/new database.
To replace your existing database with your full backup you have to specify REPLACE option. There are many other option you can use with WITH clause but we will not discuss in this article, check the MSDN for more info. |
How to restore full backup with different path/filename.
If you restore full backup to new database or exising database then 2 things you must consider.
if destination datbase logical file names are different then backedup database logical filenames then you have to specify MOVE option which can specify logical file names of backedup database and destination file path. To verify the logical filenames contained in your backup you can run the following command. |
Since we took backup of northwind database we have to run sp_helpdb for Northwind
Now run the following command which will either create a new database Northwind_New or it will overwrite if already exists |
Click here to copy the following block | RESTORE DATABASE Northwind_New FROM DISK = N'c:\Nwind_091505_full.bkp' WITH REPLACE , MOVE N'Northwind' TO N'C:\Program Files\Microsoft SQL Server\MSSQL\data\Northwind_new.MDF', MOVE N'Northwind_Log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL\data\Northwind_new_Log.LDF' |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|