How to Dump and Load a Berkeley Database File
Use the db_dump and db_load tools. Here's an example of how to upgrade your bayes_toks file with Berkeley db 4.1 installed:
cd ~ db4.1_dump .spamassassin/bayes_toks > dmp db4.1_load bayes_toks < dmp mv bayes_toks .spamassassin/bayes_toks
You may need to perform the "dump" step on the original machine, and the db_dump and db_load tools may have different names on your platform.
You can do the same with the bayes_seen and auto-whitelist files, but they're not as important; I generally just blow them away:
cd ~ rm .spamassassin/bayes_seen rm .spamassassin/auto-whitelist*