Tuesday, November 24, 2020

CRS-2674 CRS-2632 ORA-01013 CRS-5017 PRCR-1079 PRCD-1084

CRS-2674 CRS-2632 ORA-01013 CRS-5017 PRCR-1079 PRCD-1084  service not coming up

Services are not coming up after srvctl start service -d <DB NAME>

One or two services failed to start up, while the rest services are all good to be started up or shutdown.


$ srvctl start service -d TESTDB -s reports

PRCD-1084 : Failed to start service REPORTS

PRCR-1079 : Failed to start resource ora.testdb.reports.svc

CRS-5017: The resource action "ora.testdb.reports.svc start" 

          encountered the following error:

ORA-01013: user requested cancel of current operation

. For details refer to "(:CLSN00107:)" in "/u01/app/grid/diag/crs/

                     racnode1/crs/trace/crsd_oraagent_oracle.trc".

CRS-2674: Start of 'ora.testdb.reports.svc' on 'racnode1' failed

CRS-2632: There are no more servers to try to place resource 

 'ora.testdb.reports.svc' on that would satisfy its placement policy

It seems the information about this database or service is inconsistent in OCR.  We can try the following steps one after another until the it is successful.


1)Remove database from OCR, and add it back again.

$srvctl remove database....

$srvctl add database ....

$ srvctl add instance ....

$ srvctl start service -d TESTDB -s reports


2) For some reason database outage is unavailable, service can be started up manually.

Start up service on instance

 1. Users or applications can connect to database through this service,

 but srvctl still shows service not running


SQL> exec DBMS_SERVICE.START_SERVICE('REPORTS','TESTDB1');


$ srvctl status service -d testdb -s reports 


Service REPORTS is not running.

Friday, November 20, 2020

MySQL Database Service support for E3 shapes

 

Announcing the MySQL Database Service support for E3 shapes


The MySQL team is excited to announce that MySQL Database Service now supports the Oracle Cloud Infrastructure Compute E3 shapes. These shapes are built on the 2nd Gen AMD EPYC 7742 processor, with a base clock frequency of 2.25 GHz and max boost of up to 3.4 GHz, and have better networking and more RAM. MySQL Database Service customers can start to use them today and enjoy higher performance and flexibility for diverse MySQL workloads.

The MySQL Database Service E3 offers up to 64 OCPUs (128 virtual cores) and 1 TB of RAM. This is the highest core count and memory for a single fully managed MySQL instance on any public cloud.

If  already on Oracle Cloud Infrastructure account, you can easily start to use the new E3 shapes in the MySQL Database Service. Just access the web console and under the MySQL menu, select DB System and Create. You will be able to choose between the following options:






Tuesday, November 17, 2020

JRE 1.7.0_281 Certified with EBS Releases 12.2 and 12.1

JRE 1.7.0_281 Certified with EBS Releases 12.2 and 12.1 



The Java Runtime Environment 1.7.0_281 (7u281) on the JRE 7 codeline is now certified with Oracle E-Business Suite Releases 12.2 and 12.1. Note that Oracle strongly recommends that you migrate to JRE 8 using Java Web Start now

As JRE 7 has reached end of life, this release is not available through the usual public download sites.  This update is available for Oracle E-Business Suite customers during the extended support period of your EBS release from My Oracle Support as Patch 31856327.


You should only apply this update if you have a dependency on using JRE 7. This article answers some questions you may have on the subject.

Should I apply this JRE 7 update?

If you have a client tier that can only run JRE 7,  you must use Java Deployment Technology from JRE 8 to launch JRE 7. This is a requirement because JRE updates since JRE 1.7.0_161 have not included Java Deployment Technology.

To stay current with critical fixes provided by the Java team, you should uptake the latest JRE 7 update, as well as the latest JRE 8 update.

Additional guidance on such scenarios can be found in our recently published My Oracle Support note, FAQ: Essentials of Java Usage in Oracle E-Business Suite (MOS Note 2510500.1).

How do I get support adopting this latest Java CPU?

If you are using Java Web Start and require assistance with applying this CPU, you can log a service request for assistance from the Java Support organization.

For those of you still in transition to Java Web Start, refer to the following in our recently published My Oracle Support note, 

FAQ: Essentials of Java Usage in Oracle E-Business Suite (MOS Note 2510500.1):

Where are the JRE 7 requirements for EBS documented?

Full requirements for using Oracle E-Business Suite Releases 12.2 and 12.1 with JRE 7 are listed in the following documents:

References

Related Articles


OCTOBER 2020 Updates to EBS Technology Codelevel Checker (ETCC)

