Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Search for keywords in Oracle DDL

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

If you want to export all the definitions under the DD user, the code in SQL*Plus is as follows:

SET PAGESIZE 0

SET TRIMSPOOL ON

SET LINESIZE 10000

SET LONG 90000

SET FEEDBACK OFF

SET FEED OFF

SET ECHO OFF

SPOOL / tmp/schema_dd.sql

SELECT CASE

WHEN U.OBJECT_TYPE IN

('PROCEDURE',' FUNCTION','PACKAGE', 'TRIGGER') THEN

DBMS_METADATA.GET_DDL (U.OBJECT_TYPE, U.OBJECT_NAME, 'DD') | |

CHR (10) | |'/'

ELSE

DBMS_METADATA.GET_DDL (U.OBJECT_TYPE, U.OBJECT_NAME, 'DD') | |

CHR (10) | |';'

END AS SCOTT_DDL

FROM USER_OBJECTS U

WHERE U.OBJECT_TYPE IN

('PROCEDURE','FUNCTION','PACKAGE','TRIGGER')

AND U.OBJECT_NAME not like 'BIN%'

SPOOL OFF

You can export all DDL statements under the DD user to the / tmp/schema_dd.sql file. Find keywords in DDL

Fgrep 999 * | grep-v 999999

Fgrep 9999 * | grep-v 999999

Fgrep CN30006 * | grep-v CN300006

Fgrep CN3000006 * | grep-v CN300006 another simpler way to find keywords

Select * from dba_source t where OWNER='DD' and upper (text) like'% 999% 'and upper (text) not like'% 999999%'

Select * from dba_source t where OWNER='DD' and upper (text) like'% CN30006%' and upper (text) not like'% CN300006%'

Select * from dba_source t where OWNER='DD' and upper (text) like'% CN3000006%' and upper (text) not like'% CN300006%'

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report