Avatar billede dr.m Nybegynder
13. december 2002 - 21:47 Der er 6 kommentarer og
1 løsning

Reduce DB size

Hello Experts

My db is 26gb set to auto shrink.

I run a script made by one of our developers to delete records from different tables - no problem.

around 5 million records deleted.

Why is my DB still 26gb?

Free hd space is 14gb

Please advice

/Michael
Avatar billede dr.m Nybegynder
13. december 2002 - 21:48 #1
SQL 2000 SP2 btw
Avatar billede Spotgun Seniormester
13. december 2002 - 21:52 #2
Usually databases allocate HD-space in chunks. I doesnt expand in size per record you add. When you are close to filling your designated HD-space, the DB automaticly expands to a new chunk of your harddrive.
As a result of that, it doesnt automaticly downsize its "reserved db-space" when you delete a whole bunch of records.

But if you've set your SQLserver to AutoShrink, it should automaticly reduce its size to the nearest available chunk. Anyway, try to see if there is a manual "pack & reindex"-kinda function somewhere in one of the toolbars.
Avatar billede dr.m Nybegynder
13. december 2002 - 22:08 #3
Thanks, I already feel wiser :)

The only option I find is "index tuning wizard" I don't know if it's the right way. I get stuck when it ask me for a "workload file"

Thanks again for your response

/Michael (SQL idiot)
Avatar billede dr.m Nybegynder
13. december 2002 - 22:15 #4
Even though the db doesn't allocate size per record, 5 mil. is about 1.7 gb in db size.

The reason I know that, is that the same records deleted on this db were created on a new db on another SQL server.
Avatar billede kennethrisum Nybegynder
13. december 2002 - 22:26 #5
You must:
1. Reorganize your indexes
2. Shrink the database

The easiest way to do this is to make a Maintainence plan. Otherwise seek help in books online on the topics mentione.
Avatar billede dr.m Nybegynder
13. december 2002 - 22:35 #6
Funny (or not), I did actualy created a Maintainence plan in order to take backup and check integrity, I somehow managed to skip the "reorginize" part.

Will try in a while.

Thanks
Avatar billede dr.m Nybegynder
15. december 2002 - 15:26 #7
free space restored :-)
kennethrisum, pls make a "svar".

You have both been helpful!
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Computerworld tilbyder specialiserede kurser i database-management

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester