Tuesday, March 27, 2012

DBCC Shrinkdatabase /shrinkfile not shrinking my database

I have 137GB of database (mdf). it is showing on database properties
that i still have about 63Gb available. If i go to EM-shrink file, i
can have a minimum of 65GB which i guess is my actual data. But when i
shrink it from there or from Query Analyzer, it still remains 137Gb.
I even tried doing a dbcc shrinkfile to 110GB, but still it didn't
work.
can anybody help pls.
TIA
JorizJoriz,
Just to clarify, this is the .mdf file and not the .ldf file that you're
trying to shrink correct? What are you specifying for the targetpercent in
the DBCC SHRINKFILE statement? Do you have exclusive access to the database
right now?
HTH
Jerry
<google@.joriz.is-a-geek.net> wrote in message
news:1129585565.049054.249070@.g44g2000cwa.googlegroups.com...
>
> I have 137GB of database (mdf). it is showing on database properties
> that i still have about 63Gb available. If i go to EM-shrink file, i
> can have a minimum of 65GB which i guess is my actual data. But when i
> shrink it from there or from Query Analyzer, it still remains 137Gb.
> I even tried doing a dbcc shrinkfile to 110GB, but still it didn't
> work.
> can anybody help pls.
> TIA
> Joriz
>|||Hi Joriz,
If u want to shrink the mdf file then ui have to run srink database
command.
But in most cases that doesnt work.
The process u are following works in ldf files.
If u want to optimise ur logfile on disk.
u have to run this command
backup log database name with truncate_only
dbcc shrinkfile(logical name , size)
HTH
from
Doller
Jerry Spivey wrote:
> Joriz,
> Just to clarify, this is the .mdf file and not the .ldf file that you're
> trying to shrink correct? What are you specifying for the targetpercent in
> the DBCC SHRINKFILE statement? Do you have exclusive access to the database
> right now?
> HTH
> Jerry
> <google@.joriz.is-a-geek.net> wrote in message
> news:1129585565.049054.249070@.g44g2000cwa.googlegroups.com...
> >
> >
> > I have 137GB of database (mdf). it is showing on database properties
> > that i still have about 63Gb available. If i go to EM-shrink file, i
> > can have a minimum of 65GB which i guess is my actual data. But when i
> > shrink it from there or from Query Analyzer, it still remains 137Gb.
> > I even tried doing a dbcc shrinkfile to 110GB, but still it didn't
> > work.
> >
> > can anybody help pls.
> >
> > TIA
> >
> > Joriz
> >|||doller wrote:
> Hi Joriz,
> If u want to shrink the mdf file then ui have to run srink database
> command.
> But in most cases that doesnt work.
> The process u are following works in ldf files.
> If u want to optimise ur logfile on disk.
> u have to run this command
> backup log database name with truncate_only
> dbcc shrinkfile(logical name , size)
> HTH
> from
> Doller
>
> Jerry Spivey wrote:
>> Joriz,
>> Just to clarify, this is the .mdf file and not the .ldf file that you're
>> trying to shrink correct? What are you specifying for the targetpercent in
>> the DBCC SHRINKFILE statement? Do you have exclusive access to the database
>> right now?
>> HTH
>> Jerry
>> <google@.joriz.is-a-geek.net> wrote in message
>> news:1129585565.049054.249070@.g44g2000cwa.googlegroups.com...
>> I have 137GB of database (mdf). it is showing on database properties
>> that i still have about 63Gb available. If i go to EM-shrink file, i
>> can have a minimum of 65GB which i guess is my actual data. But when i
>> shrink it from there or from Query Analyzer, it still remains 137Gb.
>> I even tried doing a dbcc shrinkfile to 110GB, but still it didn't
>> work.
>> can anybody help pls.
>> TIA
>> Joriz
>
Shrinking the database file doesn't require a SHRINK DATABASE - that can
be done with the DBCC SHRINKFILE command as well.
When you want to shrink your database file (.mdf) you can use the syntax
below :
USE YourDatabaseName
DBCC SHRINKFILE (LogicalDataFileName, TargetSize)
You can look up the command in Books On Line. If you need to get the
logical file names of your database, you can use sp_helpdb.
HTH
Regards
Steen

No comments:

Post a Comment