declare
v_sql varchar2(100);
v_table_name varchar2(100);
v_ref sys_refcursor;
begin
for v_ref in (select object_name from user_objects where object_type = 'SEQUENCE') loop
v_sql := 'alter sequence ' || v_ref.object_name || ' nocache';
execute immediate v_sql;
dbms_output.put_line(v_sql);
end loop;
exception
when others then
dbms_output.put_line(SQLCODE || ' ' || SQLERRM);
end;
这里也可以设置cache的大小,比如要将所有序列的cache设置为20,只需要将nocache改成cache 20就可以了。