Pages

Wednesday, December 25, 2024

Oracle CVE by example

=============
Oracle CVE
=============
Oracle release CVE every 3 months

Start here
Search for "Database"

For example:
Critical Patch Update (CPU) Program Oct 2024 Patch Availability Document (DB-only) (Doc ID 3036945.1)

Search for the Oracle product + version + host and go to the patch page

This is patch page

DATABASE RELEASE UPDATE 19.25.0.0.0 (Patch) for Linux x86-64

To download the patch, follow the URL from the patch page
Patch 36912597: DATABASE RELEASE UPDATE 19.25.0.0.0


Sunday, December 22, 2024

Oracle ISV options

=====================
What is an Oracle ISV
=====================

Useful Abbreviations
ISV - Oracle Independent Software Vendor
ASFU - Oracle Application Specific Full Use
ESL - Oracle Embedded Software License

=====================
What is ISV
=====================
ISVs are third-party organizations that develop, market, and sell software applications that run on Oracle platforms.
Standard license models for ISVs are ASFU, ESL, 
Proprietary Application Hosting License

=====================
License models 
=====================
AFSU
The Oracle ASFU license is a comprehensive licensing model tailored for ISVs who wish to bundle Oracle technology with their proprietary applications for distribution to their end-users.
Key Characteristics:
- Bundling and Distribution: 
    Allows ISVs to include Oracle technology within their application packages, offering a unified solution to end-users.
- End-User Restrictions: 
    While end-users can fully utilize the Oracle technology as part of the ISV application, they are prohibited from leveraging it for any purposes beyond the scope of the ISV application itself.
- Versatility: 
    Suitable for ISVs looking to enhance their applications with Oracle’s advanced technology features while maintaining control over the application’s distribution and usage.

ESL
The Oracle ESL offers a more integrated approach for ISVs, permitting the embedding of Oracle software directly into their applications.
Under this model, Oracle software becomes a fundamental component of the ISV application, effectively making the Oracle software and the ISV application a single, indistinguishable product.

Key Characteristics:
- Deep Integration: 
  Oracle software is deeply integrated and indistinguishable from the ISV application, providing a seamless experience to the end-user.
- Inseparability: 
  The embedded Oracle software cannot be separated from the ISV application or used independently, ensuring that the value of the Oracle technology directly supports the ISV application’s functionality.
- Targeted Usage: 
  Ideal for ISVs whose applications require the robust functionality of Oracle technology to operate but wish to keep the Oracle components invisible to the end-user.
  
Proprietary Application Hosting License
While not as commonly referenced as ASFU or ESL, the Proprietary Application Hosting License is another important option for ISVs, particularly those offering Software as a Service (SaaS) or hosting their applications on behalf of their customers.
This license supports ISVs in leveraging Oracle technologies to host and manage their applications on Oracle platforms, providing a scalable and secure environment for application deployment.

Thursday, December 19, 2024

Toyota Aygo 2011 1.0L petrol Specs, per owner handbook

Engine Oil: 
Capacity: 3.3 Liter

Which oil - not clear from manual... 3 different places, three different specs:

SAE 0W-20 - Is the recommendation.
SAE 5W-30 - Is an alternative.
SAE 10W-30 ACEA A3 Is the spec for oil replacement every 15,000 km.

API service SL, SM, SN + Resource-Conserving



Normal oil consumption: up to 1L for 1000 km

Change Interval: 15,000 km/1 year Oil + Oil Filter

Manual Gearbox Oil:
1.7 Liter
Option A:
Toyota LV Manual Gaerbox Oil
Option B: (API GL-4) SAE 75W Oil

Change Interval: 135,000 km


Coolant 
Toyota Super Long Life Coolant

50% Ethylene Glycol mix with 50% distilled water.

Capacity Depends on the model
The code it on the coolant system, near the fill up hole.

0Q07 : 4.4 Liter
0Q01, 0Q02 : 4.0 Liter




Change Interval:
1st - after 210,000 km (no time limit)
2nd - after 120,000 (no time limit)

Plugs
DENSO SK16HR11 Iridium Plug
Change Interval: 90,000 km

Alternatives:
DENSO IKH16TT - Iridium TT plug
DENSO K16HR-U11 - Nickel plug
DENSO KH16TT - Nickel TT

Brakes
Capacity: 1.5 L
SAE J1704 DOT 4 

Another spec: FMVSS No.116

Change Interval: 30,000 km or 2 years.

Tyres
155/65R14 75T

Fuel Filter
Change Interval: 90,000 km

Monday, December 16, 2024

Remove Supplemental Logging for a table form Golden Gate Replication by example

Remove Supplemental Logging for a table form Golden Gate Replication by example

Commands:
DBLOGIN USERID ogguser, password xxxxxxx
INFO TRANDATA CELL_USER.CELL_REPORT_DATA
DELETE TRANDATA CELL_USER.CELL_REPORT_DATA
DELETE TRANDATA CELL_USER.CELL_REPORT_DATA, ALLCOLS
INFO TRANDATA CELL_USER.CELL_REPORT_DATA

Double check from sqlplus:
SELECT log_group_name, log_group_type
  FROM DBA_LOG_GROUPS
 WHERE table_name='CELL_REPORT_DATA';

If there is data:
ALTER TABLE CELL_USER.CELL_REPORT_DATA DROP SUPPLEMENTAL LOG GROUP <log_group_name>;

By Example:
DBLOGIN USERID gguser, password xxxxxxx
Successfully logged into database.

INFO TRANDATA CELL_USER.CELL_REPORT_DATA
2024-12-16 06:36:57  INFO    OGG-10471  ***** Oracle Goldengate support information on table CELL_USER.CELL_REPORT_DATA *****
Oracle Goldengate support native capture on table CELL_USER.CELL_REPORT_DATA.
Oracle Goldengate marked following column as key columns on table CELL_USER.CELL_REPORT_DATA: TCAP_ID, TS_START, ACTION_REASON_ID, VLR, LAC, CELL, IS_BORDER, IMSI, SESSION_ID
No unique key is defined for table CELL_USER.CELL_REPORT_DATA.

Logging of supplemental redo log data is enabled for table CELL_USER.CELL_REPORT_DATA.

Columns supplementally logged for table CELL_USER.CELL_REPORT_DATA: "TCAP_ID", "TS_START", "ACTION_REASON_ID", "VLR", "LAC", "CELL", "IS_BORDER", "IMSI", "SESSION_ID"

Prepared CSN for table CELL_USER.CELL_REPORT_DATA: 51949060106

DELETE TRANDATA CELL_USER.CELL_REPORT_DATA

2024-12-16 06:39:25  INFO    OGG-15142  Logging of supplemental redo log data disabled for table CELL_USER.CELL_REPORT_DATA.

2024-12-16 06:39:25  INFO    OGG-15139  TRANDATA for scheduling columns has been disabled on table CELL_USER.CELL_REPORT_DATA.

DELETE TRANDATA CELL_USER.CELL_REPORT_DATA, ALLCOLS

2024-12-16 06:39:42  INFO    OGG-15141  Logging of supplemental redo log data is already disabled for table CELL_USER.CELL_REPORT_DATA.

2024-12-16 06:39:42  INFO    OGG-15137  TRANDATA is already disabled for table CELL_USER.CELL_REPORT_DATA.

2024-12-16 06:39:42  INFO    OGG-15137  TRANDATA is already disabled for table CELL_USER.CELL_REPORT_DATA.

INFO TRANDATA CELL_USER.CELL_REPORT_DATA

2024-12-16 06:40:09  INFO    OGG-10471  ***** Oracle Goldengate support information on table CELL_USER.CELL_REPORT_DATA *****
Oracle Goldengate support native capture on table CELL_USER.CELL_REPORT_DATA.
Oracle Goldengate marked following column as key columns on table CELL_USER.CELL_REPORT_DATA: TCAP_ID, TS_START, ACTION_REASON_ID, VLR, LAC, CELL, IS_BORDER, IMSI, SESSION_ID
No unique key is defined for table CELL_USER.CELL_REPORT_DATA.

Logging of supplemental redo log data is disabled for table CELL_USER.CELL_REPORT_DATA.


Double check from sqlplus:
SELECT log_group_name, log_group_type
  FROM DBA_LOG_GROUPS
 WHERE table_name='CELL_REPORT_DATA';

no rows selected

Monday, December 9, 2024

Wait Event enq: JI - contention top event in perfstat Report

===============
Issue
===============
The top wait is "JI enqueue contention"
What is it, and how to fix it?


Top 5 Timed Events                                  Avg %Total
~~~~~~~~~~~~~~~~~~                                 wait   Call
Event                            Waits  Time (s)   (ms)   Time
---------------------------- --------- --------- ------ ------
enq: JI - contention               720     3,602   5002   99.0
db file async I/O submit         1,175        12     10     .3
CPU time                                      11            .3
db file sequential read          7,150         4      1     .1
control file parallel write      3,119         3      1     .1
       -------------------------------------------------------

Foreground Wait Events  DB/Inst: IGT/igt  Snaps: 135715-135716
-> 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
---------------------------- ------ ---- ---------- ----- ----- -----
enq: JI - contention            720  100      3,602  5002   0.2  99.0
db file sequential read       7,127    0          4     1   2.3    .1
log file sync                 2,648    0          3     1   0.8    .1
cursor: pin S                    76    0          0     2   0.0    .0
control file sequential read  3,304    0          0     0   1.1    .0
Disk file operations I/O        134    0          0     0   0.0    .0
SQL*Net message from client  80,952    0    165,951  2050  25.9
jobq slave wait              14,277   98      7,139   500   4.6
SQL*Net message to client    80,952    0          0     0  25.9
SQL*Net more data from clien  2,195    0          0     0   0.7
        -------------------------------------------------------------


===============
Oracle Theory
===============
JI enqueue is used to serialize the refresh of a materialized view, JI enqueue is acquired in exclusive mode on the mview base (container) table when the refresh is being performed, it ensures that two or more refresh processes do not try to refresh the same object.

===============
Solution
===============
You may want to see which session is holding the JI enqueue with the help of Note 1020008.6 or <Note  1020007.6>.
If the JI enqueue holder is an intended refresh session, the other session(s) that intend to refresh the same mview may just need to wait until the first one finishes.

If however the JI enqueue holder session is stuck (e.g. was killed without the immediate option), then you may want to take further actions to remove/terminate this session, so that the intended refresh can acquire the JI enqueue on the mview and proceed with the refresh.

Materialized View Refresh is Hanging With JI Contention (Doc ID 1358453.1)

set lines 200 
set pagesize 66 
break on Kill on sid on  username on terminal 
column sid format 99999
column Kill heading 'Kill String' format a13 
column res heading 'Resource Type' format 999 
column id1 format 9999990 
column id2 format 9999990 
column state FOR A10
column event FOR A30
column locking heading 'Lock Held/Lock Requested' format a40 
column lmode heading 'Lock Held' format a20 
column request heading 'Lock Requested' format a20 
column serial# format 99999 
column username  format a30  heading "Username" 
column terminal heading Term format a6 
column tab format a40 heading "Table Name" 
column owner format a9 
column LAddr heading "ID1 - ID2" format a18 
column Lockt heading "Lock Type" format a80
column command format a25 


