Friday, March 30, 2012

How to shrink db

We have a SQL 2005 server. There is a db which isabout 20g, but about 80%
of it is empty. How can I shrink the data file not using the GUI?Hello,
Take a look into DBCC SHRINKFILE and DBCC SHRINKDB in books online.
DBCC SHRINKFILE - Allows you to shrink the database file level
DBCC SHRINKDB - Shrinks the database [both data and log files]
Thanks
Hari
"news.microsoft.com" <Xeon@.donotemailme.com> wrote in message
news:eYuc6nzFHHA.3616@.TK2MSFTNGP06.phx.gbl...
> We have a SQL 2005 server. There is a db which isabout 20g, but about 80%
> of it is empty. How can I shrink the data file not using the GUI?
>|||Is it normal for DBCC SHRINKFILE to take a long time? I have 20G DB which
is 80% empty space.
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:eqW6%23g0FHHA.3976@.TK2MSFTNGP05.phx.gbl...
> Hello,
> Take a look into DBCC SHRINKFILE and DBCC SHRINKDB in books online.
> DBCC SHRINKFILE - Allows you to shrink the database file level
> DBCC SHRINKDB - Shrinks the database [both data and log files]
> Thanks
> Hari
> "news.microsoft.com" <Xeon@.donotemailme.com> wrote in message
> news:eYuc6nzFHHA.3616@.TK2MSFTNGP06.phx.gbl...
>|||Hello,
It is faster. I will recommend to shrink in smaller size. First shrink to 15
GB then to 10 GB and finally to 5 GB.
Thanks
Hari
"news.microsoft.com" <Xeon@.donotemailme.com> wrote in message
news:ec76tC1FHHA.1784@.TK2MSFTNGP06.phx.gbl...
> Is it normal for DBCC SHRINKFILE to take a long time? I have 20G DB which
> is 80% empty space.
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:eqW6%23g0FHHA.3976@.TK2MSFTNGP05.phx.gbl...
>

No comments:

Post a Comment