using h2 version h2-1.3.176 (with in memory db and also with local storage and also by tcp/ip)
I have strange lock, see below.
connection sample: jdbc:h2:mem:test1;MVCC=TRUE;LOCK_TIMEOUT=30000
it's not a timeout problem because the program is indefinitely locked.
I've noticed the error starts after I create a temporary table: the create temporary table just goes fine, but after some ddl query, the error appears.
There is'nt an error, if I don't create any temporary table.
PS: I can't use H2 1.4 because it's not stable: with that version I have the error "java.lang.IllegalStateException: Chunk XYZ not found"
Timeout trying to lock table "SYS"; SQL statement:
CREATE TABLE TestCalcField1(
a VARCHAR(255),
b VARCHAR(255),
i INTEGER ,
j INTEGER ) [50200-176]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
at org.h2.message.DbException.get(DbException.java:178)
at org.h2.message.DbException.get(DbException.java:154)
at org.h2.table.RegularTable.doLock(RegularTable.java:530)
at org.h2.table.RegularTable.lock(RegularTable.java:464)
at org.h2.engine.Database.lockMeta(Database.java:869)
at org.h2.command.ddl.CreateTable.update(CreateTable.java:134)
at org.h2.command.CommandContainer.update(CommandContainer.java:79)
at org.h2.command.Command.executeUpdate(Command.java:254)
at org.h2.jdbc.JdbcStatement.executeUpdateInternal(JdbcStatement.java:132)
at org.h2.jdbc.JdbcStatement.executeUpdate(JdbcStatement.java:117)
at it.novabyte.ntools.database.NQuery.executeUpdateSQL(NQuery.java:640)
... 21 more
Related
Getting an error message when trying to create a temp table. I copied this code directly from Oracle's website. I also downloaded the latest version 18.2. What am I missing here?
CREATE PRIVATE TEMPORARY TABLE ora$ptt_my_temp_table
(
id NUMBER(10,2),
description VARCHAR2(20)
)
ON COMMIT PRESERVE DEFINITION;
Error Message:
Error starting at line : 1 in command -
CREATE PRIVATE TEMPORARY TABLE ora$ptt_my_temp_table
(
id NUMBER(10,2),
description VARCHAR2(20)
)
ON COMMIT PRESERVE DEFINITION
Error report -
ORA-00905: missing keyword
00905. 00000 - "missing keyword"
*Cause:
*Action:
I presume you're not on Oracle 18c but some lower version (which doesn't know private temporary tables). Therefore, I suggest you run
CREATE GLOBAL TEMPORARY TABLE ora$ptt_my_temp_table
(
id NUMBER(10,2),
description VARCHAR2(20)
)
ON COMMIT PRESERVE ROWS;
and move on.
The problem is the ON COMMIT PRESERVE ROWS line. That syntax is only used for Global Temorary Tables. For Private Temporary tables, you need to use one of the following:
ON COMMIT DROP DEFINITION
This drops the table at the end of the transaction (or at the end of the session if transactions are not being used).
This is the default, so this line can be omitted if this is the behavior you want.
ON COMMIT PRESERVE DEFINITION
The table will persist beyond any transactions, but will still be deleted at the end of the session.
See: https://oracle-base.com/articles/18c/private-temporary-tables-18c
I have problems with some Oracle external table
create table myExternalTable
(field1, field2....)
ORGANIZATION EXTERNAL
(TYPE ORACLE_LOADER
DEFAULT DIRECTORY myDirectory
ACCESS PARAMETERS
(RECORDS DELIMITED BY NEWLINE
NOLOGFILE
NOBADFILE
NODISCARDFILE
FIELDS TERMINATED BY '$')
LOCATION ('data.dsv'));
commit;
alter table myExternalTable reject limit unlimited; --solve reject limit reached problem
select * from myExternalTable;
When I select on the table I have this error :
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04040: file data.dsv in myDirectory not found
It seems that the error description is not right because normally the table is already loaded with data.dsv when created.
Plus data.dsv exists in myDirectory.
What is going on? Can somebody help?
Note :
Instead of the select, this is what I normally do :
merge into myDatabaseTable
using
(select field1, field2,.... from myExternalTable) temp
on (temp.field1= myDatabaseTable.field1)
when matched then update
set myDatabaseTable.field1 = temp.field1,
myDatabaseTable.field2 = temp.field2,
......;
This works good on my development environment but on some other environment I have the error I said before :
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04040: file data.dsv in myDirectory not found
First I thought that, in the environment it does not work, the directory did not point where it had to but selecting on dba_directories table, I could see the path of the directory is correct.
The problem is related with the access rights of the user on the operating system side. It is defined in Oracle Support Note Create Database Directory on Remote Share/Server (Doc ID 739772.1)
For my case, I created the directory with a sysdba and then for allowing other users to accesss that external table, I created another table which is creates by Create Table as Select statement for the external table. Otherwise, I need to map the Windows Oracle Service owner user to the exact Oracle user which is already defined in the note.
So, it is more like a well fitting workaround for my case.
To sum up the steps in a nutshell:
1- Create the external table T2
2- Create a table named T1 with CTAS to external table
3- Give SELECT right to T1
Hope this helps for your case.
Im getting this strange h2 error (vers 1.2.147) , the code basically does this :-
create session1
insert into table ABC
commit
XXX
create session2
read from table XYZ -> produces locked table ABC timeout exception.
close session2
close session1
The bizarre thing about this scenario is that if XXX is empty (ie no code) I get the timeout exception however if it contains a Select statement, it all works fine.
?????
I was inserting some records in the production table ,while doing that before commit ,I lost the production connection and none of the record got inserted.
Now when I am trying to insert the same record ,the sql plus is getting hanged and data is not getting saved.
But when I tried for other record which I was not inserted ,those records are getting inserted.
I have checked the table again ,for availability of data.Those previous data has not stored anywhere.
SQL plus is not generating any error also ,so that I can check the error and try to rectify.
Can anyone please help me to analyse and troubleshoot the problem.
while inserting in oracle the connection has lost now I am not able to add the same data
If your SQL/Plus session hangs, it's probably being blocked by your previous session. To find the offending session, you can use (requires DBA privileges):
select * from v$lock where block = 1
This should give you the session ID of the blocking session. Now you can run
select * from v$session
and check whether the session ID returned by the first query indeed belongs to your previous session. To kill the session, use the command
alter system kill session '<SID>,<serial#>'
I have and application which uses Adodb to insert data in Oracle table(customers database).
Data is successfully inserted if there are no errors.
If there is any error like invalid datatype etc. Error is raised and captured by my application and dumped in log gile.
My customer has written their own triggers on this particular table. When a record is inserted few other checking are done be fore the data insertion
Now all fine until now.
But recently we found that many a times data is not inserted in the oracle table.
When checked in log file no error was found.
Then I logged the query which was executed.
Copied the query to oracle Sql prompt and executed it gave error of trigger.
My Issue is
Customer is not ready to share the details of trigger.
Error is not raised while inserting to oracle table so we are not able to log it or take any action.
The same qry when executed directly in oracle the trigger errors are show.
Help needed for
Why the error is not raised in ADODB
Do I have to inform customer to implement any error raising
Anything that you can suggest for resolving the issue
I have 0% to 10% knowledge of Oracle
"Copied the query to oracle Sql prompt and executed it gave error of trigger." Since the ADO session doesn't report an error, it may be that the error from the trigger is misleading. It may simply be a check on the lines of "Hey, you are not allowed to insert into this table except though the application".
"Error is not raised while inserting to oracle table so we are not able to log it or take any action."
If the error isn't raised at the time of insert, it MAY be raised at the time of committing. Deferred constraints and materialized views could give this.
Hypothetically, I could reproduce your experience as follows:
1. Create a table tab_a with a deferrable constraint initially deferred (eg val_a > 10)
2. The ADO session inserts a row violating the constraint but it dooesn't error because the constraint is deferred
3. The commit happens and the constraint violation exception fires and the transaction is rolled back instead of being committed.
So see if you are catering for the possibility of an error in the commit.
It may also be something else later in the transaction which results in a rollback of the whole transaction (eg a deadlock). Session tracing would be good. Failing that, look into a SERVERERROR trigger on the user to log the error (eg in a file, so it won't be rolled back)
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7004.htm#i2153530
You can log your business logic in log table.
But you have to use stored procedure to log the message.
Stored procedure should have pragma Transaction such that your log data must be saved in log table.
You are trigger should have error handling - and in error handling , you have to call Logged stored procedure (which have pragma transaction)
I've never used adodb ( and I assume that is what you are using, not ADO.NET?).. But, a quick look at its references leads to this question.. Are you actually checking the return state of your query?
$ok = $DB->Execute("update atable set aval = 0");
if (!$ok) mylogerr($DB->ErrorMsg());