This is how to detect the longest running queries in an Oracle Database by utilizing the tables dba_hist_sqlstat, dba_hist_sqltext, and dba_hist_snapshot. We will also explore the previous execution plans (hash values) that could potentially offer better performance. Lastly, we will differentiate between SQL Profiles