OCTOBER 2020 Updates to EBS Technology Codelevel Checker (ETCC)

The E-Business Suite Technology Codelevel Checker (ETCC) utility identifies patches that need to be applied to your Oracle E-Business Suite 12.2 technology stack for the application and database tiers.
The ETCC tool was designed to be self-documenting; however, you can read about it in the following document:

What’s New

ETCC has been updated to include bug fixes and patching combinations for the following recommended versions:

Database

  • Oracle Database Release Update RU 19.9.0.0.201020
  • Oracle JavaVM Component Database RU 19.9.0.0.201020
  • Oracle Database Proactive BP 12.1.0.2.201020
  • Oracle Database PSU 12.1.0.2.201020
  • Oracle JavaVM Component Database PSU 12.1.0.2.201020
  • Oracle Database Patch for Exadata BP 11.2.0.4.201020
  • Oracle Database PSU 11.2.0.4.201020
  • Oracle JavaVM Component Database PSU 11.2.0.4.201020
  • Microsoft Windows Database BP 19.7.0.0.200414
  • Microsoft Windows Database BP 12.1.0.2.200114
  • Oracle JavaVM Component 12.1.0.2.200114 on Windows
  • Microsoft Windows Database BP 11.2.0.4.180417
  • Oracle JavaVM Component 11.2.0.4.180417 on Windows

Fusion Middleware

  • WebLogic Patch Set Update 10.3.6.0.201020
  • Oracle Fusion Middleware 11.1.1.9
  • Forms and Reports 10.1.2.3.2

Obtaining ETCC

We recommend using the latest version of ETCC, as new bugfixes will not be checked by prior versions of the utility. The latest version of the ETCC tool can always be downloaded via Patch 17537119 from My Oracle Support.

References

Related Articles

 

Monday, November 16, 2020

Analyze UNDO Usage

 Check Current Undo Configuration and Advise Recommended Setup 

Script to Analyze Undo Usage

Hello , Below is the scipt to Script to Analyze Undo Usage

Ensure to execute the script as SYS user. (Above 10g)

SET SERVEROUTPUT ON
SET LINES 600
ALTER SESSION SET NLS_DATE_FORMAT = 'DD/MM/YYYY HH24:MI:SS';

DECLARE
    v_analyse_start_time    DATE := SYSDATE - 7;
    v_analyse_end_time      DATE := SYSDATE;
    v_cur_dt                DATE;
    v_undo_info_ret         BOOLEAN;
    v_cur_undo_mb           NUMBER;
    v_undo_tbs_name         VARCHAR2(100);
    v_undo_tbs_size         NUMBER;
    v_undo_autoext          BOOLEAN;
    v_undo_retention        NUMBER(5);
    v_undo_guarantee        BOOLEAN;
    v_instance_number       NUMBER;
    v_undo_advisor_advice   VARCHAR2(100);
    v_undo_health_ret       NUMBER;
    v_problem               VARCHAR2(1000);
    v_recommendation        VARCHAR2(1000);
    v_rationale             VARCHAR2(1000);
    v_retention             NUMBER;
    v_utbsize               NUMBER;
    v_best_retention        NUMBER;
    v_longest_query         NUMBER;
    v_required_retention    NUMBER;
