sql-server-maintenance-solution icon indicating copy to clipboard operation
sql-server-maintenance-solution copied to clipboard

"Could not read the drive '\\.\NUL\'" when using Litespeed to backup to NUL

Open john-trollope-bzy opened this issue 5 years ago • 5 comments

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 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.

john-trollope-bzy avatar Feb 13 '20 13:02 john-trollope-bzy

Could you attach the output - file? You can also send it to me in a mail.

olahallengren avatar Feb 23 '20 16:02 olahallengren

EXECUTE dbo.DatabaseBackup @databases = 'master,msdb', @Directory = 'nul', @BackupType = 'FULL', @BackupSoftware = 'LITESPEED'

Date and time: 2020-02-24 09:48:08 Server: Version: 9.00.5324.00 Edition: Developer Edition Platform: Windows Procedure: .[dbo].[DatabaseBackup] Parameters: @Databases = 'master,msdb', @Directory = 'nul', @BackupType = 'FULL', @Verify = 'N', @CleanupTime = NULL, @CleanupMode = 'AFTER_BACKUP', @Compress = NULL, @CopyOnly = 'N', @ChangeBackupType = 'N', @BackupSoftware = 'LITESPEED', @CheckSum = 'N', @BlockSize = NULL, @BufferCount = NULL, @MaxTransferSize = NULL, @NumberOfFiles = NULL, @CompressionLevel = NULL, @Description = NULL, @Threads = NULL, @Throttle = NULL, @Encrypt = 'N', @EncryptionAlgorithm = NULL, @ServerCertificate = NULL, @ServerAsymmetricKey = NULL, @EncryptionKey = NULL, @ReadWriteFileGroups = 'N', @OverrideBackupPreference = 'N', @NoRecovery = 'N', @URL = NULL, @Credential = NULL, @MirrorDirectory = NULL, @MirrorCleanupTime = NULL, @MirrorCleanupMode = 'AFTER_BACKUP', @MirrorURL = NULL, @AvailabilityGroups = NULL, @Updateability = 'ALL', @AdaptiveCompression = NULL, @ModificationLevel = NULL, @LogSizeSinceLastLogBackup = NULL, @TimeSinceLastLogBackup = NULL, @DataDomainBoostHost = NULL, @DataDomainBoostUser = NULL, @DataDomainBoostDevicePath = NULL, @DataDomainBoostLockboxPath = NULL, @DirectoryStructure = '{ServerName}${InstanceName}{DirectorySeparator}{DatabaseName}{DirectorySeparator}{BackupType}{Partial}{CopyOnly}', @AvailabilityGroupDirectoryStructure = '{ClusterName}${AvailabilityGroupName}{DirectorySeparator}{DatabaseName}{DirectorySeparator}{BackupType}{Partial}{CopyOnly}', @FileName = '{ServerName}${InstanceName}{DatabaseName}{BackupType}{Partial}{CopyOnly}{Year}{Month}{Day}{Hour}{Minute}{Second}{FileNumber}.{FileExtension}', @AvailabilityGroupFileName = '{ClusterName}${AvailabilityGroupName}{DatabaseName}{BackupType}{Partial}{CopyOnly}{Year}{Month}{Day}{Hour}{Minute}{Second}{FileNumber}.{FileExtension}', @FileExtensionFull = NULL, @FileExtensionDiff = NULL, @FileExtensionLog = NULL, @Init = 'N', @DatabaseOrder = NULL, @DatabasesInParallel = 'N', @LogToTable = 'N', @Execute = 'Y' Version: 2019-06-14 00:05:34 Source: https://ola.hallengren.com

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

john-trollope-bzy avatar Feb 24 '20 09:02 john-trollope-bzy

@johntrollope, thank you. Do you know what the correct syntax is to perform a backup to NUL in LiteSpeed?

olahallengren avatar Mar 01 '20 18:03 olahallengren

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

john-trollope-bzy avatar Mar 12 '20 12:03 john-trollope-bzy

@johntrollope, is the parameter @filename required, even when you specify @nowrite = 1?

olahallengren avatar Dec 05 '20 21:12 olahallengren