Thursday, March 29, 2012

dbcc shrinkdatabase vs dbcc shrinkfile

Hello all,
I just chopped off millions of stale records from a table bringing the
row count from 85M to 5 and also freeing up around 30GB of data. What
is the safest way to shrink the database to reclaim this freed up space?Hello,
I recommend you to use DBCC SHRINKFILE to shrink the MDF and LDF file
seperately. Before executing the SHRINKFILE use the command SP_SPACEUSED
to identify the unallocated space.
Thanks
Hari
"AF" <af.at.work@.gmail.com> wrote in message
news:1168388869.505893.31950@.i56g2000hsf.googlegroups.com...
> Hello all,
> I just chopped off millions of stale records from a table bringing the
> row count from 85M to 5 and also freeing up around 30GB of data. What
> is the safest way to shrink the database to reclaim this freed up space?
>|||Hari Prasad wrote:
> Hello,
> I recommend you to use DBCC SHRINKFILE to shrink the MDF and LDF file
> seperately. Before executing the SHRINKFILE use the command SP_SPACEUSED
> to identify the unallocated space.
> Thanks
> Hari
>
> "AF" <af.at.work@.gmail.com> wrote in message
> news:1168388869.505893.31950@.i56g2000hsf.googlegroups.com...
> > Hello all,
> >
> > I just chopped off millions of stale records from a table bringing the
> > row count from 85M to 5 and also freeing up around 30GB of data. What
> > is the safest way to shrink the database to reclaim this freed up space?
> >
Thanks Hari, just curious -- why separately?
These are the results of sp_spaceused but how do I interpret these to
use dbcc shrinkfile?
name size unallocated space
mydb 39536.81 MB 504.16 MB
reserved data index size unused
8589984 KB 7921840 KB 647688 KB 20456 KB|||AF wrote:
> Hari Prasad wrote:
> > Hello,
> >
> > I recommend you to use DBCC SHRINKFILE to shrink the MDF and LDF file
> > seperately. Before executing the SHRINKFILE use the command SP_SPACEUSED
> > to identify the unallocated space.
> >
> > Thanks
> > Hari
> >
> >
> > "AF" <af.at.work@.gmail.com> wrote in message
> > news:1168388869.505893.31950@.i56g2000hsf.googlegroups.com...
> > > Hello all,
> > >
> > > I just chopped off millions of stale records from a table bringing the
> > > row count from 85M to 5 and also freeing up around 30GB of data. What
> > > is the safest way to shrink the database to reclaim this freed up space?
> > >
> Thanks Hari, just curious -- why separately?
> These are the results of sp_spaceused but how do I interpret these to
> use dbcc shrinkfile?
> name size unallocated space
> mydb 39536.81 MB 504.16 MB
> reserved data index size unused
> 8589984 KB 7921840 KB 647688 KB 20456 KB
This is the usage reported from SSEM:
mydb.mdf
7721MB USED
1172MB FREE
mydb.ldf
158MB USED
30486MB FREEsql

No comments:

Post a Comment