BEGIN
    select sysdate into v_cur_dt from dual;
    DBMS_OUTPUT.PUT_LINE(CHR(9));
    DBMS_OUTPUT.PUT_LINE('- Undo Analysis started at : ' || v_cur_dt || ' -');
    DBMS_OUTPUT.PUT_LINE('--------------------------------------------------');

    v_undo_info_ret := DBMS_UNDO_ADV.UNDO_INFO(v_undo_tbs_name, v_undo_tbs_size, v_undo_autoext, v_undo_retention, v_undo_guarantee);
    select sum(bytes)/1024/1024 into v_cur_undo_mb from dba_data_files where tablespace_name = v_undo_tbs_name;

    DBMS_OUTPUT.PUT_LINE('NOTE:The following analysis is based upon the database workload during the period -');
    DBMS_OUTPUT.PUT_LINE('Begin Time : ' || v_analyse_start_time);
    DBMS_OUTPUT.PUT_LINE('End Time   : ' || v_analyse_end_time);
    
    DBMS_OUTPUT.PUT_LINE(CHR(9));
    DBMS_OUTPUT.PUT_LINE('Current Undo Configuration');
    DBMS_OUTPUT.PUT_LINE('--------------------------');
    DBMS_OUTPUT.PUT_LINE(RPAD('Current undo tablespace',55) || ' : ' || v_undo_tbs_name);
    DBMS_OUTPUT.PUT_LINE(RPAD('Current undo tablespace size (datafile size now) ',55) || ' : ' || v_cur_undo_mb || 'M');
    DBMS_OUTPUT.PUT_LINE(RPAD('Current undo tablespace size (consider autoextend) ',55) || ' : ' || v_undo_tbs_size || 'M');
    IF V_UNDO_AUTOEXT THEN
        DBMS_OUTPUT.PUT_LINE(RPAD('AUTOEXTEND for undo tablespace is',55) || ' : ON');  
    ELSE
        DBMS_OUTPUT.PUT_LINE(RPAD('AUTOEXTEND for undo tablespace is',55) || ' : OFF');  
    END IF;
    DBMS_OUTPUT.PUT_LINE(RPAD('Current undo retention',55) || ' : ' || v_undo_retention);

    IF v_undo_guarantee THEN
        DBMS_OUTPUT.PUT_LINE(RPAD('UNDO GUARANTEE is set to',55) || ' : TRUE');
    ELSE
        dbms_output.put_line(RPAD('UNDO GUARANTEE is set to',55) || ' : FALSE');
    END IF;
    DBMS_OUTPUT.PUT_LINE(CHR(9));

    SELECT instance_number INTO v_instance_number FROM V$INSTANCE;

    DBMS_OUTPUT.PUT_LINE('Undo Advisor Summary');
    DBMS_OUTPUT.PUT_LINE('---------------------------');

    v_undo_advisor_advice := dbms_undo_adv.undo_advisor(v_analyse_start_time, v_analyse_end_time, v_instance_number);
    DBMS_OUTPUT.PUT_LINE(v_undo_advisor_advice);

    DBMS_OUTPUT.PUT_LINE(CHR(9));
    DBMS_OUTPUT.PUT_LINE('Undo Space Recommendation');
    DBMS_OUTPUT.PUT_LINE('-------------------------');

    v_undo_health_ret := dbms_undo_adv.undo_health(v_analyse_start_time, v_analyse_end_time, v_problem, v_recommendation, v_rationale, v_retention, v_utbsize);
    IF v_undo_health_ret > 0 THEN
        DBMS_OUTPUT.PUT_LINE('Minimum Recommendation           : ' || v_recommendation);
        DBMS_OUTPUT.PUT_LINE('Rationale                        : ' || v_rationale);
        DBMS_OUTPUT.PUT_LINE('Recommended Undo Tablespace Size : ' || v_utbsize || 'M');
    ELSE
        DBMS_OUTPUT.PUT_LINE('Allocated undo space is sufficient for the current workload.');
    END IF;
    
    SELECT dbms_undo_adv.best_possible_retention(v_analyse_start_time, v_analyse_end_time) into v_best_retention FROM dual;
    SELECT dbms_undo_adv.longest_query(v_analyse_start_time, v_analyse_end_time) into v_longest_query FROM dual;
    SELECT dbms_undo_adv.required_retention(v_analyse_start_time, v_analyse_end_time) into v_required_retention FROM dual;

    DBMS_OUTPUT.PUT_LINE(CHR(9));
    DBMS_OUTPUT.PUT_LINE('Retention Recommendation');
    DBMS_OUTPUT.PUT_LINE('------------------------');
    DBMS_OUTPUT.PUT_LINE(RPAD('The best possible retention with current configuration is ',60) || ' : ' || v_best_retention || ' Seconds');
    DBMS_OUTPUT.PUT_LINE(RPAD('The longest running query ran for ',60) || ' : ' || v_longest_query || ' Seconds');
    DBMS_OUTPUT.PUT_LINE(RPAD('The undo retention required to avoid errors is ',60) || ' : ' || v_required_retention || ' Seconds');

END;
/


OUTPUT

- Undo Analysis started at : 16/11/2020 11:08:40 -
--------------------------------------------------

NOTE:The following analysis is based upon the database workload during the period -
Begin Time : 23/08/2013 11:08:40
End Time   : 30/08/2013 11:08:40

Current Undo Configuration
--------------------------
Current undo tablespace                                 : UNDOTBS2
Current undo tablespace size (datafile size now)        : 20M
Current undo tablespace size (consider autoextend)      : 20M
AUTOEXTEND for undo tablespace is                       : ON
Current undo retention                                  : 900
UNDO GUARANTEE is set to                                : FALSE

Undo Advisor Summary
---------------------------
Finding 1:Undo Tablespace is under pressure. Recommendation 1:Size undo tablespace to 26 MB

