TSQL – Restore database,store filelistonly, restore on litespeed server

--

-- Show the lsit of all database files from backup files
RESTORE FILELISTONLY FROM DISK =  N'E:\FilePaath\File.BAK', WITH FILE = 1
GO

-- Restoring a Litespeed backup 
exec master.dbo.xp_restore_database @database = N'New_DatabaseName' ,
@filename = N'E:\FilePaath\File.LSBAK',
@filenumber = 1,
@with = N'STATS = 10',
@with = N'MOVE N''DB_dat1'' TO N''L:\PATH\mydatafile.ndf''',
@with = N'MOVE N''DB_Log1'' TO N''L:\PATH\mylogfile.ndf''',
@affinity = 0,
@logging = 0

-- Restoring a Litespeed backup 
RESTORE DATABASE 'New_DatabaseName' FROM DISK = N'E:\FilePaath\File.LSBAK'
WITH MOVE 'DB_dat1' TO 'L:\PATH\mydatafile.ndf',
MOVE 'AdventureWorks_Data' TO 'c:\mssql\data\yukon\AdventureWorksCopy_Data.mdf', 
MOVE 'AdventureWorks_Log' TO 'c:\mssql\log\yukon\AdventureWorksCopy_Log.ldf', 
,RECOVERY, REPLACE
--
--
Advertisements
This entry was posted in SQL, SQL Server, Uncategorized and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s