SELECT
    l.sid,
    s.serial#,
    nvl(s.username, 'Internal') username,
    s.event,
    s.state,
    decode(
        s.command, 0, 'None', 
          decode(l.id2, 0, u1.name|| '.'
                 || substr(t1.name, 1, 20), 'None')) tab,
    c.command_name    command,
    decode(
        l.lmode, 1, 'No Lock', 2, 'Row Share', 3, 'Row Exclusive', 4, 'Share', 5, 'Share Row Exclusive', 6, 'Exclusive', '--none--'
    )                 lmode,
    decode(
        l.request, 1, 'No Lock', 2, 'Row Share', 3, 'Row Exclusive', 4, 'Share', 5, 'Share Row Exclusive', 6, 'Exclusive', '--none--'
    )                 request,
    l.id1
    || '-'
    || l.id2          laddr,
    l.type
    || ' - '
    || lt.description lockt
FROM
    gv$lock       l,
    gv$session    s,
    sys.user$    u1,
    sys.obj$     t1,
    v$sqlcommand c,
    v$lock_type  lt
WHERE
    l.sid = s.sid
    AND l.inst_id = s.inst_id
    AND t1.obj# = decode(
        l.id2, 0, l.id1, 1
    )
    AND u1.user# = t1.owner#
    AND s.type != 'BACKGROUND'
    AND c.command_type = s.command
    AND lt.type = l.type
ORDER BY
    s.inst_id,
    s.sid;
SID SERIAL# Username     EVENT                          STATE      Table Name                         COMMAND                Lock Held             Lock Requested
------ ------- ------------ ------------------------------ ---------- ---------------------------------- ---------------------- -------------------- --------------------
ID1 - ID2          Lock Type
------------------ --------------------------------------------------------------------------------
  1182   14171 MY_SCHEMA    SQL*Net message from dblink    WAITING    MY_SCHEMA.GSM_NP_PSTN_ACS_SS       SELECT                 Exclusive             --none--
61267-0            JI - Lock held during materialized view operations (like refresh, alter) to 
                   prevent concurrent operations on the same materialized view

         14171              SQL*Net message from dblink    WAITING    MY_SCHEMA.HSC_GATE_SC_SS           SELECT                 Exclusive             --none--
61309-0            JI - Lock held during materialized view operations (like refresh, alter) to 
                   prevent concurrent operations on the same materialized view

         14171              SQL*Net message from dblink    WAITING    MY_SCHEMA.GSM_NP_INCORRECT_HOM     SELECT                 Exclusive             --none--
61231-0            JI - Lock held during materialized view operations (like refresh, alter) to 
                   prevent concurrent operations on the same materialized view

         14171              SQL*Net message from dblink    WAITING    MY_SCHEMA.GSM_NP_CORRECT_IDDS_     SELECT                 Exclusive             --none--
61213-0            JI - Lock held during materialized view operations (like refresh, alter) to 
                   prevent concurrent operations on the same materialized view

         14171              SQL*Net message from dblink    WAITING    MY_SCHEMA.SHORT_CODE_NETWORK_T     SELECT                 Exclusive             --none--
61207-0            JI - Lock held during materialized view operations (like refresh, alter) to 
                   prevent concurrent operations on the same materialized view

         14171              SQL*Net message from dblink    WAITING    MY_SCHEMA.SHORT_CODES_TYPES_SS     SELECT                 Exclusive             --none--
61195-0            JI - Lock held during materialized view operations (like refresh, alter) to 
                   prevent concurrent operations on the same materialized view

         14171               SQL*Net message from dblink    WAITING    MY_SCHEMA.GSM_NP_PSTN_SETTINGS    SELECT                 Exclusive             --none--
61279-0            JI - Lock held during materialized view operations (like refresh, alter) to 
                   prevent concurrent operations on the same materialized view


When connecting to database , under user user MY_SCHEMA
There is a job to refresh the MV Group and a job to refresh the MV Group data.
Both were stuck.
After killing the session of the jobs, and running PL/SQL code in debug mode, there was an application data issue that prevented the refresh from completing.
Once issue was fixed, the Materiazlized View refresh was completed successfully.

Thursday, December 5, 2024

ORA-39405: Oracle Data Pump does not support importing from a source database with TSTZ version 42 into a target database with TSTZ version 32.

==============
Issue
==============
During import from oracle 19.22 to oracle 19.10, following error came during import.

Apparently, even if Oracle servers are of same major version, an export file from higher TZ VERSION database cannot be imported into lower TZ_VERSION database.

Once updated, the import was successfull.

Import: Release 19.0.0.0.0 - Production on Wed Dec 4 17:03:27 2024
Version 19.10.2.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.
Connected to: Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production
ORA-39002: invalid operation
ORA-39405: Oracle Data Pump does not support importing from a source database with TSTZ version 42 into a target database with TSTZ version 32.

==============
Evidences
==============
Check Current Time Zone Version

The V$TIMEZONE_FILE view displays the zone file version being used by the database.

SQL>  SELECT version FROM v$timezone_file;

   VERSION
----------
        32

SQL>  SELECT DBMS_DST.get_latest_timezone_version FROM   dual;

GET_LATEST_TIMEZONE_VERSION
---------------------------
                         32

SQL>  SELECT * FROM V$VERSION;
Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production Version 19.10.2.0.0


==============
Solution
==============
Step A - apply patch 35220732, to upgrade TZ VERSION to version 42.

Step B - Implement steps described in "Datetime Data Types and Time Zone Support", "4.7.2 Upgrading the Time Zone Data Using the utltz_* Scripts" section

