Tuesday, March 27, 2012

DBCC SHRINKDATABASE

Hello Gurus,
In the enterprise manager, when I click on a database, the properties on the
right hand side shows that there is 6 GB free space in the secondary data f
ile. However, issuing a DBCC SHRINKDATABASE does not seem to do anything to
shrink the database. I have
tried SHRINKFILE as well. Why could this be happening?
Thanks,
Alex Gneed to use the shrinkfile with truncateonly option to ensure that unused sp
ace is returned to the OS, however if U do not have disk space/contraint iss
ues then it's better to leave the data files as it is to reduce I/O issues a
t a later time during fileg
rowth.|||You have open transactions?
http://www.aspfaq.com/2471
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Alex G" <anonymous@.discussions.microsoft.com> wrote in message
news:6409A05E-E35A-4E3E-A1D3-4B5DCE741E5D@.microsoft.com...
> Hello Gurus,
> In the enterprise manager, when I click on a database, the properties on
the right hand side shows that there is 6 GB free space in the secondary
data file. However, issuing a DBCC SHRINKDATABASE does not seem to do
anything to shrink the database. I have tried SHRINKFILE as well. Why could
this be happening?
> Thanks,
> Alex G|||No open transactions.
DB Size = 11 GB
Free space = 6 GB
How can I get that 6 GB back? We are doing a lot of detaching and attaching
programatically and it is PIA trying to move that big file around especially
when you KNOW there is free space.
Please help!!
-- Aaron Bertrand - MVP wrote: --
You have open transactions?
http://www.aspfaq.com/2471
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Alex G" <anonymous@.discussions.microsoft.com> wrote in message
news:6409A05E-E35A-4E3E-A1D3-4B5DCE741E5D@.microsoft.com...
> Hello Gurus,
the right hand side shows that there is 6 GB free space in the secondary
data file. However, issuing a DBCC SHRINKDATABASE does not seem to do
anything to shrink the database. I have tried SHRINKFILE as well. Why could
this be happening?
> Alex G|||Try this
backup log DBName with truncate_only
dbcc shrinkfile ('DBname',0,truncateonly)
dbcc shrinkfile ('DBName',0,truncateonly)

>--Original Message--
>No open transactions.
>DB Size = 11 GB
>Free space = 6 GB
>How can I get that 6 GB back? We are doing a lot of
detaching and attaching programatically and it is PIA
trying to move that big file around especially when you
KNOW there is free space.
>Please help!!
> -- Aaron Bertrand - MVP wrote: --
> You have open transactions?
> http://www.aspfaq.com/2471
> --
> Aaron Bertrand
> SQL Server MVP
> http://www.aspfaq.com/
>
>
> "Alex G" <anonymous@.discussions.microsoft.com>
wrote in message
> news:6409A05E-E35A-4E3E-A1D3-
4B5DCE741E5D@.microsoft.com...
database, the properties on
> the right hand side shows that there is 6 GB free
space in the secondary
> data file. However, issuing a DBCC SHRINKDATABASE
does not seem to do
> anything to shrink the database. I have tried
SHRINKFILE as well. Why could
> this be happening?
>
>.
>sql

No comments:

Post a Comment