Link to home
Start Free TrialLog in
Avatar of MohitPandit
MohitPanditFlag for India

asked on

SQL Server: Re-build or Re-Organize Indexes

Hello,

I've live production database and I've updated many ALTER table script and UPDATE queries as well.

Now, I want to re-build or re-organize the indexes.

Can anyone provide the script for re-build and re-organize indexes on tables?
Otherwise I need to go each table to re-build the indexes. I need a script which will make judgement either indexes should be re-build or re-ogranize automatically.

Can any one touch into it?

Regards,
MohitPandit
Avatar of icemokka
icemokka
Flag of Belgium image

Try this script : http://www.mssqltips.com/tip.asp?tip=1367

Plenty of examples in Google with "rebuild all indexes mssql"
pls note if its 100% available server whilst you can rebuild indexes whilst online, if the index is in use it will stop the job, also will see a drop in performance whilst it occurs.

I use a script from the new which sorts the indexes into fragmentation then selects the top 10 worst fragmented indexes and rebuilds them runs each night so by process of rolling rebuilds they all get brought in line and cuts the maintenance window requirements....

let me know if youd like that

*I use a script from the WEB

sorry dont know what i was thinking typing there!!
Simplest way is to add it as a task in your maintenance plan.
The schedule it when to run
Avatar of Bhavesh Shah

Sory.....

Pls ignore, its already provided.
ASKER CERTIFIED SOLUTION
Avatar of MohitPandit
MohitPandit
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

A working script was provided 40 minutes later then the question-post.
Others also provided valid answers but then the author finally made the effort to google the answers himself.
Something everybody does before posting on fora everywhere.

I think those points should still be appointed to some of the answering experts (including me)

Regards,
icemokka
Avatar of MohitPandit

ASKER

Hi IceMokka,

I appreciate your effort but I found the actually great script.
That's why I accepted myself.

This is not meant that I shouldn't give you the points actually, it will be helpful in the community.

Let me know in case you have any concern

Regards,
Mohit