Oracle Troubleshooting: 20 Common Errors and Their Solutions

English

When working with Oracle Database, you may encounter various errors. These errors can arise due to system misconfigurations, query mistakes, resource shortages, and other causes. Below are 20 common errors that beginners are likely to face, along with their explanations and solutions.


1. ORA-00942: table or view does not exist

Meaning: The specified table or view could not be found.

Cause:
The table or view does not exist, or you lack the necessary permissions.

Solution:
Check with the SYS user or schema owner. Specify the schema name explicitly if needed.

Verify the table using SYS:

SELECT * FROM dba_tables WHERE table_name = 'YOUR_TABLE_NAME';

Grant permission to a specific user:

GRANT SELECT ON <schema>.<table> TO <username>;

Check privileges with SYS:

SELECT * FROM dba_tab_privs WHERE grantee = '<username>';

2. ORA-00001: unique constraint (string.string) violated

Meaning: A unique constraint has been violated.

Solution:
Check the existing constraints and avoid inserting duplicate values.

Check constraint details:

SELECT constraint_name, column_name
FROM dba_cons_columns
WHERE table_name = '<TABLE_NAME>' AND constraint_name = '<CONSTRAINT_NAME>';

3. ORA-12154: TNS:could not resolve the connect identifier specified

Meaning: The connect identifier could not be resolved.

Solution:
Verify the identifier and confirm that tnsnames.ora is correctly configured.

Check TNS configuration (regular user):

vi $ORACLE_HOME/network/admin/tnsnames.ora

Check listener status (SYSDBA required):

lsnrctl status

4. ORA-12560: TNS:protocol adapter error

Meaning: The client cannot connect to the server.

Solution:
Make sure the database is up and running.

Start the server (SYSDBA):

CONNECT / AS SYSDBA;
STARTUP;

5. ORA-01017: invalid username/password; logon denied

Meaning: Incorrect username or password.

Solution:
The user account may be locked. Unlock it with SYSDBA:

CONNECT / AS SYSDBA;
ALTER USER <username> IDENTIFIED BY <new_password>;
ALTER USER <username> ACCOUNT UNLOCK;

6. ORA-04031: unable to allocate string bytes of shared memory (“string“,”string“,”string“,”string“)

Meaning: The SGA (System Global Area) lacks memory.

Solution:
Resize the SGA parameters using SYSDBA:

CONNECT / AS SYSDBA;
SHOW PARAMETER sga_max_size;
SHOW PARAMETER sga_target;
ALTER SYSTEM SET sga_max_size = <new_size> SCOPE=SPFILE;
ALTER SYSTEM SET sga_target = <new_size> SCOPE=SPFILE;
SHUTDOWN IMMEDIATE;
STARTUP;

7. ORA-01555: snapshot too old: rollback segment number string with name “string” too small

Meaning: UNDO tablespace is insufficient.

Solution:
Expand the UNDO tablespace using SYSDBA:

CONNECT / AS SYSDBA;
SELECT tablespace_name, bytes FROM dba_data_files WHERE tablespace_name = 'UNDOTBS1';
ALTER DATABASE DATAFILE '<full_path_to_datafile>' RESIZE <new_size>;

8. ORA-00933: SQL command not properly ended

Meaning: SQL syntax is incorrect.

Solution:
Check and correct your SQL statement.


9. ORA-01403: no data found

Meaning: No rows were returned from the query.

Solution:
Check your WHERE clause and ensure the data exists.


10. ORA-01653: unable to extend table string.string by string in tablespace string

Meaning: Tablespace has run out of space.

Solution:
Expand the tablespace with SYSDBA:

CONNECT / AS SYSDBA;
ALTER DATABASE DATAFILE '<full_path_to_datafile>' RESIZE <new_size>;

11. ORA-00904: string: invalid identifier

Meaning: An invalid identifier was used in SQL.

Solution:
Correct the column name or alias.


12. ORA-02291: integrity constraint (string.string) violated – parent key not found

Meaning: A foreign key constraint was violated.

Solution:
Ensure the referenced parent key exists before inserting the child record.


13. ORA-03113: end-of-file on communication channel

Meaning: The connection was unexpectedly closed.

Solution:
Check communication status and inspect server logs (SYS user required):

tail -f $ORACLE_BASE/diag/rdbms/db_name/alert_db_name.log

14. ORA-01033: ORACLE initialization or shutdown in progress

Meaning: The database is currently starting or shutting down.

Solution:
Check the database status and start it if needed:

CONNECT / AS SYSDBA;
STARTUP

15. ORA-01000: maximum open cursors exceeded

Meaning: Too many cursors have been opened.

Solution:
Increase the open cursor limit using SYSDBA:

CONNECT / AS SYSDBA;
ALTER SYSTEM SET open_cursors = 3000 SCOPE=BOTH;

16. ORA-01950: no privileges on tablespace ‘string‘

Meaning: You don’t have the necessary privileges on the tablespace.

Solution:
Grant unlimited tablespace permission (SYS user):

CONNECT / AS SYSDBA;
GRANT UNLIMITED TABLESPACE TO <username>;

17. ORA-00936: missing expression

Meaning: The SQL statement lacks a required expression.

Solution:
Check and correct the SQL syntax. SYS privileges are not required.


18. ORA-06512: at stringline string

Meaning: A PL/SQL block has encountered an error.

Solution:
Check the line indicated in the error and correct the PL/SQL code.


19. ORA-00018: maximum number of sessions exceeded

Meaning: The number of allowed sessions has been exceeded.

Solution:
Increase the session limit using SYSDBA:

CONNECT / AS SYSDBA;
ALTER SYSTEM SET SESSIONS=500 SCOPE=SPFILE;

20. ORA-28000: The account is locked.

Meaning: The user account is locked.

Solution:
Unlock the account using SYSDBA:

CONNECT / AS SYSDBA;
ALTER USER <username> ACCOUNT UNLOCK;

Reference

Database Error Messages


Conclusion

Managing and troubleshooting Oracle databases often requires SYSDBA or equivalent privileges. When dealing with critical settings or resources, operations should be performed with appropriate authority. If your account lacks such privileges, consult the database administrator or switch to a SYS user session to proceed.

コメント

Copied title and URL