Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions DatabaseBackup.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SET ANSI_NULLS ON

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Expand Down Expand Up @@ -3354,7 +3355,7 @@ BEGIN

SET @CurrentCommandType = 'xp_create_subdir'

SET @CurrentCommand = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = dbo.xp_create_subdir N''' + REPLACE(@CurrentDirectoryPath,'''','''''') + ''' IF @ReturnCode <> 0 RAISERROR(''Error creating directory.'', 16, 1)'
SET @CurrentCommand = 'DECLARE @t TABLE (msg NVARCHAR(MAX)) DECLARE @returncode INT INSERT INTO @t (msg) DECLARE @ReturnCode int EXECUTE @ReturnCode = dbo.xp_create_subdir N''' + REPLACE(@CurrentDirectoryPath,'''','''''') + ''' IF @ReturnCode <> 0 RAISERROR(''Error creating directory.'', 16, 1)'

EXECUTE @CurrentCommandOutput = dbo.CommandExecute @DatabaseContext = @CurrentDatabaseContext, @Command = @CurrentCommand, @CommandType = @CurrentCommandType, @Mode = 1, @DatabaseName = @CurrentDatabaseName, @LogToTable = @LogToTable, @Execute = @Execute
SET @Error = @@ERROR
Expand Down Expand Up @@ -3706,8 +3707,14 @@ BEGIN
SET @CurrentDatabaseContext = 'master'

SET @CurrentCommandType = 'emc_run_backup'

SET @CurrentCommand = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = dbo.emc_run_backup '''
/*
Fix for error
Error: Msg 0, Sev 0, State 1: Unknown token received from SQL Server [SQLSTATE HY000]
String data, right truncation [SQLSTATE 01004]
Msg 16389, Sev 16, State 1: The connection is no longer usable because the server response for a previously executed statement was incorrectly formatted. [SQLSTATE 08S01]
https://github.com/olahallengren/sql-server-maintenance-solution/issues/658
*/
SET @CurrentCommand = 'DECLARE @t TABLE (msg NVARCHAR(MAX)) DECLARE @returncode INT INSERT INTO @t (msg) EXECUTE @ReturnCode = dbo.emc_run_backup '''

SET @CurrentCommand += ' -c ' + CASE WHEN @CurrentAvailabilityGroup IS NOT NULL THEN @Cluster ELSE CAST(SERVERPROPERTY('MachineName') AS nvarchar) END

Expand Down Expand Up @@ -4081,5 +4088,3 @@ BEGIN
----------------------------------------------------------------------------------------------------

END
GO