473,507 Members | 2,374 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL2000-How to reclaim the Unallocate Space for Database(low hdd space - Urgent!!!)

7 New Member
Good day,
I felt this forum is good because the reply is fast and relevent. so, this is my second question...
I am working on SQL2000, one of my db is use up around 250gb, and the hard disk is running out of space soon...(very soon).
I have run the sp_spacesused and found that the unallocate db is

database_name database_size unallocated space ----
Internet 113693.50 MB 43466.96MB -


reserved data index_size unused
------------------ ------------------ ------------------ ------------------
71808552 KB 70249352 KB 957440 KB 601760 KB


I have clean up the log file, and also run the SQL EM shrink database, but no help...I would like to reclaim the space that allocated in the server (43466.96MB ) , how can I do that....i have try the dbcc shrink file from EM , and start with 10 MB , but it take more than 2 hours, but again no luck...the result still the same...can anyone please me ? my hard disk is running out of space.......very very soon.
thanks
Sep 17 '08 #1
8 4997
ck9663
2,878 Recognized Expert Specialist
Have you tried shrinking the FILEGROUP of your database?

-- CK
Sep 17 '08 #2
iburyak
1,017 Recognized Expert Top Contributor
To free up space is tedious job and takes days sometimes to do it and in many cases need space. So I am not mistaken you need space to free up space.

1. I will get back to you in couple of hours with a script that will help you identifying largest tables on which you should work first.
2.It takes a lot of time because you don't have space and as soon you'll free up some it will get easier.
3. For now you can just do manually.
sp_spaceused table_name
on tables that you have heaviest updates or just feel that they are a problem.
4.If you'll see that table has a big number on unallocated space you should start working on such table.

So what could you do on such table?
Make sure you work at off hours it will affect your users.
a. Create clustered index on any column and then drop it. (if clustered index exists this step will not help) What this index does, is re oranges data because data is a last level of this index. It will basically defrag data itself and free up space to the server. But unfortunately while this happening space is needed to move data around while index built so choose first tables carefully.
Use sp_spaceused table_name to see result.
b.Defrag indexes. There is such a command.
If you don't know how there is an easier way to do the same is to drop and recreate indexes. It will also free up empty pockets on index pages.
Again use sp_spaceused table_name to see result.
I usually save what was before and after to see result.
Also you can view final result on whole database by executing:
sp_spaceused
c.Before using step a or b you might think of some tables that have old data that could be deleted or offloaded somewhere else.
5. You probably need reorg job to be running on schedule for a future. You should consult your DBA for info on this.

Good Luck.
Sep 17 '08 #3
copper21
3 New Member
I'd recommend dbcc shrinkfile in 500mb chunks, to run more efficiently
Sep 20 '08 #4
copper21
3 New Member
To see exact space used in the current database (sp_spaceused is not always accurate unless dbcc updateusage is run), you could use this :
select cast(size/128.0 as decimal(10,1)) as [size mb], cast(FILEPROPERTY(f.name, 'spaceused')/128.0 as decimal(10,1)) as [used mb], maxsize [maxsize mb]
, cast(growth*8/1024 as varchar(11))+case when f.status&0x100000>0 then '%' else '' end [growth]
, isnull(filegroup_name(f.groupid),'log') [groupname]
, cast(100*(size/128-(FILEPROPERTY(f.name,'spaceused')/128))/(size/128.0) as int) [% free]
from dbo.sysfiles f order by f.fileid
Sep 20 '08 #5
iburyak
1,017 Recognized Expert Top Contributor
To see exact space used in the current database (sp_spaceused is not always accurate unless dbcc updateusage is run), you could use this :
select cast(size/128.0 as decimal(10,1)) as [size mb], cast(FILEPROPERTY(f.name, 'spaceused')/128.0 as decimal(10,1)) as [used mb], maxsize [maxsize mb]
, cast(growth*8/1024 as varchar(11))+case when f.status&0x100000>0 then '%' else '' end [growth]
, isnull(filegroup_name(f.groupid),'log') [groupname]
, cast(100*(size/128-(FILEPROPERTY(f.name,'spaceused')/128))/(size/128.0) as int) [% free]
from dbo.sysfiles f order by f.fileid
This is great I love this approach.
I’ll use it in a future for sure.

Thanks.
Sep 22 '08 #6
lbseong
7 New Member
Thanks to you guy for giving me help ...

