Saturday, November 15, 2008

What is an ORA-00600? : internal error code

Generally whenever you got ORA-00600 error on your screen or in the alert log or in trace files they indicate that something inconsistency happened with your oracle database software. This is raised from the kernel code of the Oracle RDBMS software when an unexpected condition is met. This mean exception encountered in the RDBMS kernel code.

A typical form of ORA-00600 error in the alert log is like below,
Errors in file /var/opt/dumpfile/udump/orastdby_ora_15862.trc:
ORA-00600: internal error code, arguments: [15160], [], [], [], [], [], [], []
Sat Nov 15 17:49:27 2008


•Whenever an ORA-600 error is raised a trace file is generated and an entry written to the alert.log with details of the trace file location.

•The trace file contains vital information about what led to the error condition.

•The trace file will be written to either USER_DUMP_DEST (if the error was caught in a user process) or BACKGROUND_DUMP_DEST (if the error was caught in a background process like PMON or SMON). In the above example we see trace file is generated in udump directory which indicates the error was caught in a user process.

•Besides with ORA-00600 we see a list of arguments in square brackets. The first argument tells us from where in the code the error was caught and thus it is the key information in identifying the problem. This argument is either a number or a character string.

•Subsequent arguments are used to supply further information eg. values of internal variables etc.

Related Documents
ORA-00600 internal error code, kmgs_pre_process_request_6
What is Alert Log?

Wednesday, November 12, 2008

IMPDP fails with ORA-39002, ORA-29283: invalid file operation

Problem Description
My impdp operation fails with error ORA-39002, ORA-39070, ORA-29283, ORA-29283: invalid file operation as below.
SQL> host impdp cr_3/cr_3 remap_schema=cr_2:cr_3 dumpfile=skydbcr_2-04-10-2008.dmp directory=e

Import: Release 10.2.0.1.0 - Production on Wednesday, 12 November, 2008 16:42:27

Copyright (c) 2003, 2005, Oracle. All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 475
ORA-29283: invalid file operation

Cause and Solution of the Problem
1. Check whether the user who run the expdp operation has READ,WRITE permission on the database directory. If not then as a dba user run grant permission on cr_3,
GRANT READ,WRITE ON DIRECTORY E TO CR_3;

2. Check whether the path used in database directory physically exists on the OS.
Whenever you create a directory oracle does not check existence physical directory on OS. The checking is done on runtime.

3. Check whether the owner of oracle process has enough permission on the OS directory where the file is accessed. On unix issue,
ls -l name_of_the_file and see permission. If not then using chmod grant read, write access to the file to oracle user.
On windows if NTFS file system then you can change it by right clicking on the file or folder and then select sharing and security option.

4. Even though oracle-user has enough permissions on the directory, it may raise ora-29283 if the owner of the file is not oracle. In such case using chown change the ownership of the file on unix. On windows if NTFS file system then you can change it by right clicking on the file or folder and then select sharing and security option.

Tuesday, November 11, 2008

Online Redefinition fails with ORA-23540: Redefinition not defined or initiated

Problem Description
While doing online redefinition on a table dbms_redefinition.copy_table_dependents fails with error ORA-23540 as below.
SQL> set serverout on
SQL> declare
2  error_count pls_integer := 0;
3  BEGIN
4  dbms_redefinition.copy_table_dependents('MUCI', 'HISTORY', 'HISTORY_',1, true, true, true, false,error_count);
5  dbms_output.put_line('errors := ' || to_char(error_count));
6  END;
7  /
declare
*
ERROR at line 1:
ORA-23540: Redefinition not defined or initiated
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: at "SYS.DBMS_REDEFINITION", line 1662
ORA-06512: at line 4

Cause of the problem
There may be different causes against it. If the schema specified in the dbms_redefinition.copy_table_dependents procedure does not exist already in the database then above error can appears. Suppose it may be the case that you specified schema name as lower case but by default username is created in uppercase.

There may be other reason is that the redefinition process is not yet started or initiated by dbms_redefinition.start_redef_table over the table. In fact dbms_redefinition.start_redef_table function create a materialized view on the table. If the materialized view is not yet created then ORA-23540 come.

Solution of the Problem
Let's see whether materialized view created on the underlying table.
SQL> select master,log_table from dba_mview_logs where log_owner='MUCI' and master='HISTORY';
no rows selected

Check for underlying table under the user.
SQL> desc muci.history;
ERROR:
ORA-04043: object muci.history does not exist

In fact user MUCI is not existed on the system and hence error comes.

The same error also appears if redefinition is not defined on the table. Suppose here schema MUCI_FINAL exist and also table HISTORY_DETAIL as well as interim table HISTORY_ but redefinition is not defined.
SQL> declare
2  error_count pls_integer := 0;
3  BEGIN
4  dbms_redefinition.copy_table_dependents('MUCI_FINAL', 'HISTORY_DETAIL', 'HISTORY_',1, true, true, true, false,error_count);
5  dbms_output.put_line('errors := ' || to_char(error_count));
6  END;
7  /
declare
*
ERROR at line 1:
ORA-23540: Redefinition not defined or initiated
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: at "SYS.DBMS_REDEFINITION", line 1662
ORA-06512: at line 4

Check for tables by,

SQL> select table_name from dba_tables where owner='MUCI_FINAL' and table_name like 'HISTORY%';

TABLE_NAME
------------------------------
HISTORY_DETAIL_
HISTORY_DETAIL
HISTORY_
HISTORY

See materialized view log exists on HISTORY (ran dbms_redefinition.start_redef_table earlier) and hence dbms_redefinition.copy_table_dependents procedure can be run over HISTORY table.
SQL> select master,log_table from dba_mview_logs where log_owner='MUCI_FINAL' and master='HISTORY';

MASTER                         LOG_TABLE
------------------------------ ------------------------------
HISTORY                        MLOG$_HISTORY
SQL> declare
2  error_count pls_integer := 0;
3  BEGIN
4  dbms_redefinition.copy_table_dependents('MUCI_FINAL', 'HISTORY', 'HISTORY_',1, true, true, true, false,error_count);
5  dbms_output.put_line('errors := ' || to_char(error_count));
6  END;
7  /
errors := 0

PL/SQL procedure successfully completed.

Related Documents
How to Convert Long data type to Lob
How to convert non-partitioned table to partition table using re-definition