Monday, March 12, 2012

Last allocated extent

Hello,
Is it possible to know the last allocated extent in a datafile? I want to
know this information to know(estimate) how much space will be free when i
shrink one datafile.
Another thing that would like to know is if its possible to shrink one
datafile that initially was created with 10GB and now i want to reduce the
size of this datafile to 3GB.
Thanks and best regards
Hi
From BOL:
"The target size for data and log files as calculated by DBCC SHRINKDATABASE
can never be smaller than the minimum size of a file. The minimum size of a
file is the size specified when the file was originally created"
If you created the DB with 10GB, you can's shink it smaller than 10GB.
You are not guaranteed that data is written at the beginning of the data
file and then follows on from that. There might be data extents allocated all
over the file.
Regards
Mike
"CC&JM" wrote:

> Hello,
> Is it possible to know the last allocated extent in a datafile? I want to
> know this information to know(estimate) how much space will be free when i
> shrink one datafile.
> Another thing that would like to know is if its possible to shrink one
> datafile that initially was created with 10GB and now i want to reduce the
> size of this datafile to 3GB.
> Thanks and best regards
|||Thanks Mike
Best regards
"Mike Epprecht (SQL MVP)" wrote:
[vbcol=seagreen]
> Hi
> From BOL:
> "The target size for data and log files as calculated by DBCC SHRINKDATABASE
> can never be smaller than the minimum size of a file. The minimum size of a
> file is the size specified when the file was originally created"
> If you created the DB with 10GB, you can's shink it smaller than 10GB.
> You are not guaranteed that data is written at the beginning of the data
> file and then follows on from that. There might be data extents allocated all
> over the file.
> Regards
> Mike
> "CC&JM" wrote:
|||Also, there's no supported way to find the last allocated extent in a file.
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"CC&JM" <CCJM@.discussions.microsoft.com> wrote in message
news:12334118-BD82-4316-8A82-B62F3AB6A9E7@.microsoft.com...[vbcol=seagreen]
> Thanks Mike
> Best regards
> "Mike Epprecht (SQL MVP)" wrote:
SHRINKDATABASE[vbcol=seagreen]
of a[vbcol=seagreen]
allocated all[vbcol=seagreen]
to[vbcol=seagreen]
when i[vbcol=seagreen]
the[vbcol=seagreen]

No comments:

Post a Comment