Maint Plan T-SQL Exec Step - bug

  • Ok, here we are - SQL 2008 SP1 64-bit cluster Ent. Edition

    I'm using 'Execute T-SQL Task' instead of the 'Backup Database Task' (well, I need MIRROR TO in my backup statements).

    The script below should backup all the databases:

    DECLARE db_cursor CURSOR FOR

    SELECT name

    FROM sys.databases

    WHERE state_desc = 'ONLINE'

    AND user_access_desc = 'MULTI_USER'

    AND name NOT IN ('tempdb')

    OPEN db_cursor

    FETCH NEXT FROM db_cursor INTO @name

    WHILE @@FETCH_STATUS = 0

    BEGIN

    BACKUP DATABASE @name TO DISK = @fileName MIRROR TO DISK=@mirror_fileName WITH FORMAT, COMPRESSION, CHECKSUM

    FETCH NEXT FROM db_cursor INTO @name

    END

    CLOSE db_cursor

    DEALLOCATE db_cursor

    To make it short - after the new DB is created, the Maint Plan does not backup it (no errors, T-SQL step completed successfully etc.). The script itself works fine, if executed separately.

    The question is - do we have some kind of cache for the Maint Plans, that stores T-SQL step results somewhere?

    To be honest - it looks like a bug to me. Any ideas?

  • Couple softballs you may have already tried.

    What database is the T-Sql set to run in?

    Can you put a table insert (testDatabases) with the values for the backups statement. Confirm it gets data into the cursor.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply