Skip to Main Content
  • Questions
  • Oracle 12c Performance issue after upgrading database from 10.2.0.5.0 to 12.1.0.2.0

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Parth.

Asked: February 20, 2019 - 12:31 pm UTC

Last updated: February 22, 2019 - 7:03 am UTC

Version: 12.1.0.2.0

Viewed 1000+ times

You Asked

Hello,

One of our client has upgraded Test environment Oracle database from 10.2.0.5.0 to 12.1.0.2.0 with Production data.

After upgrading the database, we are facing performance issue in few processes which are taking huge time to complete compare to older database version.

For example,
1. Facing "ORA-01722 Invalid Number" error when trying to access CHAR data type column with numeric value without quotes.
>> When we are executing the query on Production environment(Oracle Database 10.2.0.5), we are not getting any error while in case of this upgraded database, same query is throwing "ORA-01722 Invalid Number" error.

2. Mismatch of data type while comparing two fields in WHERE clause (For example, One column is having CHAR data type and another column is having VARCHAR2 data type in where clause)
>> When we are executing one process which is having this type of condition is taking around 1.5 minutes on Production database while in case of upgraded database, same process is taking approx 2.5 hours which is very huge amount of time.

There are some other queries, which are having this type of issue.

Please help us to resolve this issue and to improve over all performance ASAP.

Thanks.

and Connor said...

Facing "ORA-01722 Invalid Number" error when trying to access CHAR data type column with numeric value without quotes


The reality is - you *always* had this problem, you just got very very lucky with Oracle 10g in that you did not see it. Here's an example:

SQL> create table t1 ( x1 varchar2(10), y1 int );

Table created.

SQL> create table t2 ( x2 varchar2(10), y2 int );

Table created.

SQL>
SQL> insert into t1 values ('12',1);

1 row created.

SQL> insert into t1 values ('13',1);

1 row created.

SQL> insert into t1 values ('14',1);

1 row created.

SQL> insert into t1 values ('15',1);

1 row created.

SQL>
SQL> insert into t2 values ('12',5);

1 row created.

SQL> insert into t2 values ('13',5);

1 row created.

SQL> insert into t2 values ('14',5);

1 row created.

SQL> insert into t2 values ('15',5);

1 row created.

SQL> insert into t2 values ('blah',2);

1 row created.

SQL>
SQL> exec dbms_stats.gather_table_stats('','T1')

PL/SQL procedure successfully completed.

SQL> exec dbms_stats.gather_table_stats('','T2')

PL/SQL procedure successfully completed.

SQL>
SQL>
SQL> select /*+ leading(t1 t2) use_nl(t2) */ *
  2  from t1, t2
  3  where t1.x1 = t2.x2
  4  and   t2.x2 > 0
  5  and   t1.y1 = 1;

X1                 Y1 X2                 Y2
---------- ---------- ---------- ----------
12                  1 12                  5
13                  1 13                  5
14                  1 14                  5
15                  1 15                  5

4 rows selected.

SQL>
SQL> select /*+ leading(t2 t1) use_nl(t1) */ *
  2  from t1, t2
  3  where t1.x1 = t2.x2
  4  and   t2.x2 > 0
  5  and   t1.y1 = 1;
ERROR:
ORA-01722: invalid number



Depending on which plan the optimizer took, you *always* were running this risk. What has most likely happened is that 12c has chosen a different plan, and you've run into this problem.

The bottom line is - mis-matched data types where you are relying on the database to make a conversion rather than it being done explicitly in code, then you are always going to have problems.

As an intermim, all I can suggest is setting optimizer_features_enable to a lower value until you can rectify the code and/or database structures.

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

Performance

Get all the information about database performance in the Database Performance guide.