A little detail to remember when trouble-shooting at the session level – some of the information summarised in the Instance Activity figures (v$sysstat) is not available in the Session Activity figures (v$sesstat / v$mystat). The difference goes right down to the x$ objects, and here are two versions of a simple query I wrote for 19c to check for the missing statistics (you’ll have to be able to connect as SYS to get results from the first one):
rem
rem Script: mystat_missing.sql
rem Author: Jonathan Lewis
rem Dated: Nov 2023
rem Purpose:
rem
rem Last tested
rem 23.3.0.0
rem 19.11.0.0
rem 12.2.0.1
spool mystat_missing
set linesize 132
set pagesize 60
set trimspool on
set tab off
select
usd.indx, usd.ksusdnam, usd.ksusdcls
from
x$ksusd usd
where
usd.indx not in (
select sta.indx
from x$ksumysta sta
)
/
select
sys.statistic#, sys.name, sys.class
from
v$sysstat sys
where
sys.statistic# not in (
select mst.statistic#
from v$mystat mst
)
/
spool off
If you run the script against 12.2.0.1 you’ll find that there are no “missing” session stats, but when you upgrade to 19c (in my case 19.11.0.0) you’ll find a couple of dozen statistics reported. This was the output I got:
STATISTIC# NAME CLASS
---------- ---------------------------------------------------------------- ----------
2010 Instance Statistic test case 384
2011 cell RDMA reads unused 264
2012 cell RDMA writes 264
2013 cell pmem cache read hits unused 264
2014 cell pmem cache writes 264
2015 NS transactions 257
2016 NS transactions timed out 257
2017 NS transactions interrupted 257
2018 NS transactions not using all standbys 257
2019 NS transactions skipping send 257
2020 NS transaction setups 257
2021 NS transaction bytes loaded 320
2022 NS transaction bytes to network 320
2023 NS transaction bytes relogged 322
2024 NS transaction bytes logged 322
2025 NS transaction send time 320
2026 NS transaction setup time 320
2027 NS transaction confirm time 320
2028 NS recovery timeout interrupts 384
2029 NS recovery DTC full interrupts 384
2030 NS recovery fetch requests made 384
2031 NS recovery fetch ranges received 384
2032 NS recovery fetch requested bytes 384
2033 NS recovery fetch received bytes 384
2034 NS recovery fetch received time 384
2035 NS recovery fetch requests remade 384
26 rows selected.
Running the query against 23c Free (23.3) on the Developer VM created by Oracle, the number of “missing” statistics jumped to 1,052 – so I won’t list them. Given the size of the list I did a quick check to remind myself of how many statistics were actually present in v$sysstat, and that produced an interesting comparison.
--
-- 19.11.0.0
--
SQL> select count(*) ct_19c from v$sysstat;
CT_19C
----------
2036
--
-- 23.3.0.0 (on premises)
--
SQL> select count(*) ct_23c from v$sysstat;
CT_23C
----------
2661
So there are 600-ish extra stats available in 23c, but 1,000-ish stats that don’t appear at the session level. So if you’ve been taking advantage of some of the “new” 19c stats to help with trouble-shooting you may find that they disappear on the upgrade. More on that later.
If you look at the output I’ve listed above you might spot that all the missing stats satisfy the predicate “class >= 256”. In fact, the class is a bit vector, and a more appropriate predicate would be: “bitand(class,256) = 256”. Either option gives you a fairly lazy way to do any checks you might be interested in. For example, after setting up a database link from a 19c instance to a 23c instance, I ran the following query to find out how many statistics that were visible in the 19c v$sesstat had changed their class to become invisible in the 23c v$sesstat.
select name from v$sysstat where class < 256
intersect
select name from V$sysstat@oracle23 where class >= 256
/
NAME
----------------------------------------------------------------
...
SMON posted for dropping temp segment
SMON posted for instance recovery
SMON posted for txn recovery for other instances
SMON posted for undo segment recovery
SMON posted for undo segment shrink
TBS Extension: bytes extended
TBS Extension: files extended
TBS Extension: tasks created
TBS Extension: tasks executed
...
commit cleanout failures: block lost
commit cleanout failures: buffer being written
commit cleanout failures: callback failure
commit cleanout failures: cannot pin
commit cleanout failures: delayed log
commit cleanout failures: flashback
commit cleanout failures: hot backup in progress
commit cleanout failures: write disabled
...
db corrupt blocks detected
db corrupt blocks recovered
...
502 rows selected.
Of the 502 stats a very large fraction were about In Memory (prefixed IM), and there were a number that looked as if they were only relevant to background processes and therefore (to some extent, possibly) not of interest when debugging user activity. It’s also possible that some of the statistics would fall into different classes if certain features (e.g hybrid columnar compression) were linked in to the executable.
Another query that might be of interest is a typical “what’s changed” query. What statistics are available in 23c that aren’t in 19c (and vice versa):
select
name, version
from (
select name, '23c' version from v$sysstat@oracle23
minus
select name, '23c' from V$sysstat
union all
select name, '19c' version from v$sysstat
minus
select name, '19c' from V$sysstat@oracle23
)
order by
version desc, name
/
Again there are so many that I don’t think it would be helpful to reproduce my results, but I’ll just say that there were 663 stats in 23c that weren’t in 19c, and 38 stats in 19c that weren’t in 23c. Of course, it’s possible (and I didn’t check carefully) that some of these new/”disappearing” statistics show up only because they’ve had a name change as the version changed.
A couple of the new 23c stats that I like the look of (and would like to see at the session level) are:
user commits PL/SQL
user commits Autonomous
I’m sure that there are more that will reveal themselves as (occasionally) useful over time, and further investigation is left to the reader.
[…] Instance Activity Stats (Nov 2023): New items in v$sysstat and items that disappear from v$sesstat on the upgrade to 23c. […]
Pingback by Upgrade catalogue | Oracle Scratchpad — November 20, 2023 @ 3:56 pm GMT Nov 20,2023 |