Step A - apply patch 35220732, to upgrade to version 42

mkdir patches
mv p35220732_190000_Linux-x86-64.zip patches
unzip p35220732_190000_Linux-x86-64.zip
cd 35220732
$ORACLE_HOME/OPatch/opatch apply - report
$ORACLE_HOME/OPatch/opatch apply


oracle@myhost:~/patches/35220732>% $ORACLE_HOME/OPatch/opatch apply -report
Oracle Interim Patch Installer version 12.2.0.1.25
Copyright (c) 2024, Oracle Corporation.  All rights reserved.


Oracle Home       : /software/oracle/1910
Central Inventory : /software/oracle/oraInventory
   from           : /software/oracle/1910/oraInst.loc
OPatch version    : 12.2.0.1.25
OUI version       : 12.2.0.7.0
Log file location : /software/oracle/1910/cfgtoollogs/opatch/opatch2024-12-05_09-33-33AM_1.log

Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   35220732

Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
You are calling OPatch with -ocmrf option while this OPatch is generic, not beine calling OPatch.
Backing up files...
Applying interim patch '35220732' to OH '/software/oracle/1910'
Users request no RAC file generation.  Do not create MP files.

Skip patching component oracle.oracore.rsf, 19.0.0.0.0 and its actions.
The actions are reported here, but are not performed.

ApplySession skipping inventory update.
Patch 35220732 successfully applied.
Log file location: /software/oracle/1910/cfgtoollogs/opatch/opatch2024-12-05_09-33-33AM_1.log

OPatch succeeded.

SQL> SELECT DBMS_DST.get_latest_timezone_version FROM  dual;

GET_LATEST_TIMEZONE_VERSION
---------------------------
                         42

SQL> SELECT version FROM v$timezone_file;

   VERSION
----------
        32

Even after applying the patch, the v$timezone_file is still not updated.

ls -ltr $ORACLE_HOME/oracore/zoneinfo/
-rw-r--r-- 1 oracle dba 779003 Aug 10  2016 timezlrg_17.dat
-rw-r--r-- 1 oracle dba 800913 Aug 10  2016 timezlrg_16.dat
-rw-r--r-- 1 oracle dba 791476 Aug 10  2016 timezlrg_15.dat
-rw-r--r-- 1 oracle dba 782475 Aug 10  2016 timezlrg_13.dat
-rw-r--r-- 1 oracle dba 785621 Aug 10  2016 timezlrg_12.dat
-rw-r--r-- 1 oracle dba 787272 Aug 10  2016 timezlrg_11.dat
-rw-r--r-- 1 oracle dba 351525 Aug 10  2016 timezone_9.dat
-rw-r--r-- 1 oracle dba 286815 Aug 10  2016 timezone_7.dat
-rw-r--r-- 1 oracle dba 286217 Aug 10  2016 timezone_6.dat
-rw-r--r-- 1 oracle dba 286310 Aug 10  2016 timezone_5.dat
-rw-r--r-- 1 oracle dba 782585 Sep 28  2016 timezlrg_28.dat
-rw-r--r-- 1 oracle dba 341401 Sep 28  2016 timezone_28.dat
-rw-r--r-- 1 oracle dba 788462 Dec  5  2016 timezlrg_29.dat
-rw-r--r-- 1 oracle dba 341401 Dec  5  2016 timezone_29.dat
-rw-r--r-- 1 oracle dba 340884 May  2  2017 timezone_30.dat
-rw-r--r-- 1 oracle dba 785841 May  2  2017 timezlrg_30.dat
-rw-r--r-- 1 oracle dba 340892 Nov  6  2017 timezone_31.dat
-rw-r--r-- 1 oracle dba 786708 Nov  6  2017 timezlrg_31.dat
-rw-r--r-- 1 oracle dba  52931 Jun 14  2018 timezdif.csv
-rw-r--r-- 1 oracle dba  59574 Jun 14  2018 readme.txt
-rw-r--r-- 1 oracle dba 340869 Jun 19  2018 timezone_32.dat
-rw-r--r-- 1 oracle dba 786909 Jun 19  2018 timezlrg_32.dat
-rw-r--r-- 1 oracle dba 408795 Apr 14  2023 timezone_42.dat
-rw-r--r-- 1 oracle dba 944613 Apr 14  2023 timezlrg_42.dat
-rw-r--r-- 1 oracle dba  74717 Apr 14  2023 readme_42.txt

Step B - Implement steps described in Datetime Data Types and Time Zone Support, 4.7.2 Upgrading the Time Zone Data Using the utltz_* Scripts section

SQL> @$ORACLE_HOME/rdbms/admin/utltz_countstats.sql

Session altered.

