"Could not read the drive '\\.\NUL\'" when using Litespeed to backup to NUL
Description of the issue When you use Litespeed with dbo.DatabaseBackup to backup up to NUL, the generated syntax is incorrect.
SQL Server version and edition Only tested on 2005 as I do not have Litespeed on 2008+
Version of the script 2019-06-14 00:05:34
What command are you executing?
-- FAILS EXECUTE dbo.DatabaseBackup @Databases = 'USER_DATABASES', @Directory = 'nul', @BackupType = 'FULL', @BackupSoftware = 'LITESPEED'
-- FAILS EXECUTE dbo.DatabaseBackup @Databases = 'USER_DATABASES', @Directory = 'nul', @BackupType = 'DIFF', @BackupSoftware = 'LITESPEED'
-- FAILS EXECUTE dbo.DatabaseBackup @Databases = 'USER_DATABASES', @Directory = 'nul', @BackupType = 'LOG', @BackupSoftware = 'LITESPEED'
What output are you getting?
Msg 50000, Level 16, State 1, Line 1
Error performing LiteSpeed backup.
Could you attach the output - file? You can also send it to me in a mail.
EXECUTE dbo.DatabaseBackup @databases = 'master,msdb', @Directory = 'nul', @BackupType = 'FULL', @BackupSoftware = 'LITESPEED'
Date and time: 2020-02-24 09:48:08
Server:
Date and time: 2020-02-24 09:48:08 Database: [master] State: ONLINE Standby: No Updateability: READ_WRITE User access: MULTI_USER Is accessible: Yes Recovery model: SIMPLE Encrypted: N/A Differential base LSN: 5373000000312000086 Last log backup LSN: N/A
Date and time: 2020-02-24 09:48:08 Command: DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_backup_database @database = N'master', @filename = N'NUL', @with = 'NO_CHECKSUM' IF @ReturnCode <> 0 RAISERROR('Error performing LiteSpeed backup.', 16, 1) LiteSpeed(R) for SQL Server Version 6.1.1.1011 Copyright 2010 Quest Software, Inc.
Msg 60601, Level 16, State 1, Line 0 Could not read the drive '\.\NUL': Ensure that target file exists and is available.
Msg 50000, Level 16, State 1, Line 1 Error performing LiteSpeed backup. Outcome: Failed Duration: 00:00:01 Date and time: 2020-02-24 09:48:09
Date and time: 2020-02-24 09:48:09 Database: [msdb] State: ONLINE Standby: No Updateability: READ_WRITE User access: MULTI_USER Is accessible: Yes Recovery model: SIMPLE Encrypted: N/A Differential base LSN: 56575000000538400031 Last log backup LSN: N/A
Date and time: 2020-02-24 09:48:09 Command: DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_backup_database @database = N'msdb', @filename = N'NUL', @with = 'NO_CHECKSUM' IF @ReturnCode <> 0 RAISERROR('Error performing LiteSpeed backup.', 16, 1) LiteSpeed(R) for SQL Server Version 6.1.1.1011 Copyright 2010 Quest Software, Inc.
Msg 60601, Level 16, State 1, Line 0 Could not read the drive '\.\NUL': Ensure that target file exists and is available.
Msg 50000, Level 16, State 1, Line 1 Error performing LiteSpeed backup. Outcome: Failed Duration: 00:00:01 Date and time: 2020-02-24 09:48:10
Date and time: 2020-02-24 09:48:10
@johntrollope, thank you. Do you know what the correct syntax is to perform a backup to NUL in LiteSpeed?
Took a bit of Googling as it is not obvious:
exec dbo.xp_backup_database @database = 'msdb', @filename = 'd:\msdb_not_really_backed_up.sls', @nowrite = 1
-- To prove a file is not really created:
exec dbo.xp_cmdshell 'dir d:\msdb_not_really_backed_up.sls' go
LiteSpeed(R) for SQL Server Version 6.1.1.1011 Copyright 2010 Quest Software, Inc. Processed 2328 pages for database 'msdb', file 'MSDBData' on file 1. Processed 8 pages for database 'msdb', file 'MSDBLog' on file 1. BACKUP DATABASE successfully processed 2336 pages in 0.085 seconds (225.087 MB/sec).
Backup added as file number: 1
Native Size: 21.31 MB
Backup Size: 2.80 MB
CPU Seconds: 0.28
output
Volume in drive D is ***
Volume Serial Number is ***
Directory of d:
File Not Found
@johntrollope, is the parameter @filename required, even when you specify @nowrite = 1?