How to backup & restore only attached files and directories using LiteSpeed, using xp_backup_database with @attachedfile and xp_restore_attachedfilesonly
WORKAROUND:
To back up just a file or directory, using LiteSpeed :
Use sqllitespeed in mostly the same way you would a backup- but the operation is a fileset operation.
EXAMPLE:
To backup c:\files:
Sqllitespeed -B fileset -F files.bkp --attachedfile c:\files
And to restore:
Sqllitespeed -R fileset -F files.bkp --attachedfile “c:\files to c:\files_restored”
Note: All the normal stuff is available: throttle, threading, striping, affinity, compression, encryption, etc…
There is support for SQL Server within xpSLS.dll too- but you have to manually create the extended stored procedures. So issue:
sp_addextendedproc 'xp_restore_fileset', 'xpSLS.dll'
sp_addextendedproc 'xp_backup_fileset', 'xpSLS.dll'
and then the corresponding operation as above is:
exec xp_backup_fileset help, @filename='c:\files.bkp', @attachedfile='c:\files'
exec xp_restore_fileset help, @filename='c:\files.bkp', @attachedfile='c:\files to c:\files_restored'
EXAMPLE:
EXEC master.dbo.xp_restore_attachedfilesonly
@filename= 'C:\Backup\2005\Pubs_201208130655_Full.bak',
@attachedfile = '''C:\LiteSpeedOracle_UserGuide.pdf''to''C:\Backup\LiteSpeedOracle_UserGuide.pdf'''
IMPORTANT NOTE: This feature is not Supported, therefore, it may be missing or altered in a future version of LiteSpeed for SQL Server.