利用存储过程结合DBLink批量复制表(Procedure),具体实现代码如下:
create or replace procedure "SP_CREATETABLE" authid current_user
as
v_tmp varchar2(50);
cursor cur_table is select table_name from user_tables@DBLINK_217;
begin
dbms_output.put_line('------ 开始 ------');
for tableName in cur_table loop
v_tmp := tableName.Table_Name;
dbms_output.put_line('------ create table start ------' ||v_tmp);
execute immediate 'create table '||v_tmp||' as select * from '||v_tmp||'@DBLINK_217 ';
dbms_output.put_line('------ create table finished ------' ||v_tmp);
end loop;
exception
when others then
dbms_output.put_line(v_tmp);
end;