This is the result base on (select cast(size/128.0 as decimal(10,1)) as [size mb], cast(FILEPROPERTY(f.name, 'spaceused')/128.0 as decimal(10,1)) as [used mb], maxsize [maxsize mb]
, cast(growth*8/1024 as varchar(11))+case when f.status&0x100000>0 then '%' else '' end [growth]
, isnull(filegroup_name(f.groupid),'log') [groupname]
, cast(100*(size/128-(FILEPROPERTY(f.name,'spaceused')/128))/(size/128.0) as int) [% free]
from dbo.sysfiles f order by f.fileid
)

113583.0 76608.6 -1 200 PRIMARY 32
301.0 16.5 -1 100 log 94

But againt, I also run the DBCC Shink File cmd, no luck....shirnking 3 MB of data, it take more than 1 hour and slow down the server performance, until I have to kill the process...and get scolded by my manager for decrease the server performance....when I use sp_spaceused

Content 4120526 26925048 25831184 836760 257104
How can I free up the 35gb from the database ?
Sep 23 '08 #7
lbseong
7 New Member
Hello,
Thanks for your advise, can I just check with u, my database is for internet access and not allow to be down, I guess maybe the dbccindexdefrag will help a little bit, dbcc reindex will not allow as the db is 24 hours accessible...do you have any other good suggestion? maybe like shinking individual table command...fyi, the shrinking for 3 -5 mb have taken like 1 hour + and not completed...ai...

To free up space is tedious job and takes days sometimes to do it and in many cases need space. So I am not mistaken you need space to free up space.

1. I will get back to you in couple of hours with a script that will help you identifying largest tables on which you should work first.
2.It takes a lot of time because you don't have space and as soon you'll free up some it will get easier.
3. For now you can just do manually.
sp_spaceused table_name
on tables that you have heaviest updates or just feel that they are a problem.
4.If you'll see that table has a big number on unallocated space you should start working on such table.

So what could you do on such table?
Make sure you work at off hours it will affect your users.
a. Create clustered index on any column and then drop it. (if clustered index exists this step will not help) What this index does, is re oranges data because data is a last level of this index. It will basically defrag data itself and free up space to the server. But unfortunately while this happening space is needed to move data around while index built so choose first tables carefully.
Use sp_spaceused table_name to see result.
b.Defrag indexes. There is such a command.
If you don't know how there is an easier way to do the same is to drop and recreate indexes. It will also free up empty pockets on index pages.
Again use sp_spaceused table_name to see result.
I usually save what was before and after to see result.
Also you can view final result on whole database by executing:
sp_spaceused
c.Before using step a or b you might think of some tables that have old data that could be deleted or offloaded somewhere else.
5. You probably need reorg job to be running on schedule for a future. You should consult your DBA for info on this.

Good Luck.
Sep 23 '08 #8
iburyak
1,017 Recognized Expert Top Contributor
Hello,
Thanks for your advise, can I just check with u, my database is for internet access and not allow to be down, I guess maybe the dbccindexdefrag will help a little bit, dbcc reindex will not allow as the db is 24 hours accessible...do you have any other good suggestion? maybe like shinking individual table command...fyi, the shrinking for 3 -5 mb have taken like 1 hour + and not completed...ai...
See if you can shrink tran log and temdb.
When you'll free up some space your other commands will run faster.

Good Luck.
Sep 23 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

21
3998
by: Christian Seberino | last post by:
Linux kernel style guide, Guido's C style guide and (I believe) old K&R style recommends 8 SPACES for indent. I finally got convinced of wisdom of 8 space indentation. Guido also likes 8 space...
5
7517
by: Yasaswi Pulavarti | last post by:
does a command like, db2 drop table tabschema.tabname when run from the Aix prompt reclaim the disk space? Are there any other options? How can we make sure the disk space is reclaimed? Thanks,...
10
8293
by: Shuo Xiang | last post by:
Greetings: I know that variables declared on a stack definitely does not reside in heap space so there is only a very limited amount of stuff that you can store in the stack of a function. But...
9
7312
by: Ajay | last post by:
Hi all, Can I know what is the stack space and heap space allocated by the compiler.Can i increase it or decrease it.if yes,pleae tell me theway to do it.Thanks in advance. Cheers, Ajay
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7111
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7485
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5042
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
760
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.