oracle 19c statspack test

目录

1. login as sysdba

3. install statspack

--4. test statspack

--5.loading test ffs_index

--6. end statpack.snap

--7. spreport.sql

--8. check report sp_4_11.lst 

--9. autotask 

--10.  post configure 


1. login as sysdba

2. create tablespace

3. install

--4. test statspack

--5.loading test ffs_index

--6. end statpack.snap

--7. spreport.sql

--8. check report sp_4_11.lst 

1. login as sysdba

[oracle@rhel64 ~]$ sqlplus / as sysdba

[oracle@rhel64 ~]$ sqlplus sys/oracle@orcl as sysdba

2. create tablespace

SQL> create tablespace perfstat datafile '/u01/app/oracle/oradata/ORCL/perstat.ora' size 100m extent management local;

Tablespace created.

3. install statspack

创建用户perfstat

SQL> @?/rdbms/admin/spcreate.sql

Session altered.


Choose the PERFSTAT user's password
-----------------------------------
Not specifying a password will result in the installation FAILING

Enter value for perfstat_password:

Enter value for default_tablespace: perfstat

Enter value for temporary_tablespace: TEMP

.

.

.

Package body created.

No errors.

NOTE:
SPCPKG complete. Please check spcpkg.lis for any errors.

SQL>
SQL> -- Bug#25233027: xxx Set this parameter to FALSE for creating common objects in consolidated database
SQL> alter session set "_oracle_script" = FALSE;

Session altered.

--check table 

SQL> select dt.table_name from dba_tables dt where dt.owner='PERFSTAT' ;

SQL> conn perfstat/oracle
Connected.

SQL> select table_name from user_tables;

(73 tables)

--4. test statspack

SQL> execute statspack.snap;
BEGIN statspack.snap; END;

*
ERROR at line 1:
ORA-01658: unable to create INITIAL extent for segment in tablespace PERFSTAT

alter database datafile  '/u01/app/oracle/oradata/ORCL/perstat.ora' autoextend on next 10m;

--5.loading test ffs_index

CREATE TABLE TEST AS SELECT * FROM all_objects WHERE 0=1;

CREATE INDEX ind_test_id ON TEST(object_id);

INSERT INTO TEST SELECT * FROM all_objects WHERE object_id IS NOT NULL AND object_id > 10000 ORDER BY object_id DESC;

commit;

analyze table test compute statistics for table for all columns for all indexes;

select object_id from test;

alter table test modify(object_id not null);

select/*+ index(test ind_TEST_ID)*/ object_id from test;

alter system flush buffer_cache;

select object_id from test where rownum<11;

select owner,header_file,header_block from dba_segments where segment_name='IND_TEST_ID';

--6. end statpack.snap

SQL> execute statspack.snap;

PL/SQL procedure successfully completed.

查看产生的快照
select t.snap_id,to_char(t.snap_time,'yyyy-mm-dd hh:mi:ss') as S_Time,t.snapshot_exec_time_s from STATS$SNAPSHOT t;

--7. spreport.sql

Listing all Completed Snapshots

Snap
Instance DB Name Snap Id Snap Started Level Comment
------------ ------------ --------- ----------------- ----- --------------------
orcl ORCL 4 25 Mar 2023 10:56 5
11 25 Mar 2023 11:05 5

Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 4
Begin Snapshot Id specified: 4

Enter value for end_snap: 11

--8. check report sp_4_11.lst 

[oracle@rhel64 ~]$ ls
Desktop Downloads Pictures sp_4_11.lst spctab.lis Templates
Documents Music Public spcpkg.lis spcusr.lis Videos


STATSPACK report for

Database DB Id Instance Inst Num Startup Time Release RAC
~~~~~~~~ ----------- ------------ -------- --------------- ----------- ---
1659186914 orcl 1 17-Mar-23 00:10 19.0.0.0.0 NO

Host Name Platform CPUs Cores Sockets Memory (G)
~~~~ ---------------- ---------------------- ----- ----- ------- ------------
rhel64 Linux x86 64-bit 2 2 1 3.7

