Check Database Integrity

  • Hi,

    As started new DBA job I found out that as DBA we need to maintain database so could someone please help me to find out solution of following issue:-

    How to check database integrity and what is command for update statics , shrink database and when we need to check database integrity, update statics and shrink database.

    Thanks!

  • Hi nkm129,

    take a look at BOL for DBCC CHECKDB, for each db you can use:

    EXEC sp_MSforeachdb @command1="print '?' DBCC CHECKDB ('?')"

    ... plz read Database Engine Administrator InfoCenter

    and further Maintenance Plans

    [font="Verdana"]CU
    tosc[/font]

    www.insidesql.org
  • Don't shrink the database. It shuffles index pages, causing fragmentation, and generally is not necessary.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (5/9/2008)


    Don't shrink the database. It shuffles index pages, causing fragmentation, and generally is not necessary.

    Gail Shaw

    Could you explain what shrink will do ?

    Thanks!

  • If moves pages as early in the file as possble (generally causing massive fragmentation in the process), then releases unused space to the OS. This depends on the settings you give it, of course.

    It's no recommended, because databases need free space inside to work properly. If you shrink the file down, it will grow again, possibly causing file system fragmentation as well.

    See - http://sqlinthewild.co.za/index.php/2007/09/08/shrinking-databases/

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply