Bo's Oracle Station

查看: 2134|回复: 0

课程第49次(2017-10-31星期二)

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2017-10-31 20:44:19 | 显示全部楼层 |阅读模式
  1. select  * from dba_rsrc_plans  ;

  2. select  * from dba_rsrc_plan_directives  d
  3. where d.PLAN='PLAN3';

  4. select * from dba_rsrc_group_mappings;

  5. select  * from dba_rsrc_consumer_groups;

  6. --------------------------

  7. DECLARE
  8. spfileValue VARCHAR2(1000);
  9. execText VARCHAR2(1000);
  10. scopeValue VARCHAR2(30) := 'MEMORY';
  11. planName VARCHAR2(100) :='PLAN4';
  12. BEGIN
  13. dbms_resource_manager.clear_pending_area();
  14. dbms_resource_manager.create_pending_area();
  15. dbms_resource_manager.create_plan( plan => 'PLAN4', comment => 'plan4',max_iops => NULL,max_mbps => NULL,cpu_mth=>'RATIO' );
  16. dbms_resource_manager.create_plan_directive(
  17.     plan => 'PLAN4',
  18.     group_or_subplan => 'GROUP1',
  19.     comment => '',
  20.     switch_elapsed_time => NULL,
  21.      max_utilization_limit => '',
  22.     mgmt_p1 => 100, mgmt_p2 => NULL, mgmt_p3 => NULL, mgmt_p4 => NULL,
  23.     mgmt_p5 => NULL, mgmt_p6 => NULL, mgmt_p7 => NULL, mgmt_p8 => NULL ,
  24.     parallel_degree_limit_p1 => NULL ,
  25.     parallel_target_percentage => NULL ,
  26.     parallel_queue_timeout => NULL ,
  27.     parallel_stmt_critical => 'false' ,
  28.     switch_io_logical => NULL ,
  29.     switch_io_reqs => NULL ,
  30.    switch_io_megabytes => NULL ,
  31.     active_sess_pool_p1 => NULL,
  32.     queueing_p1 => NULL,
  33.     switch_group => '',
  34.     switch_time => NULL,
  35.     switch_estimate => case 'false' when 'false' then false when 'true' then true else false end,
  36.     undo_pool => NULL ,
  37.     max_idle_time => NULL,
  38.     max_idle_blocker_time => NULL,
  39.     switch_for_call => case 'true' when 'false' then false when 'true' then true else false end

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

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

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

  115. );
  116. dbms_resource_manager.submit_pending_area();
  117. END;


  118. ------

  119. DECLARE
  120. spfileValue VARCHAR2(1000);
  121. execText VARCHAR2(1000);
  122. scopeValue VARCHAR2(30) := 'MEMORY';
  123. planName VARCHAR2(100) :='PLAN5';
  124. BEGIN
  125. dbms_resource_manager.clear_pending_area();
  126. dbms_resource_manager.create_pending_area();
  127. dbms_resource_manager.create_plan( plan => 'PLAN5', comment => 'plan5',max_iops => NULL,max_mbps => NULL );
  128. dbms_resource_manager.create_plan_directive(
  129.     plan => 'PLAN5',
  130.     group_or_subplan => 'GROUP1',
  131.     comment => '',
  132.     switch_elapsed_time => NULL,
  133.      max_utilization_limit => '',
  134.     mgmt_p1 => 10, mgmt_p2 => 20, mgmt_p3 => NULL, mgmt_p4 => NULL,
  135.     mgmt_p5 => NULL, mgmt_p6 => NULL, mgmt_p7 => NULL, mgmt_p8 => NULL ,
  136.     parallel_degree_limit_p1 => NULL ,
  137.     parallel_target_percentage => NULL ,
  138.     parallel_queue_timeout => NULL ,
  139.     parallel_stmt_critical => 'false' ,
  140.     switch_io_logical => NULL ,
  141.     switch_io_reqs => NULL ,
  142.    switch_io_megabytes => NULL ,
  143.     active_sess_pool_p1 => NULL,
  144.     queueing_p1 => NULL,
  145.     switch_group => '',
  146.     switch_time => NULL,
  147.     switch_estimate => case 'false' when 'false' then false when 'true' then true else false end,
  148.     undo_pool => NULL ,
  149.     max_idle_time => NULL,
  150.     max_idle_blocker_time => NULL,
  151.     switch_for_call => case 'true' when 'false' then false when 'true' then true else false end

  152. );
  153. dbms_resource_manager.create_plan_directive(
  154.     plan => 'PLAN5',
  155.     group_or_subplan => 'GROUP2',
  156.     comment => '',
  157.     switch_elapsed_time => NULL,
  158.      max_utilization_limit => '',
  159.     mgmt_p1 => 20, mgmt_p2 => NULL, mgmt_p3 => NULL, mgmt_p4 => NULL,
  160.     mgmt_p5 => NULL, mgmt_p6 => NULL, mgmt_p7 => NULL, mgmt_p8 => NULL ,
  161.     parallel_degree_limit_p1 => NULL ,
  162.     parallel_target_percentage => NULL ,
  163.     parallel_queue_timeout => NULL ,
  164.     parallel_stmt_critical => 'false' ,
  165.     switch_io_logical => NULL ,
  166.     switch_io_reqs => NULL ,
  167.    switch_io_megabytes => NULL ,
  168.     active_sess_pool_p1 => NULL,
  169.     queueing_p1 => NULL,
  170.     switch_group => '',
  171.     switch_time => NULL,
  172.     switch_estimate => case 'false' when 'false' then false when 'true' then true else false end,
  173.     undo_pool => NULL ,
  174.     max_idle_time => NULL,
  175.     max_idle_blocker_time => NULL,
  176.     switch_for_call => case 'true' when 'false' then false when 'true' then true else false end

  177. );
  178. dbms_resource_manager.create_plan_directive(
  179.     plan => 'PLAN5',
  180.     group_or_subplan => 'OTHER_GROUPS',
  181.     comment => '',
  182.     switch_elapsed_time => NULL,
  183.      max_utilization_limit => '',
  184.     mgmt_p1 => 30, mgmt_p2 => NULL, mgmt_p3 => NULL, mgmt_p4 => NULL,
  185.     mgmt_p5 => NULL, mgmt_p6 => NULL, mgmt_p7 => NULL, mgmt_p8 => NULL ,
  186.     parallel_degree_limit_p1 => NULL ,
  187.     parallel_target_percentage => NULL ,
  188.     parallel_queue_timeout => NULL ,
  189.     parallel_stmt_critical => 'false' ,
  190.     switch_io_logical => NULL ,
  191.     switch_io_reqs => NULL ,
  192.    switch_io_megabytes => NULL ,
  193.     active_sess_pool_p1 => NULL,
  194.     queueing_p1 => NULL,
  195.     switch_group => '',
  196.     switch_time => NULL,
  197.     switch_estimate => case 'false' when 'false' then false when 'true' then true else false end,
  198.     undo_pool => NULL ,
  199.     max_idle_time => NULL,
  200.     max_idle_blocker_time => NULL,
  201.     switch_for_call => case 'true' when 'false' then false when 'true' then true else false end

  202. );
  203. dbms_resource_manager.create_plan_directive(
  204.     plan => 'PLAN5',
  205.     group_or_subplan => 'SYS_GROUP',
  206.     comment => '',
  207.     switch_elapsed_time => NULL,
  208.      max_utilization_limit => '',
  209.     mgmt_p1 => 40, mgmt_p2 => NULL, mgmt_p3 => NULL, mgmt_p4 => NULL,
  210.     mgmt_p5 => NULL, mgmt_p6 => NULL, mgmt_p7 => NULL, mgmt_p8 => NULL ,
  211.     parallel_degree_limit_p1 => NULL ,
  212.     parallel_target_percentage => NULL ,
  213.     parallel_queue_timeout => NULL ,
  214.     parallel_stmt_critical => 'false' ,
  215.     switch_io_logical => NULL ,
  216.     switch_io_reqs => NULL ,
  217.    switch_io_megabytes => NULL ,
  218.     active_sess_pool_p1 => NULL,
  219.     queueing_p1 => NULL,
  220.     switch_group => '',
  221.     switch_time => NULL,
  222.     switch_estimate => case 'false' when 'false' then false when 'true' then true else false end,
  223.     undo_pool => NULL ,
  224.     max_idle_time => NULL,
  225.     max_idle_blocker_time => NULL,
  226.     switch_for_call => case 'true' when 'false' then false when 'true' then true else false end

  227. );
  228. dbms_resource_manager.submit_pending_area();
  229. ;
