20.5.17

ORA-02291: integrity constraint violated - parent key not found

“Error: ORA-02291: integrity constraint violated - parent key not found”



Reason:   A Primary key does not have the same value as the foreign key. We will discuss it in detail later in this article.

Action:   For ORA-02291: integrity constraint violated - parent key not found You may either delete the foreign key or the matching primary key can be added. In either way, you may try to get this error corrected.


Let's understand more about ORA-02291: integrity constraint violated - parent key not found?


The Oracle software brought us the strength by which multiple tables in the database can pass on information so efficiently. Not only this, there are numerous devices in this software which enables access to and sourcing data from multiple tables. You can easily execute complicated database issues without an unusual uncertainty by creating statements with the fantastic characteristic of this software. Realistically, if we talk about user or database no one is perfect or 100% error-free or have the sense to identify forthcoming possible errors occurs throughout the regular activities.


The most well-known error occurs while manipulating data across multiple data tables is the ORA-02291.Now, we will have a brief discussion about ORA-02291: integrity constraint violated - parent key not found:-

" integrity constraint <constraint name> violated – parent key not found” is the standard message co-occurred with the ORA-02291.Which means someone used the primary key in order to execute a reference to a specific table but somehow, during this process specified column failed to match the primary key. As well as, the other reason for executing the error can be non-existence of primary key for the table in question.It is useful to secure a note of few important things related to the primary key before we proceed further.




In oracle, a primary key is a single field or combination of fields that defines a record in a unique way. Every field of the primary key must contain some value, it means, the value of any field can never be null and each table contains only one primary key. One last important thing about a primary key that it cannot hold more than thirty-two columns.


Now while we are familiar with all concepts of a primary key, it will not be difficult for us to determine the error and fix it with fewer efforts (ORA-02291: integrity constraint violated - parent key not found). 

Usually, the error occurs when foreign key plays a parent-child relation between two tables. The process of foreign key states that each table shares the same value. overall, the referenced table is a parent table. On the other hand, the child table will take place where foreign key originates from. It is quite often that a foreign key in a child table will reference to a primary key in a parent table. The cause why the ORA-02291 trigger is when the corresponding parent is empty (does not have any value) and by the time, you still try to insert a value into a child table which includes a foreign key. Your this action disrupts the integrity of referential relationship, bother standard functionality and provoking oracle to produce an error message "ORA-02291: integrity constraint violated - parent key not found".



“The valid method to fix the error ORA-02291: integrity constraint violated - parent key not found “--- the primary table to insert the value will be the parent and obviously secondary table to insert value will be the child table. To elaborate, you should insert the value inside the parent table first and later, add it to the child table.



keep sharing :) 




Labels:

17.5.17

ORA-01033: ORACLE initialization or shutdown in progress

ORA-01033: ORACLE initialization or shutdown in progress



Cause: You are trying to access oracle database while  database is either starting up or shuting down (ORA-01033: ORACLE initialization or shutdown in progress).

Action: For ORA-01033: ORACLE initialization or shutdown in progress you need to wait for some time. Then retry the operation again (connect after some time) to check if ORA-01033: ORACLE initialization or shutdown in progress is there or not.


What is ORA-01033: ORACLE initialization or shutdown in progress?

This is very common error and not occurs much. But you must have some idea if you face ORA-01033: ORACLE initialization or shutdown in progress occurs. As we know We can only set database to  Shutdown or startup using SYSDBA privileges. So you must have SYSDBA privileges to troubleshoot. I suggest  to  wait for 5mins because may be your DBA has shutdown the Database and it's in progress.Or if you are a DBA then check the status of database  do start if it is down. My case below:-

[server@****** ~]$ sqlplus /nolog

SQL*Plus: Release 12.1.0.1.0 Production on Wed May 17 14:24:19 2017

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

SQL>conn test/test@test
ERROR:
ORA-01033: ORACLE initialization or shutdown in progress
Process ID: 0
Session ID: 0 Serial number: 0

The ORA-01033 error also happens when the database is not open. SO in this case below is the solution :

"alter database open"


Brief about ORA-01033: ORACLE initialization or shutdown in progress :- 


Sometime when We stop our oracle database then if at the same time any user will try to access the database then that user will face the issue ORA-01033: ORACLE initialization or shutdown in progress .For work around to solve "The ORA-01033: ORACLE initialization or shutdown in progress" ask your user to wait for some time and check the status of the database. Also check the alert logs for error ORA-01033: ORACLE initialization or shutdown in progress.You need to check the status and see if your database is in the middle of startup or shutdown.

There may be other cause for error ORA-01033: ORACLE initialization or shutdown in progress is like when RAM regions held by the OS and that makes Oracle think that instance is already running. Then also Database will through the error ORA-01033: ORACLE initialization or shutdown in progress.

Solution for ORA-01033: ORACLE initialization or shutdown in progress provided by oracle. Check your database status and paas below command by SYSDBA if your database is not open.
1. wait for some time
2. check the status of DB
3. "alter database open"

Keep sharing :)

Labels:

10.5.17

ORA-12714 invalid national character set specified

Error: ORA-12714

ORA-12714  invalid national character set specified 

ORA-12714 invalid national character set specified  is very common error and related to database parameters and sessions parameters.


Cause 

Only UTF8 and AL16UTF16 are allowed to be used as the national character set. Check your NLS_NCHAR_CHARACTERSET which is set using:

select value from NLS_DATABASE_PARAMETERS where parameter = 'NLS_NCHAR_CHARACTERSET';

it should return UTF8 Or AL16UTF16

Action

Ensure that the specified national character set is valid

Please aware that at session level, some parameters could be different. If you want to be sure, compare the results of:

select * from nls_database_parameters;

with:

select * from nls_session_parameters;



Please find the below information:-    

Bug No :- 2834295 

Cause :-  declaring cursor for a function that returns a table of NVARCHAR2

 Affects below products :
Product (Component)
Oracle Server (Rdbms)
Range of versions believed to be affected
Versions BELOW 11.1
Versions confirmed as being affected
  • 10.2.0.3
  • 9.2.0.8
  • 9.2.0.2
Platforms affected
Generic (all / most platforms affected)

Fixed:

The fix for 2834295 is first included in
  • 11.1.0.6 (Base Release)
  • 10.2.0.4 (Server Patch Set)

Please check for document number on oracle support :-  2834295.8



Labels: