Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Informix lock

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. When you unload a table, it appears:

244:Could not do a physical-order read to fetchnext row

107:ISAM error:record is locked

How do I unlock it without restarting the database?

Onstat-g ses and onstat-g sql can check which users and which SQL are manipulating the table through the SQL statement.

You can focus on checking the UPDATE,DELTE,INSERT statement in onstat-g sql.

Onstat-k looks at the lock and checks whether the table is locked through the output tblsnum column.

Tblsnum can be obtained through the following SQL

Select tabname,hex (partnum) from systableswhere tabname= "tabname"

This is a small script that I often use to see who locks the watch, followed by the option of onstat-g. Let's see what exactly has been implemented.

Code:

Onstat-k | grep X | awk'{print $3}'| sort-u > tmp1.txt

Cat tmp1.txt | while read line

Do

Onstat-u | grep $line

Done

Rm tmp1.txt

two。 Recently, when I update the tables in the informix database, I always report a-244 error. I have increased the number of locks in the configuration file.

But it still doesn't work. I don't know what the mistake of-244 has to do with it.

Please check the lock level of the table, which can be divided into page,row

SQL code can only describe the failure of the operation, and ultimately depends on the ISAM error code.

As long as there is no problem with the index, it is estimated that it is the problem of lock concurrency, not the problem of insufficient locks.

It may be avoided by taking the index as far as possible.

3. If the application locks a table in Informix, how to find out which process is locked and how to release it?

1. Find the lock table (take tab_test as an example).

2. Find the partnum corresponding to tab_test in systables.

3. Convert this number to hexadecimal with a calculator.

4. Use onstat-k | grep [hexadecimal] to find the corresponding lock and record the corresponding owner number. This owner number represents the user process performing this operation, and finds the record with rowid 0 (if any).

5. Use onstat-u | grep [owner] to find the corresponding user process.

6. If you want to see which statement generated the lock, look at the statement with: onstat-g ses [owner]. Or kill it with onmode-z [owner].

Thank you, upstairs, for solving the problem I've been looking for for a long time. But the last point is session id.

4. If the following error occurs when you execute the SQL statement:

244: Could not do a physical-order read tofetch next row.

113: ISAM error: the file is locked.

There is no doubt that the table you want to access is locked by someone else.

If you use the set lock mode to wait statement, the onstat-u command can report that the session is waiting for lock resources (

Sign bit "L"), such as:

C0000000379015e8 Lmuri PRMUR-4626 informix tJc0000000006e45f0 20 1 00

Error after timeout:

244: Could not do a physical-order read tofetch next row.

154: ISAM error: Lock Timeout Expired

So, how do you find out who locked the watch? To introduce a tip, execute the following SQL statement:

DATABASE sysmaster

SELECT owner FROM syslocks WHEREtabname= "Table name"

The resulting owner is the locked session number SID, so we can use the onstat-g ses SID command to view the session information.

This includes which user it is and what SQL statements are executed. You can also kill the session using the onmode-z command as DBA.

But the method is really good, much better than mine:

1. Find the lock table (take tea as an example).

2. Find the partnum corresponding to tea in systables.

3. Convert this number to hexadecimal with a calculator.

4. Use onstat-k | grep [hexadecimal] to find the corresponding lock and record the corresponding owner number, which represents the user process performing this operation.

5. Use onstat-u | grep [owner] to find the corresponding user process.

6. If you want to see which statement generated the lock, look at the statement with: onstat-g ses [owner]. Or kill it with onmode-z [owner].

5. I have a table, and when I use ISQL to query, it prompts me that the record is locked, but not the content, using the unlock table table name, and prompts me that the table is not locked by me.

Confirm that a record in the table is locked. How to unlock without restarting the database and table data.

The record should be locked by the database access of other processes

We can only find the source and release the lock.

Unlock steps:

1. Find the lock table (take tpm_radio_bts as an example).

2. Find the partnum corresponding to tpm_radio_bts in systables.

3. Convert this number to hexadecimal with a calculator.

4. Use onstat-k | grep [hexadecimal] to find the corresponding lock and record the corresponding owner number, which represents the user process performing this operation.

5. Use onstat-u | grep [owner] to find the corresponding user process.

6. If you want to see which statement generated the lock, look at the statement with: onstat-g ses [owner]. Or kill it with onmode-z [owner].

6. How do I check what locks are being used in the database? How to set the lock of informix? What should I do now to change a table from a page-level lock to a record trivial?

1. Look at the lock level of the watch

(1) oncheck-ptdatabase_name:table_name

(2) select tabname, locklevel fromsystables where...

2. Set the lock level

Alter tablet_test lock mode (ROW)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report