Failed: JDK version is incompatible Error

Today I was installing last PSU GRID/DB for 12.1.0.2, when hit the next error ;Today I was installing last PSU GRID/DB for 12.1.0.2, when hit the next error ;

root@wolf-3:~# opatchauto apply /data/ho/crs/anr/26635815 -oh /cloud/prod/server/121
OPatchauto session is initiated at Tue Dec 5 12:37:27 2017
System initialization log file is /cloud/prod/server/121/cfgtoollogs/opatchautodb/systemconfig2017-12-05_12-37-31PM.log.
Failed: JDK version is incompatible.Please use a jdk version the same as, or later than 16
The result of cluvfy command does not contain OVERALL_STATUS String.
OPATCHAUTO-72050: System instance creation failed.
OPATCHAUTO-72050: Failed while retrieving system information.
OPATCHAUTO-72050: Please check log file for more details.
OPatchauto session completed at Tue Dec 5 12:37:35 2017
Time taken to complete the session 0 minute, 9 seconds
Topology creation failed.

I haven’t clearly the error, but the problem is because of the path where I executed the opatchauto. In my case I moved to $ORACLE_HOME/OPatch.

root@wolf-3:~# cd /cloud/prod/server/121
root@wolf-3:/cloud/prod/server/121# cd OPatch
root@wolf-3:/cloud/prod/server/121/OPatch# ./opatchauto apply /data/ho/crs/anr/26635815 -oh /cloud/prod/server/121

Use a complete path for opatchauto solve the problem too.
HTH – Antonio NAVARRO

Advertisements

How To Get A Report Of Hosts From Listener.log

Last day I was requiered to get a report of machines that connecting to a database. Of course, there are many ways of get this data. In this case I used the listener.log (if there are many listener you have to explore all them). This example is valid for unix-box, using shell script commands, like show below;

cat listener_db12.log | egrep -v ‘service_update|ping|status|W7CORP’ | awk -F “HOST=” ‘{print $2}’ |awk -F “)” ‘{print $1}’ | sort | uniq

What is each command;

i) output the listener_db12.log
ii) exclude lines thats include the strings ‘service_update|ping|status|W7CORP’
iii) using awk use HOST like field separator
iv) using awk use ) like field separator
v) sort the previus result, in this case only de machines that connect to this database
vi) uniq for eliminate duplicates

HTH – Antonio NAVARRO

 

Cal Command Using PL/SQL

In this blog entry I like share a little script for generate a unix style cal command. It is coded using PL/SQL.


REM =================================================================
REM
REM Cal command unix style.
REM
REM USAGE: STA CAL <MONTH> <YEAR&>
REM EX:    STA CAL 12 2245
REM
REM CREATED : 22/10/2015
REM AUTHOR  : Antonio NAVARRO
REM
REM =================================================================
SET SERVEROUTPUT ON SIZE 100000
SET VER OFF
DECLARE
/*** Create a varray to containts the Months ***/
TYPE list_of_months IS VARRAY (12) OF VARCHAR2 (100);
Months list_of_months := list_of_months ('January', 'February', 'March','April', 'May', 'June','July', 'August', 'September','October', 'November', 'December');

/*** Create a varray to containts the numbers of each month ***/
TYPE list_of_numberofdays IS VARRAY (12) OF NUMBER (2);
Days list_of_numberofdays := list_of_numberofdays (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

i        PLS_INTEGER;
d        PLS_INTEGER;
LineCal  VARCHAR2 (100);

FUNCTION DAY
(
  Month Number,
  Year  Number
) RETURN NUMBER IS
DayString    VARCHAR2 (10); -- WITH THIS FORMAT DD/MM/YYYY
DayOfTheWeek NUMBER;
BEGIN
  DayString := '01/' || Month || '/' || Year;
  SELECT TO_NUMBER (to_char(to_date(DayString,'dd/mm/yyyy'), 'D')) INTO DayOfTheWeek FROM DUAL;
  RETURN DayOfTheWeek;
END;

FUNCTION IsLeapYear
(
  year NUMBER
) RETURN BOOLEAN IS
BEGIN  
  IF (( MOD (year,4) = 0) AND ( MOD (year,100) != 0)) THEN RETURN TRUE; END IF;
  IF ( MOD (year,400) = 0) THEN  RETURN TRUE; END IF;
  RETURN FALSE;
END; /*** IsLeapYear ***/

BEGIN
  -- Check for leap year
  IF ((&1 = 2) AND (isLeapYear(&2))) THEN Days (2) := 29; END IF;

  -- Print header
  DBMS_OUTPUT.PUT_LINE ('.    ' ||  Months (&1) || ' ' || &2);
  DBMS_OUTPUT.PUT_LINE ('. S M Tu W Th F S');
  DBMS_OUTPUT.PUT_LINE ('. ');

  d := day (&1, &2);
  LineCal := '.';

  -- Print the calendar
  -- The first line
  i := 0;
  WHILE i < d LOOP
    i := i+1;
    LineCal := LineCal || ' ' ;
  END LOOP;

  -- The rest of lines
  i := 0;
  WHILE i <= days (&1) LOOP
    i := i + 1;    

    IF (i < 10) THEN -- add one more space if it is one digit
      LineCal := LineCal || ' ' || i;
    ELSE
      LineCal := LineCal || ' ' || i;
    END IF ;

    IF ((MOD ((i+d),7) = 0) OR (i = days (&1))) THEN 
      dbms_output.put_line (LineCal); 
      LineCal := '.';
    END IF;

  END LOOP;

 END; /*** PRINCIPAL ***/
 /

An example;

 
BBDD*ANTO> sta cal 11 2017
.   November 2017
.   S   M  Tu   W  Th   F   S
.
.               1   2   3   4
.   5   6   7   8   9  10  11
.  12  13  14  15  16  17  18
.  19  20  21  22  23  24  25
.  26  27  28  29  30

HTH – Antonio NAVARRO

List Grid Infrastructure Patches From ASMCMD

Today I like to show a easy way to list installed patches in Oracle Clusterware. From version 12.1 and forwards you can see by using asmcmd command line;

 

ASMCMD [+] > showpatches
---------------

List of Patches

===============

19769480

20299023

20831110

21359755

21436941

21948354

22291127

23054246

24006101

24732082

24828633

24828643

 

HTH – Antonio NAVARRO

Case Of Use

Last week I post a code for show percentages in a way the grafic by user text mode. Today I want to show a new example of this;

                                           
COLUMN sid FORMAT 999
COLUMN serial# FORMAT 9999999
COLUMN machine FORMAT A30
COLUMN progress_pct FORMAT 99999999.00
COLUMN elapsed FORMAT A10
COLUMN remaining FORMAT A10
COLUMN grafi format a20

BBDD*ANTO> SELECT s.sid,
  2  s.serial#,
  3  s.machine,
  4  ROUND(sl.elapsed_seconds/60) || ':' || MOD(sl.elapsed_seconds,60) elapsed,
  5  ROUND(sl.time_remaining/60) || ':' || MOD(sl.time_remaining,60) remaining,
  6  PERCENTAGE_GRAPH_TEXT (ROUND(sl.sofar/sl.totalwork*100, 2)) grafi
  7  FROM v$session s,
  8  v$session_longops sl
  9  WHERE s.sid = sl.sid
 10  AND s.serial# = sl.serial#
 11  /

 SID  SERIAL# MACHINE                        ELAPSED    REMAINING  GRAFI
____ ________ ______________________________ __________ __________ ____________________
####    19162 #######                        0:12       0:5        [******....] 68,63%
####      291 #######                        0:11       0:11       [****......] 49,62%
####      291 #######                        0:11       0:11       [****......] 49,62%
####      291 #######                        0:11       0:11       [****......] 49,62%
####    28799 #######                        1:37       20:55      [..........] 3%

5 rows selected.

 

HTH – Antonio NAVARRO

 

Graphic In Text Mode

I have to admit that I am a fanatic of the text mode, began to play computers in the eighties and practically everything was text mode. Today I will show a very simple function to put a kind of graphic (in text mode) to get our querys a little more interesting.

Here is the code;

-------------------------------------------------------------------------------- 
--Function that generate a graphic for percentages in text mode
--The function have five parametero, first one mandatory and the rest
--are optionals.
--
-- Parameter list;
--
-- Position 1 Is the figure that represent the percentage
-- Position 2 Is how many characters are used for generate the graph text (10)
-- Position 3 Is the simbol used for represent the percent (*)
-- Position 4 Is the simbol used for represent the space until the end ( )
-- Position 5 Is a flag to show the last string (number plus % simbol) (TRUE)
-- 
-- --- example i ----
-- SELECT PERCENTAGE_GRAPH_TEXT (20) FROM DUAL;
--
-- Result: [**........] 20%
--
-- -- example ii -----
-- SELECT PERCENTAGE_GRAPH_TEXT (20, 5, '=', ' ') from dual;
--
-- Result: [=    ] 20%
--
--
--  AUTOR:   Antonio NAVARRO
--  FECHA:   28.10.99
--  MODIFICADO: 28.10.99
--  FICHERO: PERCENTAGE_GRAPH_TEXT.SQL
--  LOCALIZACION: \\SAN/NAS
--
---------------------------------------------------------------------------------

CREATE OR REPLACE
FUNCTION PERCENTAGE_GRAPH_TEXT
(
numero number ,
longitud number default 10 ,
simbolo varchar2 default '*' ,
simbolo_relleno varchar2 default '.' ,
numero_por_centaje boolean default true
) RETURN VARCHAR2 IS

TEXTO VARCHAR2(110);

BEGIN


-- Open textgraph ---
TEXTO := TEXTO || '[';

FOR i IN 1..longitud LOOP
/*** Si estamos en porcentaje escribir simbolo, sino escribir vacio ***/
IF round ((i*100)/longitud) <= numero THEN
TEXTO := TEXTO || simbolo;
ELSE
TEXTO := TEXTO || simbolo_relleno;
END IF;

END LOOP;

-- Close texgraph ---
TEXTO := TEXTO || ']';

IF numero_por_centaje THEN
TEXTO := TEXTO || ' ' || numero || '%';
END IF;

RETURN (TEXTO);


END; /*** PERCENTAGE_GRAPH_TEXT ***/
/

An example of this will be like show below;

WEB*ANTO> SELECT PERCENTAGE_GRAPH_TEXT (20) FROM DUAL;

PERCENTAGE_GRAPH_TEXT(20)
_______________________________________________________________________
[**……..] 20%

WEB*ANTO> SELECT PERCENTAGE_GRAPH_TEXT (20, 5, ‘=’, ‘ ‘) from dual;

PERCENTAGE_GRAPH_TEXT(20,5,’=’,”)
_______________________________________________________________________
[= ] 20%

There are many options and possibilities that are left for the reader.

HTH – Antonio NAVARRO

Ora-01110 And Ora-01187 Errors

Last morning I was duplicating a database, when I finish, dev reported me about the ORA-01110 and ORA-01187 errors where they tryed a query. The problem is the temporary files not was restaured in a correct way (This is a older version of Oracle 10g).

The solution was drop the current temporary tablespace and recreate it.

HTH – Antonio NAVARRO.