Suggestion for DB maintenance

  • Need help!

    I have already setup for maintenance plan to rebuild index after filtering large data types... but while it is rebuilding the index it also build statistics.. what should i do at this situation.. should i run the proc which will recompile all the procs, view after this task? if i do so can i do it online in production database during slow period or what could be the best method?

    lets see the proc i am gonna use is like this below to recompile:

    DECLARE recompileproc CURSOR

    FOR

    SELECT [name]

    FROM sysobjects

    WHERE xtype in ('p', 'v', 'fn')

    OPEN recompileproc

    DECLARE @Procedure VARCHAR(70)

    FETCH NEXT FROM recompileproc INTO @Procedure

    WHILE @@fetch_status = 0

    BEGIN

    EXEC sp_recompile @Procedure

    FETCH NEXT FROM recompileproc INTO @Procedure

    END

    CLOSE recompileproc

    DEALLOCATE recompileproc

    end

    thanks

    sagar

  • Also another thing... by rebuilding i did not see defrag down to 0... some of them stay fragment of 60% is that because of small no of data pages what is logic behind to it?

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

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