Steps to Restore BAK FIle to Database
1)Retrieve the logical file name of the database
RESTORE FILELISTONLY
FROM DISK = 'E:\YourBaackUpFile.bak'
GO
Step 2: set database to single user
ALTER DATABASE DatabaseName
SET SINGLE_USER WITH
ROLLBACK IMMEDIATE
GO
Step 3: Restore database with the help of the logical file name retrieved in step 1.
RESTORE DATABASE YourDB
FROM DISK = 'D:\YourBaackUpFile.bak'
WITH MOVE 'YourMDFLogicalName' TO 'E:\DataYourMDFFile.mdf',
MOVE 'YourLDFLogicalName' TO 'E:\DataYourLDFFile.ldf'
GO
Step 4: Bring database to multi user mode.
ALTER DATABASE YourDB SET MULTI_USER
GO
Here are all the four steps together:
1)Retrieve the logical file name of the database
RESTORE FILELISTONLY
FROM DISK = 'E:\YourBaackUpFile.bak'
GO
Step 2: set database to single user
ALTER DATABASE DatabaseName
SET SINGLE_USER WITH
ROLLBACK IMMEDIATE
GO
Step 3: Restore database with the help of the logical file name retrieved in step 1.
RESTORE DATABASE YourDB
FROM DISK = 'D:\YourBaackUpFile.bak'
WITH MOVE 'YourMDFLogicalName' TO 'E:\DataYourMDFFile.mdf',
MOVE 'YourLDFLogicalName' TO 'E:\DataYourLDFFile.ldf'
GO
Step 4: Bring database to multi user mode.
ALTER DATABASE YourDB SET MULTI_USER
GO
Here are all the four steps together:
No comments:
Post a Comment