Bo's Oracle Station

查看: 2494|回复: 0

课程第50次(2017-11-02星期四)

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2017-11-2 20:01:02 | 显示全部楼层 |阅读模式
1Z0-053第16章
1Z0-05219章(上完13章),1Z0-05321章(上完16章)和1Z0-063多租户部分共9章(上完0章)
总共上完全部49章中的29
  1. select  username , status from v$session
  2. where terminal='pts/0';

  3. select * from v$transaction ;

  4. select  * from dba_rsrc_plan_directives d
  5.   where d.PLAN='PLAN1';
  6.   
  7. begin
  8.    dbms_resource_manager.create_pending_area;
  9.    dbms_resource_manager.update_plan_directive(
  10.     plan => 'PLAN1',
  11.     group_or_subplan => 'GROUP1',
  12.     new_active_sess_pool_p1 => 2,
  13.     new_queueing_p1 => 3);
  14.         dbms_resource_manager.submit_pending_area();
  15. END;

  16. select d.GROUP_OR_SUBPLAN,

  17.    d.ACTIVE_SESS_POOL_P1, d.QUEUEING_P1 from dba_rsrc_plan_directives d
  18.   where d.PLAN='PLAN1';
  19.   
  20.   ------
  21.   
  22.   select  s.sid, terminal  ,   
  23.    s.RESOURCE_CONSUMER_GROUP  ,s.STATUS
  24.    from v$session  s where terminal in ('pts/2', 'pts/0','pts/1');
复制代码
Screenshot.png


  1. begin
  2.    dbms_resource_manager.create_pending_area;
  3.    dbms_resource_manager.update_plan_directive(
  4.     plan => 'PLAN1',
  5.     group_or_subplan => 'GROUP1',
  6.     new_active_sess_pool_p1 => -1,
  7.     new_queueing_p1 => -1);
  8.         dbms_resource_manager.submit_pending_area();
  9. END;

  10. select d.GROUP_OR_SUBPLAN,
  11.    d.ACTIVE_SESS_POOL_P1, d.QUEUEING_P1 from dba_rsrc_plan_directives d
  12.   where d.PLAN='PLAN1';
  13.   
  14.   begin
  15.    dbms_resource_manager.create_pending_area;
  16.    dbms_resource_manager.update_plan_directive(
  17.     plan => 'PLAN1',
  18.     group_or_subplan => 'GROUP1',
  19.     new_undo_pool=> 8
  20.     );
  21.         dbms_resource_manager.submit_pending_area();
  22. END;
  23.   
  24.   
  25.   select d.GROUP_OR_SUBPLAN,
  26.    d.UNDO_POOL from dba_rsrc_plan_directives d
  27.   where d.PLAN='PLAN1';
复制代码

Screenshot.png
12c在使用预估时有问题:
  1. begin
  2.    dbms_resource_manager.create_pending_area;
  3.    dbms_resource_manager.update_plan_directive(
  4.     plan => 'PLAN1',
  5.     group_or_subplan => 'GROUP1',
  6.     new_switch_group => 'CANCEL_SQL',
  7.         new_switch_elapsed_time => 5,
  8.         new_switch_estimate => true
  9.     );
  10.         dbms_resource_manager.submit_pending_area();
  11. END;

  12. select d.GROUP_OR_SUBPLAN,
  13.    d.SWITCH_ELAPSED_TIME,
  14.    d.SWITCH_ESTIMATE,
  15.    d.SWITCH_FOR_CALL,
  16.    d.SWITCH_GROUP,
  17.    d.SWITCH_IO_LOGICAL,
  18.    d.SWITCH_IO_MEGABYTES,
  19.    d.SWITCH_IO_REQS,
  20.    d.SWITCH_TIME,
  21.    d.SWITCH_TIME_IN_CALL
  22.   
  23.     from dba_rsrc_plan_directives d
  24.   where d.PLAN='PLAN1';
  25.   
  26.   begin
  27.    dbms_resource_manager.create_pending_area;
  28.    dbms_resource_manager.update_plan_directive(
  29.     plan => 'PLAN1',
  30.     group_or_subplan => 'GROUP1',
  31.     new_switch_group => 'CANCEL_SQL',
  32.         new_switch_elapsed_time => 5,
  33.         new_switch_estimate => false
  34.     );
  35.         dbms_resource_manager.submit_pending_area();
  36. END;

  37. select d.GROUP_OR_SUBPLAN,
  38.    d.SWITCH_ELAPSED_TIME,
  39.    d.SWITCH_ESTIMATE,
  40.    d.SWITCH_FOR_CALL,
  41.    d.SWITCH_GROUP,
  42.    d.SWITCH_IO_LOGICAL,
  43.    d.SWITCH_IO_MEGABYTES,
  44.    d.SWITCH_IO_REQS,
  45.    d.SWITCH_TIME,
  46.    d.SWITCH_TIME_IN_CALL
  47.   
  48.     from dba_rsrc_plan_directives d
  49.   where d.PLAN='PLAN1';
