More info.   I looked to see what filenames are for a newly created database 
and 'c470.dat' corresponds to SYSUSERS.   The database that I am trying to run 
the 'RawDBReader' on is an old database that has been upgrade many times, 
probably starting back at Derby 10.2 or so.   Looking at old backups of this 
database from as far back as 2014, I don't find 'c470.dat' on any old backup 
either.

So on a whim, I copied 'c470.dat' from the newly created database to my old 
database that I am trying to recover.   Now I can run the 'RawDBReader' tool 
and seem to be able to access the table that I am having issues with.

So it appears the tool is looking for a 'SYSUSERS' table, that does not exist 
when the database is old and upgraded many times.

-----Original Message-----
From: Bergquist, Brett [mailto:[email protected]]
Sent: Wednesday, July 27, 2016 1:57 PM
To: [email protected]
Subject: RE: Need some help in trying to figure out a corrupt database

I will try to get that Brian.  Unfortunately, the database is 470GB so moving 
it around and accessing it is not trivial.

I also tried to use the tool from

https://issues.apache.org/jira/browse/DERBY-6136

When I run this tool I get an error that looks like:

ij> connect 'jdbc:derby:memory:db;create=true';
ij> create type serializable external name 'java.io.Serializable'
ij> language java;
0 rows inserted/updated/deleted
ij> call syscs_util.syscs_register_tool
(
'customTool',
true,
'RawDBReader',
'CONTROL',
'RAW_',
'/opt/canoga/canogaview/glassfish/databases/csemdb',
null,
'CSEM',
'CSEM'
);
ERROR 38000: The exception 'java.sql.SQLException: The exception 
'java.sql.SQLException: 
/opt/canoga/canogaview/glassfish/databases/csemdb/seg0/c470.dat (No such file 
or directory)' was thrown while evaluating an expression.' was thrown while 
evaluating an expression.
ERROR 38000: The exception 'java.sql.SQLException: 
/opt/canoga/canogaview/glassfish/databases/csemdb/seg0/c470.dat (No such file 
or directory)' was thrown while evaluating an expression.
ERROR (no SQLState): 
/opt/canoga/canogaview/glassfish/databases/csemdb/seg0/c470.dat (No such file 
or directory)
ij>

It is true that this is no file 
'/opt/canoga/canogaview/glassfish/databases/csemdb/seg0/c470.dat'.

Using the instructions on the wiki page

https://wiki.apache.org/db-derby/ListFileNamesOfTables

to list the filenames for the derby tables, I can find no reference to ' 
c470.dat' however which is puzzling.   Here is what I used to query for all 
including the indexes and the system tables:

CREATE FUNCTION bigintToHexString(hexString bigint)
     RETURNS VARCHAR(16)
     PARAMETER STYLE JAVA NO SQL
     LANGUAGE JAVA
     EXTERNAL NAME 'java.lang.Long.toHexString';

select  CAST(TABLENAME as varchar(32)) as DB_table, CAST('c' ||  
bigintToHexString
(CONGLOMERATENUMBER)  ||  '.dat'as varchar(12)) as file , isindex  from 
SYS.SYSCONGLOMERATES a, SYS.SYSTABLES b where a.TABLEID = b.TABLEID order by 
file;

There is no 'c470.dat', so I don't know where this is being referenced from.






-----Original Message-----
From: Bryan Pendleton [mailto:[email protected]]
Sent: Wednesday, July 27, 2016 10:34 AM
To: [email protected]
Subject: Re: Need some help in trying to figure out a corrupt database

>  I can query each of the columns in the table individually like:
>

>
> If I select multiple columns such as
>
>         SELECT ID, DTYPE FROM CORE_V1.DEVICE_ENTITY;
>
> Then I get:
>
> ERROR XSDA7: Restore of a serializable or SQLData object of class ,
> attempted to read more data than was originally stored ERROR XJ001: Java 
> exception: ': java.io.EOFException'.

Perhaps the table is not corrupt; perhaps instead there is a bug in the query 
execution?

Can you post the full and complete exception trace? Ideally, from a debug build 
with source file line numbers?

bryan



Canoga Perkins
20600 Prairie Street
Chatsworth, CA 91311
(818) 718-6300

This e-mail and any attached document(s) is confidential and is intended only 
for the review of the party to whom it is addressed. If you have received this 
transmission in error, please notify the sender immediately and discard the 
original message and any attachment(s).

Canoga Perkins
20600 Prairie Street
Chatsworth, CA 91311
(818) 718-6300

This e-mail and any attached document(s) is confidential and is intended only 
for the review of the party to whom it is addressed. If you have received this 
transmission in error, please notify the sender immediately and discard the 
original message and any attachment(s).

Reply via email to