the High Seas of Information Technology
Detailed Instructions for using MC_CompactDB
- Download the tp_CompactDB.mdb database (checksums)
- Edit the MyCompactMyDatabases default values:
- [optional] The name (or path) of the default backup folder. You can choose any name for your backup folder (DB_Backups is the default). If you choose a zero-length string the backups are saved in the same folder as the database. MC_CompactDB is set up to automatically creates backup folders if one isn't found.
- [optional] the path to a log file.
- [optional] backup retention. This represents the number of backups to keep at any given time. For example, if backup retention is "3", then three backups will be retained. When a new backup is created, the oldest will drop off. If backup retention is zero, no backups are saved (in this case, also set the default backup folder to a zero-length string so as not to create an empty folder for backups. Note: even if the backup retention is set to zero, a temporary backup is saved before any database is compressed, and if the compression fails the database is immediately restored.
myCompactDB.DefaultBackupFolder = "xRecycleBin"myCompactDB.DefaultLogFilePath = "C:\myTemp\Scheduled\log.txt"myCompactDB.DefaultBackupRetention = 3
- add the database file locations as needed for your databases
- Run the MyCompactMyDatabases procedure as needed.
- Advanced Options and Notes
- You can use the class in your own utility database - just import both the MC_CompactDB and MC_DB classes and create a sub or function in a standard module to run the compact procedures
- There is a list of properties and methods in the MC_CompactDB class source code, with more information on how they work.
- Setting the TestMode property to true will execute a "dry run" that imitates and logs all actions without actually changing or modifying any database files.
- Setting VerboseLogging to true will provide a more information in the log file (most noticeably, showing a list of the backups detected as well as those deleted).
- The Add method of the MC_CompactDB class takes arguments to set properties for an individual database, at which point it is stored in the MC_CompactDB collection of databases to be iterated when compacts are run. This should suffice since an individual database has only a small number of properties (and in practice, just one that really matters - its file location). An accessor method to retrieve the MC_DB object collection from the collection in the MC_CompactDB class has been added as of version 1.04 . In general, this is used only when creating a separate set of monthly backups apart from the compact DB schedule. The main purpose for the MC_DB databases class is so that each database to be compacted can have its own settings for default behaviors. For the most part, you want to simply set defaults for the log file, the backup retention, and backup folder, and provide file paths for the databases. In practice you'll likely have one set of preferences that apply to most (or all) of your databases. Nevertheless, if you require a specific database to be treated differently (For instance, keeping more backups or specifying a particular backup folder), then this can be handled with arguments of the Add method at the time the DB is added.