Results 1 to 5 of 5
  1. #1
    Join Date
    May 2004
    Location
    Dubai
    Posts
    40

    Unanswered: Shrink Database base on specific Schedule

    Hi

    I want to know what is command that i add to the Query Analyzer until
    i tell to the database that it Shrink my DB every 1 day

    I know it can be done from all Tasks > Shrink Database ..

    But i want to know the Code commands for that for using in Query Analyzer


    Thanks

  2. #2
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    DBCC SHRINKDB()
    and
    DBCC SHRINKFILE

    If you look these up in BOL, it will give you all the gory details.
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

  3. #3
    Join Date
    May 2004
    Location
    Dubai
    Posts
    40
    Yes
    I know those
    but i want to know how can i schedule the shrink process

    thanks

  4. #4
    Join Date
    Sep 2003
    Location
    Germany
    Posts
    63
    Hi there,

    I would use SQL Server Agent to schedule a task which executes the two commands at a certain time every day.
    You can create a new Task in Enterprise Manager under Administration->SQL Server Agent->Jobs

    Greetings,
    Carsten

  5. #5
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Yes, you need those, but nothing will happen unless your reorg the data and indexes and dump the db and logs...
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •