Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

my database wont shrink

Status
Not open for further replies.

nuct

Programmer
Sep 5, 2001
103
Hi

We have a database which is 11 gb in size. However only 9 gb is is used the remaining 2 gb is free space. I was wondering how I go about freeing this the OS. I have tried:

DBCC SHRINKDATABASE (i3_eic, 1, TRUNCATEONLY)

but it only seemed to free about 400 mb or so.

Has anybody got any ideas as we are rapidly running out of space on the server.

Cheers,
Simon
 
are you saying that it might shrink to the desired size at the next backup?
 
You need to backup the log in order to move the transactions away from the active log. You should then be able to shrink it. However, if the log is just going to grow again then there is little point doing this.

Scheduling regular log backups can help to keep its size to a minimum, but this is at the cost of restore-simplicity.
e.g.
Full backup at 01:00 every day.
TLog backup every 15 mins.

If the system fails at 00:46 you will have to restore the full backup, then each of the TLog backups (4 per hour x 23 hours + 3 + active = 96 logs!)



James Goodman MCSE, MCDBA
 
You need to backup the log in order to move the transactions away from the active log. You should then be able to shrink it. "

When you say "it" do you mean the database files of the log files. Because my problem is that the database file needs to be shrunk. The log file isn't an issue because it is set to truncate on checkpoint.
 
If there is something i am misunderstanding feel free to explain it to me.
 
Ahh, ok.

You might be able to free a little more space by simply running:
DBCC SHRINKDATABASE (i3_eic)

This should move the pages to the beginning of the file, which might then free up some more space.

You will want to reindex/defrag all of your indexes after running any shrink command, as the indexes become fragmented & performance can suffer.



James Goodman MCSE, MCDBA
 
ok cheers, and obviously i would be better to do this after hours right?

Simon.
 
I think I'll do it later. Cheers for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top