Snapshot Snap Id Snap Time Sessions Curs/Sess Comment
~~~~~~~~ ---------- ------------------ -------- --------- ------------------
Begin Snap: 4 25-Mar-23 10:56:17 60 1.3
End Snap: 11 25-Mar-23 11:05:39 59 1.6
Elapsed: 9.37 (mins) Av Act Sess: 0.0
DB time: 0.08 (mins) DB CPU: 0.06 (mins)

Cache Sizes Begin End
~~~~~~~~~~~ ---------- ----------
Buffer Cache: 576M Std Block Size: 8K
Shared Pool: 224M Log Buffer: 7,360K

Load Profile Per Second Per Transaction Per Exec Per Call
~~~~~~~~~~~~ ------------------ ----------------- ----------- -----------
DB time(s): 0.0 0.2 0.00 0.05
DB CPU(s): 0.0 0.2 0.00 0.04
Redo size: 36,628.0 1,083,418.5
Logical reads: 396.2 11,719.3
Block changes: 61.7 1,823.8
Physical reads: 3.3 98.2
Physical writes: 9.2 272.3
User calls: 0.2 4.7
Parses: 5.9 172.9
Hard parses: 1.5 43.2
W/A MB processed: 0.2 5.8
Logons: 0.0 0.3
Executes: 21.3 629.2
Rollbacks: 0.0 0.0
Transactions: 0.0

Instance Efficiency Indicators
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Buffer Nowait %: 100.00 Redo NoWait %: 100.00
Buffer Hit %: 99.89 Optimal W/A Exec %: 99.95
Library Hit %: 81.48 Soft Parse %: 75.04
Execute to Parse %: 72.52 Latch Hit %: 99.97
Parse CPU to Parse Elapsd %: 87.57 % Non-Parse CPU: 85.36

Shared Pool Statistics Begin End
------ ------
Memory Usage %: 91.84 91.37
% SQL with executions>1: 80.78 71.85
% Memory for SQL w/exec>1: 83.36 74.73

Top 5 Timed Events Avg %Total
~~~~~~~~~~~~~~~~~~ wait Call
Event Waits Time (s) (ms) Time
----------------------------------------- ------------ ----------- ------ ------
pman timer 187 562 3008 25.5
Data Guard: Timer 18 544 30208 24.6
Data Guard: Gap Manager 9 544 60412 24.6
CPU time 10 .5
Failed Logon Delay 1 1 1000 .0
-------------------------------------------------------------
Host CPU (CPUs: 2 Cores: 2 Sockets: 1)
~~~~~~~~ Load Average
Begin End User System Idle WIO WCPU
------- ------- ------- ------- ------- ------- --------
0.14 0.65 1.33 1.10 96.79 0.04

Instance CPU
~~~~~~~~~~~~ % Time (seconds)
-------- --------------
Host: Total time (s): 1,107.5
Host: Busy CPU time (s): 35.5
% of time Host is Busy: 3.2
Instance: Total CPU time (s): 16.5
% of Busy CPU used for Instance: 46.5
Instance: Total Database time (s): 16.8
%DB time waiting for CPU (Resource Mgr): 0.0

Virtual Memory Paging
~~~~~~~~~~~~~~~~~~~~~
KB paged out per sec: 8.2
KB paged in per sec: .1

Memory Statistics Begin End
~~~~~~~~~~~~~~~~~ ------------ ------------
Host Mem (MB): 3,752.0 3,752.0
SGA use (MB): 1,504.0 1,504.0
PGA use (MB): 382.3 360.3
% Host Mem used for SGA+PGA: 50.3 49.7
-------------------------------------------------------------

Time Model System Stats DB/Inst: ORCL/orcl Snaps: 4-11
-> Ordered by % of DB time desc, Statistic name

