What you're looking for is fragment caching - you just have to surround the code you want to not be cached with mfunc or mclude tags. Alternatively, you could use javascript or iframes.
If you use fragment caching, though, you can't use Enhanced caching. Since you're using DB Caching, I assume you're on a VPS or dedicated server, so other page caching options might be available for you, and I'm not sure whether they will work with these dynamic tags or not. You can always try them. If they don't work, what will happen is the whole page will just not get cached, so your best bet is to try it out. Basic caching might give you enough benefit, anyway.
Edit your templates to with the following syntax to ensure that dynamic features remain so:
Example 1:
<!-- mfunc any PHP code --><!-- /mfunc -->
Example 2:
<!-- mfunc -->any PHP code<!-- /mfunc -->
Example 3:
<!--MFUNC -->
echo rand();
<!--/mfunc -->
Example 4:
<!-- mclude path/to/file.php --><!-- /mclude -->
Example 5:
<!-- mclude -->path/to/file.php<!-- /mclude -->