In a setup without database agents dynatrace does not querry the application databases at all.
The insights into database transactions are gained from the code that is executing the statements, e.g. JDBC or ADO.NET. So Dynatrace is able to see the statements executed by the applicatoin but does not execute statements agains application databases itself.
Database Agent executes three types of queries:
1. Monitoring for metrics - they access internal database structures allowing us to track its performance.
2. Live View queries - similar to the above, but executed on demand, when user requests more detailed information.
3. Execution plan queries - when user requests an execution plan for a query seen in Live View or captured in PurePath, Database Agent will retrieve it on demand.
At any point, the Database Agent doesn't access any tables with user data. We only query internal structures provided by the database engine. Please review the documentation to see the list of required permissions, retrieved measures and behaviors of the Live View and Execution Plan features: https://www.dynatrace.com/support/doc/appmon/database-monitoring/