.
Amount of TSTZ data using num_rows stats info in DBA_TABLES.
.
For SYS tables first ...
Note: empty tables are not listed.
Stat date  - Owner.TableName.ColumnName - num_rows
04/12/2024 - SYS.AQ$_ALERT_QT_S.CREATION_TIME - 4
04/12/2024 - SYS.AQ$_ALERT_QT_S.DELETION_TIME - 4
04/12/2024 - SYS.AQ$_ALERT_QT_S.MODIFICATION_TIME - 4
20/10/2021 - SYS.AQ$_AQ$_MEM_MC_S.CREATION_TIME - 3
20/10/2021 - SYS.AQ$_AQ$_MEM_MC_S.DELETION_TIME - 3
20/10/2021 - SYS.AQ$_AQ$_MEM_MC_S.MODIFICATION_TIME - 3
20/10/2021 - SYS.AQ$_AQ_PROP_TABLE_S.CREATION_TIME - 1
20/10/2021 - SYS.AQ$_AQ_PROP_TABLE_S.DELETION_TIME - 1
20/10/2021 - SYS.AQ$_AQ_PROP_TABLE_S.MODIFICATION_TIME - 1
04/12/2024 - SYS.AQ$_KUPC$DATAPUMP_QUETAB_1_S.CREATION_TIME - 1
04/12/2024 - SYS.AQ$_KUPC$DATAPUMP_QUETAB_1_S.DELETION_TIME - 1
04/12/2024 - SYS.AQ$_KUPC$DATAPUMP_QUETAB_1_S.MODIFICATION_TIME - 1
20/10/2021 - SYS.AQ$_ORA$PREPLUGIN_BACKUP_QTB_S.CREATION_TIME - 1
20/10/2021 - SYS.AQ$_ORA$PREPLUGIN_BACKUP_QTB_S.DELETION_TIME - 1
20/10/2021 - SYS.AQ$_ORA$PREPLUGIN_BACKUP_QTB_S.MODIFICATION_TIME - 1
20/10/2021 - SYS.AQ$_PDB_MON_EVENT_QTABLE$_S.CREATION_TIME - 1
20/10/2021 - SYS.AQ$_PDB_MON_EVENT_QTABLE$_S.DELETION_TIME - 1
20/10/2021 - SYS.AQ$_PDB_MON_EVENT_QTABLE$_S.MODIFICATION_TIME - 1
04/12/2024 - SYS.AQ$_SCHEDULER$_EVENT_QTAB_S.CREATION_TIME - 3
04/12/2024 - SYS.AQ$_SCHEDULER$_EVENT_QTAB_S.DELETION_TIME - 3
04/12/2024 - SYS.AQ$_SCHEDULER$_EVENT_QTAB_S.MODIFICATION_TIME - 3
20/10/2021 - SYS.AQ$_SCHEDULER$_REMDB_JOBQTAB_S.CREATION_TIME - 1
20/10/2021 - SYS.AQ$_SCHEDULER$_REMDB_JOBQTAB_S.DELETION_TIME - 1
20/10/2021 - SYS.AQ$_SCHEDULER$_REMDB_JOBQTAB_S.MODIFICATION_TIME - 1
21/10/2021 - SYS.AQ$_SCHEDULER_FILEWATCHER_QT_S.CREATION_TIME - 1
21/10/2021 - SYS.AQ$_SCHEDULER_FILEWATCHER_QT_S.DELETION_TIME - 1
21/10/2021 - SYS.AQ$_SCHEDULER_FILEWATCHER_QT_S.MODIFICATION_TIME - 1
04/12/2024 - SYS.AQ$_SUBSCRIBER_TABLE.CREATION_TIME - 1
04/12/2024 - SYS.AQ$_SUBSCRIBER_TABLE.DELETION_TIME - 1
04/12/2024 - SYS.AQ$_SUBSCRIBER_TABLE.MODIFICATION_TIME - 1
20/10/2021 - SYS.AQ$_SYS$SERVICE_METRICS_TAB_S.CREATION_TIME - 4
20/10/2021 - SYS.AQ$_SYS$SERVICE_METRICS_TAB_S.DELETION_TIME - 4
20/10/2021 - SYS.AQ$_SYS$SERVICE_METRICS_TAB_S.MODIFICATION_TIME - 4
20/10/2021 - SYS.ATSK$_SCHEDULE_CONTROL.MRCT_TASK_TIME_TZ - 2
04/12/2024 - SYS.KET$_AUTOTASK_STATUS.ABA_START_TIME - 1
04/12/2024 - SYS.KET$_AUTOTASK_STATUS.ABA_STATE_TIME - 1
04/12/2024 - SYS.KET$_AUTOTASK_STATUS.MW_RECORD_TIME - 1
04/12/2024 - SYS.KET$_AUTOTASK_STATUS.MW_START_TIME - 1
04/12/2024 - SYS.KET$_AUTOTASK_STATUS.RECONCILE_TIME - 1
04/12/2024 - SYS.KET$_CLIENT_CONFIG.FIELD_2 - 7
04/12/2024 - SYS.KET$_CLIENT_CONFIG.LAST_CHANGE - 7
04/12/2024 - SYS.KET$_CLIENT_TASKS.CURR_WIN_START - 1
04/12/2024 - SYS.KET$_CLIENT_TASKS.LG_DATE - 1
04/12/2024 - SYS.KET$_CLIENT_TASKS.LT_DATE - 1
04/12/2024 - SYS.OPTSTAT_HIST_CONTROL$.SPARE6 - 45
04/12/2024 - SYS.OPTSTAT_HIST_CONTROL$.SVAL2 - 45
04/12/2024 - SYS.OPTSTAT_SNAPSHOT$.TIMESTAMP - 163860
04/12/2024 - SYS.OPTSTAT_USER_PREFS$.CHGTIME - 72
20/10/2021 - SYS.RADM_FPTM$.TSWTZ_COL - 1
04/12/2024 - SYS.REG$.NTFN_GROUPING_START_TIME - 4
04/12/2024 - SYS.REG$.REG_TIME - 4
04/12/2024 - SYS.SCHEDULER$_EVENT_LOG.LOG_DATE - 2668
04/12/2024 - SYS.SCHEDULER$_GLOBAL_ATTRIBUTE.ATTR_TSTAMP - 11
04/12/2024 - SYS.SCHEDULER$_JOB.END_DATE - 29
04/12/2024 - SYS.SCHEDULER$_JOB.LAST_ENABLED_TIME - 29
04/12/2024 - SYS.SCHEDULER$_JOB.LAST_END_DATE - 29
04/12/2024 - SYS.SCHEDULER$_JOB.LAST_START_DATE - 29
04/12/2024 - SYS.SCHEDULER$_JOB.NEXT_RUN_DATE - 29
04/12/2024 - SYS.SCHEDULER$_JOB.START_DATE - 29
02/12/2024 - SYS.SCHEDULER$_JOB_RUN_DETAILS.LOG_DATE - 1372
02/12/2024 - SYS.SCHEDULER$_JOB_RUN_DETAILS.REQ_START_DATE - 1372
02/12/2024 - SYS.SCHEDULER$_JOB_RUN_DETAILS.START_DATE - 1372
21/10/2021 - SYS.SCHEDULER$_SCHEDULE.END_DATE - 4
21/10/2021 - SYS.SCHEDULER$_SCHEDULE.REFERENCE_DATE - 4
04/12/2024 - SYS.SCHEDULER$_WINDOW.ACTUAL_START_DATE - 9
04/12/2024 - SYS.SCHEDULER$_WINDOW.END_DATE - 9
04/12/2024 - SYS.SCHEDULER$_WINDOW.LAST_START_DATE - 9
04/12/2024 - SYS.SCHEDULER$_WINDOW.MANUAL_OPEN_TIME - 9
04/12/2024 - SYS.SCHEDULER$_WINDOW.NEXT_START_DATE - 9
04/12/2024 - SYS.SCHEDULER$_WINDOW.START_DATE - 9
03/12/2024 - SYS.SCHEDULER$_WINDOW_DETAILS.LOG_DATE - 30
03/12/2024 - SYS.SCHEDULER$_WINDOW_DETAILS.REQ_START_DATE - 30
03/12/2024 - SYS.SCHEDULER$_WINDOW_DETAILS.START_DATE - 30
04/12/2024 - SYS.STATS_TARGET$.END_TIME - 2839
04/12/2024 - SYS.STATS_TARGET$.START_TIME - 2839
04/12/2024 - SYS.TAB_STATS$.SPARE6 - 1179
04/12/2024 - SYS.WRI$_ALERT_HISTORY.CREATION_TIME - 3
04/12/2024 - SYS.WRI$_ALERT_HISTORY.TIME_SUGGESTED - 3
04/12/2024 - SYS.WRI$_OPTSTAT_HISTGRM_HISTORY.SAVTIME - 277020
04/12/2024 - SYS.WRI$_OPTSTAT_HISTGRM_HISTORY.SPARE6 - 277020
04/12/2024 - SYS.WRI$_OPTSTAT_HISTHEAD_HISTORY.SAVTIME - 25069
04/12/2024 - SYS.WRI$_OPTSTAT_HISTHEAD_HISTORY.SPARE6 - 25069
04/12/2024 - SYS.WRI$_OPTSTAT_IND_HISTORY.SAVTIME - 9589
04/12/2024 - SYS.WRI$_OPTSTAT_IND_HISTORY.SPARE6 - 9589
04/12/2024 - SYS.WRI$_OPTSTAT_OPR.END_TIME - 1005
04/12/2024 - SYS.WRI$_OPTSTAT_OPR.SPARE6 - 1005
04/12/2024 - SYS.WRI$_OPTSTAT_OPR.START_TIME - 1005
04/12/2024 - SYS.WRI$_OPTSTAT_OPR_TASKS.END_TIME - 38636
04/12/2024 - SYS.WRI$_OPTSTAT_OPR_TASKS.SPARE6 - 38636
04/12/2024 - SYS.WRI$_OPTSTAT_OPR_TASKS.START_TIME - 38636
04/12/2024 - SYS.WRI$_OPTSTAT_TAB_HISTORY.SAVTIME - 16324
04/12/2024 - SYS.WRI$_OPTSTAT_TAB_HISTORY.SPARE6 - 16324
04/12/2024 - SYS.WRM$_DATABASE_INSTANCE.STARTUP_TIME_TZ - 2
04/12/2024 - SYS.WRM$_SNAPSHOT.BEGIN_INTERVAL_TIME_TZ - 213
04/12/2024 - SYS.WRM$_SNAPSHOT.END_INTERVAL_TIME_TZ - 213
27/05/2024 - SYS.XS$PRIN.END_DATE - 15
27/05/2024 - SYS.XS$PRIN.START_DATE - 15
Total numrows of SYS TSTZ columns is : 953487
There are in total 166 SYS TSTZ columns.
.
For non-SYS tables ...
Note: empty tables are not listed.
Stat date  - Owner.Tablename.Columnname - num_rows
20/10/2021 - GSMADMIN_INTERNAL.AQ$_CHANGE_LOG_QUEUE_TABLE_S.CREATION_TIME - 1
20/10/2021 - GSMADMIN_INTERNAL.AQ$_CHANGE_LOG_QUEUE_TABLE_S.DELETION_TIME - 1
20/10/2021 - GSMADMIN_INTERNAL.AQ$_CHANGE_LOG_QUEUE_TABLE_S.MODIFICATION_TIME -
1
20/10/2021 - WMSYS.AQ$_WM$EVENT_QUEUE_TABLE_S.CREATION_TIME - 1
20/10/2021 - WMSYS.AQ$_WM$EVENT_QUEUE_TABLE_S.DELETION_TIME - 1
20/10/2021 - WMSYS.AQ$_WM$EVENT_QUEUE_TABLE_S.MODIFICATION_TIME - 1
20/10/2021 - WMSYS.WM$WORKSPACES_TABLE$.CREATETIME - 1
20/10/2021 - WMSYS.WM$WORKSPACES_TABLE$.LAST_CHANGE - 1
Total numrows of non-SYS TSTZ columns is : 8
There are in total 17 non-SYS TSTZ columns.
Total Minutes elapsed : 0

