I want to enable the hint GATHER_PLAN_STATISTICS for all queries that are run and then disable it once I do not need anymore.
I tried setting the session variable statistics_level to all like below:
alter session set statistics_level = all;
& I also tried:
alter system set statistics_level=all;
But neither worked. I tried using the SYS account and the normal user account but still did not work. Is there any additional things I need to do after running these queries?
EDIT:
This is how I invoke the DISPLAY_CURSOR function:
SELECT * FROM table(DBMS_XPLAN.DISPLAY_CURSOR(sql_id=>'1srsmak7r2gp1', format=>'ALLSTATS LAST +cost'));