shrinking the database |
Post Reply ![]() |
Author | |
Raman ![]() Guest Group ![]() |
![]() ![]() ![]() ![]() ![]() Posted: 27 September 2004 at 1:53pm |
I am on version 2.1.1.367 and I would like to shrink my SQL database which has grown a lot what is the best way to do it |
|
![]() |
|
LogSat ![]() Admin Group ![]() ![]() Joined: 25 January 2005 Location: United States Status: Offline Points: 4104 |
![]() ![]() ![]() ![]() ![]() |
Raman,What kind of database platform are you using? MS Access has an option to shrink a database, with SQL server there are other procedures that usually DBA's follow to maintain the transaction logs.
Roberto Franceschetti
LogSat Software
|
|
![]() |
|
sgeorge ![]() Senior Member ![]() Joined: 23 August 2005 Status: Offline Points: 178 |
![]() ![]() ![]() ![]() ![]() |
Roberto, my quarantine db is being written to an MS Access file.
To my understanding, the only way to shrink the database is to stop
SpamFilter, open the database in Microsoft Access, shrink the db, and
then restart SpamFilter. Is there another way to do this without
temporarily stopping the program?
Thanks, Stephen |
|
![]() |
|
LogSat ![]() Admin Group ![]() ![]() Joined: 25 January 2005 Location: United States Status: Offline Points: 4104 |
![]() ![]() ![]() ![]() ![]() |
Stephen, Unfortunately this is also the only way we know of. Access was really designed to be a single-user database, and Microsoft is having a real hard time into trying to make it a real multi-user platform. |
|
![]() |
|
sgeorge ![]() Senior Member ![]() Joined: 23 August 2005 Status: Offline Points: 178 |
![]() ![]() ![]() ![]() ![]() |
Hi, I thought I would just post a windows .bat file that has been helpful for me in shrinking my Access DB. Generally, I make a copy of my Spamfilter database, run some queries on it to remove dead-obvious spam from the DB, and then I stop the SpamFilter service and swap-in the shrunk database in place of the working database.
Here's my batch file... Important Notes:
@echo off set SPAMFILTER_SERVICE_NAME=SpamFilter set FILE_MOVE_FROM=SpamFilter2.mdb set FILE_MOVE_TO=SpamFilter.mdb echo ***************************************************** echo Moving SpamFilter2.mdb to SpamFilter.mdb and echo restarting SpamFilter... echo ***************************************************** echo Hit Ctrl and c to cancel, starting in 3 seconds... @ping 127.0.0.1 -n 2 -w 1000 > nul echo Hit Ctrl and c to cancel, starting in 2 seconds... @ping 127.0.0.1 -n 2 -w 1000 > nul echo Hit Ctrl and c to cancel, starting in 1 second... @ping 127.0.0.1 -n 2 -w 1000 > nul echo Replacing Database... :begin c: set object=c:\Program Files\SpamFilter\Database cd %object% if not %ERRORLEVEL% == 0 goto error_directory_change if not exist %FILE_MOVE_FROM% goto error_no_file rem *** Checks Passed - Proceed *** net stop %SPAMFILTER_SERVICE_NAME% if not %ERRORLEVEL% == 0 goto error_no_stop @ping 127.0.0.1 -n 1 -w 1000 > nul move /Y %FILE_MOVE_FROM% %FILE_MOVE_TO% if not %ERRORLEVEL% == 0 echo Warning: %FILE_MOVE_FROM% could not be moved to %FILE_MOVE_TO%. Be sure that %FILE_MOVE_TO% is not marked as read-only. Attempting to restart SpamFilter... net start %SPAMFILTER_SERVICE_NAME% if not %ERRORLEVEL% == 0 goto error_no_start echo Success! goto quit :error_directory_change echo Could not change to directory: %object% goto quit :error_no_file echo The file does not exist: %FILE_MOVE_FROM% goto quit :error_no_stop echo The service "%SPAMFILTER_SERVICE_NAME%" could not be stopped. Be sure the service exists and is running. goto quit :error_no_start echo The service "%SPAMFILTER_SERVICE_NAME%" could not be started. Be sure the service exists. echo SpamFilter IS NOT RUNNING! goto quit :quit @ping 127.0.0.1 -n 5 -w 1000 > nul |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
This page was generated in 0.117 seconds.