declare
v_Sql varchar2(2000);
v_count number;
begin
for xx in (select t.OWNER, t.TABLE_NAME, t.COLUMN_NAME from dba_tab_columns t where t.OWNER = '要查询的SCHEMA') loop
begin
v_Sql := 'select count(1) from ' || xx.owner || '.' || xx.table_name ||' where ' || LOWER(xx.column_name) || ' like ''%检索关键字%'' ';
execute immediate v_Sql
into v_count;
if (v_count >= 1) then
dbms_output.put_line(xx.table_name || ':' || xx.column_name || ':' || v_Sql);
end if;
exception
when others then
null;
end;
end loop;
end;
oracle 死锁
select t1.sid, t1.SERIAL#, t3.sql_text from v$session t1, v$locked_object t2, v$sql t3 where t1.sid = t2.SESSION_ID AND t3.hash_value = t1.sql_hash_value;