Session altered.

SQL>

SQL> @./rdbms/admin/utltz_upg_check.sql

Session altered.

INFO: Starting with RDBMS DST update preparation.
INFO: NO actual RDBMS DST update will be done by this script.
INFO: If an ERROR occurs the script will EXIT sqlplus.
INFO: Doing checks for known issues ...
INFO: Database version is 19.0.0.0 .
INFO: Database RDBMS DST version is DSTv32 .
INFO: No known issues detected.
INFO: Now detecting new RDBMS DST version.
A prepare window has been successfully started.
INFO: Newest RDBMS DST version detected is DSTv42 .
INFO: Next step is checking all TSTZ data.
INFO: It might take a while before any further output is seen ...
A prepare window has been successfully ended.
INFO: A newer RDBMS DST version than the one currently used is found.
INFO: Note that NO DST update was yet done.
INFO: Now run utltz_upg_apply.sql to do the actual RDBMS DST update.
INFO: Note that the utltz_upg_apply.sql script will
INFO: restart the database 2 times WITHOUT any confirmation or prompt.

Session altered.

SQL>

The utltz_upg_apply.sql script automatically restarts the database multiple times during its execution.

SQL> @./rdbms/admin/utltz_upg_apply.sql
Session altered.
INFO: If an ERROR occurs, the script will EXIT SQL*Plus.
INFO: The database RDBMS DST version will be updated to DSTv42 .
WARNING: This script will restart the database 2 times
WARNING: WITHOUT asking ANY confirmation.
WARNING: Hit control-c NOW if this is not intended.
INFO: Restarting the database in UPGRADE mode to start the DST upgrade.
Database closed.
Database dismounted.
ORACLE instance shut down.

ORACLE instance started.

Total System Global Area 8589930592 bytes
Fixed Size                  8917088 bytes
Variable Size            6174015488 bytes
Database Buffers         2399141888 bytes
Redo Buffers                7856128 bytes
Database mounted.
Database opened.
INFO: Starting the RDBMS DST upgrade.
INFO: Upgrading all SYS owned TSTZ data.
INFO: It might take time before any further output is seen ...
An upgrade window has been successfully started.
INFO: Restarting the database in NORMAL mode to upgrade non-SYS TSTZ data.
INFO: Do NOT start any application yet that uses TSTZ data!
INFO: Next is a list of all upgraded tables:
Table list: "GSMADMIN_INTERNAL"."AQ$_CHANGE_LOG_QUEUE_TABLE_L"
Number of failures: 0
Table list: "GSMADMIN_INTERNAL"."AQ$_CHANGE_LOG_QUEUE_TABLE_S"
Number of failures: 0
INFO: Total failures during update of TSTZ data: 0 .
An upgrade window has been successfully ended.
INFO: Your new Server RDBMS DST version is DSTv42 .
INFO: The RDBMS DST update is successfully finished.
INFO: Make sure to exit this SQL*Plus session.
INFO: Do not use it for timezone related selects.

Session altered.

SQL>

The TZ_VERSION column in the REGISTRY$DATABASE and v$timezone_file now gets updated with the new time zone version.

SQL> SELECT * FROM REGISTRY$DATABASE;

PLATFORM_ID PLATFORM_NAME        EDITION       TZ_VERSION
----------- -------------------- ------------- ----------
         13 Linux x86 64-bit     SE2                   42

SQL> SELECT version FROM v$timezone_file;

   VERSION
----------
        42

Tuesday, December 3, 2024

Create perfstat user, with permissions and jobs

=======================
Create perfstat user and jobs
=======================

set_statspack.sh
#!/bin/bash
. /etc/sh/orash/oracle_login.sh igt

sqlplus /nolog << EOF
connect / as sysdba
define perfstat_password=passwd
define default_tablespace=WORKAREA
define temporary_tablespace=TEMPORARY
@?/rdbms/admin/spcreate.sql
GRANT CREATE JOB TO PERFSTAT;
connect perfstat/&&perfstat_password

ALTER SESSION SET NLS_DATE_FORMAT='dd/mm/yyyy hh24:mi:ss';
SET SERVEROUTPUT ON;
SET ECHO ON;

INSERT INTO STATS\$IDLE_EVENT
SELECT name FROM V\$EVENT_NAME WHERE wait_class='Idle'
MINUS
SELECT event FROM STATS\$IDLE_EVENT;
commit;

DECLARE
  v_hourly_job   NUMBER;
  v_purge_job    NUMBER;
BEGIN
 DBMS_OUTPUT.put_line('Create Statspack Job');
 DBMS_JOB.submit
  (job=> v_hourly_job,
   what=>'DECLARE snap number; BEGIN snap := STATSPACK.snap (i_snap_level=>7); END;',
   next_date=>TRUNC(SYSDATE+1/24,'HH'),
   interval=>'TRUNC(SYSDATE+1/24,''HH'')'
  );
  commit;
  
  DBMS_OUTPUT.put_line('Run Job');
  DBMS_JOB.run(v_hourly_job);

  DBMS_OUTPUT.put_line('Create purge statspack data older than 14 days');  
  DBMS_JOB.submit  
  (job=> v_purge_job,
   what=>'STATSPACK.purge(i_purge_before_date=>sysdate-14,i_extended_purge=>true);',
   next_date => TRUNC(SYSDATE+1)+3/24, 
   interval => 'TRUNC(SYSDATE+1)+3/24'
  );
  commit; 
END;
/
EOF
exit


