PUT cursors and Locking w/o Logging
Posted in 1999
Topics: General Discussion
Question for the community: If I have a database without logging (I know! It's one of the last few of the databases created by my predecessor and I am migrating it to 7.31 with logging next week, honest) and I am inserting using a PUT CURSOR. Does the PUT CURSOR hold locks on all of the rows inserted until the cursor is closed? If the database had logging I would open the CURSOR...WITH HOLD and COMMIT every N rows to release the locks so I have assumed that without logging that no locks would be held, except briefly while the 200 or so row that fit in the PUT buffer are being inserted on the engine side, and I would have no problem. But suddenly I am nervous. I have to copy 2 - 20,000,000 row tables from one server to another and I fear running out of lock (80,000 configured). This is a critical job that I will not be able to monitor constantly for the 15 hours or so that it will run, so I just want to increase my level of comfort. Anyone have any thoughts, definite answers, "How can you be so dumb?" comments? All graciously and gladly accepted. Thanks Art S. Kagel
Well firstly, I presume you are turning logging off on the new database
since you can't connect between databases of different logging states. That
is if your source DB doesn't have logging and your target does, then you
have to turn logging off the target one.
Regarding locking.. why not just lock table in exclusive mode? Also,
loading into your target database.. I wouldn't be worrying about locks, I
would be worrying about generating a long transaction thus not having enough
log space left for rollback and the engine automatically rolling back the
transaction.
Personally I would unload from source and reload into target. 20,000,000
rows isn't that many! Be sure to turn logging off on the new DB for the
load to not produce a long transaction and it would also be faster withoutlogging on!!!
Regards
Paul.
Art S. Kagel <kagel@bloomberg.net> wrote in message
news:378F61D9.21114684@bloomberg.net...
> Question for the community:
>
> If I have a database without logging (I know! It's one of the last few
> of the databases created by my predecessor and I am migrating it to
> 7.31 with logging next week, honest) and I am inserting using a PUT
> CURSOR. Does the PUT CURSOR hold locks on all of the rows inserted
> until the cursor is closed? If the database had logging I would open
> the CURSOR...WITH HOLD and COMMIT every N rows to release the locks so
> I have assumed that without logging that no locks would be held, except
> briefly while the 200 or so row that fit in the PUT buffer are being
> inserted on the engine side, and I would have no problem. But suddenly
> I am nervous. I have to copy 2 - 20,000,000 row tables from one server
> to another and I fear running out of lock (80,000 configured). This is
> a critical job that I will not be able to monitor constantly for the
> 15 hours or so that it will run, so I just want to increase my level of
> comfort. Anyone have any thoughts, definite answers, "How can you be
> so dumb?" comments? All graciously and gladly accepted.
>
> Thanks
> Art S. Kagel