复制代码
  1. root@127.0.0.1's password:
  2. Last login: Tue Oct 31 19:55:42 2017 from station29.example.com
  3. [root@station26 ~]# su - oracle
  4. [oracle@station26 ~]$ sqlplus /nolog

  5. SQL*Plus: Release 12.1.0.2.0 Production on Thu Nov 2 19:10:35 2017

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

  7. SQL> conn hr/oracle_4U
  8. Connected.
  9. SQL> !ps
  10.   PID TTY          TIME CMD
  11. 7778 pts/0    00:00:00 bash
  12. 7802 pts/0    00:00:00 sqlplus
  13. 7821 pts/0    00:00:00 ps

  14. SQL> update employees set salary=salary*2 where employee_id=100;

  15. 1 row updated.

  16. SQL> commit;

  17. Commit complete.

  18. SQL> select  count(*) from t_big;

  19.   COUNT(*)
  20. ----------
  21.     326347

  22. SQL>  select  count(*) from t_big a, departments b ;

  23.   COUNT(*)
  24. ----------
  25.    8811369

  26. SQL> select  count(*) from t_big a, departments b, departments c;

  27.   COUNT(*)
  28. ----------
  29. 237906963

  30. SQL> !ps
  31.   PID TTY          TIME CMD
  32. 7778 pts/0    00:00:00 bash
  33. 7802 pts/0    00:00:00 sqlplus
  34. 8803 pts/0    00:00:00 ps

  35. SQL> drop index i_big ;

  36. Index dropped.

  37. SQL> desc t_big   
  38. Name                                           Null?    Type
  39. ----------------------------------------- -------- ----------------------------
  40. OWNER                                                    VARCHAR2(128)
  41. NAME                                                    VARCHAR2(128)
  42. TYPE                                                    VARCHAR2(12)
  43. LINE                                                    NUMBER
  44. TEXT                                                    VARCHAR2(4000)
  45. ORIGIN_CON_ID                                            NUMBER

  46. SQL> create index i_big on t_big ( text , dump(text)  , OWNER, NAME, TYPE, LINE , ORIGIN_CON_ID ) parallel 20 ;
  47. create index i_big on t_big ( text , dump(text)  , OWNER, NAME, TYPE, LINE , ORIGIN_CON_ID ) parallel 20
  48.                                           *
  49. ERROR at line 1:
  50. ORA-01450: maximum key length (6398) exceeded


  51. SQL> create index i_big on t_big ( text , substr(dump(text),1,20) , OWNER, NAME, TYPE, LINE , ORIGIN_CON_ID ) parallel 20 ;

  52. Index created.

  53. SQL> select  * from v$pq_sesstat ;

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

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

  71. 13 rows selected.

  72. SQL> drop index i_big;

  73. Index dropped.

  74. SQL> create index i_big on t_big ( text , substr(dump(text),1,20) , OWNER, NAME, TYPE, LINE , ORIGIN_CON_ID ) parallel 20 ;

  75. Index created.

  76. SQL> drop index i_big;

  77. Index dropped.

  78. SQL> create index i_big on t_big ( text , substr(dump(text),1,20) , substr(dump(text),21,10), OWNER, NAME, TYPE, LINE , ORIGIN_CON_ID ) parallel 20 ;

  79. Index created.

  80. SQL> drop index i_big;

  81. Index dropped.

  82. SQL> select  count(*)  from t_big a  , t_big b;
  83. ^Cselect        count(*)  from t_big a        , t_big b
  84.                        *
  85. ERROR at line 1:
  86. ORA-01013: user requested cancel of current operation



  87. SQL> conn hr/oracle_4U
  88. Connected.
  89. SQL> create table t05316_a ( a char(2000)) ;

  90. Table created.

  91. SQL> create table t05316_b ( a char(2000)) ;

  92. Table created.

  93. SQL> conn hr/oracle_4U
  94. Connected.
  95. SQL> conn / as sysdba
  96. Connected.
  97. SQL> insert into hr.t05316_a values ('A') ;

  98. 1 row created.

  99. SQL> commit;

  100. Commit complete.

  101. SQL> insert into hr.t05316_b values ('X') ;

  102. 1 row created.

  103. SQL> commit;

  104. Commit complete.

  105. SQL> conn hr/oracle_4U
  106. Connected.
  107. SQL> update t05316_a set a='B';

  108. 1 row updated.

  109. SQL> update t05316_a set a='C';

  110. 1 row updated.

  111. SQL> exec dbms_stats.gather_table_stat('HR','T_BIG') ;
  112. BEGIN dbms_stats.gather_table_stat('HR','T_BIG') ; END;

  113.                  *
  114. ERROR at line 1:
  115. ORA-06550: line 1, column 18:
  116. PLS-00302: component 'GATHER_TABLE_STAT' must be declared
  117. ORA-06550: line 1, column 7:
  118. PL/SQL: Statement ignored


  119. SQL>  exec dbms_stats.gather_table_stats('HR','T_BIG') ;

  120. PL/SQL procedure successfully completed.

  121. SQL> select count(*)  from t_big a , departments b, departments c;
  122. select count(*)  from t_big a , departments b, departments c
  123.                       *
  124. ERROR at line 1:
  125. ORA-56735: elapsed time limit exceeded - call aborted


  126. SQL> select count(*)  from t_big a , departments b, departments c;
  127. select count(*)  from t_big a , departments b, departments c
  128.                       *
  129. ERROR at line 1:
  130. ORA-56735: elapsed time limit exceeded - call aborted


  131. SQL>
复制代码
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 => -1,
  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 => NULL ,
  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 => 'CANCEL_SQL',
  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.submit_pending_area();
  34. END;



  35. begin
  36.    dbms_resource_manager.clear_pending_area;
  37.    dbms_resource_manager.create_pending_area;
  38.    dbms_resource_manager.update_plan_directive(
  39.     plan => 'PLAN1',
  40.     group_or_subplan => 'GROUP1',
  41.     new_switch_group => 'CANCEL_SQL',
  42.         new_switch_io_megabytes =>1,
  43.         new_switch_estimate => false
  44.     );
  45.         dbms_resource_manager.submit_pending_area();
  46. END;

  47. select d.GROUP_OR_SUBPLAN,
  48.    d.SWITCH_ELAPSED_TIME,
  49.    d.SWITCH_ESTIMATE,
  50.    d.SWITCH_FOR_CALL,
  51.    d.SWITCH_GROUP,
  52.    d.SWITCH_IO_LOGICAL,
  53.    d.SWITCH_IO_MEGABYTES,
  54.    d.SWITCH_IO_REQS,
  55.    d.SWITCH_TIME,
  56.    d.SWITCH_TIME_IN_CALL
  57.   
  58.     from dba_rsrc_plan_directives d
  59.   where d.PLAN='PLAN1';