=======================
Note 1 : Drop user perfstat
=======================
DROP USER perfstat CASCADE;
DROP public synonym STATS$SNAPSHOT_ID;
DROP public synonym STATS$DATABASE_INSTANCE;
DROP public synonym STATS$LEVEL_DESCRIPTION;
DROP public synonym STATS$X$KCBFWAIT;
DROP public synonym STATS$X$KSPPSV;
DROP public synonym STATS$X$KSPPI;
DROP public synonym STATS$X$KSXPPING;
DROP public synonym STATS$V$FILESTATXS;
DROP public synonym STATS$V$TEMPSTATXS;
DROP public synonym STATS$V$SQLXS;
DROP public synonym STATS$V$SQLSTATS_SUMMARY;
DROP public synonym STATS$SNAPSHOT_ID;
DROP public synonym STATS$DATABASE_INSTANCE;
DROP public synonym STATS$LEVEL_DESCRIPTION;
DROP public synonym STATS$SNAPSHOT;
DROP public synonym STATS$DB_CACHE_ADVICE;
DROP public synonym STATS$FILESTATXS;
DROP public synonym STATS$TEMPSTATXS;
DROP public synonym STATS$LATCH;
DROP public synonym STATS$LATCH_CHILDREN;
DROP public synonym STATS$LATCH_PARENT;
DROP public synonym STATS$LATCH_MISSES_SUMMARY;
DROP public synonym STATS$LIBRARYCACHE;
DROP public synonym STATS$BUFFER_POOL_STATISTICS;
DROP public synonym STATS$ROLLSTAT;
DROP public synonym STATS$ROWCACHE_SUMMARY;
DROP public synonym STATS$SGA;
DROP public synonym STATS$SGASTAT;
DROP public synonym STATS$SYSSTAT;
DROP public synonym STATS$SESSTAT;
DROP public synonym STATS$SYSTEM_EVENT;
DROP public synonym STATS$SESSION_EVENT;
DROP public synonym STATS$WAITSTAT;
DROP public synonym STATS$ENQUEUE_STATISTICS;
DROP public synonym STATS$SQL_SUMMARY;
DROP public synonym STATS$SQLTEXT;
DROP public synonym STATS$SQL_STATISTICS;
DROP public synonym STATS$RESOURCE_LIMIT;
DROP public synonym STATS$DLM_MISC;
DROP public synonym STATS$CR_BLOCK_SERVER;
DROP public synonym STATS$CURRENT_BLOCK_SERVER;
DROP public synonym STATS$INSTANCE_CACHE_TRANSFER;
DROP public synonym STATS$UNDOSTAT;
DROP public synonym STATS$SQL_PLAN_USAGE;
DROP public synonym STATS$SQL_PLAN;
DROP public synonym STATS$SEG_STAT;
DROP public synonym STATS$SEG_STAT_OBJ;
DROP public synonym STATS$PGASTAT;
DROP public synonym STATS$PARAMETER;
DROP public synonym STATS$INSTANCE_RECOVERY;
DROP public synonym STATS$STATSPACK_PARAMETER;
DROP public synonym STATS$SHARED_POOL_ADVICE;
DROP public synonym STATS$SQL_WORKAREA_HISTOGRAM;
DROP public synonym STATS$PGA_TARGET_ADVICE;
DROP public synonym STATS$JAVA_POOL_ADVICE;
DROP public synonym STATS$THREAD;
DROP public synonym STATS$FILE_HISTOGRAM;
DROP public synonym STATS$EVENT_HISTOGRAM;
DROP public synonym STATS$TIME_MODEL_STATNAME;
DROP public synonym STATS$SYS_TIME_MODEL;
DROP public synonym STATS$SESS_TIME_MODEL;
DROP public synonym STATS$STREAMS_CAPTURE;
DROP public synonym STATS$STREAMS_APPLY_SUM;
DROP public synonym STATS$PROPAGATION_SENDER;
DROP public synonym STATS$PROPAGATION_RECEIVER;
DROP public synonym STATS$BUFFERED_QUEUES;
DROP public synonym STATS$BUFFERED_SUBSCRIBERS;
DROP public synonym STATS$RULE_SET;
DROP public synonym STATS$OSSTATNAME;
DROP public synonym STATS$OSSTAT;
DROP public synonym STATS$PROCESS_ROLLUP;
DROP public synonym STATS$PROCESS_MEMORY_ROLLUP;
DROP public synonym STATS$SGA_TARGET_ADVICE;
DROP public synonym STATS$STREAMS_POOL_ADVICE;
DROP public synonym STATS$MUTEX_SLEEP;
DROP public synonym STATS$DYNAMIC_REMASTER_STATS;
DROP public synonym STATS$TEMP_SQLSTATS;
DROP public synonym STATS$IOSTAT_FUNCTION_NAME;
DROP public synonym STATS$IOSTAT_FUNCTION;
DROP public synonym STATS$IOSTAT_FUNCTION_DETAIL;
DROP public synonym STATS$MEMORY_TARGET_ADVICE;
DROP public synonym STATS$MEMORY_DYNAMIC_COMPS;
DROP public synonym STATS$MEMORY_RESIZE_OPS;
DROP public synonym STATS$INTERCONNECT_PINGS;
DROP public synonym STATS$IDLE_EVENT;
DROP public synonym STATSPACK;

=======================
Note 2 - scripts
=======================
All perfstat objects are created from these 3 scripts, under $ORACLE_HOME
$ORACLE_HOME/rdbms/admin/spcusr.sql
$ORACLE_HOME/rdbms/admin/spctab.sql
$ORACLE_HOME/rdbms/admin/spcpkg.sql