Statistic Time (s) % DB time
----------------------------------- -------------------- ---------
DB CPU 3.3 72.5
sql execute elapsed time 3.1 66.5
parse time elapsed 1.5 32.0
hard parse elapsed time 1.4 31.3
RMAN cpu time (backup/restore) 1.1 24.9
connection management call elapsed 1.1 23.9
hard parse (sharing criteria) elaps 0.2 3.7
failed parse elapsed time 0.1 2.9
PL/SQL compilation elapsed time 0.1 2.3
PL/SQL execution elapsed time 0.0 .4
repeated bind elapsed time 0.0 .1
hard parse (bind mismatch) elapsed 0.0 .1
sequence load elapsed time 0.0 .0
DB time 4.6
background cpu time 13.2
background elapsed time 12.2
-------------------------------------------------------------
Foreground Wait Events DB/Inst: ORCL/orcl Snaps: 4-11
-> Only events with Total Wait Time (s) >= .001 are shown
-> ordered by Total Wait Time desc, Waits desc (idle events last)

Avg %Total
%Tim Total Wait wait Waits Call
Event Waits out Time (s) (ms) /txn Time
---------------------------- ------------ ---- ---------- ------ -------- ------
Failed Logon Delay 1 100 1 1000 0.1 .0
db file sequential read 206 0 0 1 10.8 .0
direct path write temp 63 0 0 2 3.3 .0
local write wait 128 0 0 1 6.7 .0
Data file init write 31 0 0 2 1.6 .0
direct path sync 4 0 0 14 0.2 .0
buffer busy waits 2 0 0 11 0.1 .0
log file sync 8 0 0 3 0.4 .0
PGA memory operation 884 0 0 0 46.5 .0
control file parallel write 12 0 0 1 0.6 .0
SQL*Net break/reset to clien 20 0 0 0 1.1 .0
DLM cross inst call completi 4 0 0 1 0.2 .0
Disk file operations I/O 36 0 0 0 1.9 .0
db file scattered read 3 0 0 1 0.2 .0
direct path read temp 64 0 0 0 3.4 .0
direct path read 12 0 0 0 0.6 .0
db file single write 4 0 0 1 0.2 .0
SQL*Net message from client 43 0 2,387 55516 2.3
watchdog main loop 374 0 1,125 3008 19.7
-------------------------------------------------------------

Background Wait Events DB/Inst: ORCL/orcl Snaps: 4-11
-> Only events with Total Wait Time (s) >= .001 are shown
-> ordered by Total Wait Time desc, Waits desc (idle events last)

Avg %Total
%Tim Total Wait wait Waits Call
Event Waits out Time (s) (ms) /txn Time
---------------------------- ------------ ---- ---------- ------ -------- ------
pman timer 187 100 562 3008 9.8 25.5
Data Guard: Timer 18 0 544 30208 0.9 24.6
Data Guard: Gap Manager 9 0 544 60412 0.5 24.6
log file parallel write 766 0 1 1 40.3 .0
db file async I/O submit 959 0 0 0 50.5 .0
control file parallel write 279 0 0 1 14.7 .0
oracle thread bootstrap 4 0 0 47 0.2 .0
latch free 122 0 0 0 6.4 .0
direct path sync 10 0 0 5 0.5 .0
Data file init write 15 0 0 3 0.8 .0
os thread creation 4 0 0 7 0.2 .0
control file sequential read 1,606 0 0 0 84.5 .0
db file sequential read 41 0 0 1 2.2 .0
Disk file operations I/O 39 0 0 0 2.1 .0
ADR block file read 15 0 0 1 0.8 .0
latch: shared pool 17 0 0 1 0.9 .0
PGA memory operation 284 0 0 0 14.9 .0
direct path write 11 0 0 1 0.6 .0
ADR block file write 3 0 0 1 0.2 .0
DLM cross inst call completi 3 0 0 0 0.2 .0
row cache mutex 2 0 0 1 0.1 .0
rdbms ipc message 7,121 85 10,726 1506 374.8
Space Manager: slave idle wa 1,427 0 4,491 3147 75.1
class slave wait 49 0 2,791 56950 2.6
DIAG idle wait 1,098 100 1,123 1023 57.8
pmon timer 374 99 1,122 3000 19.7
LNS ASYNC dest activation 2 0 600 ###### 0.1
dispatcher timer 10 100 600 60005 0.5
smon timer 2 100 600 ###### 0.1
OFS idle 187 100 563 3008 9.8
wait for unread message on b 549 100 562 1024 28.9
heartbeat redo informer 973 0 562 578 51.2
LNS ASYNC end of log 773 0 562 727 40.7
lreg timer 187 100 562 3003 9.8
Streams AQ: qmn coordinator 41 0 561 13674 2.2
Streams AQ: qmn slave idle w 21 0 561 26697 1.1
AQPC idle 18 100 544 30208 0.9
SQL*Net message from client 8 0 0 25 0.4
KSV master wait 51 100 0 0 2.7
-------------------------------------------------------------

Wait Events (fg and bg) DB/Inst: ORCL/orcl Snaps: 4-11
-> s - second, cs - centisecond, ms - millisecond, us - microsecond
-> %Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
-> Only events with Total Wait Time (s) >= .001 are shown
-> ordered by Total Wait Time desc, Waits desc (idle events last)

Avg %Total
%Tim Total Wait wait Waits Call
Event Waits out Time (s) (ms) /txn Time
---------------------------- ------------ ---- ---------- ------ -------- ------
pman timer 187 100 562 3008 9.8 25.5
Data Guard: Timer 18 0 544 30208 0.9 24.6
Data Guard: Gap Manager 9 0 544 60412 0.5 24.6
Failed Logon Delay 1 100 1 1000 0.1 .0
log file parallel write 766 0 1 1 40.3 .0
db file async I/O submit 959 0 0 0 50.5 .0
control file parallel write 291 0 0 1 15.3 .0
oracle thread bootstrap 4 0 0 47 0.2 .0
db file sequential read 247 0 0 1 13.0 .0
direct path write temp 63 0 0 2 3.3 .0
local write wait 128 0 0 1 6.7 .0
direct path sync 14 0 0 7 0.7 .0
Data file init write 46 0 0 2 2.4 .0
latch free 122 0 0 0 6.4 .0
os thread creation 4 0 0 7 0.2 .0
control file sequential read 1,791 0 0 0 94.3 .0
buffer busy waits 2 0 0 11 0.1 .0
PGA memory operation 1,168 0 0 0 61.5 .0
log file sync 8 0 0 3 0.4 .0
Disk file operations I/O 75 0 0 0 3.9 .0
ADR block file read 15 0 0 1 0.8 .0
latch: shared pool 17 0 0 1 0.9 .0
direct path write 12 0 0 1 0.6 .0
DLM cross inst call completi 7 0 0 1 0.4 .0
SQL*Net break/reset to clien 22 0 0 0 1.2 .0
db file scattered read 3 0 0 1 0.2 .0
direct path read temp 64 0 0 0 3.4 .0
db file single write 7 0 0 0 0.4 .0
direct path read 20 0 0 0 1.1 .0
ADR block file write 3 0 0 1 0.2 .0
row cache mutex 2 0 0 1 0.1 .0
rdbms ipc message 7,121 85 10,726 1506 374.8
Space Manager: slave idle wa 1,427 0 4,491 3147 75.1
class slave wait 49 0 2,791 56950 2.6
SQL*Net message from client 51 0 2,387 46812 2.7
watchdog main loop 374 0 1,125 3008 19.7
DIAG idle wait 1,098 100 1,123 1023 57.8
pmon timer 374 99 1,122 3000 19.7
LNS ASYNC dest activation 2 0 600 ###### 0.1
dispatcher timer 10 100 600 60005 0.5
smon timer 2 100 600 ###### 0.1
OFS idle 187 100 563 3008 9.8
wait for unread message on b 549 100 562 1024 28.9
heartbeat redo informer 973 0 562 578 51.2
LNS ASYNC end of log 773 0 562 727 40.7
lreg timer 187 100 562 3003 9.8
Streams AQ: qmn coordinator 41 0 561 13674 2.2
Streams AQ: qmn slave idle w 21 0 561 26697 1.1
AQPC idle 18 100 544 30208 0.9

