BEGIN
DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT ();
END;
/
SELECT snap_id,
dbid,
begin_interval_time,
end_interval_time
FROM dba_hist_snapshot
ORDER BY end_interval_time DESC;
SNAP_ID DBID BEGIN_INTERVAL_TIME END_INTERVAL_TIME
---------- ---------- ---------------------------- --------------------------
164 41924548 14-APR-17 09.38.19.467 AM 14-APR-17 10.51.21.886 AM
163 41924548 14-APR-17 09.00.10.470 AM 14-APR-17 09.38.19.467 AM
162 41924548 14-APR-17 08.00.07.242 AM 14-APR-17 09.00.10.470 AM
161 41924548 14-APR-17 07.00.04.120 AM 14-APR-17 08.00.07.242 AM
--查看缺省的window_size
SELECT baseline_name, baseline_type, moving_window_size
FROM dba_hist_baseline
WHERE baseline_name = 'SYSTEM_MOVING_WINDOW';
BASELINE_NAME BASELINE_TYPE MOVING_WINDOW_SIZE
------------------------ ------------- ------------------
SYSTEM_MOVING_WINDOW MOVING_WINDOW 8
BEGIN
DBMS_WORKLOAD_REPOSITORY.MODIFY_BASELINE_WINDOW_SIZE (
window_size => 7,
dbid => 41924548);
END;
/
--window_size为天,只能够小于等于当前快照保留时间,否则报错,如下:
ERROR at line 1:
ORA-13541: system moving window baseline size (864000)
greater than retention (691200)
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 686
ORA-06512: at line 2
5. 管理基线样本
创建单个基线模板
BEGIN
DBMS_WORKLOAD_REPOSITORY.CREATE_BASELINE_TEMPLATE (
start_time => TO_DATE ('2017-04-14 17:00:00', 'yyyy-mm-dd hh24:mi:ss'),
end_time => TO_DATE ('2017-04-14 19:00:00', 'yyyy-mm-dd hh24:mi:ss'),
baseline_name => 'baseline_140414',
template_name => 'template_140414',
expiration => 10,
dbid => 41924548);
END;
/
--如果创建基线样本时间小于当前时间,则收到如下错误
ERROR at line 1:
ORA-13537: invalid input for create baseline template (end_time, end_time is less than SYSDATE)
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 768
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 818
ORA-06512: at line 2
SQL> @?/rdbms/admin/awrinfo.sql
This script will report general AWR information
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Specify the Report File Name
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrinfo.txt. To use this name,
press <return> to continue, otherwise enter an alternative.
Enter value for report_name:
Using the report name awrinfo.txt
No errors. -- Author : Leshami
No errors. -- Blog : https://blog.csdn.net/leshami
~~~~~~~~~~~~~~~ -- QQ : 645746311
AWR INFO Report
~~~~~~~~~~~~~~~
Report generated at
19:48:53 on Apr 14, 2017 ( Friday ) in Timezone +08:00
Warning: Non Default AWR Setting!
--------------------------------------------------------------------------------
Snapshot interval is 60 minutes and Retention is 8 days
DB_ID DB Name HOST_PLATFORM INST STARTUP_TIME LAST_ASH_SID PAR
------------ ------- ----------------------- ---- ----------------- ------------ ---
* 41924548 ORA11G ydq - Linux x86 64-bit 1 15:18:26 (04/07) 617410 NO
########################################################
(I) AWR Snapshots Information
########################################################
*****************************************************
(1a) SYSAUX usage - Schema breakdown (dba_segments)
*****************************************************
|
| Total SYSAUX size 617.4 MB ( 2% of 32,768.0 MB MAX with AUTOEXTEND ON )
|
| Schema SYS occupies 206.6 MB ( 33.5% )
| Schema XDB occupies 157.7 MB ( 25.5% )
| Schema APEX_030200 occupies 85.4 MB ( 13.8% )
| Schema MDSYS occupies 73.9 MB ( 12.0% )