复制代码
切换到别的组去:
  1. begin
  2.    dbms_resource_manager.create_pending_area;
  3.    dbms_resource_manager.update_plan_directive(
  4.     plan => 'PLAN1',
  5.     group_or_subplan => 'GROUP1',
  6.     new_undo_pool=> -1
  7.     );
  8.         dbms_resource_manager.submit_pending_area();
  9. END;

  10. begin
  11.    dbms_resource_manager.clear_pending_area;
  12.    dbms_resource_manager.create_pending_area;
  13.    dbms_resource_manager.update_plan_directive(
  14.     plan => 'PLAN1',
  15.     group_or_subplan => 'GROUP1',
  16.     new_switch_group => 'GROUP2',
  17.         new_switch_io_megabytes =>3,
  18.         new_switch_estimate => false,
  19.         new_switch_for_call =>true
  20.     );
  21.         dbms_resource_manager.submit_pending_area();
  22. END;

  23. select d.GROUP_OR_SUBPLAN,
  24.    d.SWITCH_ELAPSED_TIME,
  25.    d.SWITCH_ESTIMATE,
  26.    d.SWITCH_FOR_CALL,
  27.    d.SWITCH_GROUP,
  28.    d.SWITCH_IO_LOGICAL,
  29.    d.SWITCH_IO_MEGABYTES,
  30.    d.SWITCH_IO_REQS,
  31.    d.SWITCH_TIME,
  32.    d.SWITCH_TIME_IN_CALL
  33.   
  34.     from dba_rsrc_plan_directives d
  35.   where d.PLAN='PLAN1';
  36.   
  37.   ----
  38.   
  39.   begin
  40.    dbms_resource_manager.clear_pending_area;
  41.    dbms_resource_manager.create_pending_area;
  42.    dbms_resource_manager.update_plan_directive(
  43.     plan => 'PLAN1',
  44.     group_or_subplan => 'GROUP1',
  45.     new_switch_group => 'GROUP2',
  46.         new_switch_io_megabytes =>-1,
  47.         new_switch_elapsed_time => 5,
  48.         new_switch_estimate => false,
  49.         new_switch_for_call =>true
  50.     );
  51.         dbms_resource_manager.submit_pending_area();
  52. END;
  53.   
  54.   ---
  55.   select d.GROUP_OR_SUBPLAN,
  56.    d.SWITCH_ELAPSED_TIME,
  57.    d.SWITCH_ESTIMATE,
  58.    d.SWITCH_FOR_CALL,
  59.    d.SWITCH_GROUP,
  60.    d.SWITCH_IO_LOGICAL,
  61.    d.SWITCH_IO_MEGABYTES,
  62.    d.SWITCH_IO_REQS,
  63.    d.SWITCH_TIME,
  64.    d.SWITCH_TIME_IN_CALL
  65.   
  66.     from dba_rsrc_plan_directives d
  67.   where d.PLAN='PLAN1';
复制代码
Screenshot-1.png

  1. Resource Plans  >   Edit Resource Plan: PLAN1        Logged in as SYS
  2. Show SQL
  3.         
  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.update_plan_directive(
  14.     plan => 'PLAN1',
  15.     group_or_subplan => 'GROUP1',
  16.     new_comment => '',
  17.     new_switch_elapsed_time => -1,
  18.     new_mgmt_p1 => 30, new_mgmt_p2 => NULL, new_mgmt_p3 => NULL, new_mgmt_p4 => NULL,
  19.     new_mgmt_p5 => NULL, new_mgmt_p6 => NULL, new_mgmt_p7 => NULL, new_mgmt_p8 => NULL ,
  20.     new_parallel_degree_limit_p1 => NULL ,
  21.     new_parallel_target_percentage => NULL ,
  22.     new_parallel_queue_timeout => NULL ,
  23.     new_parallel_stmt_critical => 'false' ,
  24.     new_switch_io_logical => NULL ,
  25.     new_switch_io_reqs => NULL,
  26.     new_switch_io_megabytes => NULL ,
  27.     new_active_sess_pool_p1 => NULL,
  28.     new_queueing_p1 => NULL,
  29.     new_switch_group => '',
  30.     new_switch_time => NULL,
  31.     new_switch_estimate => case 'false' when 'false' then false when 'true' then true else false end ,
  32.     new_undo_pool => NULL ,
  33.     new_max_idle_time => 5,
  34.     new_max_idle_blocker_time => 3,
  35.     new_switch_for_call => case 'true' when 'false' then false when 'true' then true else false end

  36. );
  37. dbms_resource_manager.submit_pending_area();
  38. END;
  39.                         
复制代码

