Wednesday, March 28, 2012

Resizing an existing DB

I created a DB with a preallocated size of 20GB and I need to shink
this down to a smaller size. If I go into DB properties and enter a
new value it says that the size must be greater than the current size.
Is there any way to do this? Also when I try and restore the DB is
wants 20GB of disk space even though it's only using about 1GB of
data. Any help will be muchly appreciated.
Darren.Use DBCC SHRINKDATABASE or DBCC SHRINKFILE. These commands are documented in Books Online.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Darren" <walker_712@.hotmail.com> wrote in message news:cd9d3666.0405102239.21563966@.posting.google.com...
> I created a DB with a preallocated size of 20GB and I need to shink
> this down to a smaller size. If I go into DB properties and enter a
> new value it says that the size must be greater than the current size.
> Is there any way to do this? Also when I try and restore the DB is
> wants 20GB of disk space even though it's only using about 1GB of
> data. Any help will be muchly appreciated.
> Darren.|||Hi Darren,
Unfortunatly you can't. The smallest size you can shrink
your database to is the size the database was initally set
to when you created it, in this case 20gb.
Although there are lots of ways of doing it, personally I
would save the data, drop the database, recreate it with 1
gb, then copy the database back into it.
J
>--Original Message--
>I created a DB with a preallocated size of 20GB and I
need to shink
>this down to a smaller size. If I go into DB properties
and enter a
>new value it says that the size must be greater than the
current size.
>Is there any way to do this? Also when I try and restore
the DB is
>wants 20GB of disk space even though it's only using
about 1GB of
>data. Any help will be muchly appreciated.
>Darren.
>.
>|||Julie,
DBCC SHRINKFILE should be able to shrink the size below the initial size...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Julie" <anonymous@.discussions.microsoft.com> wrote in message news:b30801c43735$c4a30970$a301280a@.phx.gbl...
> Hi Darren,
> Unfortunatly you can't. The smallest size you can shrink
> your database to is the size the database was initally set
> to when you created it, in this case 20gb.
> Although there are lots of ways of doing it, personally I
> would save the data, drop the database, recreate it with 1
> gb, then copy the database back into it.
> J
>
>
> >--Original Message--
> >I created a DB with a preallocated size of 20GB and I
> need to shink
> >this down to a smaller size. If I go into DB properties
> and enter a
> >new value it says that the size must be greater than the
> current size.
> >Is there any way to do this? Also when I try and restore
> the DB is
> >wants 20GB of disk space even though it's only using
> about 1GB of
> >data. Any help will be muchly appreciated.
> >
> >Darren.
> >.
> >|||Ok, now hanging my head in shame.
Moving swiftly along...
>--Original Message--
>Julie,
>DBCC SHRINKFILE should be able to shrink the size below
the initial size...
>--
>Tibor Karaszi, SQL Server MVP
>http://www.karaszi.com/sqlserver/default.asp
>
>"Julie" <anonymous@.discussions.microsoft.com> wrote in
message news:b30801c43735$c4a30970$a301280a@.phx.gbl...
>> Hi Darren,
>> Unfortunatly you can't. The smallest size you can shrink
>> your database to is the size the database was initally
set
>> to when you created it, in this case 20gb.
>> Although there are lots of ways of doing it,
personally I
>> would save the data, drop the database, recreate it
with 1
>> gb, then copy the database back into it.
>> J
>>
>>
>> >--Original Message--
>> >I created a DB with a preallocated size of 20GB and I
>> need to shink
>> >this down to a smaller size. If I go into DB properties
>> and enter a
>> >new value it says that the size must be greater than
the
>> current size.
>> >Is there any way to do this? Also when I try and
restore
>> the DB is
>> >wants 20GB of disk space even though it's only using
>> about 1GB of
>> >data. Any help will be muchly appreciated.
>> >
>> >Darren.
>> >.
>> >
>
>.
>|||LOL...
As if we didn't do this all of us, from time to time. :-)
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Julie" <anonymous@.discussions.microsoft.com> wrote in message news:b38e01c4373e$eb86b330$a301280a@.phx.gbl...
> Ok, now hanging my head in shame.
> Moving swiftly along...
>
> >--Original Message--
> >Julie,
> >
> >DBCC SHRINKFILE should be able to shrink the size below
> the initial size...
> >
> >--
> >Tibor Karaszi, SQL Server MVP
> >http://www.karaszi.com/sqlserver/default.asp
> >
> >
> >"Julie" <anonymous@.discussions.microsoft.com> wrote in
> message news:b30801c43735$c4a30970$a301280a@.phx.gbl...
> >> Hi Darren,
> >>
> >> Unfortunatly you can't. The smallest size you can shrink
> >> your database to is the size the database was initally
> set
> >> to when you created it, in this case 20gb.
> >>
> >> Although there are lots of ways of doing it,
> personally I
> >> would save the data, drop the database, recreate it
> with 1
> >> gb, then copy the database back into it.
> >>
> >> J
> >>
> >>
> >>
> >>
> >> >--Original Message--
> >> >I created a DB with a preallocated size of 20GB and I
> >> need to shink
> >> >this down to a smaller size. If I go into DB properties
> >> and enter a
> >> >new value it says that the size must be greater than
> the
> >> current size.
> >> >Is there any way to do this? Also when I try and
> restore
> >> the DB is
> >> >wants 20GB of disk space even though it's only using
> >> about 1GB of
> >> >data. Any help will be muchly appreciated.
> >> >
> >> >Darren.
> >> >.
> >> >
> >
> >
> >.
> >

No comments:

Post a Comment