|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<databaseChangeLog |
| 3 | + xmlns="http://www.liquibase.org/xml/ns/dbchangelog" |
| 4 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 5 | + xmlns:ora="http://www.oracle.com/xml/ns/dbchangelog-ext" |
| 6 | + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd" |
| 7 | +> |
| 8 | + <changeSet |
| 9 | + id="invalid_objects_check" |
| 10 | + author="jlyle" |
| 11 | + runOnChange="true" |
| 12 | + runAlways="true" |
| 13 | + > |
| 14 | + <preConditions onFail="MARK_RAN" onError="HALT"> |
| 15 | + <sqlCheck expectedResult="1"> |
| 16 | + select case when count(status) > 0 then 1 else 0 end as mycount from dba_objects where owner in ('SERT_CORE','SERT_PUB') and status = 'INVALID'; |
| 17 | + </sqlCheck> |
| 18 | + </preConditions> |
| 19 | + <rollback></rollback> |
| 20 | + <ora:runOracleScript ownerName="jlyle" sourceType="STRING" objectType="SCRIPT" objectName="invalid_objects_check"> |
| 21 | + <ora:source> |
| 22 | + set pagesize 50000 |
| 23 | + prompt "********************************************************************************" |
| 24 | + prompt "** Invalid Objects" |
| 25 | + prompt "********************************************************************************" |
| 26 | + select /*ansiconsole*/ |
| 27 | + owner||'.'||object_name invalid_object |
| 28 | + ,object_type |
| 29 | + from dba_objects |
| 30 | + where status = 'INVALID' |
| 31 | + and owner in ('SERT_CORE','SERT_PUB'); |
| 32 | + |
| 33 | + prompt "********************************************************************************" |
| 34 | + prompt "** Object Errors" |
| 35 | + prompt "********************************************************************************" |
| 36 | + select /*ansiconsole*/ |
| 37 | + owner||'.'||name invalid_object |
| 38 | + ,type |
| 39 | + ,sequence |
| 40 | + ,line |
| 41 | + ,position |
| 42 | + ,nvl(regexp_substr(regexp_replace(text, '^PL/SQL: '), '^(ORA|PLS|PLW)'), 'PLS') message_type |
| 43 | + ,regexp_replace(regexp_replace(text, '^PL/SQL: '), '(ORA|PLS|PLW)-[0-9]+: ') text |
| 44 | + from dba_errors |
| 45 | + where owner in ('SERT_CORE','SERT_PUB') |
| 46 | + order by owner, type, name, sequence; |
| 47 | + </ora:source> |
| 48 | + </ora:runOracleScript> |
| 49 | + <stop>*** ERROR Invalid objects exist in schema ***</stop> |
| 50 | + </changeSet> |
| 51 | +</databaseChangeLog> |
0 commit comments