Wait Events (fg and bg) DB/Inst: ORCL/orcl Snaps: 4-11
-> s - second, cs - centisecond, ms - millisecond, us - microsecond
-> %Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
-> Only events with Total Wait Time (s) >= .001 are shown
-> ordered by Total Wait Time desc, Waits desc (idle events last)

Avg %Total
%Tim Total Wait wait Waits Call
Event Waits out Time (s) (ms) /txn Time
---------------------------- ------------ ---- ---------- ------ -------- ------
KSV master wait 51 100 0 0 2.7
-------------------------------------------------------------
Wait Event Histogram DB/Inst: ORCL/orcl Snaps: 4-11
-> Total Waits - units: K is 1000, M is 1000000, G is 1000000000
-> % of Waits - column heading: <=1s is truly <1024ms, >1s is truly >=1024ms
-> % of Waits - value: .0 indicates value was <.05%, null is truly 0
-> Ordered by Event (idle events last)

Total ----------------- % of Waits ------------------
Event Waits <1ms <2ms <4ms <8ms <16ms <32ms <=1s >1s
-------------------------- ----- ----- ----- ----- ----- ----- ----- ----- -----
ADR block file read 15 73.3 26.7
ADR block file write 3 100.0
ADR file lock 4 100.0
AWR Flush 2 100.0
DLM cross inst call comple 7 85.7 14.3
Data Guard: Gap Manager 9 100.0
Data Guard: Timer 18 100.0
Data file init write 46 41.3 15.2 32.6 4.3 6.5
Disk file operations I/O 75 97.3 2.7
Failed Logon Delay 1 100.0
LGWR wait for redo copy 2 100.0
PGA memory operation 1168 99.9 .1
SQL*Net break/reset to cli 22 100.0
asynch descriptor resize 8 100.0
buffer busy waits 2 50.0 50.0
control file parallel writ 291 45.7 51.9 1.4 .7 .3
control file sequential re 1791 100.0
datafile move cleanup duri 7 100.0
db file async I/O submit 959 89.8 5.8 4.2 .2
db file scattered read 3 33.3 66.7
db file sequential read 247 73.3 23.5 3.2
db file single write 7 85.7 14.3
direct path read 20 95.0 5.0
direct path read temp 64 100.0
direct path sync 14 50.0 14.3 7.1 28.6
direct path write 12 83.3 16.7
direct path write temp 63 28.6 41.3 23.8 6.3
index (re)build lock or pi 6 100.0
latch free 122 92.6 4.1 2.5 .8
latch: messages 2 100.0
latch: shared pool 17 88.2 5.9 5.9
local write wait 128 77.3 21.1 1.6
log file parallel write 766 83.8 10.4 2.9 1.4 .7 .7 .1
log file sync 8 37.5 25.0 25.0 12.5
oracle thread bootstrap 4 25.0 75.0
os thread creation 4 25.0 50.0 25.0
pman timer 187 100.0
row cache mutex 2 100.0
AQPC idle 18 100.0
DIAG idle wait 1097 100.0
KSV master wait 51 100.0
LNS ASYNC dest activation 2 100.0
LNS ASYNC end of log 773 15.5 3.4 .8 1.0 .8 1.7 76.8
OFS idle 187 100.0
SQL*Net message from clien 51 19.6 13.7 3.9 7.8 3.9 3.9 7.8 39.2
SQL*Net message to client 49 100.0
SQL*Net more data from cli 1 100.0
Space Manager: slave idle 1427 2.1 .1 .1 .1 24.1 73.4
Streams AQ: qmn coordinato 41 46.3 2.4 2.4 48.8
Streams AQ: qmn slave idle 21 4.8 95.2
class slave wait 50 4.0 4.0 2.0 4.0 86.0
Wait Event Histogram DB/Inst: ORCL/orcl Snaps: 4-11
-> Total Waits - units: K is 1000, M is 1000000, G is 1000000000
-> % of Waits - column heading: <=1s is truly <1024ms, >1s is truly >=1024ms
-> % of Waits - value: .0 indicates value was <.05%, null is truly 0
-> Ordered by Event (idle events last)

