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
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
Thanks.
ReplyDelete
ReplyDeleteHi,
Thanks for sharing the great information... Its useful and helpful information…Keep Sharing.
SQL DBA training in Hyderabad
it is a good information
ReplyDeleteSQL Server DBA Online Training india
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
ReplyDeleteSql Server tutorial and I think this will enhance the knowledge of other visitors for sureSql Server Online Training
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
ReplyDeleteBest Spring Classroom Training Institute
Best Devops Classroom Training Institute
Best Corejava Classroom Training Institute
Best Oracle Classroom Training Institute
Best Oracle Classroom Training Institute
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
ReplyDeleteSuperb. 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
ReplyDeleteThoughtful Experience while Reading all your articles...Gained Technical Knowledge from your posts...Appreciated all your works with Excellency
ReplyDeleteJava training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery
Very Nice Blog…Thanks for sharing this information with us. Here am sharing some information about training institute.
ReplyDeleteAzure 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
betmatik
ReplyDeletekralbet
betpark
tipobet
slot siteleri
kibris bahis siteleri
poker siteleri
bonus veren siteler
mobil ödeme bahis
LİNQ
شركة مكافحة النمل الابيض بالجبيل TWqcaBteZ9
ReplyDelete