Query using wrong execution plan - Took long time to finish
Oracle Database 19c Enterprise Edition - Version 19.18
RAC database on Oracle Linux
We have a data load process that completes within 25 minutes but today it took 3 hours. I found out that, today it used a wrong / bad execution plan, therefore, it took lot longer.
BTW.. all stats are current for all tables and indexes. Also, we have not introduced any new indexes or data has not increased in size.
So, I have the following questions:
- how do I find the correct plan id or sql id that ran last week with 25 minutes completion?(sql query, etc.)
- After I found the above information, how should I remove this bad plan and pin a correct plan, so all subsequent data load runs using the correct execution plan?