huge data insert

20 views
Skip to first unread message

uyeee

unread,
Feb 15, 2010, 8:52:52 AM2/15/10
to H2 Database
Hi!

I use runscript(org.h2.tools.RunScript).

java -Xms5120m -Xmx5120m LOCK_MODE=0;LOG=0;UNDO_LOG=0


when 268,096 recode inserted, it stoped...

please tell me how insert more data.

よろしくおねがいします!


this is Exception message
---------------------------------------------------------------------------------------------------------------------
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2882)
at
java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:
100)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:
390)
at java.lang.StringBuffer.append(StringBuffer.java:224)
at java.text.MessageFormat.subformat(MessageFormat.java:1208)
at java.text.MessageFormat.format(MessageFormat.java:836)
at java.text.Format.format(Format.java:140)
at java.text.MessageFormat.format(MessageFormat.java:812)
at org.h2.message.Message.translate(Message.java:94)
at org.h2.message.Message.getSQLException(Message.java:109)
at org.h2.message.Message.getSQLException(Message.java:121)
at org.h2.message.Message.getSyntaxError(Message.java:146)
at org.h2.command.Parser.read(Parser.java:2558)
at org.h2.command.Parser.readIfMore(Parser.java:775)
at org.h2.command.Parser.parseInsert(Parser.java:951)
at org.h2.command.Parser.parsePrepared(Parser.java:379)
at org.h2.command.Parser.parse(Parser.java:292)
at org.h2.command.Parser.parse(Parser.java:264)
at org.h2.command.Parser.prepareCommand(Parser.java:236)
at org.h2.engine.Session.prepareLocal(Session.java:417)
at org.h2.server.TcpServerThread.process(TcpServerThread.java:231)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:137)
at java.lang.Thread.run(Thread.java:619)

at org.h2.engine.SessionRemote.done(SessionRemote.java:522)
at org.h2.command.CommandRemote.prepare(CommandRemote.java:70)
at org.h2.command.CommandRemote.<init>(CommandRemote.java:48)
at org.h2.engine.SessionRemote.prepareCommand(SessionRemote.java:418)
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:
1070)
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:163)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:151)
at org.h2.tools.RunScript.process(RunScript.java:250)
at org.h2.tools.RunScript.process(RunScript.java:186)
at org.h2.tools.RunScript.process(RunScript.java:311)
at org.h2.tools.RunScript.run(RunScript.java:140)
at org.h2.tools.RunScript.main(RunScript.java:68)

Chuck Remes

unread,
Feb 15, 2010, 10:09:45 AM2/15/10
to h2-da...@googlegroups.com
You ran out of Java heap space. You don't show any of your code, but this is clearly not a problem with H2. Your code is holding references to a lot of data and used up all of the memory. I can see that from the backtrace.

Show us more code so we can suggest how to manage your memory better. Or, allocate more RAM to your JVM (-Xmx6g or larger).

cr

> --
> You received this message because you are subscribed to the Google Groups "H2 Database" group.
> To post to this group, send email to h2-da...@googlegroups.com.
> To unsubscribe from this group, send email to h2-database...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
>

uyeee

unread,
Feb 15, 2010, 9:52:28 PM2/15/10
to H2 Database
Thank you Chuck

I download from here
http://www.h2database.com/h2-2010-01-30.zip

I used "org.h2.tools.RunScript".

jvm option
-Xms5120m -Xmx5120m

command line option
-url "jdbc:h2:http:localhost/
test;SCHEMA=test;LOCK_MODE=0;LOG=0;UNDO_LOG=0"
-driver "org.h2.Driver"
-user sa
-script test.sql

---------------------------------
test.sql
insert into test (c1,c2,c3,c4,c5,c6) values
('a1','','b1','c1','d1','e1');
insert into test (c1,c2,c3,c4,c5,c6) values
('a2','','b2','c2','d2','e2');
insert into test (c1,c2,c3,c4,c5,c6) values
('a3','','b3','c3','d3','e3');
:
:
----------------------------------

but it stopped at 268,096 recode.

I see ,It caused by less memory.

Then, I should use more memory??
Or, I should use other tools??

よろしくおねがいします!

Erin Drummond

unread,
Feb 15, 2010, 9:56:06 PM2/15/10
to h2-da...@googlegroups.com
Is it not an option to simply split up the script into multiple files
with around 265,000 querys in each?

2010/2/16 uyeee <toomoko...@gmail.com>:

Ryan How

unread,
Feb 15, 2010, 10:07:22 PM2/15/10
to h2-da...@googlegroups.com
Is it the server or the client running out of memory?

You need to make sure the server is running with plenty of memory, I
don't think the client needs it in this case.

uyeee

unread,
Feb 15, 2010, 11:26:34 PM2/15/10
to H2 Database
Thank you Erin

It's ok to split around 265,000 querys...
but, I have to insert (total) 100,000,000 querys.

so.. is there more easy way?

On Feb 16, 11:56 am, Erin Drummond <erin....@gmail.com> wrote:
> Is it not an option to simply split up the script into multiple files
> with around 265,000 querys in each?
>

> 2010/2/16 uyeee <toomoko.uey...@gmail.com>:

uyeee

unread,
Feb 16, 2010, 1:26:28 AM2/16/10
to H2 Database
Thank you Ryan

uyeee

unread,
Feb 16, 2010, 3:46:07 AM2/16/10
to H2 Database
test.sql has "syntax error" at 268,096.

The problem caused by my mistake (not by less memory, not by h2
performance).
sorry...

Best regards

Reply all
Reply to author
Forward
0 new messages