Sunday, November 25, 2018

ORA-28000: the account is locked:Exception occurred: java.sql.SQLException:

 Error :

..
Exception occurred: java.sql.SQLException: ORA-28000: the account is locked
ORA-28000: the account is locked
...

The following ORACLE error:
ORA-28000: the account is locked
occurred while executing the SQL statement:


Cause :

The issue is caused by a locked APPS Database account.

The following script allows you to check the number of failed logins, which can lock the apps user :

select profile , resource_name, limit
from dba_profiles
where resource_name ='FAILED_LOGIN_ATTEMPTS';

Example output :

DEFAULT FAILED_LOGIN_ATTEMPTS : 10
AD_PATCH_MONITOR_PROFILE FAILED_LOGIN_ATTEMPTS : 3


Solution :

​To implement the solution test the following steps in a Development instance and then migrate accordingly:

1. Ensure that you have taken a backup of your Environment.

2. Increase the number of failed logins allowed before the apps user is locked(optional):

alter profile AD_PATCH_MONITOR_PROFILE limit failed_login_attempts unlimited;

alter profile default limit failed_login_attempts unlimited password_lock_time 1/1440;

3.Unlock the locked APPS User account :

alter user apps account unlock;

4. Rerun the failed cloning commands and confirm the error is resolved.

Friday, November 23, 2018

How update statement works in oracle

UPDATE command in sql is used to modify existing records in a table. How SQL UPDATE statement works inside the Oracle architecture and the sequence of steps which oracle follow internally for the execution of update statement is explained below.
Picture
DATE Syntax
UPDATE emp
SET column1 = value1, column2=value2, …
WHERE condition;



How does the update query execution occur?

1.SQL*PLUS checks the syntax on client side.
 
2. If syntax is correct the query is stamped as a valid sql statement and encrypted into  oci (oracle call interface) packets and sent via LAN using TCP to the server.

3. Once the packets reach the server the server process will rebuild the query and again perform a  syntax check on server side.

Then if syntax is correct server process will continue execution of the query.

4.The server process will go to the library cache. The library cache keeps the recently executed  sql statements along with their execution plan.

  In the library cache the server process will search from the mru (most recently used) end to the lru (least recently used) end for a match for the sql statement. It does this by using a hash algorithm that returns a hash value. If the hash value of the query we have written matches with that of the query in library cache then server process need not generate an execution plan (soft parsing) but if no match is found then server process has to proceed with the generation of execution plan (hard parsing).

Parsing is the process undertaken by oracle to generate an execution plan.


5. The first step in parsing involves performing a symantic check. This is nothing but   check for the existence of the obj and its structure in the database.


This check is done by server process in the data dictionary cache. Here server process will ask for the definition of the object, if already available within the data dictionary cache, server process will process the check. If not available then server process will retrieve the required information from the system tablespace.


6. After this in case of hard parsing the server process will approach the optimizer, who will read the sql statement and generate the execution plan of the query. The optimizer generates multiple execution plans during parsing.

7. After generation of the e-plan’s by the optimizer the server process will pick the best possible and cost effective e-plan and go to the library cache.

In the library cache the server process will keep the e-plan in the library cache along with the original sql text.
 
At this point in time the parsing ends and the execution of the sql statement will begin.

 
8. After generation of e-plan server process will keep the plan in the library cache on the MRU end .

Thereafter the plan is picked up by the server process and execution of the update will begin.

 
9. Server process will bring the required blocks from the specific datafile of the table  which has to be updated.

The blocks will be brought into database block buffers(or database buffer cache).
The blocks will be containing the original data of the table.


10. Then server process will bring equal no of empty blocks from the undo tablespace  and they will also be brought into the database block buffers(or database buffer  cache).


11. Server process will copy the original data from the userdata blocks into the empty rollback/undo blocks and create a before image.

12. Then server process will bring a set of userdata blocks into the pga (program  global area) and after performing filter operations the selected rows will be   updated with new content.


The above update process will continue until all the userdata blocks have been checked and updated.

After the update operation is complete then dbwriter will write the data back to the respective datafiles after a certain time gap.

ORACLE DATABASE CONTENT

ORACLE DATABASE 11gR2 & 12C  CONTENT Pre-Requisite: UNIX, SQL Basics Introduction to Oracle Database §   Introduction of Database ...