Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

"after drop indexes on tables all views dependent get invalidated." ?

598210Jul 20 2008 — edited Jul 20 2008
Am I missing something or below paragraph may be wrong?

<from-documentation>
Data Warehousing Considerations

Some data warehouses drop indexes on tables at night to facilitate faster loads. However, all views dependent on the table whose index is dropped get invalidated. This means that subsequently running any package that reference these dropped views will invalidate the package.

Remember that whenever you create a table, index, and view, and then drop the index, all objects dependent on that table are invalidated, including views, packages, package bodies, functions, and procedures. This protects updatable join views.

To make the view valid again, use one of the following statements:

SELECT * FROM vtest;


or

ALTER VIEW vtest compile;
</from-documentation>

Oracle® Database Concepts 10g Release 2 (10.2)
6 Dependencies Among Schema Objects
http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/depend.htm#i3265

And below is a test case I tried on 10.2
CREATE TABLE testtab (testcol VARCHAR2(20));

CREATE INDEX nui_testtab on testtab (testcol);

CREATE VIEW testview AS SELECT * FROM testtab;

CREATE TRIGGER testtrig
BEFORE INSERT
ON testtab
BEGIN
  NULL;
END testtrig;
/

CREATE OR REPLACE PROCEDURE testproc IS
 i PLS_INTEGER;
BEGIN
  SELECT COUNT(*)
  INTO i
  FROM testtab;

  dbms_output.put_line(TO_CHAR(i));
END testproc;
/

set serveroutput on
exec dbms_utility.get_dependency('TABLE', 'HR', 'TESTTAB');

DEPENDENCIES ON HR.TESTTAB
------------------------------------------------------------------
*TABLE HR.TESTTAB()
*   VIEW HR.TESTVIEW()
*   TRIGGER HR.TESTTRIG()
*   PROCEDURE HR.TESTPROC()

PL/SQL procedure successfully completed

drop index NUI_TESTTAB ;

select object_name, object_type, status from user_objects where object_name like '%TEST%' ;

OBJECT_NAME                                                                      OBJECT_TYPE         STATUS
-------------------------------------------------------------------------------- ------------------- -------
TESTPROC                                                                         PROCEDURE           VALID
TESTTAB                                                                          TABLE               VALID
TESTTRIG                                                                         TRIGGER             VALID
TESTVIEW                                                                         VIEW                VALID
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 17 2008
Added on Jul 20 2008
1 comment
778 views