To restore database in sql server we have different methods
1. with Query
2. Directly from sql server management studio
With Query to Restore database:
To restore database by using sql server query we need to write the query like as shown below
Syntax of Query to restore database
RESTORE DATABASE yourdbname
FROM DISK = 'E:\yourbackfile.bak'
WITH
MOVE 'mdffilename' TO 'E:\datayourmdffilename.mdf',
MOVE 'ldbfilename' TO 'E:\datayourldffilename.ldf'
, REPLACE
|
Example:
RESTORE DATABASE MySampledb
FROM DISK = 'E:\mysampledb.bak'
WITH
MOVE 'MySampledb' TO 'E:\MySampledb.mdf',
MOVE 'MySampledb_log' TO 'E:\MySampledb.ldf'
, REPLACE
|
Once we run above query we will get output like as shown below
Now refresh your databases and check for your restored database
Directly from SQL Server Management Studio
Open sql server management studio à Select your database à Right click on it and select Tasks in that select Backup and click on it like as shown below
Whenever we click on Restore Database option it will open new window in that give database name and select from device option in source to restore section like as shown below
Now click on upload icon in from device option to give database backup file path. Whenever we click on upload icon we will get another window to specify database like as shown below
Now click Add option to specify database backup file (.bak or .mdf format) path and click OK once we add our database backup file path that will be like as shown below
Now click OK it will added in restore database section in that select Restore option and click OK to restore database that would be like as following screen
Once everything done we will get success message like as shown below









0 comments:
Post a Comment
Note: only a member of this blog may post a comment.