Compacting your DVMAX Datafile (Windows)
Operating Systems: Windows
Applies to Versions: 7.0 - 7.0.12
Compacting your datafile can be done as routine maintenance to help keep the health and performance of your database running smoothly. A compaction can described as something similar to doing a defrag on your computer's hard drive. Instead, a compaction will "defrag" just your database.
Note: A compaction requires the DVMAX database to be OFFLINE. No one will be able to use DVMAX during the compaction.
Time Required: The time it takes to complete the compaction could be anywhere from 1 - 4 hours on average. A lot of this depends on:
- How large your database is.
- How fast your server's hard drives are.
Step 1 - Quit DVMAX on all computers
To compact your datafile, the database must not be in use, and the DVMAX program must be quit.
Log off DVMAX Client on all workstations and then Quit the DVMAX Server application.
The rest of this document's steps will occur on the Server computer.
Step 2 - Get to Know your Datafile
Before making a new datafile in the next step, you will need to know where your datafile is, and how big it is (important!).
Navigate to the data folder, typically located in:
C:\DVMAXDatabaseFiles\DVMAXDataFolder
Observe the contents here and check the size on each file. You can right-click and select ‘Properties’ on each file to determine their current size if necessary. Once you have a grand total for all files in this folder, write it down or remember it for the next step.
Lastly, navigate back to C:\DVMAXDatabaseFiles
Make a new folder in this directory called "Compact". This will be used in the next step.
Step 3 - Launch & Run 4D Tools / Compaction
Navigate to C:\Program Files\DVMAXProgramFiles7\DVMAXToolsFolder
Double click the 4D Tools program.
A Browse window will appear.
Change the Enable: drop down menu to Compiled Database.
Navigate to your DVMAX Server folder and then double click on the Server Database folder.
Select the DVMAX.4dc. Typically located in:
C:\Program Files\DVMAXProgramFiles7\DVMAXServerFolder\Server Database.
A Login window will appear.
Log in as the DVMAX Administrator with the correct Password and click Connect.
After a few moments, the 4D Tools main Information window will appear. If you have a large datafile it could take several minutes for this to come up - be patient.
Click on the Maintain tab.
At the bottom of the window, click on the Compact button.
If your entire database is larger than 1 GB, you will need to 'split' the database. Click the Split button at the bottom left of the Browse window.
The Segments window will appear.
Click Add to start creating your new datafile.
A Save window will appear. Name the main datafile according to your clinic's abbreviation. (ie. Railroad Animal Hospital would be RAH.)
Browse to the path of the 'compact' folder you made earlier in STEP 2 and save it there.
Click Add in the segment window again. Name this file with a suffix of '1' to indicate it's the 1st segment. (ie. RAH1).
Continue adding segments until you have enough. The initial datafile can store up to 900mb, and each segment can store 1,500 MB. Add enough segments so that the total files you create are a couple GBs larger than your original data. If you are not sure how large your data is, refer back to STEP 2.
Once you've added all the segments you need, you will have to set the size for each file.
In the Add window, all your segments will be listed. Highlight the first file, which ends with .4DD.
Place a bullet in front of Segment Size, type in 900, and click Set.
For the second, and any subsequent files listed (ends in .4DS), highlight them one at a time, place the bullet in front of Segment Size, set the size to 1500 and click Set.
Once this is completed for all files listed click OK and the compaction will begin!
At this point the compaction is on auto-pilot and can take anywhere from 30 minutes to 3-4 hours. A small progress window will appear on screen as it compacts each table and index. Check it every so often as there is no 'overall' progress from start to finish.
The Compaction will be complete if you a) Do not see any progress/information bar for several seconds, and b) the 4D Tools window responds if you click the Information tab.
Once the compaction is complete, click on the Information tab and click Quit.
Step 4 - Move Files
Now that you have made your new, compacted datafile, you must move your original data out and place your new dataile in it's place.
Navigate to your original data folder, typically in C:\DVMAXDatabaseFiles\DVMAXDataFolder
Create a new folder called "Old Data".
MOVE all the contents of the DVMAXDataFolder INTO the "Old Data" folder.
Next, Navigate and open the folder that contains your compacted data that you made in STEP 2
MOVE the contents of your 'Compact' folder INTO the DVMAXDataFolder.
Step 5 - Launch on New/Compacted Datafile
Start the DVMAX Server program up as you normally would. The Server will not know where the new datafile is and will prompt you with a Browse window.
Navigate to your new datafile, which should now be in C:\DVMAXDatabaseFiles\DVMAXDataFolder.
Double click the datafile.
The System will continue to prompt you for all the segments as well. Select each one, one at a time, as it requests them.
Once all files are selected, the DVMAX Server program will launch.
Step 6 - Log File creation (depends on config)
If your system is using the Log file feature, it will let you know and ask you to select your log file.
Click OK on the prompt, and at the Browse window click 'New'.
Leave the default name and save the new log file in your DVMAXDataFolder as well.
The System will perform a backup. After the backup is complete, DVMAX will be ready for use!