Hadoop:FATAL-6109: Internal error: no columns found in table: Inappropriate ioctl for device at expression maxcol_id at apply_file.c:309
This article explains how to resolve errors in HADOOP with CTAS(Create Table As Select).The error is well known for our developers and a ticket is logged in.
Problem Details
Problem Statement
FATAL-6109: Internal error: no columns found in table: Inappropriate ioctl for device at expression maxcol_id at apply_file.c:309
Affected Versions
2.8+
Affected Platforms
Hadoop
Description
Oracle makes two different operations in one command - DDL and DML when we do CTAS, it creates a table and also inserts rows in to the table. Currently, it's not supported by DbVisit for Hadoop.
The apply process has crashed with error FATAL-6109: Internal error: no columns found in table: Inappropriate ioctl for device at expression maxcol_id at apply_file.c:309. The error persists even after APPLY is re-started.
Unprepare the table from replication using dbvrep console. You need to do it with offline clause since the APPLY process is down -
https://dbvisit.atlassian.net/wiki/spaces/ugd8/pages/60784941/Full+Command-Line+Reference.
If you are not sure of the table caused this error check the latest trace file - the trace file can be located in $dbvrep_base/log/trace directory.
Scroll to the bottom of the file and search for last SQL query "before backtrace() returned" pattern.
Mon Jul 24 15:55:00 2017 [execute_SQL_file] file: SQL would be insert into "MSI"."SRC"
("NEW_OWNER","NEW_OBJECT_NAME","NEW_SUBOBJECT_NAME","NEW_OBJECT_ID","NEW_DATA_OBJECT_ID","NEW_OBJECT_TYPE","NEW_CREATED","NEW_LAST_DDL_TIME","NEW_TIMESTAMP","NEW_STATUS","NEW_TEMPORARY","NEW_GENERATED","NEW_SECONDARY","NEW_NAMESPACE",OPERATION,DATE_CHANGE,SCN)
values
(:1,
:2,
:3,
to_number(:4),
to_number(:5),
:6,
:7,
:8,
:9,
:10,
:11,
:12,
:13,
to_number(:14),
:15,
:16,
:17)
Mon Jul 24 15:55:00 2017 [set_and_parse_csv_header] set_and_parse_csv_header: 103894
Mon Jul 24 15:55:00 2017 [set_and_parse_csv_header] Maxcol_id=0
header=OPERATION DATE_CHANGE SCN
ERATION DATE_CHANGE SCN
»‰[26]
Mon Jul 24 15:55:00 2017 [OCI_tassert_c_fun] Thread assert failed: -6109: no columns found in table at apply_file.c.309 for maxcol_id: Inappropriate ioctl for device
Mon Jul 24 15:55:00 2017: backtrace() returned:
Mon Jul 24 15:55:00 2017: /tmp/par-oracle/cache-1e39210f255d5d0277e29b8b36af26fb27f6c69d/libCapply.so(bt+0x2b) [0x7f58ca992a2f]Mon Jul 24 15:55:00 2017:
Mon Jul 24 15:55:00 2017: /tmp/par-oracle/cache-1e39210f255d5d0277e29b8b36af26fb27f6c69d/libCapply.so(apply_dump_all_omitbuf+0x3bc) [0x7f58ca9930d2]Mon Jul 24 15:55:00 2017:
Mon Jul 24 15:55:00 2017: /tmp/par-oracle/cache-1e39210f255d5d0277e29b8b36af26fb27f6c69d/libCapply.so(apply_dump_all_omitbuf_Perl+0xe) [0x7f58caa54f28]Mon Jul 24 15:55:00 2017:
Mon Jul 24 15:55:00 2017: /tmp/par-oracle/cache-1e39210f255d5d0277e29b8b36af26fb27f6c69d/Libapply.so(XS_Libapply_apply_dump_all_omitbuf_Perl+0xdb) [0x7f58d0e8cebb]Mon Jul 24 15:55:00 2017:
Mon Jul 24 15:55:00 2017: dbvrep APPLY RQ-3535(Perl_pp_entersub+0x489) [0x4925d9]Mon Jul 24 15:55:00 2017:
Solution
To workaround this issue, you can create the DDL of the table first and then insert rows into the table, below is a example:
dbvrep> unprepare offline table msi.src
SQL> drop table src;
SQL> CREATE TABLE src AS SELECT * FROM all_objects WHERE 1=0;
SQL> alter system switch logfile;
SQL> insert into src select * FROM all_objects WHERE ROWNUM <= 100;
SQL> commit;
SQL> drop table tgt;
SQL> CREATE TABLE tgt as SELECT * FROM src WHERE 1=0;
SQL> alter system switch logfile;
SQL> insert into tgt SELECT * FROM src WHERE ROWNUM <= 80;
SQL> commit;