只有dba_objects 试图显示 回收站中的对象

Summary

After creating a custom Oracle10g database with the Ultrasearch component configured, you check DBA_OBJECTS to see whether any objects are invalid and you find that one or more triggers (owned by the WK_TEST schema) are listed as invalid. For example:

SQL> select owner, object_name, object_type from dba_objects where status='INVALID';

OWNER OBJECT_NAME OBJECT_TYPE

WK_TEST BINI9rjO2Nrz43gQJQKQSwgzw==0 TRIGGER

When you check DBA_TRIGGERS, no triggers are listed as invalid.

When you check DBA_RECYCLEBIN, you find the original name of the trigger (before it was moved to the recyclebin). For example:

SQL> select owner,object_name,original_name, type from dba_recyclebin where

object_name='BINI9rjO2Nrz43gQJQKQSwgzw==0'

OWNER OBJECT_NAME ORIGINAL_NAME TYPE

WK_TEST BINI9rjO2Nrz43gQJQKQSwgzw==0 WK$UPD_TRIG TRIGGER

and when you check DBA_OBJECTS, you find that the original trigger is valid. For example:

SQL> select owner, object_name, object_type, status from dba_objects where object_name='WK$UPD_TRIG';

OWNER OBJECT_NAME OBJECT_TYPE STATUS

WK_TEST WK$UPD_TRIG TRIGGER VALID

In summary, the DBA_OBJECTS view lists an invalid trigger but further investigation shows that the trigger is in the recyclebin and is no longer required (as it has been re-created).

This problem may affect Oracle10g databases that do not have the Ultrasearch component configured, but the schema that owns the trigger(s) will be different.

Solution

To purge an invalid trigger from the recyclebin, and stop it from being referenced in DBA_OBJECTS, do the following:

  1. Identify the table that the trigger is based on (and any other indexes/triggers that are based on the same table). For example:

SQL> select owner, object_name, original_name, type from dba_recyclebin where base_object = (select base_object from dba_recyclebin where object_name='BINI9rjO2Nrz43gQJQKQSwgzw==0');

OWNER OBJECT_NAME ORIGINAL_NAME TYPE

WK_TEST BINI9rjO2Nnz43gQJQKQSwgzw==0 WK$URL_DSID_STATUS_IDX INDEX

WK_TEST BINI9rjO2Noz43gQJQKQSwgzw==0 WK$URL_DSID_ENQ_IDX INDEX

WK_TEST BINI9rjO2Npz43gQJQKQSwgzw==0 WK$URL_ACCESS_URL_IDX INDEX

WK_TEST BINI9rjO2Nqz43gQJQKQSwgzw==0 WK$URL_PK INDEX

WK_TEST BINI9rjO2Nrz43gQJQKQSwgzw==0 WKUPD_TRIG TRIGGER **WK_TEST BINI9rjO2Nsz43gQJQKQSwgzw==0 WKURL TABLE**

  1. Purge the table from the recyclebin. For example:

SQL> purge table WK_TEST."BINI9rjO2Nsz43gQJQKQSwgzw==0";

  1. Verify that the invalid trigger is no longer referenced in DBA_OBJECTS

  2. Repeat steps 1-3 for any other invalid triggers in the recyclebin

@ Added for WebIV searches:

Attachments :

Cause

The table that the trigger is based on was dropped and re-created, but the dropped table (and any associated triggers or indexes) were not purged from the recyclebin.

In Oracle10g, Development have made a small change to some of the data dictionary views.

This change means that most views will display objects that are currently in the recyclebin but some views will not display objects that are currently in the recyclebin.

The views that will not display objects that are currently in the recyclebin are:

  • the *_TABLES family of views (DBA_TABLES, USER_TABLES, ALL_TABLES)
  • the *_INDEXES family of views (DBA_INDEXES, USER_INDEXES, ALL_INDEXES)
  • the *_TRIGGERS family of views (DBA_TRIGGERS, USER_TRIGGERS, ALL_TRIGGERS)

Other views (like the *_OBJECTS family of views) will display objects that are currently in the recyclebin

相关推荐
逻辑驱动的ken4 小时前
Java高频面试考点场景题09
java·开发语言·数据库·算法·oracle·哈希算法·散列表
下地种菜小叶5 小时前
定时任务系统怎么设计?一次讲清任务注册、分布式调度、幂等执行与失败补偿
java·开发语言·数据库·oracle·rabbitmq
-XWB-7 小时前
【Oracle】Oracle诊断系列(5/6):统计信息与执行计划——优化器的“大脑”管理
数据库·oracle
大江东去浪淘尽千古风流人物7 小时前
【cuVSLAM】项目解析:一套偏工程实战的 GPU 紧耦合视觉惯性 SLAM
数据库·人工智能·python·机器学习·oracle
oradh7 小时前
Oracle数据库视图概述
数据库·oracle·数据库视图·oracle基础·oracle入门
爱学的小码8 小时前
MySQL(进阶)--存储过程和触发器
数据库·oracle
懒铭心9 小时前
RHEL 7 + Oracle 19.3.0 单实例部署指南
oracle
蜜獾云10 小时前
交易系统之数据库弱依赖解决方案
数据库·oracle
林深时见鹿v11 小时前
《后端开发全栈工具安装踩坑指南 & 经验沉淀手册》
java·人工智能·python·oracle
资深数据库专家11 小时前
恒生 PK 中电金信
数据库·oracle·人大金仓数据库