Realtime 'Active Session History' information of Oracle Databases
Whats more interesting than applying what we learn in real-time scenarios. This article is inspired by an interesting article I read a few days ago (URL shown below). Rather than using the reporting tool mentioned by the author, we will use Python's rich plotting libraries to create an interactive graph.
https://www.dba-scripts.com/scripts/diagnostic-and-tuning/oracle-active-session-history-ash/graph-active_session_history/
Steps we performed:
- Connect to Oracle Database using cx_Oracle library. Make sure to perform exception handling.
- Execute a SELECT statement to fetch the ASH information into a Pandas DataFrame, in our case ash_graph_copy or whatever, i was experimenting a lot and was lazy enough to let variable name be intact.
- Use the pivot_table method to create the pivot_table with SAMPLE_TIME column as the Index.
- This is purely to make the graphing easier.
- Use the iplot() to create the graph.
- Voila! Grab a pastry and have fun.
Comments
Post a Comment
Hey there, feel free to leave a comment.