复制代码


Screenshot.png


  1. DECLARE
  2. spfileValue VARCHAR2(1000);
  3. execText VARCHAR2(1000);
  4. scopeValue VARCHAR2(30) := 'MEMORY';
  5. planName VARCHAR2(100) :='PLAN1';
  6. BEGIN
  7. dbms_resource_manager.clear_pending_area();
  8. dbms_resource_manager.create_pending_area();
  9. dbms_resource_manager.update_plan_directive(
  10.     plan => 'PLAN1',
  11.     group_or_subplan => 'GROUP1',
  12.     new_comment => '',
  13.     new_switch_elapsed_time => NULL,
  14.     new_mgmt_p1 => 30, new_mgmt_p2 => NULL, new_mgmt_p3 => NULL, new_mgmt_p4 => NULL,
  15.     new_mgmt_p5 => NULL, new_mgmt_p6 => NULL, new_mgmt_p7 => NULL, new_mgmt_p8 => NULL ,
  16.     new_parallel_degree_limit_p1 => 1 ,
  17.     new_parallel_target_percentage => NULL ,
  18.     new_parallel_queue_timeout => NULL ,
  19.     new_parallel_stmt_critical => 'false' ,
  20.     new_switch_io_logical => NULL ,
  21.     new_switch_io_reqs => NULL,
  22.     new_switch_io_megabytes => NULL ,
  23.     new_active_sess_pool_p1 => NULL,
  24.     new_queueing_p1 => NULL,
  25.     new_switch_group => NULL,
  26.     new_switch_time => NULL,
  27.     new_switch_estimate => case 'false' when 'false' then false when 'true' then true else false end ,
  28.     new_undo_pool => NULL ,
  29.     new_max_idle_time => NULL,
  30.     new_max_idle_blocker_time => NULL,
  31.     new_switch_for_call => case 'true' when 'false' then false when 'true' then true else false end

  32. );
  33. dbms_resource_manager.update_plan_directive(
  34.     plan => 'PLAN1',
  35.     group_or_subplan => 'GROUP2',
  36.     new_comment => '',
  37.     new_switch_elapsed_time => NULL,
  38.     new_mgmt_p1 => 15, new_mgmt_p2 => NULL, new_mgmt_p3 => NULL, new_mgmt_p4 => NULL,
  39.     new_mgmt_p5 => NULL, new_mgmt_p6 => NULL, new_mgmt_p7 => NULL, new_mgmt_p8 => NULL ,
  40.     new_parallel_degree_limit_p1 => NULL ,
  41.     new_parallel_target_percentage => NULL ,
  42.     new_parallel_queue_timeout => NULL ,
  43.     new_parallel_stmt_critical => 'false' ,
  44.     new_switch_io_logical => NULL ,
  45.     new_switch_io_reqs => NULL,
  46.     new_switch_io_megabytes => NULL ,
  47.     new_active_sess_pool_p1 => NULL,
  48.     new_queueing_p1 => NULL,
  49.     new_switch_group => NULL,
  50.     new_switch_time => NULL,
  51.     new_switch_estimate => case 'false' when 'false' then false when 'true' then true else false end ,
  52.     new_undo_pool => NULL ,
  53.     new_max_idle_time => NULL,
  54.     new_max_idle_blocker_time => NULL,
  55.     new_switch_for_call => case 'true' when 'false' then false when 'true' then true else false end

  56. );
  57. dbms_resource_manager.update_plan_directive(
  58.     plan => 'PLAN1',
  59.     group_or_subplan => 'SYS_GROUP',
  60.     new_comment => '',
  61.     new_switch_elapsed_time => NULL,
  62.     new_mgmt_p1 => 50, new_mgmt_p2 => NULL, new_mgmt_p3 => NULL, new_mgmt_p4 => NULL,
  63.     new_mgmt_p5 => NULL, new_mgmt_p6 => NULL, new_mgmt_p7 => NULL, new_mgmt_p8 => NULL ,
  64.     new_parallel_degree_limit_p1 => NULL ,
  65.     new_parallel_target_percentage => NULL ,
  66.     new_parallel_queue_timeout => NULL ,
  67.     new_parallel_stmt_critical => 'false' ,
  68.     new_switch_io_logical => NULL ,
  69.     new_switch_io_reqs => NULL,
  70.     new_switch_io_megabytes => NULL ,
  71.     new_active_sess_pool_p1 => NULL,
  72.     new_queueing_p1 => NULL,
  73.     new_switch_group => NULL,
  74.     new_switch_time => NULL,
  75.     new_switch_estimate => case 'false' when 'false' then false when 'true' then true else false end ,
  76.     new_undo_pool => NULL ,
  77.     new_max_idle_time => NULL,
  78.     new_max_idle_blocker_time => NULL,
  79.     new_switch_for_call => case 'true' when 'false' then false when 'true' then true else false end

  80. );
  81. dbms_resource_manager.update_plan_directive(
  82.     plan => 'PLAN1',
  83.     group_or_subplan => 'OTHER_GROUPS',
  84.     new_comment => '',
  85.     new_switch_elapsed_time => NULL,
  86.     new_mgmt_p1 => 5, new_mgmt_p2 => NULL, new_mgmt_p3 => NULL, new_mgmt_p4 => NULL,
  87.     new_mgmt_p5 => NULL, new_mgmt_p6 => NULL, new_mgmt_p7 => NULL, new_mgmt_p8 => NULL ,
  88.     new_parallel_degree_limit_p1 => NULL ,
  89.     new_parallel_target_percentage => NULL ,
  90.     new_parallel_queue_timeout => NULL ,
  91.     new_parallel_stmt_critical => 'false' ,
  92.     new_switch_io_logical => NULL ,
  93.     new_switch_io_reqs => NULL,
  94.     new_switch_io_megabytes => NULL ,
  95.     new_active_sess_pool_p1 => NULL,
  96.     new_queueing_p1 => NULL,
  97.     new_switch_group => NULL,
  98.     new_switch_time => NULL,
  99.     new_switch_estimate => case 'false' when 'false' then false when 'true' then true else false end ,
  100.     new_undo_pool => NULL ,
  101.     new_max_idle_time => NULL,
  102.     new_max_idle_blocker_time => NULL,
  103.     new_switch_for_call => case 'true' when 'false' then false when 'true' then true else false end

  104. );
  105. dbms_resource_manager.submit_pending_area();
  106. END;
  107.                         
复制代码
Screenshot.png

  1. [oracle@station26 ~]$ sqlplus /nolog

  2. SQL*Plus: Release 12.1.0.2.0 Production on Tue Oct 31 21:22:32 2017

  3. Copyright (c) 1982, 2014, Oracle.  All rights reserved.

  4. SQL> conn hr/oracle_4U
  5. Connected.
  6. SQL> select  count(*) from t_big;

  7.   COUNT(*)
  8. ----------
  9.     326347

  10. SQL> select  * from v$pq_sesstat;

  11. STATISTIC                       LAST_QUERY SESSION_TOTAL     CON_ID
  12. ------------------------------ ---------- ------------- ----------
  13. Queries Parallelized                        0              0          0
  14. DML Parallelized                        0              0          0
  15. DDL Parallelized                        0              0          0
  16. DFO Trees                                0              0          0
  17. Server Threads                                0              0          0
  18. Allocation Height                        0              0          0
  19. Allocation Width                        0              0          0
  20. Local Msgs Sent                         0              0          0
  21. Distr Msgs Sent                         0              0          0
  22. Local Msgs Recv'd                        0              0          0
  23. Distr Msgs Recv'd                        0              0          0

  24. STATISTIC                       LAST_QUERY SESSION_TOTAL     CON_ID
  25. ------------------------------ ---------- ------------- ----------
  26. DOP                                        0              0          0
  27. Slave Sets                                0              0          0

  28. 13 rows selected.

  29. SQL> create  index i_big on t_big(text )  parallel  20 ;

  30. Index created.

  31. SQL> select  * from v$pq_sesstat;

  32. STATISTIC                       LAST_QUERY SESSION_TOTAL     CON_ID
  33. ------------------------------ ---------- ------------- ----------
  34. Queries Parallelized                        0              0          0
  35. DML Parallelized                        0              0          0
  36. DDL Parallelized                        0              0          0
  37. DFO Trees                                0              0          0
  38. Server Threads                                0              0          0
  39. Allocation Height                        0              0          0
  40. Allocation Width                        0              0          0
  41. Local Msgs Sent                         0              0          0
  42. Distr Msgs Sent                         0              0          0
  43. Local Msgs Recv'd                        0              0          0
  44. Distr Msgs Recv'd                        0              0          0

  45. STATISTIC                       LAST_QUERY SESSION_TOTAL     CON_ID
  46. ------------------------------ ---------- ------------- ----------
  47. DOP                                        0              0          0
  48. Slave Sets                                0              0          0

  49. 13 rows selected.

  50. SQL> drop index i_big;

  51. Index dropped.

  52. SQL> create  index i_big on t_big(text )  parallel  20 ;

  53. Index created.

  54. SQL> select  * from v$pq_sesstat;

  55. STATISTIC                       LAST_QUERY SESSION_TOTAL     CON_ID
  56. ------------------------------ ---------- ------------- ----------
  57. Queries Parallelized                        0              0          0
  58. DML Parallelized                        0              0          0
  59. DDL Parallelized                        1              1          0
  60. DFO Trees                                1              1          0
  61. Server Threads                               40              0          0
  62. Allocation Height                       20              0          0
  63. Allocation Width                        1              0          0
  64. Local Msgs Sent                      3269           3269          0
  65. Distr Msgs Sent                         0              0          0
  66. Local Msgs Recv'd                     3269           3269          0
  67. Distr Msgs Recv'd                        0              0          0

  68. STATISTIC                       LAST_QUERY SESSION_TOTAL     CON_ID
  69. ------------------------------ ---------- ------------- ----------
  70. DOP                                       20              0          0
  71. Slave Sets                                2              0          0

  72. 13 rows selected.

  73. SQL>
复制代码


回复

使用道具 举报

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

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-4-23 16:43 , Processed in 0.038718 second(s), 27 queries .

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