There is a pretty raw way to add your own SQL queries to Mumbai. Since there is no way yet to configure it through a GUI dialog, here’s how to hack it in manually:
- Create an *.sql file in the config subdirectory that holds your SQL query (no trailing semicolon). As an example, let’s replicate the sessions view that already exists in Mumbai. We create a sessions.sql file with the line:
SELECT * FROM V$SESSION
- Create a file commands.ini in the config subdirectory, open it in a text editor and create an entry in this file for your SQL statement. For our example this might look like this:
Here is the same entry with explanations:
[sessions] -> Any unique identifier.
Caption=Sessions -> The caption for the menu item in Mumbai.
Command=sessions.sql -> The filename where the SQL statement is stored.
ImageIndex=-1 -> The index of the image to be used for the menu item.
SortBy=SID,SERIAL# -> Columns to sort by, separated by comma.
SortOrder=ASC,DESC -> Sort order for these columns.
SIDColumn=SID ->The column name which holds a SID.
SERIALCOLUMN=SERIAL# ->The column name which holds a SERIAL#.
SQLIDCOLUMN=SQL_ID ->The column name which holds a SQL_ID.
SQLCHILDNUMBERCOLUMN=SQL_CHILD_NUMBER ->The column name which holds an SQL child number.
PADDRCOLUMN=PADDR ->The column name which holds a process address.
- What you end up when you (re)start Mumbai is an entry for your SQL command on
the Ad-hoc>Custom button.
Notice how the context menu show functionality based on the additional information you gave about the meaning of specific columns like SID, SERIAL#, etc.. Currently only the column identifiers shown in the example entry above are recognized.