PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > comp.db.ms-sqlserver > database optimization
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
database optimization

Réponse
 
LinkBack Outils de la discussion
Vieux 31/12/2007, 14h36   #1
David Greenberg
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut database optimization

Hi
We use Sql 2000.
When defining a database maintenance plan one of the options is to
optimize the database, reorganize data and index pages, remove unused
pages etc.
Is there a command to do this manualy (or in a job) and not by usung a
DBM plan ?
  Réponse avec citation
Vieux 31/12/2007, 19h47   #2
David Portas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: database optimization

"David Greenberg" <davidgr@iba.org.il> wrote in message
news:flaupm$35v$1@news2.netvision.net.il...
> Hi
> We use Sql 2000.
> When defining a database maintenance plan one of the options is to
> optimize the database, reorganize data and index pages, remove unused
> pages etc.
> Is there a command to do this manualy (or in a job) and not by usung a DBM
> plan ?


Yes. ALL of the features of Maintenance Plans are T-SQL commands.

http://msdn2.microsoft.com/en-us/lib...8(SQL.80).aspx

--
David Portas


  Réponse avec citation
Vieux 01/01/2008, 09h00   #3
David Greenberg
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: database optimization

David Portas wrote:
> "David Greenberg" <davidgr@iba.org.il> wrote in message
> news:flaupm$35v$1@news2.netvision.net.il...
>
>>Hi
>>We use Sql 2000.
>>When defining a database maintenance plan one of the options is to
>>optimize the database, reorganize data and index pages, remove unused
>>pages etc.
>>Is there a command to do this manualy (or in a job) and not by usung a DBM
>>plan ?

>
>
> Yes. ALL of the features of Maintenance Plans are T-SQL commands.
>
> http://msdn2.microsoft.com/en-us/lib...8(SQL.80).aspx
>


Thanks for the link. Problem is that the "dbcc reindex" works on a
single table , meaning that I have to write a command per table and have
to remember to add a new line for new tables when I add them.
Isn't there a single command that will take care of the whole database
in one go ?
  Réponse avec citation
Vieux 01/01/2008, 10h02   #4
Erland Sommarskog
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: database optimization

David Greenberg (davidgr@iba.org.il) writes:
> Thanks for the link. Problem is that the "dbcc reindex" works on a
> single table , meaning that I have to write a command per table and have
> to remember to add a new line for new tables when I add them.
> Isn't there a single command that will take care of the whole database
> in one go ?


You can easily write a script that iterates over sysobjects to do this.
In this case you can also run DBCC SHOWCONTIG WITH TABLE_RESULTS and
check for fragmentation, so that you only defragment tables that have a
certain fragmentation level.

If you don't like writing code, you can also do:

sp_MSforeachdb 'DBCC DBREINDEX(?)'

The stored procedure sp_MSforeachdb is undocumented and use of it is not
supported. Then again, it's commonly used.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
  Réponse avec citation
Vieux 09/01/2008, 20h01   #5
Knowledgy
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: database optimization

You can use the undocumented system stored proc called



Sp_msforeachtable



The parameter is the command you want to run and the proc will execute it
against every table within the database


--
Sincerely,
John K
Knowledgy Consulting, LLC
www.knowledgy.org

Atlanta's Business Intelligence and Knowledge Management Experts


"David Greenberg" <davidgr@iba.org.il> wrote in message
news:flaupm$35v$1@news2.netvision.net.il...
> Hi
> We use Sql 2000.
> When defining a database maintenance plan one of the options is to
> optimize the database, reorganize data and index pages, remove unused
> pages etc.
> Is there a command to do this manualy (or in a job) and not by usung a DBM
> plan ?



  Réponse avec citation
Vieux 11/01/2008, 16h31   #6
Jack Vamvas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: database optimization

Check SQL Books Online and search DBCC SHOWCONTIG - there is a script in
there which is useful and deals
with all the tables

--

Jack Vamvas
___________________________________
Search IT jobs from multiple sources- http://www.ITjobfeed.com




"David Greenberg" <davidgr@iba.org.il> wrote in message
news:flaupm$35v$1@news2.netvision.net.il...
> Hi
> We use Sql 2000.
> When defining a database maintenance plan one of the options is to
> optimize the database, reorganize data and index pages, remove unused
> pages etc.
> Is there a command to do this manualy (or in a job) and not by usung a DBM
> plan ?



  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h02.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,17077 seconds with 14 queries