Bo's Oracle Station

查看: 1979|回复: 0

课程第56次(2017-03-02星期四)

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2017-3-3 09:48:36 | 显示全部楼层 |阅读模式
1. 补充Moving Data中遗漏的部分:
  1. impdp  user1/oracle_4U  parfile=par2.par

  2. parfile:
  3. directory=datadir1
  4. network_link=dblink1
  5. flashback_scn=9727454
  6. tables=hr.ta
  7. remap_schema=hr:user1


  8. public database link:
  9. create public database link ....
复制代码
2. 2017-03-02.sql:
  1. select u.USERNAME, u.INITIAL_RSRC_CONSUMER_GROUP
  2.   from dba_users u
  3.   where u.USERNAME='HR';
  4.   
  5.   DECLARE
  6. spfileValue VARCHAR2(1000);
  7. execText VARCHAR2(1000);
  8. scopeValue VARCHAR2(30) := 'MEMORY';
  9. planName VARCHAR2(100) :='PLAN1';
  10. BEGIN
  11. dbms_resource_manager.clear_pending_area();
  12. dbms_resource_manager.create_pending_area();
  13. dbms_resource_manager.create_plan( plan => 'PLAN1', comment => 'plan1',max_iops => NULL,max_mbps => NULL );
  14. dbms_resource_manager.create_plan_directive(
  15.     plan => 'PLAN1',
  16.     group_or_subplan => 'GROUP1',
  17.     comment => '',
  18.     switch_elapsed_time => NULL,
  19.      max_utilization_limit => null,
  20.     mgmt_p1 => NULL, mgmt_p2 => 80, mgmt_p3 => NULL, mgmt_p4 => NULL,
  21.     mgmt_p5 => NULL, mgmt_p6 => NULL, mgmt_p7 => NULL, mgmt_p8 => NULL ,
  22.     parallel_degree_limit_p1 => NULL ,
  23.     parallel_target_percentage => NULL ,
  24.     parallel_queue_timeout => NULL ,
  25.     parallel_stmt_critical => 'false' ,
  26.     switch_io_logical => NULL ,
  27.     switch_io_reqs => NULL ,
  28.    switch_io_megabytes => NULL ,
  29.     active_sess_pool_p1 => NULL,
  30.     queueing_p1 => NULL,
  31.     switch_group => '',
  32.     switch_time => NULL,
  33.     switch_estimate => case 'false' when 'false' then false when 'true' then true else false end,
  34.     undo_pool => NULL ,
  35.     max_idle_time => NULL,
  36.     max_idle_blocker_time => NULL,
  37.     switch_for_call => case 'true' when 'false' then false when 'true' then true else false end

  38. );
  39. dbms_resource_manager.create_plan_directive(
  40.     plan => 'PLAN1',
  41.     group_or_subplan => 'GROUP2',
  42.     comment => '',
  43.     switch_elapsed_time => NULL,
  44.      max_utilization_limit => null,
  45.     mgmt_p1 => NULL, mgmt_p2 => 20, mgmt_p3 => NULL, mgmt_p4 => NULL,
  46.     mgmt_p5 => NULL, mgmt_p6 => NULL, mgmt_p7 => NULL, mgmt_p8 => NULL ,
  47.     parallel_degree_limit_p1 => NULL ,
  48.     parallel_target_percentage => NULL ,
  49.     parallel_queue_timeout => NULL ,
  50.     parallel_stmt_critical => 'false' ,
  51.     switch_io_logical => NULL ,
  52.     switch_io_reqs => NULL ,
  53.    switch_io_megabytes => NULL ,
  54.     active_sess_pool_p1 => NULL,
  55.     queueing_p1 => NULL,
  56.     switch_group => '',
  57.     switch_time => NULL,
  58.     switch_estimate => case 'false' when 'false' then false when 'true' then true else false end,
  59.     undo_pool => NULL ,
  60.     max_idle_time => NULL,
  61.     max_idle_blocker_time => NULL,
  62.     switch_for_call => case 'true' when 'false' then false when 'true' then true else false end

  63. );
  64. dbms_resource_manager.create_plan_directive(
  65.     plan => 'PLAN1',
  66.     group_or_subplan => 'LOW_GROUP',
  67.     comment => '',
  68.     switch_elapsed_time => NULL,
  69.      max_utilization_limit => null,
  70.     mgmt_p1 => NULL, mgmt_p2 => NULL, mgmt_p3 => 100, mgmt_p4 => NULL,
  71.     mgmt_p5 => NULL, mgmt_p6 => NULL, mgmt_p7 => NULL, mgmt_p8 => NULL ,
  72.     parallel_degree_limit_p1 => NULL ,
  73.     parallel_target_percentage => NULL ,
  74.     parallel_queue_timeout => NULL ,
  75.     parallel_stmt_critical => 'false' ,
  76.     switch_io_logical => NULL ,
  77.     switch_io_reqs => NULL ,
  78.    switch_io_megabytes => NULL ,
  79.     active_sess_pool_p1 => NULL,
  80.     queueing_p1 => NULL,
  81.     switch_group => '',
  82.     switch_time => NULL,
  83.     switch_estimate => case 'false' when 'false' then false when 'true' then true else false end,
  84.     undo_pool => NULL ,
  85.     max_idle_time => NULL,
  86.     max_idle_blocker_time => NULL,
  87.     switch_for_call => case 'true' when 'false' then false when 'true' then true else false end

  88. );
  89. dbms_resource_manager.create_plan_directive(
  90.     plan => 'PLAN1',
  91.     group_or_subplan => 'OTHER_GROUPS',
  92.     comment => '',
  93.     switch_elapsed_time => NULL,
  94.      max_utilization_limit => null,
  95.     mgmt_p1 => NULL, mgmt_p2 => NULL, mgmt_p3 => NULL, mgmt_p4 => 100,
  96.     mgmt_p5 => NULL, mgmt_p6 => NULL, mgmt_p7 => NULL, mgmt_p8 => NULL ,
  97.     parallel_degree_limit_p1 => NULL ,
  98.     parallel_target_percentage => NULL ,
  99.     parallel_queue_timeout => NULL ,
  100.     parallel_stmt_critical => 'false' ,
  101.     switch_io_logical => NULL ,
  102.     switch_io_reqs => NULL ,
  103.    switch_io_megabytes => NULL ,
  104.     active_sess_pool_p1 => NULL,
  105.     queueing_p1 => NULL,
  106.     switch_group => '',
  107.     switch_time => NULL,
  108.     switch_estimate => case 'false' when 'false' then false when 'true' then true else false end,
  109.     undo_pool => NULL ,
  110.     max_idle_time => NULL,
  111.     max_idle_blocker_time => NULL,
  112.     switch_for_call => case 'true' when 'false' then false when 'true' then true else false end

  113. );
  114. dbms_resource_manager.create_plan_directive(
  115.     plan => 'PLAN1',
  116.     group_or_subplan => 'SYS_GROUP',
  117.     comment => '',
  118.     switch_elapsed_time => NULL,
  119.      max_utilization_limit => null,
  120.     mgmt_p1 => 100, mgmt_p2 => NULL, mgmt_p3 => NULL, mgmt_p4 => NULL,
  121.     mgmt_p5 => NULL, mgmt_p6 => NULL, mgmt_p7 => NULL, mgmt_p8 => NULL ,
  122.     parallel_degree_limit_p1 => NULL ,
  123.     parallel_target_percentage => NULL ,
  124.     parallel_queue_timeout => NULL ,
  125.     parallel_stmt_critical => 'false' ,
  126.     switch_io_logical => NULL ,
  127.     switch_io_reqs => NULL ,
  128.    switch_io_megabytes => NULL ,
  129.     active_sess_pool_p1 => NULL,
  130.     queueing_p1 => NULL,
  131.     switch_group => '',
  132.     switch_time => NULL,
  133.     switch_estimate => case 'false' when 'false' then false when 'true' then true else false end,
  134.     undo_pool => NULL ,
  135.     max_idle_time => NULL,
  136.     max_idle_blocker_time => NULL,
  137.     switch_for_call => case 'true' when 'false' then false when 'true' then true else false end

  138. );
  139. dbms_resource_manager.submit_pending_area();
  140. END;


  141. select s.USERNAME, s.RESOURCE_CONSUMER_GROUP
  142. from v$session s
  143. where s.TERMINAL='pts/3';


  144. select s.USERNAME, s.RESOURCE_CONSUMER_GROUP
  145. from v$session s
  146. where s.TERMINAL='pts/3';


  147. select  * from dict where table_name like 'DBA_SCHEDULER_%';

  148. grant execute on jobclass1 to hr;

  149. ---
  150. create table hr.t05317_lw( a date ) ;

  151. create or replace procedure hr.proc05317_lw
  152. is
  153. begin
  154.    insert into  hr.t05317_lw values(sysdate);
  155.    commit;
  156. end;
  157. --em
  158. select  * from hr.t05317_lw;

  159. begin
  160.    dbms_scheduler.create_job(
  161.    job_name => 'hr.job8',
  162.    program_name=>'hr.program8',
  163.    schedule_name=>'hr.schedule8',
  164.    job_style=>'LIGHTWEIGHT',
  165.    enabled=> true);
  166. end;

  167. DECLARE
  168. newjob sys.job;
  169. newjobarr sys.job_array;
  170. BEGIN
  171. -- Create an array of JOB object types
  172.   newjobarr := sys.job_array();
  173. -- Allocate sufficient space in the array
  174.   newjobarr.extend(100);
  175. -- Add definitions for jobs
  176. FOR i IN 1..100 LOOP
  177.    -- Create a JOB object type
  178.    newjob := sys.job(job_name => 'HR.JOB8_' || to_char(i),
  179.                      job_style => 'LIGHTWEIGHT',
  180.                      job_template => 'HR.PROGRAM8',
  181.                    enabled => TRUE );
  182. -- Add job to the array
  183.    newjobarr(i) := newjob;
  184. END LOOP;
  185. -- Call CREATE_JOBS to create jobs in one transaction
  186. DBMS_SCHEDULER.CREATE_JOBS(newjobarr, 'TRANSACTIONAL');
  187. END;
复制代码




回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-4-19 03:41 , Processed in 0.160572 second(s), 33 queries .

快速回复 返回顶部 返回列表