Undo Space Recommendation
-------------------------
Minimum Recommendation           : Size undo tablespace to 26 MB
Rationale                        : Increase undo tablespace size so that long running queries will not fail
Recommended Undo Tablespace Size : 26M

Retention Recommendation
------------------------
The best possible retention with current configuration is    : 9171 Seconds
The longest running query ran for                            : 2543 Seconds
The undo retention required to avoid errors is               : 2543 Seconds

PL/SQL procedure successfully completed.

UNDO MANAGEMENT (UNDO ADVISOR)

 What is the Undo Advisor and how to Use it through the DBMS_UNDO_ADV package 

(Doc ID 1580225.1)


Undo data is a vital component of a Oracle database environment, and when something goes wrong with undo tablespaces where this data is stored, the database administrator (DBA) must take quick action to correct the problem. Otherwise, the database could become damaged, and valuable information might be permanently lost. 

Oracle Undo tablespaces were introduced in Oracle Database 9i, but not until Oracle Database 11g was the undo management mode set to AUTO by default. Automatic undo management means that Oracle DBAs no longer need to manage rollback segments manually because the Oracle database itself will manage rollback segments in a single tablespace.
As soon as an Oracle database instance starts, it looks for the UNDO_TABLESPACE parameter to determine which undo tablespace should be used; if it does not find the specified undo tablespace, the database will not start and an error will be generated in the database’s alert log. If the UNDO_TABLESPACE parameter is not being used, the database will try to find any undo tablespace in the database, and if it cannot find one, it will start to use rollback segments stored in the SYSTEM tablespace. This is not an optimal situation for database performance and is definitely not recommended. Again, in this situation, an alert message will be written to the database instance’s alert log.

Tuning UNDO_RETENTION

The DBMS_UNDO_ADV package provides some excellent feedback to help determine the best value for the UNDO_RETENTION parameter:

SELECT DBMS_UNDO_ADV.LONGEST_QUERY(SYSDATE-1/24, SYSDATE)AS best_undo_time FROM dual;

BEST_U N DO_TIME

845

This output indicates that the longest-running query 

on this instance took 845 seconds. Based on this output, then, 845 seconds is a good starting point for the undo retention parameter. Another query that can help identify an appropriate value for UNDO_RETENTION follows:

 


SELECT 

DBMS_UNDO_ADV.REQUIRED_RETENTION(SYSDATE-30, SYSDATE) AS reqd_retn FROM dual;


REQD_RETN

1699


This query leverages the REQUIRED_RETENTION procedure of the DBMS_UNDO_ADV package to capture the execution time of the longest-running query in the last 30 days. If you use the same input parameter in the LONGEST_QUERY procedure of the first example, you will see that the same value will be returned.

Note

DBMS_UNDO_ADVISOR is an undocumented procedure. For more information about using it, see MOS Note 1580225.1, “What is the Undo Advisor and how to use it through the DBMS_UNDO_ADV package.” Much of this information is also available via the Undo Advisor in Enterprise Manager Database Console, Grid Control, and Cloud Control.

In This Document we will explain how to use the DBMS_UNDO_ADV PL/SQL package.

The package DBMS_UNDO_ADV is undocumented , and it is used internally by the Undo Advisor .

The Undo Advisor assists in correctly sizing the undo tablespace and to set the low threshold value of the undo retention period for any Oracle Flashback requirements.

The Undo Advisor can also be used to estimate the Undo Tablespace needed for migration from Manual To Automatic Undo management, before actually creating the new undo tablespace which will use automatic undo management.

The Undo Advisor relies for its analysis on data collected in the Automatic Workload Repository (AWR). It is therefore important that the AWR have adequate workload statistics available so that the Undo Advisor can make accurate recommendations. For newly created databases, adequate statistics may not be available immediately. In such cases, continue to use the default auto-extending undo tablespace until at least one workload cycle completes.

Note: To make the undo tablespace fixed-size, Oracle suggests that you first allow enough time after database creation to run a full workload, thus allowing the undo tablespace to grow to its minimum required size to handle the workload. Then, you can use the Undo Advisor to determine, if desired, how much larger to set the size of the undo tablespace to allow for long-running queries and Oracle Flashback operations.


Running the Undo Advisor does not alter the size of the undo tablespace. The advisor just returns a recommendation. You must use ALTER DATABASE statements to change the tablespace data files to fixed sizes.

DETAILS

 All the subprograms of package DBMS_UNDO_ADV have three versions , Except the undo_info , undo_autotune and rbu_migration Functions :

