Solved

Schedule a Reindex Job

Posted on 2006-11-22
7
524 Views
Last Modified: 2012-06-21
How do I schedule a job to run to run a script at a certain time of the day to reindex a table.

I have the script to reindex it but I want it to run every 24 hours.
0
Comment
Question by:MSAIT
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 2

Author Comment

by:MSAIT
ID: 17995202
SQL 2000
0
 
LVL 9

Accepted Solution

by:
udayshankar earned 150 total points
ID: 17995371
in sql server 2000 go to management -- jobs

right click new job. give it a name.
in steps tab add a new step and choose TSQL task and add your script there.

on the schedule tab schedule it.

hope this helps..
0
 
LVL 9

Expert Comment

by:udayshankar
ID: 17995389
or a better way to do this if you want to re-index the entire DB so the maintenance plans unders management.. new plan.. and walk through the wizard and choose to re-index. it will automatically put a job for you that runs as per the schedule you have provided.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 5

Assisted Solution

by:MrNetic
MrNetic earned 50 total points
ID: 17995644
MSAIT ,
The best way is to create a job in MSSQLSERVER, as udayshankar wrote, but don't forget, that depending the
operation ( DBCC DBREINDEX or DBCC INDEXDEFGRAG + Update Statistics ), it causes locks, and while you are running this procedure, your application might malfuction while running the Job.

Best Regards,

Paulo Condeça
0
 
LVL 6

Assisted Solution

by:btutt
btutt earned 50 total points
ID: 17996365
DBCC INDEXDEFGRAG  will not cause  olong term locks because it is considered to be an online operation.
0
 
LVL 5

Expert Comment

by:MrNetic
ID: 17996391
Btutt,

You are right, i just wanted to say that the dbcc dbreindex is a offline operation, and write that the indexdefrag is an online but.

Don't forget to use a low usage time to run the job.

Best Regards,

Paulo Condeça
0
 
LVL 2

Author Comment

by:MSAIT
ID: 18001224
Great thanks guys I think Ill manage.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Join & Write a Comment

Introduction: Often, when running a query with joins, the results show up "duplicates", and often, those duplicates can be "eliminated" in the results using DISTINCT, for example. Using DISTINCT is simple: just add it after the SELECT keyword, an…
In today’s complex data management environments, it is not unusual for UNIX servers to be dedicated to a particular department, purpose, or database.  As a result, a SAS® data analyst often works with multiple servers, each with its own data storage…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now