|
----------------UNDO池:
- select pd.group_or_subplan, pd.undo_pool
- from dba_rsrc_plan_directives pd
- where pd.plan='PLAN1';
复制代码 | GROUP_OR_SUBPLAN | UNDO_POOL | 1 | GROUP1 | 8 | 2 | GROUP2 | | 3 | SYS_GROUP | | 4 | OTHER_GROUPS | | 5 | PLAN2 | |
- select s.USERNAME ,s.TERMINAL, s.RESOURCE_CONSUMER_GROUP
- from v_$session s
- where s.TERMINAL in ('pts/5','pts/8');
复制代码 | USERNAME | TERMINAL | RESOURCE_CONSUMER_GROUP | 1 | HR | pts/5 | GROUP1 | 2 | HR | pts/8 | GROUP1 |
准备实验环境:
- create table hr.t05316_undo( a char(2000)) ;
- create table hr.t05316_undo2( a char(2000)) ;
- insert into hr.t05316_undo values ('A');
- insert into hr.t05316_undo2 values('X');
- commit;
复制代码
UNDO池是两个表加起来,两个用户(会话)也加起来算总量:
------------------------------------组间切换, 要切入的组,即使其活跃会话指标满了,也能切进去:
- select pd.group_or_subplan, pd.active_sess_pool_p1 , pd.queueing_p1
- from dba_rsrc_plan_directives pd
- where pd.plan='PLAN1';
复制代码 | GROUP_OR_SUBPLAN | ACTIVE_SESS_POOL_P1 | QUEUEING_P1 | 1 | GROUP1 | | | 2 | GROUP2 | 1 | 1 | 3 | SYS_GROUP | | | 4 | OTHER_GROUPS | | | 5 | PLAN2 | | |
把group2里头的唯一的活跃会话指标占领:
- SQL> conn sh/oracle_4U
- Connected.
- SQL>
- SQL>
- SQL>
- SQL>
- SQL> !ps
- PID TTY TIME CMD
- 12558 pts/5 00:00:00 ps
- 23606 pts/5 00:00:00 sqlplus
- SQL> select count(*) from sales a ,sales b ;
复制代码
查:
- select s.USERNAME, s.TERMINAL ,s.STATUS,s.RESOURCE_CONSUMER_GROUP
- from v_$session s
- where s.TERMINAL='pts/5';
复制代码 | USERNAME | TERMINAL | STATUS | RESOURCE_CONSUMER_GROUP | 1 | SH | pts/5 | ACTIVE | GROUP2 |
- select pd.group_or_subplan,
- pd.switch_time,
- pd.switch_group,
- pd.switch_for_call,
- pd.switch_estimate
- from dba_rsrc_plan_directives pd
- where pd.plan='PLAN1';
复制代码 | GROUP_OR_SUBPLAN | SWITCH_TIME | SWITCH_GROUP | SWITCH_FOR_CALL | SWITCH_ESTIMATE | 1 | GROUP1 | 8 | GROUP2 | TRUE | FALSE | 2 | GROUP2 | | | FALSE | FALSE | 3 | SYS_GROUP | | | TRUE | FALSE | 4 | OTHER_GROUPS | | | FALSE | FALSE | 5 | PLAN2 | | | FALSE | FALSE |
以上实验的现场视频:
http://124.16.180.178:8080/4078/switch.mpeg
IDLE TIME:
- EMPLOYEE_ID FIRST_NAME LAST_NAME
- ----------- -------------------- -------------------------
- EMAIL PHONE_NUMBER HIRE_DATE JOB_ID
- ------------------------- -------------------- ------------------ ----------
- SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
- ---------- -------------- ---------- -------------
- 196 Alana Walsh
- AWALSH 650.507.9811 24-APR-06 SH_CLERK
- 3100 124 50
- 197 Kevin Feeney
- KFEENEY 650.507.9822 23-MAY-06 SH_CLERK
- 3000 124 50
- EMPLOYEE_ID FIRST_NAME LAST_NAME
- ----------- -------------------- -------------------------
- EMAIL PHONE_NUMBER HIRE_DATE JOB_ID
- ------------------------- -------------------- ------------------ ----------
- SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
- ---------- -------------- ---------- -------------
- 107 rows selected.
- Elapsed: 00:00:00.05
- SQL> select * from employees;
- select * from employees
- *
- ERROR at line 1:
- ORA-02396: exceeded maximum idle time, please connect again
- Elapsed: 00:00:00.00
- SQL>
复制代码
做一些奇怪的映射规则:
- BEGIN
- dbms_resource_manager.clear_pending_area();
- dbms_resource_manager.create_pending_area();
- dbms_resource_manager.set_consumer_group_mapping(
- dbms_resource_manager.client_machine,
- 'station90.example.com',
- 'GROUP2'
- );
- dbms_resource_manager.submit_pending_area();
- END;
复制代码
- select *
- from dba_rsrc_mapping_priority;
复制代码 | ATTRIBUTE | PRIORITY | STATUS | 1 | EXPLICIT | 1 | | 2 | SERVICE_MODULE_ACTION | 2 | | 3 | SERVICE_MODULE | 3 | | 4 | MODULE_NAME_ACTION | 4 | | 5 | MODULE_NAME | 5 | | 6 | SERVICE_NAME | 6 | | 7 | ORACLE_USER | 7 | | 8 | CLIENT_PROGRAM | 8 | | 9 | CLIENT_OS_USER | 9 | | 10 | CLIENT_MACHINE | 10 | | 11 | CLIENT_ID | 11 | |
- SQL> conn hr/oracle_4U@orcl
- Connected.
- SQL> !ps
- PID TTY TIME CMD
- 18868 pts/8 00:00:00 ps
- 23883 pts/8 00:00:00 sqlplus
复制代码- select s.USERNAME , s.RESOURCE_CONSUMER_GROUP
- from v_$session s
- where s.TERMINAL='pts/8';
复制代码 | USERNAME | RESOURCE_CONSUMER_GROUP | 1 | HR | GROUP1 |
- begin
- dbms_resource_manager.clear_pending_area;
- dbms_resource_manager.create_pending_area;
- dbms_resource_manager.set_consumer_group_mapping_pri(
- explicit => 1,
- client_machine => 2,
- SERVICE_MODULE_ACTION=>3,
- SERVICE_MODULE=>4,
- MODULE_NAME_ACTION=>5,
- MODULE_NAME=>6,
- SERVICE_NAME=>7,
- oracle_user => 8,
- CLIENT_PROGRAM=>9,
- CLIENT_OS_USER=>10,
- CLIENT_ID=>11);
- dbms_resource_manager.submit_pending_area;
- end;
复制代码- select *
- from dba_rsrc_mapping_priority;
复制代码 | ATTRIBUTE | PRIORITY | STATUS | 1 | EXPLICIT | 1 | | 2 | CLIENT_MACHINE | 2 | | 3 | SERVICE_MODULE_ACTION | 3 | | 4 | SERVICE_MODULE | 4 | | 5 | MODULE_NAME_ACTION | 5 | | 6 | MODULE_NAME | 6 | | 7 | SERVICE_NAME | 7 | | 8 | ORACLE_USER | 8 | | 9 | CLIENT_PROGRAM | 9 | | 10 | CLIENT_OS_USER | 10 | | 11 | CLIENT_ID | 11 | |
- Connected.
- SQL> conn hr/oracle_4U@orcl
- Connected.
- SQL>
- SQL>
- SQL>
- SQL>
复制代码- select s.USERNAME , s.RESOURCE_CONSUMER_GROUP
- from v_$session s
- where s.TERMINAL='pts/8';
复制代码 | USERNAME | RESOURCE_CONSUMER_GROUP | 1 | HR | GROUP2 |
- select * from V$RSRC_CONSUMER_GROUP;
复制代码 | ID | NAME | ACTIVE_SESSIONS | EXECUTION_WAITERS | REQUESTS | CPU_WAIT_TIME | CPU_WAITS | CONSUMED_CPU_TIME | YIELDS | CPU_DECISIONS | CPU_DECISIONS_EXCLUSIVE | CPU_DECISIONS_WON | QUEUE_LENGTH | CURRENT_UNDO_CONSUMPTION | ACTIVE_SESSION_LIMIT_HIT | UNDO_LIMIT_HIT | SWITCHES_IN_CPU_TIME | SWITCHES_OUT_CPU_TIME | SWITCHES_IN_IO_MEGABYTES | SWITCHES_OUT_IO_MEGABYTES | SWITCHES_IN_IO_REQUESTS | SWITCHES_OUT_IO_REQUESTS | SQL_CANCELED | ACTIVE_SESSIONS_KILLED | IDLE_SESSIONS_KILLED | IDLE_BLKR_SESSIONS_KILLED | QUEUED_TIME | QUEUE_TIME_OUTS | IO_SERVICE_TIME | IO_SERVICE_WAITS | SMALL_READ_MEGABYTES | SMALL_WRITE_MEGABYTES | LARGE_READ_MEGABYTES | LARGE_WRITE_MEGABYTES | SMALL_READ_REQUESTS | SMALL_WRITE_REQUESTS | LARGE_READ_REQUESTS | LARGE_WRITE_REQUESTS | CURRENT_PQS_ACTIVE | CURRENT_PQ_SERVERS_ACTIVE | PQS_QUEUED | PQS_COMPLETED | PQ_SERVERS_USED | PQ_ACTIVE_TIME | CURRENT_PQS_QUEUED | PQ_QUEUED_TIME | PQ_QUEUE_TIME_OUTS | 1 | 81576 | GROUP1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 81577 | GROUP2 | 2 | 1 | 7 | 90909 | 238 | 135866 | 225 | 100 | 99 | 99 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 12168 | SYS_GROUP | 2 | 0 | 6 | 0 | 0 | 28 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 12166 | OTHER_GROUPS | 11 | 0 | 23 | 0 | 0 | 367 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | _ORACLE_BACKGROUND_GROUP_ | 35 | 0 | 35 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 1 | 0 | 68 | 0 | 11 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
1Z0-052的第12章:
- create tablespace tbs05212 datafile '/u01/app/oracle/oradata/orcl/tbs05212.dbf'
- size 5M autoextend off;
复制代码
- select * from dba_outstanding_alerts;
复制代码 | SEQUENCE_ID | REASON_ID | OWNER | OBJECT_NAME | SUBOBJECT_NAME | OBJECT_TYPE | REASON | TIME_SUGGESTED | CREATION_TIME | SUGGESTED_ACTION | ADVISOR_NAME | METRIC_VALUE | MESSAGE_TYPE | MESSAGE_GROUP | MESSAGE_LEVEL | HOSTING_CLIENT_ID | MODULE_ID | PROCESS_ID | HOST_ID | HOST_NW_ADDR | INSTANCE_NAME | INSTANCE_NUMBER | USER_ID | EXECUTION_CONTEXT_ID | ERROR_INSTANCE_ID | 1 | 651 | 9 | | TBS05212 | | TABLESPACE | Tablespace [TBS05212] is [100 percent] full | 21-AUG-18 09.35.11.290761 PM +08:00 | 21-AUG-18 09.35.11.290761 PM +08:00 | Add space to the tablespace | | 100 | Warning | Space | 1 | | SPACE MANAGEMENT:ktt.c | "orcl"."orcl" | station90.example.com | 192.168.0.90 | orcl | 1 | | | 651-0 |
- alter tablespace tbs05212 add datafile
- '/u01/app/oracle/oradata/orcl/tbs05212b.dbf' size 50M;
复制代码
........一段时间以后
- select * from dba_outstanding_alerts;
复制代码 没输出
图形界面的首页alter也消失了,转移到了:
- select * from dba_alert_history ah
- order by ah.time_suggested desc;
复制代码
| SEQUENCE_ID | REASON_ID | OWNER | OBJECT_NAME | SUBOBJECT_NAME | OBJECT_TYPE | REASON | TIME_SUGGESTED | CREATION_TIME | SUGGESTED_ACTION | ADVISOR_NAME | METRIC_VALUE | MESSAGE_TYPE | MESSAGE_GROUP | MESSAGE_LEVEL | HOSTING_CLIENT_ID | MODULE_ID | PROCESS_ID | HOST_ID | HOST_NW_ADDR | INSTANCE_NAME | INSTANCE_NUMBER | USER_ID | EXECUTION_CONTEXT_ID | ERROR_INSTANCE_ID | RESOLUTION | 1 | 651 | 9 | | TBS05212 | | TABLESPACE | Tablespace [TBS05212] is [10 percent] full | 21-AUG-18 09.45.13.291297 PM +08:00 | 21-AUG-18 09.35.11.290761 PM +08:00 | Add space to the tablespace | | 10.9090909090909 | Notification | Space | 32 | | SPACE MANAGEMENT:ktt.c | "orcl"."orcl" | station90.example.com | 192.168.0.90 | orcl | 1 | | | 651-0 | cleared | 2 | 650 | 121 | | Commit | | EVENT_CLASS | Metrics "Database Time Spent Waiting (%)" is at 49.55853 for event class "Commit" | 21-AUG-18 07.59.52.806885 PM +08:00 | 21-AUG-18 07.54.51.929247 PM +08:00 | Run ADDM to get more performance analysis about your system. | ADDM | 49.558533655248 | Notification | Performance | 32 | | SERVER MANAGEABILITY:kelr.c | "orcl"."orcl" | station90.example.com | 192.168.0.90 | orcl | 1 | | | 650-0 | cleared | 3 | 649 | 121 | | Commit | | EVENT_CLASS | Metrics "Database Time Spent Waiting (%)" is at 49.02129 for event class "Commit" | 21-AUG-18 07.49.50.950818 PM +08:00 | 21-AUG-18 07.46.50.406913 PM +08:00 | Run ADDM to get more performance analysis about your system. | ADDM | 49.0212867683013 | Notification | Performance | 32 | | SERVER MANAGEABILITY:kelr.c | "orcl"."orcl" | station90.example.com | 192.168.0.90 | orcl | 1 | | | 649-0 | cleared | 4 | 648 | 121 | | Commit | | EVENT_CLASS | Metrics "Database Time Spent Waiting (%)" is at 12.95075 for event class "Commit" | 21-AUG-18 07.36.48.399570 PM +08:00 | 21-AUG-18 07.33.47.793205 PM +08:00 | Run ADDM to get more performance analysis about your system. | ADDM | 12.9507485491163 | Notification | Performance | 32 | | SERVER MANAGEABILITY:kelr.c | "orcl"."orcl" | station90.example.com | 192.168.0.90 | orcl | 1 | | | 648-0 | cleared | 5 | 647 | 121 | | Commit | | EVENT_CLASS | Metrics "Database Time Spent Waiting (%)" is at 29.49839 for event class "Commit" | 21-AUG-18 07.27.46.699476 PM +08:00 | 21-AUG-18 03.45.52.864763 PM +08:00 | Run ADDM to get more performance analysis about your system. | ADDM | 29.4983910837832 | Notification | Performance | 32 | | SERVER MANAGEABILITY:kelr.c | "orcl"."orcl" | station90.example.com | 192.168.0.90 | orcl | 1 | | | 647-0 | cleared | 6 | 646 | 121 | | Commit | | EVENT_CLASS | Metrics "Database Time Spent Waiting (%)" is at 49.84263 for event class "Commit" | 21-AUG-18 03.42.52.320128 PM +08:00 | 21-AUG-18 03.06.45.486719 PM +08:00 | Run ADDM to get more performance analysis about your system. | ADDM | 49.8426327175679 | Notification | Performance | 32 | | SERVER MANAGEABILITY:kelr.c | "orcl"."orcl" | station90.example.com | 192.168.0.90 | orcl | 1 | | | 646-0 | cleared |
|
|