RS First Dynamics NAV Blog


...from NAV 3.60 to NAV 2013
Archivio Posts
Anno 2015

Anno 2014

Anno 2013

Anno 2012

Anno 2011

Anno 2010

Anno 2009

Anno 2008

Anno 2007

Shrink a database with Sql Script

            USE mydatabasename
            DBCC SHRINKDATABASE (mydatabasename)
            DBCC SHRINKFILE(mydatabasename_log, 10)
            BACKUP LOG mydatabasename WITH TRUNCATE_ONLY
          You can search the web for information about the following functions to learn about usage:
            DBCC SHRINKDATABASE
            DBCC SHRINKFILE
            BACKUP LOG


          If you must shrink a production database, you should always rebuild indexes afterwards (DBCC DBREINDEX). You need to keep in mind that DBCC DBREINDEX is an offline process as it can take some time to run and will lock tables.

          Another consideration when using DBCC DBREINDEX is what fill factor to use. The fill factor will depend on the read to write ratio for a given table. The more write intensive the table is, the higher the fill factor.

          There is a great document called 'Tuning Navision For Better Performance' that explains what fill factors to use. See http://www.mibuso.com/dlinfo.asp?FileID=356.

          Alternately, you can use DBCC INDEXDEFRAG to defragment the indexes. This is an online process, but it can cause performance issues while the command is running and it does not work near as well as DBCC DBREINDEX does.

          To reduce dimensions

          BACKUP LOG DB_Name WITH TRUNCATE_ONLY

          and reduced it with
          DBCC SHRINKDATABASE (DB_Name , TRUNCATEONLY)

          Categoria: Sql Server ALL
          lunedì, 30 apr 2007 Ore. 19.25

          Messaggi collegati


          Statistiche
          • Views Home Page: 451.643
          • Views Posts: 864.100
          • Views Gallerie: 0
          • n° Posts: 343
          • n° Commenti: 0
          Copyright © 2002-2007 - Blogs 2.0
          dotNetHell.it | Home Page Blogs
          ASP.NET 2.0 Windows 2003