Saturday, February 25, 2012

Reorg select tables

Hi,
I´m not a expert DBA, please need your help!!! I have to defrag my database
because poor performance, but can´t. Our database have around 1TB and don´t
have disk space and window time to defrag all database at one time.
I need to make this excluing bigest tables and make reorg index others
tables. How can I make this? Any idea?Fabio Rebelo wrote:
> Hi,
> I´m not a expert DBA, please need your help!!! I have to defrag my database
> because poor performance, but can´t. Our database have around 1TB and don´t
> have disk space and window time to defrag all database at one time.
> I need to make this excluing bigest tables and make reorg index others
> tables. How can I make this? Any idea?
Consider using this script of mine:
http://realsqlguy.com/twiki/bin/view/RealSQLGuy/DefragIndexesAsNeeded
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Hi Tracy, thanks for help. Your script will help me very much, but i need
another little thing:
I need select ours biggest tables (top 30) to exclude it from script to
reorg all database. How can i make this?
If you could, please show me a script to select this tables and the sintaxe
to reorg all database without this 30 tables. After we let´s run reorg one
big table a time.
Thans your help again, and sorry my english.
"Tracy McKibben" wrote:
> Fabio Rebelo wrote:
> > Hi,
> >
> > I´m not a expert DBA, please need your help!!! I have to defrag my database
> > because poor performance, but can´t. Our database have around 1TB and don´t
> > have disk space and window time to defrag all database at one time.
> >
> > I need to make this excluing bigest tables and make reorg index others
> > tables. How can I make this? Any idea?
> Consider using this script of mine:
> http://realsqlguy.com/twiki/bin/view/RealSQLGuy/DefragIndexesAsNeeded
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
>|||On Mon, 31 Jul 2006 11:26:02 -0700, Fabio Rebelo
<FabioRebelo@.discussions.microsoft.com> wrote:
>Hi Tracy, thanks for help. Your script will help me very much, but i need
>another little thing:
>I need select ours biggest tables (top 30) to exclude it from script to
>reorg all database. How can i make this?
Just change his one statement from:
SELECT @.Command = 'USE ' + RTRIM(@.DBName) + ' SELECT table_name FROM
INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = ''BASE TABLE'''
to:
SELECT @.Command = 'USE ' + RTRIM(@.DBName)
+ ' SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE
TABLE_TYPE = ''BASE TABLE'' AND table_name NOT IN (''bigtable1'',
''bigtable2'', ... ''bigtable30'')'
You might get other ideas along the same lines!
Good luck.
Josh

No comments:

Post a Comment