sqlexplain − Create an explain plan
sqlexplain [options] -l u/p@c sqlid
For the provided sqlid, the sqlexplain utility will write an explain plan to stdout calling dbms_xplan.display_cursor or dbms_xplan.display_awr
-l u/p
-l u/p@c
Compulsory option to provide the username, password, and potentially connect string for a database connection that provides access to a login with access to various gv$ and dba_ views. If you omit /p, rwloadsim will prompt for the password.
--awr
Use the display_awr function rather then the display_cursor function from the dbms_xplan package.
--format=’ text string ’
Provide the format argument; the default is ’last, all, allstats’.
--child-no=child#
When using the display_cursor function, provide this cursor_child_no, the default is null implying all child cursors will be included.
--sessionid=sid
--instance=inst#
--spid=T
By default, the sqlid is taken from the command line. It can alternatively be retrived as nvl(sql_id,prev_sql_id) in the v$session dictionary view, by providing the first of these options, which will become a predicate on the sid column of v$session. If the second option is also used, gv$session will be used in stead with an additional predicate on the inst_id column. If the third option is used, there will be a join to v$process or gv$process with a predicate on its spid column.
sqlid
You must either provide a sqlid as an argument or retrieve it via the --sessionid or --spid option possibly in combination with the --instance option.
sqlexplain -l system/{password} 07rw9znc8g7aj
will print the output of running the query select * from table(dbms_xplan.display_cursor(’07rw9znc8g7aj’,0,’last, all, allstats’)) to stdout
Copyright
© 2024 Oracle Corporation
Licensed under the Universal Permissive License v 1.0 as
shown at https://oss.oracle.com/licenses/upl
rwloadsim(1rwl), sqlreport(2rwl), sqlmonitor(2rwl), sqlmonitorawr(2rwl), utilities(2rwl)