I would like to extract all "ORA-" errors from OEM then group by and count by error code.
Here is the text:
SQL> select SUMMARY_MSG from sysman.MGMT$INCIDENTS where SUMMARY_MSG like '%ORA-%';
Failed to connect: java.sql.SQLException: Listener refused the connection with
the following error: ORA-12505, TNS:listener does not currently know of SID give
n in connect descriptor.
So I just want the error codes from the string above "ORA-12505" output.
I tried this but it gives me text after the ORA-12505 that I do not want, think I need to trim function?
SQL> SELECT SUBSTR(msg, INSTR(msg,'ORA-', -4) +1) FROM sysman.mgmt$events where MSG like '%ORA-%' and rownum < 5;
RA-12505, TNS:listener does not currently know of SID given in connect descripto
Thanks for any tips!