如何找到与特定表相关的所有代码,来自oracle数据库的触发器? [英] How do I find all code, triggers from an oracle database that relate to specific tables?

查看:133
本文介绍了如何找到与特定表相关的所有代码,来自oracle数据库的触发器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到一个问题,我需要从数据库中删除与某些表相关的所有代码和触发器,以便安装Solaris软件包.漫长而复杂的故事,但我需要 从干净的石板开始.

I have a problem where I need to remove all code and triggers from a database that relate to certain tables in order for a Solaris package to install. Long complicated story but I need to start with a clean slate.

我设法删除了所有现有的表/同义词,但是如何从sqlplus中找到相关的代码/触发器?

I've managed to remove all the existing tables/synonyms, but how to locate the code/triggers from sqlplus that is related?

不幸的是,删除数据库并重新创建它是不可行的.

Unfortunately, it's not feasible to drop the database and recreate it.

推荐答案

原来,所有表名都以我的模块名DAP为前缀.

Well, it turns out all the table names are prefixed with my module name DAP.

因此,要使用sqlplus查找所有表名和公共同义词:

So, to find all the table names and public synonyms with sqlplus:

select table_name from all_tables where table_name like 'DAP%';
select synonym_name from all_synonyms where table_name like 'DAP%';

获取触发器和序列的列表

To get a list of triggers and sequences

select trigger_name from all_triggers where table_name like 'DAP%';
select sequence_name from all_sequences where sequence_name like 'DAP%';

获取所有约束的列表

select table_name, constraint_name from all_constraints where table_name like 'DAP%';

要获取与DAP相关的代码:

To get the DAP related code:

select text from dba_source where name like 'DAP%';

我现在可以编写一个删除所有内容的脚本.

I can now write a script that drops everything.

这篇关于如何找到与特定表相关的所有代码,来自oracle数据库的触发器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