Maintenance plan syntax

  • I'd like to create a maintenance plan from scratch. ie, not using the wizard.  Here's what I'd like to do:

     

    Using a Execute T-SQL Statement Task, the code I put in there would simply be:

    ---------------------------------------

    use db

    go

     

    backup log <database log file> with truncate only

    go

     

    dbcc shrinkfile(<db_log_file>, 3000)

    go

     

    dbcc shrinkdatabase(<db>, 3000)

    go

    ---------------------------------------------------

    Is that the correct syntax?

  • Do you have a test database to experiment with? Have you tried it to see what happens? Why would you want to shrink your log file? It seems to me that, if you schedule the frequency correctly, your log file will simply reuse allocated space which is MUCH more efficient than shrinking and grabbing new space as needed.

  • Ditto... I only shrink a logfile if I've had some type of a unique event (like a large DW insertion etc.) that causes it to grow to nonstandard size.

    Why don't you want to use the Wizard?

    [font="Verdana"]-- Wally
    -- Reluctant DBA[/font]

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

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