I use this changelog for this:
- <!-- Check invalid objects in the Data Base -->
- <changeSet id="DataBaseCheck" author="e-ballo" runAlways="true" runOnChange="true" context="dev,int,uat,prod" >
- <preConditions onFailMessage="There are Invalid Objects in the data base!!"
- onFail="HALT" >
- <sqlCheck expectedResult="0">
- <![CDATA[
- SELECT count(1)
- FROM all_objects alo
- WHERE status = 'INVALID'
- AND alo.owner in
- ('HERE_YOUR_SCHEMA_NAMES')
- AND alo.OBJECT_NAME not like 'TST%'
- AND alo.OBJECT_NAME not like 'TEST%'
- ]]>
- </sqlCheck>
- </preConditions>
- </changeSet>
Just change the HERE_YOUR_SCHEMA_NAMES for your schema names.
I hope it helps.