Wednesday, October 31, 2007

unit_test command in oradebug

Thanks to Dan Morgan from PSOUG for getting me to start down this road. Dan pointed me at the unit_test command in oradebug in 11g as well as the dbke_test test:

SQL> oradebug unit_test

So, what to type in after unit test. There's no usage output when you input garbage:

SQL> oradebug unit_test foo
ORA-00070: command foo is not valid

There's a promising section in the output of strings of an oracle 11g binary with the word 'test' appearing frequently:

ksuxkil_test
ksudss_dbg_test
dbke_test
...

SQL> oradebug unit_test dbke_test foo

Invalid option for dbke_test
Usage:
dbke_test dde_unit_main
dbke_test dde_flow_direct
dbke_test dde_flow_kge
dbke_test dde_test_tagrule
dbke_test sweep
dbke_test dde_test_split
dbke_test dde_flow_kge_soft
dbke_test dde_flow_kge_ora
dbke_test dump_incid_cache
dbke_test reset_incid_cache
dbke_test suspend

Aha! Seems a few of these tests visible in the binary have usage prompts.

I played around with dbke_test (related to ADR) and came up with a couple nice permutations:

SQL> oradebug unit_test dbke_test dde_flow_kge_ora 12333 0 0
SQL> oradebug unit_test dbke_test dde_flow_kge_ora stupid_idiot 0 0

ORA-700 anyone?
SQL> oradebug unit_test dbke_test dde_flow_kge_soft foo bar baz

Run it on a test system unless you want to give your fellow DBA a heart attack. Thanks again to Dan for sharing.

5 comments:

Jeremiah Wilton said...

Jared Still emailed me to note that this way is much simpler:

declare
v_bug exception;
pragma exception_init(v_bug,-600);
begin
raise v_bug;
end;
/

The only shortcoming of doing it this way is that you can't specify arguments for the -600 error.

Charles Schultz said...

Sweet! I like it!

For the oradebug, have any idea what it is actually doing? How did you know dbke_test was a part of ADR? And what prompted you (or Dan, rather) towards this wonderful, bizarre endeavour?

Thanks much!

Jared said...

Charle's: your pun has not gone unnoticed.

Jared said...

"Charles", not "Charle's" - an edit feature would be nice.

Charles Schultz said...

Thanks, Jared. You guys were having too much fun. =)