oracle 有没有办法对所有oracle包和程序进行全文搜索?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/251902/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there a way to do full text search of all oracle packages and procedures?
提问by George Mauer
I would like to search through all of my procedures packages and functions for a certain phrase.
我想在我所有的程序包和函数中搜索某个短语。
Since it is possible to retrieve the code for compiled procedures using toad I assume that the full text is stored in some data dictionary table. Does anyone know where that would be?
由于可以使用 toad 检索已编译过程的代码,因此我假设全文存储在某个数据字典表中。有谁知道那会在哪里?
Thanks a lot
非常感谢
回答by Justin Cave
You can do something like
你可以做类似的事情
SELECT name, line, text
FROM dba_source
WHERE upper(text) like upper('%<<your_phrase>>%') escape '\'
回答by Jim Hudson
Toad's "object search" routine will look through ALL_SOURCE (and other parts of the data dictionary). Of course, this will be limited to the objects the connected user is allowed to see. If you have access to the DBA version, great. If not, you won't be searching everything.
Toad 的“对象搜索”例程将查看 ALL_SOURCE(和数据字典的其他部分)。当然,这将仅限于允许连接的用户看到的对象。如果您可以访问 DBA 版本,那就太好了。如果没有,您将不会搜索所有内容。
Also, if you're way back on Oracle 7, or your database was migrated up from Oracle 7 to 8i or 9i (not sure about 10 or 11), then trigger source may not appear in the user_source or all_source views. Best to check. The easiest way I've found to get it to appear is to do an actual modification -- add a space, for example -- and recompile the trigger.
此外,如果您回到 Oracle 7,或者您的数据库已从 Oracle 7 迁移到 8i 或 9i(不确定是 10 还是 11),那么触发器源可能不会出现在 user_source 或 all_source 视图中。最好检查一下。我发现让它出现的最简单方法是进行实际修改——例如添加一个空格——然后重新编译触发器。
回答by Mark
Do you mean using PL/SQL? Or just using TOAD? I know that you can use the "Find Objects" (or something like that) feature to manually search through all objects like procs, tables, etc...
你的意思是使用 PL/SQL 吗?还是只使用 TOAD?我知道您可以使用“查找对象”(或类似的东西)功能来手动搜索所有对象,例如 proc、表等...