Whenever I see the word "dynamically" I assume it to mean "In a complicated way which I don't understand". Nobody has ever contradicted me and provided a different meaning, either. So that's what I'm going to assume here.
What you do is this: Read the rows in sequence from the two databases and compare them. "In sequence" is important because if you read them in a random order it's going to be much more difficult. So they had better have keys. Here's the process:
(1) Read the first row from each database. (Call the databases X and Y.)
(2) If key X = key Y then compare the two rows and report differences; read the next row from both databases; repeat from (2).
(3) If key X < key Y then report "Key X missing from Y"; read the next row from X; repeat from (2).
(4) If key X > key Y then report "Key Y missing from X"; read the next row from Y; repeat from (2).
Actually this is a simplified version because (as you should have noticed) it doesn't tell you how to handle end-of-file in the two databases. But really, this is such an easy-to-understand process that you should be able to add on that little detail.