Oracle导出导入数据后,如果新导入的有存储过程、函数、触发器、视图之类的Object就需要重新编译一下,不然他们的状态就是无效的。提供一个SQL以供大家使用。
declare
objowner varchar2(50) := 'scott';
begin
for obj in (select * from all_objects where status = 'INVALID' and object_type in ('PROCEDURE', 'FUNCTION', 'VIEW', 'TRIGGER') and owner=upper(objowner))
loop
begin
execute immediate 'alter ' ||obj.object_type|| ' ' ||obj.object_name || ' compile';
exception
when others then
dbms_output.put_line(sqlerrm);
end;
end loop;
end;