This is upgraded version of nice utility procedure.
It sends execution plans if query is running longer then specific amount of time.
A trick was to split a big email into chunks as Oracle DB can’t send emails more than 32Kb.
Действия для SYS/SYS user actions:
1) Если у нас PDB, то выбираем необходимую:
PDBs action required:
alter session set container = OUR_PDB;
2) Обеспечиваем пользователя SYSTEM необходимыми правами. Хоть SYSTEM может селектить из вьюшек, гранты всё равно давать необходимо. Можно указать любого другого пользователя.
Provide required grants to system (or any other) user:
grant select on v_$sql to system; grant select on v_$sql_plan to system; grant select on v_$sql_plan_statistics_all to system; grant select on V_$SESSION to system; grant select on V_$instance to system;
3.1) Устанавливаем UTL_MAIL / Lets install UTL_MAIL:
Читать далее «Get long lasting sql execution plans on email / Получить план долгих запросов на почту»