Spam Filter ISP Support Forum

  New Posts New Posts RSS Feed - shrinking the database
  FAQ FAQ  Forum Search   Register Register  Login Login

shrinking the database

 Post Reply Post Reply
Author
Raman View Drop Down
Guest Group
Guest Group
Post Options Post Options   Thanks (0) Thanks(0)   Quote Raman Quote  Post ReplyReply Direct Link To This Post Topic: shrinking the database
    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

Back to Top
LogSat View Drop Down
Admin Group
Admin Group
Avatar

Joined: 25 January 2005
Location: United States
Status: Offline
Points: 4104
Post Options Post Options   Thanks (0) Thanks(0)   Quote LogSat Quote  Post ReplyReply Direct Link To This Post Posted: 28 September 2004 at 12:37am
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
Back to Top
sgeorge View Drop Down
Senior Member
Senior Member


Joined: 23 August 2005
Status: Offline
Points: 178
Post Options Post Options   Thanks (0) Thanks(0)   Quote sgeorge Quote  Post ReplyReply Direct Link To This Post Posted: 02 December 2005 at 10:15am
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
Back to Top
LogSat View Drop Down
Admin Group
Admin Group
Avatar

Joined: 25 January 2005
Location: United States
Status: Offline
Points: 4104
Post Options Post Options   Thanks (0) Thanks(0)   Quote LogSat Quote  Post ReplyReply Direct Link To This Post Posted: 02 December 2005 at 5:20pm

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.

Roberto Franceschetti

LogSat Software

Spam Filter ISP
Back to Top
sgeorge View Drop Down
Senior Member
Senior Member


Joined: 23 August 2005
Status: Offline
Points: 178
Post Options Post Options   Thanks (0) Thanks(0)   Quote sgeorge Quote  Post ReplyReply Direct Link To This Post Posted: 07 February 2006 at 10:09am
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:
  1. This has only been tested on Windows Server 2003
  2. This only works if you are running SpamFilter as a service and are using MS Access files as your database
  3. It assumes that it can find your database (and the "shrunk" copy) in c:\Program Files\SpamFilter\Database -- modify that path to fit where you save your SpamFilter quarantine
  4. SpamFilter.mdb: The database that the SpamFilter service is actively using
  5. SpamFilter2.mdb: The "offline" database that you have "shrunk" and want to swap-in
-----------------------------------

@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

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.117 seconds.