Database has full backup .bak file. It can be restored using following two steps.
Step 1: Retrive the Logical file name of the database from backup.
RESTORE FILELISTONLY
FROM DISK = 'D:\BaakUpFile.bak'
GO
Step 2:
If you want replase this existing Database
RESTORE DATABASE AdventureWorks
FROM DISK = 'D:\BaakUpFile.bak'
WITH REPLACE
Or
Use the values in the LogicalName Column in following Step.
----Make Database to single user Mode
ALTER DATABASE DataBaseName
SET SINGLE_USER WITH
ROLLBACK IMMEDIATE
----Restore Database
RESTORE DATABASE DataBaseName
FROM DISK = 'D:\BaakUpFile.bak'
WITH MOVE 'DataBaseName' TO 'database location ... DataBaseName.mdf',
MOVE 'DataBaseName_log' database location ... DataBaseName_log.ldf'
/*If there is no error in statement before database will be in multiuser
mode.
If error occurs please execute following command it will convert
database in multi user.*/
ALTER DATABASE DataBaseName SET MULTI_USER
GO
If you want make new
RESTORE DATABASE DataBaseName
FROM DISK = 'D:\BaakUpFile.bak'
WITH MOVE 'DataBaseName' TO 'database location ... DataBaseName.mdf',
MOVE 'DataBaseName_log' database location ... DataBaseName_log.ldf'
Collect from : blog.sqlauthority.com
Step 1: Retrive the Logical file name of the database from backup.
RESTORE FILELISTONLY
FROM DISK = 'D:\BaakUpFile.bak'
GO
Step 2:
If you want replase this existing Database
RESTORE DATABASE AdventureWorks
FROM DISK = 'D:\BaakUpFile.bak'
WITH REPLACE
Or
Use the values in the LogicalName Column in following Step.
----Make Database to single user Mode
ALTER DATABASE DataBaseName
SET SINGLE_USER WITH
ROLLBACK IMMEDIATE
----Restore Database
RESTORE DATABASE DataBaseName
FROM DISK = 'D:\BaakUpFile.bak'
WITH MOVE 'DataBaseName' TO 'database location ... DataBaseName.mdf',
MOVE 'DataBaseName_log' database location ... DataBaseName_log.ldf'
/*If there is no error in statement before database will be in multiuser
mode.
If error occurs please execute following command it will convert
database in multi user.*/
ALTER DATABASE DataBaseName SET MULTI_USER
GO
If you want make new
RESTORE DATABASE DataBaseName
FROM DISK = 'D:\BaakUpFile.bak'
WITH MOVE 'DataBaseName' TO 'database location ... DataBaseName.mdf',
MOVE 'DataBaseName_log' database location ... DataBaseName_log.ldf'
Collect from : blog.sqlauthority.com










