Sybase large update in batch -


i need large update in sybase.

table1 has column a, b, c, e, f, around 9 million records. table2 has column a, e, f, around 500000 records.

the bellow update sql failed due syslog full

update table1 set e = table2.e, f = table2.f table1, table2 table1.a = table2.a 

after doing research in internet, bellow 2 procedures still failed due same error did update 5000 records successfully.

any ideas. thank you!

set rowcount 5000 while (1=1)     begin      update table1 set e = table2.e, f = table2.f table1, table2 table1.a = table2.a      if @@rowcount != 5000         break     end set rowcount 0   declare @errorstatus int, @rowsprocessed int set rowcount 5000  select @rowsprocessed = 1 while (@rowsprocessed != 0) begin   begin tran     update table1 set e = table2.e, f = table2.f table1, table2 table1.a = table2.a      select @rowsprocessed = @@rowcount, @errorstatus = @@error      if (@errorstatus != 0)     begin        --raiserror ....        rollback tran        --return -1     end   commit tran end  set rowcount 0 

it appears syslog device not large enough trying accomplish, , log may not getting truncated.

you should check setting of database (sp_helpdb <dbname>) , find out if says trunc log on chkpt if don't find setting, big transactions fill syslog.

to fix must either add log space database, manually dump log, or set database option truncate log on checkpoint.

if worried minute recovery in case of system or disk failure, should add log space, , schedule more frequent log dumps.

if not worried minute recovery, can turn on database option truncate log on checkpoint.

sp_dboption <dbname>, 'trunc log on chkpt', true 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -