all groups > sql server programming > october 2003 >
You're in the

sql server programming

group:

Reorging Tables and Indexes


Reorging Tables and Indexes paul reed
10/10/2003 9:45:49 PM
sql server programming:
Hello,

I can't find a way to reorganize my tables and indexes with the maintenance
plan wizard that allows me to run it right now. It seems like I have to
"schedule" this. How does one run those utilities immediately?

Regards,

paul

Re: Reorging Tables and Indexes oj
10/10/2003 11:58:22 PM
you can invoke dbcc dbreindex or dbcc indexdefrag. you can take a look at
these commands in book online for more info.

--
-oj
Rac v2.2 & QALite!
http://www.rac4sql.net


[quoted text, click to view]

RE: Reorging Tables and Indexes v-yshao NO[at]SPAM online.microsoft.com
10/13/2003 2:32:10 PM
Hi Paul,

Thanks for Oj's help. I agree with him. Also, I'm including some
supplemental information below:

DBCC DBREINDEX rebuilds one or more indexes for a table in the specified
database.

A. Rebuild an index

This example rebuilds the au_nmind clustered index with a fillfactor of 80
on the authors table in the pubs database.

DBCC DBREINDEX ('pubs.dbo.authors', UPKCL_auidind, 80)

B. Rebuild all indexes

This example rebuilds all indexes on the authors table using a fillfactor
value of 70.

DBCC DBREINDEX (authors, '', 70)

Thanks for using MSDN newsgroup.

Regards,

Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
RE: Reorging Tables and Indexes v-yshao NO[at]SPAM online.microsoft.com
10/14/2003 1:29:36 PM
Hi Paul,

DBCC INDEXDEFRAG defragments clustered and secondary indexes of the
specified table or view.

Syntax
DBCC INDEXDEFRAG
( { database_name | database_id | 0 }
, { table_name | table_id | 'view_name' | view_id }
, { index_name | index_id }
) [ WITH NO_INFOMSGS ]

Arguments

database_name | database_id | 0

Is the database for which to defragment an index. Database names must
conform to the rules for identifiers.

table_name | table_id | 'view_name' | view_id

Is the table or view for which to defragment an index. Table and view names
must conform to the rules for identifiers.

index_name | index_id

Is the index to defragment. Index names must conform to the rules for
identifiers.

WITH NO_INFOMSGS
Suppresses all informational messages (with severity levels from 0 through
10).

Examples:

DBCC INDEXDEFRAG (Northwind, Orders, CustomersOrders)
GO

For additional information regarding DBCC INDEXDEFRAG, please refer to the
following article on the SQL Server books Online.
Topic: "DBCC INDEXDEFRAG"

Thanks for using MSDN newsgroup.

Regards,

Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
AddThis Social Bookmark Button