RE: Semi-OT: Vi Question/Need
Date: Tue, 19 Mar 2013 15:38:22 -0500
Message-ID: <F05D8DF1FB25F44085DB74CB916678E8879A9DB0FC_at_NADCWPMSGCMS10.hca.corpad.net>
Actually - just realized. The BASIC plan is close to what I need, but not exactly either because the STEP IDs can be/are different so those lines get flagged as diffs - so I still have to strip off the first 7 chars (which is easy in vi). So BASIC gets me closer, then I run through vi search/replace and then do the compare in Winmerge.
Voila! Perfect diff output (Winmerge moves sections that match when it can so that steps/sections that occur later don't get shown as diffs).
Chris
-----Original Message-----
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Christopher.Taylor2_at_parallon.net
Sent: Sunday, March 17, 2013 5:09 PM
To: kerry.osborne_at_enkitec.com; tanel_at_tanelpoder.com
Cc: oracle-l_at_freelists.org
Subject: RE: Semi-OT: Vi Question/Need
Thanks Kerry - Bruno Pier Paolo suggested using the 'BASIC' argument for plan stats and that worked perfectly. I can copy the plans from different environments, paste in Winmerge and get a nice quick and easy diff compare.
This thread took on a life of its own after my reply to Bruno. (THANKS to everyone who has responded)
Chris
-----Original Message-----
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Kerry Osborne
Sent: Sunday, March 17, 2013 8:38 AM
To: tanel_at_tanelpoder.com
Cc: oracle-l Freelists
Subject: Re: Semi-OT: Vi Question/Need
Or you could use SQL*Plus to get what you want in the first place. (use substr and a few where clauses)
SYS_at_dbm1> l
1 select substr(PLAN_TABLE_OUTPUT,1,73) PLAN_TABLE_OUTPUT from table(dbms_xplan.display_cursor('&sql_id','&child_no','typical'))
2 where PLAN_TABLE_OUTPUT like '|%' or PLAN_TABLE_OUTPUT like '-------------------------------------------------------%'3* or PLAN_TABLE_OUTPUT like 'SQL_ID%' or PLAN_TABLE_OUTPUT like 'Plan hash value%' SYS_at_dbm1> /
Enter value for sql_id: 1n60q90jkatjj
Enter value for child_no:
PLAN_TABLE_OUTPUT
SQL_ID 1n60q90jkatjj, child number 0
Plan hash value: 2886813138
| Id | Operation | Name | Rows | -------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | |
| 1 | SORT ORDER BY | | 1 |
| 2 | NESTED LOOPS | | 1 |
| 3 | NESTED LOOPS | | 1 |
| 4 | NESTED LOOPS | | 1 |
| 5 | FIXED TABLE FULL | X$KSLWT | 56 |
|* 6 | FIXED TABLE FIXED INDEX| X$KSUSE (ind:1) | 1 | |* 7 | FIXED TABLE FIXED INDEX | X$KSLED (ind:2) | 1 | |* 8 | FIXED TABLE FIXED INDEX | X$KGLCURSOR_CHILD (ind:2) | 1 | -------------------------------------------------------------------------
15 rows selected.
Kerry Osborne
Enkitec
blog: kerryosborne.oracle-guy.com
twitter: https://twitter.com/KerryOracleGuy
-- http://www.freelists.org/webpage/oracle-l -- http://www.freelists.org/webpage/oracle-lReceived on Tue Mar 19 2013 - 21:38:22 CET