Summary Table

Categories Total Count
PII 0
URL 0
DNS 0
EKL 0
IP 0
PORT 0
VsID 0
CF 0
AI 0
VPD 0
PL 0
Other 0

File Content

?-- =============================================
-- Description: Master shrink and reindexer for db
--
-- Maintenance Log:
--
-- Update By Update Date Description
-- ----------- --------- ----------------------------
-- =============================================
CREATE PROCEDURE dbo.uspMasterDoShrinkReindexAll
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
DECLARE @dbName VARCHAR(50)

BEGIN TRY
SELECT @dbName = DB_NAME()

DBCC SHRINKDATABASE(@dbName);
--TODO: Need to determine if safe to do a TRUNCATEONLY
--DBCC SHRINKDATABASE (@dbName, TRUNCATEONLY);

EXEC sp_MSforeachtable @command1='print ''?'' DBCC DBREINDEX (''?'', '' '', 100)';

EXEC sp_updatestats;

DBCC SHRINKFILE (N'LogData' , 0, TRUNCATEONLY) WITH NO_INFOMSGS;

END TRY

BEGIN CATCH
PRINT 'There was an error with the master reindexer' + CHAR(13)
SELECT * FROM dbo.ufnGetErrorInfo()
EXEC uspRaiseErrorInfo
END CATCH
END
GO