MCITP

MCITP

Friday, March 8, 2013

How to restore database using Litespeed backup file and TSQL command

Below is TSQL script to restore database in MSSQL using Litespeed backup file.

exec master.dbo.xp_restore_database @database = N'databasename' ,

@filename = N'Full path of the backup file',
@filenumber = 1,
@with = N'STATS = 10',
@with = N'MOVE N''LogicalFileNameOf MDF file'' TO N''Destinationpath\Logicalfilename.mdf''',
@with = N'MOVE N''LogicalFileNameOf LDF file'' TO N''Destinationpath\Logicalfilename.ldf''',
@affinity = 0,
@logging = 0
GO

Example :-


exec master.dbo.xp_restore_database @database = N'Test' ,
@filename = N'Q:\Backup\Test_20130308.bak',
@filenumber = 1,
@with = N'STATS = 10',
@with = N'MOVE N''Test'' TO N''M:\data\Test.mdf''',
@with = N'MOVE N''Test_log'' TO N''H:\logs\Test_log.ldf''',
@affinity = 0,
@logging = 0
GO



10 comments:


  1. Hi,
    Thanks for sharing the great information... Its useful and helpful information…Keep Sharing.

    SQL DBA training in Hyderabad

    ReplyDelete
  2. Worthful Sql server tutorial. Appreciate a lot for taking up the pain to write such a quality content on SQL server tutorial. Just now I watched this similar
    Sql Server tutorial and I think this will enhance the knowledge of other visitors for sureSql Server Online Training

    ReplyDelete
  3. thank your valuable content.we are very thankful to you.one of the recommanded blog.which is very useful to new learners and professionals.content is very useful for hadoop learners


    Best Spring Classroom Training Institute
    Best Devops Classroom Training Institute
    Best Corejava Classroom Training Institute
    Best Oracle Classroom Training Institute
    Best Oracle Classroom Training Institute

    ReplyDelete
  4. Thanks For Sharing The Information The Information Shared Is Very Valuable Please Keep Updating Us Time Just Went On Reading The article sql server Online Course

    ReplyDelete
  5. Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Worthful Sql server tutorial. Appreciate a lot for taking up the pain to write such a quality content on SQL server tutorial. Just now I watched this similar sql server Online Course

    ReplyDelete
  6. Thoughtful Experience while Reading all your articles...Gained Technical Knowledge from your posts...Appreciated all your works with Excellency
    Java training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery

    ReplyDelete
  7. Very Nice Blog…Thanks for sharing this information with us. Here am sharing some information about training institute.
    Azure Data Factory course in Ameerpet,
    Azure Data Engineer Training Online Hyderabad,
    azure training in hyderabad ameerpet,Azure
    Data Factory online Training in Hyderabad
    Microsoft Azure Data Factory in hyderabad

    ReplyDelete

Followers