If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Dropping a Table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-17-03, 11:44
vaddadik vaddadik is offline
Registered User
 
Join Date: Oct 2003
Location: Hyderabad, India
Posts: 14
Angry Dropping a Table

Folks,
I see a peculiar problem with the DB2 database..this is regarding deleting or droping of the table.
I have around 2 lakh plus records in a table and i wanted to clear the table so since truncate command is not there i wanted to delete the data but when i issued that command i got a stupid error saying "The command was process as an sql statement because it was not a valid command line processor command. During SQL processing it returned: SQL0911N The current transaction has been rolled back because of a deadlock or time out. Reason Code "68". SQLSTATE = 40001.
Im getting the same error when i tired to drop the table both from the command center as well as from the control center..
Can any of you folks let me know the best way to handle this situation..
This a ridiculous where u cannot drop the table if u have that bulk set of records..
I would be happy if some one suggests a diff approach for ths..
Regards,
Krishna
Reply With Quote
  #2 (permalink)  
Old 10-17-03, 12:01
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Krishna,
Your problem is not the number of records in the table. You are having a lock timeout. That means another process has done something on the table to lock some portion of it. You probably need to prevent everyone else from accessing the table. You can put an exclusive lock on the table before deleting the data.

HTH

Andy
Reply With Quote
  #3 (permalink)  
Old 10-17-03, 12:04
vaddadik vaddadik is offline
Registered User
 
Join Date: Oct 2003
Location: Hyderabad, India
Posts: 14
Quote:
Originally posted by ARWinner
Krishna,
Your problem is not the number of records in the table. You are having a lock timeout. That means another process has done something on the table to lock some portion of it. You probably need to prevent everyone else from accessing the table. You can put an exclusive lock on the table before deleting the data.

HTH

Andy
Hi Andy,
Can you please let me know how that exclusive lock could be applied before deleting the table?..or deleting the contents.. cause this is a temporary table which i created for my own and no application uses it. and does the delete happen if we lock the table exclusively.. Also please let me know whre the lock timeout could be increased?
Regards,
Krishna.
Reply With Quote
  #4 (permalink)  
Old 10-17-03, 12:14
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Krishna,
You did not mention that it was a temporary table in your first post. Could you post the DDL to create the table?

Andy

Quote:
Originally posted by vaddadik
Hi Andy,
Can you please let me know how that exclusive lock could be applied before deleting the table?..or deleting the contents.. cause this is a temporary table which i created for my own and no application uses it. and does the delete happen if we lock the table exclusively.. Also please let me know whre the lock timeout could be increased?
Regards,
Krishna.
Reply With Quote
  #5 (permalink)  
Old 10-17-03, 14:32
vaddadik vaddadik is offline
Registered User
 
Join Date: Oct 2003
Location: Hyderabad, India
Posts: 14
Quote:
Originally posted by ARWinner
Krishna,
You did not mention that it was a temporary table in your first post. Could you post the DDL to create the table?

Andy
Andy,
The temporary table that i was mentioning is not in the script but temporary physical table ex : create table temptable (field1 varchar(30));
Thsi table is created on the userspace1 and it phsically exists in the database.
Hope this gives better clarity
Krishna
Reply With Quote
  #6 (permalink)  
Old 10-17-03, 14:33
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
What about a load replace with no data (or maybe just one row).
Reply With Quote
  #7 (permalink)  
Old 10-17-03, 14:40
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Krishna,
Then it can be accessed by another process. Check to see who has locks on the table.

Andy

Quote:
Originally posted by vaddadik
Andy,
The temporary table that i was mentioning is not in the script but temporary physical table ex : create table temptable (field1 varchar(30));
Thsi table is created on the userspace1 and it phsically exists in the database.
Hope this gives better clarity
Krishna
Reply With Quote
  #8 (permalink)  
Old 10-17-03, 14:47
vaddadik vaddadik is offline
Registered User
 
Join Date: Oct 2003
Location: Hyderabad, India
Posts: 14
Quote:
Originally posted by ARWinner
Krishna,
Then it can be accessed by another process. Check to see who has locks on the table.

Andy
How to check the locks and remove them..if been locked from either control center or from any other..location?
Reply With Quote
  #9 (permalink)  
Old 10-17-03, 14:51
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Krishna,
You can try this tool to see who has the locks.

http://chuzhoi_files.tripod.com/index.html

Andy

Quote:
Originally posted by vaddadik
How to check the locks and remove them..if been locked from either control center or from any other..location?
Reply With Quote
  #10 (permalink)  
Old 10-17-03, 15:27
vaddadik vaddadik is offline
Registered User
 
Join Date: Oct 2003
Location: Hyderabad, India
Posts: 14
Talking

Quote:
Originally posted by ARWinner
Krishna,
You can try this tool to see who has the locks.

http://chuzhoi_files.tripod.com/index.html

Andy
Hi Andy,
Thanks a lot for the tool.. its pretty good one..
Regards,
Krishna
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On