Total ----------------- % of Waits ------------------
Event Waits <1ms <2ms <4ms <8ms <16ms <32ms <=1s >1s
-------------------------- ----- ----- ----- ----- ----- ----- ----- ----- -----
dispatcher timer 10 100.0
heartbeat redo informer 973 25.0 14.5 1.0 .3 .1 59.1
lreg timer 187 100.0
pmon timer 373 100.0
rdbms ipc message 7122 5.5 .3 .0 .1 .1 .3 72.0 21.6
smon timer 2 100.0
wait for unread message on 549 100.0
watchdog main loop 374 100.0
-------------------------------------------------------------

SQL ordered by CPU DB/Inst: ORCL/orcl Snaps: 4-11
-> Total DB CPU (s): 3
-> Captured SQL accounts for 47.4% of Total DB CPU
-> SQL reported below exceeded 1.0% of Total DB CPU

CPU CPU per Elapsd Old
Time (s) Executions Exec (s) %Total Time (s) Buffer Gets Hash Value
---------- ------------ ---------- ------ ---------- --------------- ----------
0.44 1 0.44 13.3 0.47 6,815 2912400228
Module: SQL*Plus
BEGIN statspack.snap; END;

0.27 1 0.27 8.2 0.30 11,911 3560010358
begin prvt_hdm.execute_slave_actions; end;

0.26 1 0.26 7.8 0.27 11,117 583503020
BEGIN sys.prvt_hdm.auto_execute( db_id =>
:bind_dbid, inst_id => :bind_inst, end_s
nap => :bind_snap, time_left_in_secs => :bind_time);
END;

0.05 371 0.00 1.4 0.04 1,415 4216638155
select name,intcol#,segcol#,type#,length,nvl(precision#,0),decod
e(type#,2,nvl(scale,-127/*MAXSB1MINAL*/),178,scale,179,scale,180
,scale,181,scale,182,scale,183,scale,231,scale,0),null$,fixedsto
rage,nvl(deflength,0),default$,rowid,col#,property, nvl(charseti

0.04 1 0.04 1.2 0.05 16,122 1660029652
select s.ts#, s.file#, s.block#, so.object_id, s.spare1, s.type#
, s.hwmincr from seg$ s, sys_objects so where bitand(s.spare1,13
1072) = 0 and s.ts# = so.ts_number and s.file# = so.header_file
and s.block# = so.header_block order by s.file# asc

0.04 324 0.00 1.2 0.04 1,970 1695832004
select i.obj#,i.ts#,i.file#,i.block#,i.intcols,i.type#,i.flags,
i.property,i.pctfree$,i.initrans,i.maxtrans,i.blevel,i.leafcnt,i
.distkey, i.lblkkey,i.dblkkey,i.clufac,i.cols,i.analyzetime,i.sa
mplesize,i.dataobj#, nvl(i.degree,1),nvl(i.instances,1),i.rowcnt

0.04 1 0.04 1.1 0.04 7,439 3966622712
select s.file#, s.block#, s.ts#, t.obj#, s.hwmincr, t.obj# from
tab$ t, seg$ s where bitand(s.spare1, 4503599627370496) = 45035
99627370496 and bitand(s.spare1, 65536) <> 65536 and s.file# =
t.file# and s.ts# = t.ts# and s.block# = t.block# UNION select

0.04 65 0.00 1.1 0.03 138 1232162599
select l.col#, l.intcol#, l.lobj#, l.ind#, l.ts#, l.file#, l.blo
ck#, l.chunk, l.pctversion$, l.flags, l.property, l.retention, l
.freepools from lob$ l where l.obj# = :1 order by l.intcol# asc

-------------------------------------------------------------
SQL ordered by Elapsed time for DB: ORCL Instance: orcl Snaps: 4 -11
-> Total DB Time (s): 5
-> Captured SQL accounts for 36.0% of Total DB Time
->

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值