保障上限:
  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_max_utilization_limit => 100,
  15.     new_mgmt_p1 => 30, new_mgmt_p2 => NULL, new_mgmt_p3 => NULL, new_mgmt_p4 => NULL,
  16.     new_mgmt_p5 => NULL, new_mgmt_p6 => NULL, new_mgmt_p7 => NULL, new_mgmt_p8 => NULL ,
  17.     new_parallel_degree_limit_p1 => NULL ,
  18.     new_parallel_target_percentage => NULL ,
  19.     new_parallel_queue_timeout => NULL ,
  20.     new_parallel_stmt_critical => 'false' ,
  21.     new_switch_io_logical => NULL ,
  22.     new_switch_io_reqs => NULL,
  23.     new_switch_io_megabytes => NULL ,
  24.     new_active_sess_pool_p1 => NULL,
  25.     new_queueing_p1 => NULL,
  26.     new_switch_group => 'GROUP2',
  27.     new_switch_time => NULL,
  28.     new_switch_estimate => case 'false' when 'false' then false when 'true' then true else false end ,
  29.     new_undo_pool => NULL ,
  30.     new_max_idle_time => NULL,
  31.     new_max_idle_blocker_time => NULL,
  32.     new_switch_for_call => case 'true' when 'false' then false when 'true' then true else false end

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

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

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

  108. );
  109. dbms_resource_manager.submit_pending_area();
  110. END;
复制代码
观察resource_consumer_group对cpu的使用:
  1. SELECT begin_time, consumer_group_name, cpu_consumed_time, cpu_wait_time
  2. FROM v$rsrcmgrmetric_history
  3. ORDER BY begin_time;


  4. SELECT name, consumed_cpu_time, cpu_wait_time
  5. FROM v$rsrc_consumer_group;
复制代码
  1. select  s.USERNAME, s.RESOURCE_CONSUMER_GROUP
  2. from v$session s
  3. where s.TERMINAL='pts/1';

  4. select  s.USERNAME, s.RESOURCE_CONSUMER_GROUP,s.MACHINE
  5. from v$session s
  6. where s.TERMINAL='pts/0';

  7. BEGIN
  8. dbms_resource_manager.clear_pending_area();
  9. dbms_resource_manager.create_pending_area();
  10. dbms_resource_manager.set_consumer_group_mapping_pri(
  11.     EXPLICIT => 1,  CLIENT_MACHINE => 2,
  12.     SERVICE_MODULE_ACTION => 3,
  13.     SERVICE_MODULE => 4,
  14.     MODULE_NAME_ACTION => 5,
  15.     MODULE_NAME => 6,
  16.     SERVICE_NAME => 7,
  17.     ORACLE_USER => 8,
  18.     CLIENT_PROGRAM => 9,
  19.     CLIENT_OS_USER => 10,
  20.     CLIENT_ID => 11
  21. );
  22. dbms_resource_manager.submit_pending_area();
  23. END;

  24. ---
  25. select  * from DBA_RSRC_MAPPING_PRIORITY;

  26. select * from DBA_RSRC_GROUP_MAPPINGS;

  27. BEGIN
  28. dbms_resource_manager.clear_pending_area();
  29. dbms_resource_manager.create_pending_area();
  30. dbms_resource_manager.set_consumer_group_mapping(
  31.     dbms_resource_manager.client_machine,
  32.     '192.168.0.37',
  33.     NULL
  34. );
  35. dbms_resource_manager.submit_pending_area();
  36. END;

  37. select * from DBA_RSRC_GROUP_MAPPINGS;

  38. BEGIN
  39. dbms_resource_manager.clear_pending_area();
  40. dbms_resource_manager.create_pending_area();
  41. dbms_resource_manager.set_consumer_group_mapping(
  42.     dbms_resource_manager.client_machine,
  43.     'station37.example.com',
  44.     'group2'
  45. );
  46. dbms_resource_manager.submit_pending_area();
  47. END;

  48. select * from DBA_RSRC_GROUP_MAPPINGS;
复制代码

Screenshot.png

11g和12c  Simple Plan 的差别:
  1. begin
  2. dbms_resource_manager.create_simple_plan('PLAN7',
  3.          'group1', 60 , 'group2' ,40,
  4.                  GROUP1_PERCENT=>80,
  5.                  GROUP2_PERCENT=>50);
  6. end;

  7. select  * from dba_rsrc_plan_directives where plan='PLAN7';

  8. select  * from dba_rsrc_plans where plan='PLAN7';
复制代码
Screenshot.png
12c:

11g:
Screenshot-1.png
回复

使用道具 举报

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

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-5-2 06:03 , Processed in 0.034601 second(s), 27 queries .

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