Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a temporary Oracle table to avoid Snapshot too old errors

Status
Not open for further replies.

carsort

Programmer
Mar 3, 2004
1
US
I just joined this website. I have run into "snapshot too old" issues in 8i in the past, and I don't have any control over the database on which this problem occurs. This is because I write migrations for a software company, and our clients need to run through the migrations on their own databases that they control. No one else is using the system while the migration is occurring - the system is down, but I'm causing the problem since my code is selecting from the same table that it needs to update, and the tables can vary in size, from client to client. So, I need to have methods in place within the migration code that avoids this problem, while not taking up too much time being overly 'safe'. In the past, when I ran into this problem, I created a regular Oracle table that contained all the rowids of the rows I needed to update. I then dropped that table at the end of the process. This completely avoids the problem, but is not very efficient. I'm curious if I can use the same methodology, but using an Oracle temporary table (which is only visible for that session) of the rowids instead. Since this error is random, I won't know if the temporary table is a good solution or not (until clients start calling). Does anyone have much experience with creating a temporary table of the rowids of the table you need to update, and then looping through until all rows are updated? Any advice would be greatly appreciated! I want to note that although I ran into this issue with 8i with our clients, our software now runs on 9i (and so all our clients have subsequently upgraded), so I'm not sure if there have been improvements regarding this problem.

Carrie
 
Hi,

Well, I can only speak from DBA's point of view. "Snap shot too old" can be avoid by increasing undo tablespace or avoiding a long running query, but you can't do anything about that since you don't have control over them.
But, your plan of using session-specific temporary table should work if it worked for regular table. Now, you don't have to go back and delete that table after the session.


From,
Joe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top