- Version 1: subprogram is based on historical information in memory or in AWR from start time to end time.

example : select dbms_undo_adv.required_undo_size(retention , start time , end time ) from dual;

- Version 2: subprogram is based on historical information in memory or in AWR from sysdate -7 to sysdate.

example : select dbms_undo_adv.required_undo_size(retention ) from dual;

- Version 3: subprogram is based on historical information in AWR from Begin/End snapshot id.

example : select dbms_undo_adv.required_undo_size(retention , snap_shot1 , snap_shot2 ) from dual;

Note : The Instance must not have been shutdown between the times that the begin and end snapshots specified , To Get The continous snap shot IDs You can use the following Query :

col instart_fmt noprint;
col inst_name format a12 heading 'Instance';
col db_name format a12 heading 'DB Name';
col snap_id format 99999990 heading 'Snap Id';
col snapdat format a18 heading 'Snap Started' just c;
col lvl format 99 heading 'Snap|Level';
set heading on;
break on inst_name on db_name on host on instart_fmt skip 2;
set pages 1000
ttitle off;

SELECT TO_CHAR(s.startup_time,' DD MON "at" HH24:MI:SS') INSTART_FMT,
di.instance_name INST_NAME, di.db_name DB_NAME, s.snap_id SNAP_ID,
TO_CHAR(s.end_interval_time,'DD MON YYYY HH24:MI') SNAPDAT,
s.snap_level LVL
FROM dba_hist_snapshot s, dba_hist_database_instance di
WHERE di.dbid = s.dbid
AND di.instance_number = s.instance_number
AND di.startup_time = s.startup_time
ORDER BY snap_id;

The subprograms of package DBMS_UNDO_ADV and its Usage :


 Estimate the Undo Tablespace Size needed for migration from Manual To Automatic Undo management .

Note : This function should be called only when undo_management = manual , however if undo_management = auto the function will not raise an error but the output is useless .

perform the following steps:

Start the instance and run through a standard business cycle to obtain a representative workload. Doing this to assess the workload and compute the size of the undo tablespace required for automatic undo management.

After the standard business cycle completes, run the following function to collect the undo tablespace size and help with the sizing of the undo tablespace (DBA privileges are required to run this function) .

Create an undo tablespace of the required size and turn on the automatic undo management by setting UNDO_MANAGEMENT=AUTO or by removing the parameter.

Note : For Oracle RAC configurations, repeat these steps on all instances.


To Get The Output using the historical information in memory :

set serveroutput on
DECLARE
utbsiz_in_MB NUMBER;
BEGIN
utbsiz_in_MB := DBMS_UNDO_ADV.RBU_MIGRATION;
dbms_output.put_line('=================================================================');
dbms_output.put_line('The Minimum size of the undo tablespace required is : '||utbsiz_in_MB||' MB');
dbms_output.put_line('=================================================================');
end;
/

sample output :

=============================================================
The Minimum size of the undo tablespace required is : 13 MB
=============================================================

To Get The Output using Start/End time :

set serveroutput on
DECLARE
utbsiz_in_MB NUMBER;
BEGIN
utbsiz_in_MB := DBMS_UNDO_ADV.RBU_MIGRATION(SYSDATE-1/24, SYSDATE);
dbms_output.put_line('=================================================================');
dbms_output.put_line('The Minimum size of the undo tablespace During This Time Range is required is : '||utbsiz_in_MB||' MB');
dbms_output.put_line('=================================================================');
end;
/


Provide information about undo tablespace of the current instance .

Function undo_info is used to get information about undo tablespace of the current instance.


it returns undo tablespace name, max possible size, if it is auto extensible, current undo retention value and if the undo tablespace has guaranteed undo retention.

set serveroutput on
DECLARE
tbs_name    VARCHAR2(30);
tbs_size    NUMBER(10);
tbs_autoextend    BOOLEAN;
tbs_retention    NUMBER(5);
tbs_guarantee    BOOLEAN;
undo_adv BOOLEAN;
BEGIN
dbms_output.put_line('=====================================================================');
undo_adv := dbms_undo_adv.undo_info(tbs_name, tbs_size, tbs_autoextend, tbs_retention, tbs_guarantee);
If undo_adv=TRUE then
dbms_output.put_line('UNDO Tablespace Name : ' || tbs_name);
dbms_output.put_line('UNDO tablespace is '|| CASE WHEN tbs_autoextend THEN  'Auto Extensiable' ELSE 'Fixed Size' END);
If tbs_autoextend=TRUE then dbms_output.put_line('UNDO Tablespace Maximum size (MB) is : ' || TO_CHAR(tbs_size));
else dbms_output.put_line('UNDO Tablespace Fixed size (MB) is : ' || TO_CHAR(tbs_size));
end if;
dbms_output.put_line('Undo Retention is ' || TO_CHAR(tbs_retention)||' Seconds' ||' Equivelant to ' ||round((tbs_retention/60),2) ||' Minutes');
dbms_output.put_line('Retention : '||CASE WHEN tbs_guarantee THEN 'Guaranteed ' ELSE 'Not Guaranteed' END);
else dbms_output.put_line('Function undo_info can only run if parameters undo_management is auto');
end if;
dbms_output.put_line('=====================================================================');
END;
/
sample output :

=====================================================================
UNDO Tablespace Name : UNDOTBS2
UNDO tablespace is Auto Extensiable
UNDO Tablespace Maximum size (MB) is : 6144
Undo Retention is 900 Seconds Equivelant to 15 Minutes
Retention : Not Guaranteed
=====================================================================


Determine if auto tuning of undo retention is enabled or not.

Function undo_autotune is used to find out if auto tuning of undo retention is enabled for the current undo tablespace or not.

set serveroutput on
DECLARE
tbs_autotune    BOOLEAN;
chk BOOLEAN;
BEGIN
tbs_autotune := dbms_undo_adv.undo_autotune(chk);
dbms_output.put_line('=========================================================================');
If tbs_autotune=TRUE then dbms_output.put_line('Auto Tuning of Undo Retention for the current Undo Tablespace is Enabled');
else dbms_output.put_line('Auto Tuning of Undo Retention for the current Undo Tablespace is Disabled');
end if;
dbms_output.put_line('=========================================================================');
end;
/

sample output :

=========================================================================
Auto Tuning of Undo Retention for the current Undo Tablespace is Enabled
=========================================================================

Check the length of the longest query for a given period .

Function longest_query returns the length of the longest query for a given period (Start/End time or Begin/End AWR snapshot id).

Note : zero will be returned if the information about the given period is not available.


To Get The Output using the historical information in memory :

SELECT 'The Length of the Longest Query in Memory is ' || dbms_undo_adv.longest_query LONGEST_QUERY FROM dual;

 

To Get The Output using Start/End time :

 SELECT 'The Length of the Longest Query During This Time Range is ' ||dbms_undo_adv.longest_query(SYSDATE-1/24, SYSDATE) LONGEST_QUERY FROM dual;

 

To Get The Output using Begin/End AWR snapshot id :

SELECT 'The Length of the Longest Query During This AWR snaps Range is ' ||dbms_undo_adv.longest_query(449, 451) LONGEST_QUERY FROM dual;

The required undo_retention to satisfy longest query .


Function required_retention  returns the required value for parameter undo_retention to satisfy longest query based on undo statistics available for a given period (Start/End time or Begin/End AWR snapshot id)


To Get The Output using the historical information in memory :

SELECT 'The Required undo_retention using Statistics In Memory is ' || dbms_undo_adv.required_retention required_retention FROM dual;

sample output :

The Required undo_retention using Statistics In Memory is 600

To Get The Output using Start/End time :

SELECT 'The Required undo_retention During This Time Range is ' ||dbms_undo_adv.required_retention(SYSDATE-1/24, SYSDATE) required_retention FROM dual;

To Get The Output using Begin/End AWR snapshot id :

SELECT 'The Required undo_retention During This AWR snaps Range is ' ||dbms_undo_adv.longest_query(449, 452) LONGEST_QUERY FROM dual;


Check best possible undo_retention the current undo tablespace can satisfy .

Function best_possible_retention returns best possible value for parameter undo_retention that the current undo tablespace can satisfy in order to maximize the usage of current undo tablespace based on the historical information of given period.

Note : zero will be returned if the information about the given period is not available.

Note: If The current undo tablespace is auto-extensiable , the best possible retention value returned is based on the max size the undo tablespace can grow to. You may not want your undo tablespace to grow to that size to really satisfy this undo_retention value.


To Get The Output using the historical information in memory :

SELECT 'The best possible value for undo_retention the current undo tablespace can satisfy is ' || dbms_undo_adv.best_possible_retention best_retention FROM dual;

Sample Output :

The best possible value for undo_retention the current undo tablespace can satisfy is 8208238

To Get The Output using Start/End time :

SELECT 'The best possible value for undo_retention the current undo tablespace can satisfy is ' ||dbms_undo_adv.best_possible_retention(SYSDATE-1/24, SYSDATE) best_retention FROM dual;

 

To Get The Output using Begin/End AWR snapshot id :

SELECT 'The best possible value for undo_retention the current undo tablespace can satisfy is ' ||dbms_undo_adv.best_possible_retention(578, 600) best_retention FROM dual;


The required undo tablespace size to satisfy certain undo retention value .

Function required_undo_size returns The required undo tablespace size in MB to satisfy certain undo retention value based on undo statistics available for a given period (Start/End time or Begin/End AWR snapshot id)

Note : zero will be returned if the information about the given period is not available.


To Get The Output using the historical information in memory :

SELECT 'The Required undo tablespace size using Statistics In Memory is ' || dbms_undo_adv.required_undo_size(900) || ' MB' required_undo_size FROM dual;

 

To Get The Output using Start/End time :

SELECT 'The Required undo tablespace size During This Time Range is ' || dbms_undo_adv.required_undo_size(900,SYSDATE-1/24, SYSDATE) || ' MB' required_undo_size FROM dual;

sample output :

The Required undo tablespace size During This Time Range is 10 MB

 

To Get The Output using Begin/End AWR snapshot id :

SELECT 'The Required Undo tablespace size During This AWR snaps Range is ' || dbms_undo_adv.required_undo_size(900,SYSDATE-1/24, SYSDATE) || ' MB' required_undo_size FROM dual;


Verify current undo_retention and undo tablespace size (check whether its optimal).

Function undo_health is used to check if there is any problem with the current setting of undo_retention and undo tablespace size based on the historical information of given period , and provide recommendation to fix the problem.

If the return value is 0, no problem is found. Otherwise, parameter "problem" and "recommendation" are the problem and recommendation on fixing the problem.

The Output Parameters are :

problem: problem of the system. It can be for example : "long running query may fail" or "undo tablespace cannot satisfy undo_retention".
recommendation: recommendation on fixing the problem found.
rationale: rationale for the recommendation.
retention: numerical value of retention if recommendation is to change retention.
utbsize: numberical value of undo tablespace size in MB if recommendation is to change undo tablespace size.

To Get The Output using the historical information in memory :

set serveroutput on

DECLARE
 prob VARCHAR2(100);
 reco VARCHAR2(100);
 rtnl VARCHAR2(100);
 retn PLS_INTEGER;
 utbs PLS_INTEGER;
 retv PLS_INTEGER;
BEGIN
retv := dbms_undo_adv.undo_health(prob, reco, rtnl, retn, utbs);
dbms_output.put_line('=====================================================================');
If retv=0 Then dbms_output.put_line('Problem: ' || prob || ' The undo tablespace is OK');
ELSIF retv=2 Then dbms_output.put_line('Long running queries may fail , The recommendation is : ' || reco);
dbms_output.put_line('rationale: ' || rtnl);
dbms_output.put_line('retention: ' || TO_CHAR(retn));

ELSIF retv=3 Then dbms_output.put_line('The Undo tablespace cannot satisfy the longest query , The recommendation is : ' || reco);
dbms_output.put_line('rationale: ' || rtnl);
dbms_output.put_line('undo tablespace size in MB : ' || TO_CHAR(utbs));
dbms_output.put_line('retention: ' || TO_CHAR(retn));

ELSIF retv=4 Then dbms_output.put_line('The System does not have an online undo tablespace , The recommendation is : ' || reco);
dbms_output.put_line('rationale: ' || rtnl);
dbms_output.put_line('undo tablespace size in MB : ' || TO_CHAR(utbs));

ELSIF retv=1 Then dbms_output.put_line('The Undo tablespace cannot satisfy the specified undo_retention or The Undo tablespace cannot satisfy auto tuning undo retention , The recommendation is : ' || reco);
dbms_output.put_line('rationale: ' || rtnl);
dbms_output.put_line('undo tablespace size in MB : ' || TO_CHAR(utbs));
end if;
dbms_output.put_line('=====================================================================');

END;
/

sample output :

=====================================================================
Problem: No problem found The undo tablespace is OK
=====================================================================

To Get The Output using Start/End time :

DECLARE
 prob VARCHAR2(100);
 reco VARCHAR2(100);
 rtnl VARCHAR2(100);
 retn PLS_INTEGER;
 utbs PLS_INTEGER;
 retv PLS_INTEGER;
BEGIN
retv := dbms_undo_adv.undo_health(SYSDATE-1/24, SYSDATE,prob, reco, rtnl, retn, utbs);
dbms_output.put_line('=====================================================================');
If retv=0 Then dbms_output.put_line('Problem: ' || prob || ' The undo tablespace is OK');
ELSIF retv=2 Then dbms_output.put_line('Long running queries may fail , The recommendation is : ' || reco);
dbms_output.put_line('rationale: ' || rtnl);
dbms_output.put_line('retention: ' || TO_CHAR(retn));

ELSIF retv=3 Then dbms_output.put_line('The Undo tablespace cannot satisfy the longest query , The recommendation is : ' || reco);
dbms_output.put_line('rationale: ' || rtnl);
dbms_output.put_line('undo tablespace size in MB : ' || TO_CHAR(utbs));
dbms_output.put_line('retention: ' || TO_CHAR(retn));

ELSIF retv=4 Then dbms_output.put_line('The System does not have an online undo tablespace , The recommendation is : ' || reco);
dbms_output.put_line('rationale: ' || rtnl);
dbms_output.put_line('undo tablespace size in MB : ' || TO_CHAR(utbs));

ELSIF retv=1 Then dbms_output.put_line('The Undo tablespace cannot satisfy the specified undo_retention or The Undo tablespace cannot satisfy auto tuning undo retention , The recommendation is : ' || reco);
dbms_output.put_line('rationale: ' || rtnl);
dbms_output.put_line('undo tablespace size in MB : ' || TO_CHAR(utbs));
end if;
dbms_output.put_line('=====================================================================');

END;
/

 

To Get The Output using Begin/End AWR snapshot id :

DECLARE
 prob VARCHAR2(100);
 reco VARCHAR2(100);
 rtnl VARCHAR2(100);
 retn PLS_INTEGER;
 utbs PLS_INTEGER;
 retv PLS_INTEGER;
BEGIN
retv := dbms_undo_adv.undo_health(578, 600,prob, reco, rtnl, retn, utbs);
dbms_output.put_line('=====================================================================');
If retv=0 Then dbms_output.put_line('Problem: ' || prob || ' The undo tablespace is OK');
ELSIF retv=2 Then dbms_output.put_line('Long running queries may fail , The recommendation is : ' || reco);
dbms_output.put_line('rationale: ' || rtnl);
dbms_output.put_line('retention: ' || TO_CHAR(retn));

ELSIF retv=3 Then dbms_output.put_line('The Undo tablespace cannot satisfy the longest query , The recommendation is : ' || reco);
dbms_output.put_line('rationale: ' || rtnl);
dbms_output.put_line('undo tablespace size in MB : ' || TO_CHAR(utbs));
dbms_output.put_line('retention: ' || TO_CHAR(retn));

ELSIF retv=4 Then dbms_output.put_line('The System does not have an online undo tablespace , The recommendation is : ' || reco);
dbms_output.put_line('rationale: ' || rtnl);
dbms_output.put_line('undo tablespace size in MB : ' || TO_CHAR(utbs));

ELSIF retv=1 Then dbms_output.put_line('The Undo tablespace cannot satisfy the specified undo_retention or The Undo tablespace cannot satisfy auto tuning undo retention , The recommendation is : ' || reco);
dbms_output.put_line('rationale: ' || rtnl);
dbms_output.put_line('undo tablespace size in MB : ' || TO_CHAR(utbs));
end if;
dbms_output.put_line('=====================================================================');

END;
/

 

Check if there is any problem with the current instance and provide recommendations.

Function undo_advisor uses the advisor frame work to check if there is any problem with the current instance and provide recommendations.

This function should be used when undo_management is auto.

To Get The Output using the historical information in memory :

set serveroutput on

DECLARE
reco VARCHAR2(300);
BEGIN
dbms_output.put_line('==========================================================');
reco := dbms_undo_adv.undo_advisor(1);
dbms_output.put_line(reco);
dbms_output.put_line('==========================================================');
END;
/

Note : where 1 is the Isnatce ID which can be obtained from :

For RAC :
=========
SQL> select * from V$ACTIVE_INSTANCES;

For Non RAC :
==============
SQL> select INSTANCE_NUMBER ,INSTANCE_NAME from V$INSTANCE;

 

To Get The Output using Start/End time :

set serveroutput on

DECLARE
reco VARCHAR2(300);
BEGIN
reco := dbms_undo_adv.undo_advisor(SYSDATE-1/24, SYSDATE, 1);
dbms_output.put_line(reco);
END;
/

 

To Get The Output using Begin/End AWR snapshot id :

set serveroutput on

DECLARE
reco VARCHAR2(300);
BEGIN
reco := dbms_undo_adv.undo_advisor(398, 409, 1);
dbms_output.put_line(reco);
END;
/