jueves, 1 de marzo de 2012

Liberar Memoria en SQL Server

Sp para Liberar Memoria sin necesidad de reiniciar el Servicio ...

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[usp_LiberarMem]
AS
BEGIN
EXEC sp_configure 'show advanced options', 1;
--GO
EXEC sys.sp_configure N'max server memory (MB)', N'1024'
--GO
RECONFIGURE WITH OVERRIDE
--GO
CHECKPOINT
--GO

WAITFOR DELAY '00:00:30'
EXEC sp_configure 'show advanced options', 1;
--GO
EXEC sys.sp_configure N'max server memory (MB)', N'8192'
--GO
RECONFIGURE WITH OVERRIDE
--GO
END

Para ejecutarlo:

EXECUTE [dbo].[usp_LiberarMem]

No hay comentarios: