Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2006
    Location
    DC
    Posts
    123

    Unanswered: Creating ReIndex Jobs

    How would I go about creating a job on one server /database to create it on several... at once.... ?
    Any scripts thoughts or ideas regarding this?


    thanks,
    Jonathan

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    Have a look at creating Maintenance Plans in Books Online. As always, try it on a test server, first.

  3. #3
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    Code:
    declare @sql varchar(8000)
    
    SELECT @sql = COALESCE(@sql,'') + 'DBCC DBREINDEX(' + table_name + ')
    '
    FROM information_schema.tables
    
    EXEC(@sql)
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  4. #4
    Join Date
    Feb 2004
    Posts
    8
    I have a stored procedure that you could use to dynamically rebuild or reorganize your indexes.
    http://blog.ola.hallengren.com/blog/...1/3440068.html

    Ola Hallengren
    http://ola.hallengren.com

  5. #5
    Join Date
    Jun 2004
    Location
    Long Island
    Posts
    696
    or another way:
    EXEC sp_MSforeachtable @command1="print '?' DBCC DBREINDEX ('?')"

Posting Permissions

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