一键帮你收缩所有DB文件大小(Shrink Files for All(3)

if(@recoveryModel <> 'SIMPLE')
            begin
                -- Finally changed back
                SET @tempTSQL = ('ALTER DATABASE [' + @dbname + '] SET RECOVERY ' + @recoveryModel + ' with no_wait')
                EXEC sp_executesql @tempTSQL
                if (@@ERROR = 0)
                begin
                    print('    Database [' + @dbname + '] recovery model has been changed back to ''' + @recoveryModel + '''')
                end
                else
                begin
                    print('    Database [' + @dbname + '] recovery model failed to be changed back to ''' + @recoveryModel + '''')
                end
            end
        end
    end
FETCH NEXT FROM dbCursor INTO @dbname
END

CLOSE dbCursor
DEALLOCATE dbCursor

给大家带来的不变深表歉意。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/354ab3083809484e4954f4ad1e01023e.html