• First problem

    KcV (1/5/2013)


    ---- Set Recovery Mode SIMPLE

    Begin

    ALTER DATABASE aaa

    SET RECOVERY SIMPLE;

    End

    Breaking the log chain, preventing any point in time restores until the DB is switched back to full and a full or diff backup is taken, plus means that log backups can't restore over this time. This is not a good idea

    ---- Re-Indexing of all tables of Database

    <nip>

    So where do you check fragmentation? Looks like a blanket rebuild of everything, whether it needs rebuilding or not.

    May I suggest you replace that with one of these:

    http://ola.hallengren.com/Versions.html

    http://sqlfool.com/2011/06/index-defrag-script-v4-1/

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass