Skip to content

Instantly share code, notes, and snippets.

@tmuth
Created February 17, 2015 21:24
Show Gist options
  • Save tmuth/0f1617f95efede3617d7 to your computer and use it in GitHub Desktop.
Save tmuth/0f1617f95efede3617d7 to your computer and use it in GitHub Desktop.
alter session file to set parallelism
set define "&" concat "."
set serveroutput on verify off echo off;
column PX_DEGREE_IN noprint new_value PX_DEGREE_NUM
column PX_LOCAL_IN noprint new_value PX_LOCAL
accept PX_DEGREE prompt 'Parallel Degree for Query, DML and DDL. Append an L to set parallel_force_local=true: '
select
regexp_replace('&PX_DEGREE','([[:digit:]]+).*','\1') PX_DEGREE_IN,
case when instr(upper('&PX_DEGREE'),'L') > 0 then 'TRUE' else 'FALSE' end PX_LOCAL_IN
from dual;
prompt PX_DEGREE_NUM=&PX_DEGREE_NUM
prompt PX_LOCAL=&PX_LOCAL
prompt
set echo on
set verify on
alter session force parallel query parallel &PX_DEGREE_NUM ;
alter session force parallel dml parallel &PX_DEGREE_NUM ;
alter session force parallel ddl parallel &PX_DEGREE_NUM ;
alter session set parallel_force_local=&PX_LOCAL ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment