Wednesday 16 May 2018

Why my delete is not running in parallel?

Sometimes is really faster of the delete statement is running in parallel; not only to identify the rows to be deleted, but the delete itself.

 2 observations related to this:

1) Deleting from a table partition, it seems that the alias is not being translated properly, so instead I added a where clause, to access the required partition.

2) Adding 2 where clauses didn't help, but adding a between clause, did the trick.

Example of a query which will NOT do the delete in parallel:


delete /*+ parallel(a,16) full(a)  */
from MYTAB  partition (PR001) a
where expiration_date <  add_months( trunc(sysdate), -85 );

Example of a fixed query, which will run in parallel:

delete /*+ parallel(a,16) full(a)  */
from MYTAB a 
where expiration_date <  add_months( trunc(sysdate), -85 )
and ID between 2500 and 37500;

Notes:

1. ALTER SESSION ENABLE PARALLEL DML; is still required.
2. To check that the delete is running in parallel, the below query should return more than 1 row:


select a.SID,a.USERNAME,b.xidusn,b.used_urec,b.used_ublk
from  v$session a,v$transaction b
where a.SADDR=b.ses_addr
/


Friday 11 May 2018

ORA-28040: No matching authentication protocol, when connecting to a 12c DB

The issue:

 >sqlplus myuser/mypass@MY12CDB

SQL*Plus: Release 11.2.0.2.0 Production on Fri May 11 10:22:44 2018

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

ERROR:
ORA-28040: No matching authentication protocol


 Cause: connecting to a 12c DB, with a client lower than 11.2.0.3

 Solution:

 Add the following to $ORACLE_HOME/network/admin/sqlnet.ora , for both versions:

 SQLNET.ALLOWED_LOGON_VERSION_SERVER=8
 SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8

Note: it's important to modify the sqlnet.ora in the above mentioned location.