🍅Recompile Object Invalid on Oracle
Get Started
ทำการ Connect Database ด้วย SQL*Plus
sqlplus / as sysdbaSolution 1 ( กรณีที่มี Object Invalid ไม่เยอะ )
ทำการตรวจสอบ Object Status
select object_name, status from dba_objects where object_type = 'VIEW' and status = 'INVALID' ;ทำการ Recompile Object Invalid
alter view view_name compile ;Solution 2 ( กรณีที่มี Object Invalid เยอะ )
ทำการตรวจสอบ Object Status โดยใช้ SPOOL ในการ Export Command & Result
spool script.sql select ' alter view ' || object_name || ' compile ' from dba_objects where object_type = 'VIEW' and status like 'INVALID' ;ทำการแก้ไขไฟล์ script.sql ให้เหลือกแต่คำสั่ง Recompile Object Invalid
vi script.sqlalter view view_name compile ;
alter view view_name compile ;
alter view view_name compile ;ทำการรัน SQL Script
อ่านเพิ่มเติม : https://bit.ly/2zqc34z
Last updated
Was this helpful?