Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. Step 1: Retrive the Logical file name of the database from backup.
  2. RESTORE FILELISTONLY
  3. FROM DISK = 'D:BackUpYourBaackUpFile.bak'
  4. GO
  5.  
  6.  
  7. Step 2: Use the values in the LogicalName Column in following Step.
  8.  
  9.  
  10. ---Make Database to single user Mode
  11. ALTER DATABASE YourDB
  12. SET SINGLE_USER WITH
  13. ROLLBACK IMMEDIATE
  14.  
  15. ----Restore Database
  16. RESTORE DATABASE YourDB
  17. FROM DISK = 'D:BackUpYourBaackUpFile.bak'
  18. WITH MOVE 'YourMDFLogicalName' TO 'D:DataYourMDFFile.mdf',
  19. MOVE 'YourLDFLogicalName' TO 'D:DataYourLDFFile.ldf'
  20.  
  21. /*If there is no error in statement before database will be in multiuser
  22. mode.
  23. If error occurs please execute following command it will convert
  24. database in multi user.*/
  25. ALTER DATABASE YourDB SET MULTI_USER
  26. GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement