angoca / db2tools

Set of routines that can ease your daily work.
GNU General Public License v2.0
1 stars 0 forks source link

How to Read 5GB file in DB2 stored Procedure #28

Open tejendradevn opened 8 years ago

tejendradevn commented 8 years ago

Hi All, I am new to DB2. I am trying to write stored procedure which can read 5GB .sql file and execute same at DB2 database. please help. I tried to split file and read using .net but after splitting file using ,net its not well splitted. Is there any way where I can execute such big file to DB2 database.

please advise.

Thanks

angoca commented 8 years ago

What do you have in the file? data? DML or DDL?

I suppose you have a 5GB file cotaining DDL, why don't you execute it directly in DB2? db2 -tvf xxxx.sql

tejendradevn commented 8 years ago

Hi , I have DML statements in file some of them are commented. I am designing windows scheduler using C#.net trying to read file and execute to DB2 database. For 5 GB file I tried below solutions.

Solution 1: I tried MemoryMapper Class : it executed fine for first 5GB file and for next file its giving error "Access to path denied".

Solution 2: Reading file using Streamreader.ReadLine() to iterate line to line to filder statement starting with "- " , but getting Memory I/O exception even though I have 64 bit machine.

Solution 3: I also tried splitting 5 GB file to each 1GB but DML statement not well splitted , half portion of DML statement in one file and half in other file . So getting exception while execution.

As you Suggested are you asking to execute above command Manually ? My objective is to automate process. Please advice.