可以用工具导出或者自己写个procedure直接把sequence的sql 存到1个文件中,然后执行文件即可
procedure dump_all_sequences is
l_file_handle UTL_FILE.file_type;
begin
l_file_handle := UTL_FILE.fopen('PLSQL_OUTPUT',
'all_sequences.sql',
'W',
32000);
for c in (select sequence_name,
min_value,
max_value,
increment_by,
cycle_flag,
order_flag,
cache_size,
last_number
from user_sequences
order by sequence_name) loop
utl_file.put_line(l_file_handle, '--create ' || c.sequence_name);
utl_file.put_line(l_file_handle,
'create sequence ' || c.sequence_name);
utl_file.put_line(l_file_handle, 'minvalue ' || c.min_value);
utl_file.put_line(l_file_handle, 'maxvalue ' || c.max_value);
utl_file.put_line(l_file_handle, 'start with ' || c.last_number);
utl_file.put_line(l_file_handle, 'increment by ' || c.increment_by);
if c.cache_size <> 0 then
utl_file.put_line(l_file_handle, 'cache ' || c.cache_size);
else
utl_file.put_line(l_file_handle, 'nocache');
end if;
if c.cycle_flag = 'Y' then
utl_file.put_line(l_file_handle, 'cycle');
end if;
if c.order_flag = 'Y' then
utl_file.put_line(l_file_handle, 'order');
end if;
utl_file.put_line(l_file_handle, ';');
utl_file.put_line(l_file_handle, '/');
end loop;
end;