Oracle 并行 (parallel) 大批量数据 dml

-- 步骤

1、设置数据库为非归档模式(默认数据库处于非归档模式)

 

2、设置表空间为nologging模式

  alter tablespace TBS_XXX nologging;

3、开起会话并行dml

  alter session enable parallel dml;

4、开起表为nologging模式

  alter table xxx nologging;

5、执行并行dml

  insert /*+append*/ into table1 select /*+parallel(t 100)*/ * from table2 t where ...

  update /*+parallel(t 100)*/  table  t set ...;

6、关闭表nologging模式

  alter table xxx logging;

7、关闭会话并行dml

  alter session disable parallel dml;

 

-- 查看线程
  select * from v$px_process;

-- 查询正在执行的SQL

  select b.sid,b.username,b.serial#,spid,paddr,sql_text,b.machine 

  from v$process a, v$session b, v$sqlarea c

  where a.addr = b.paddr and b.sql_hash_value = c.hash_value;

 

posted @ 2020-11-03 19:33  smandar  阅读(931)  评论(0编辑  收藏  举报