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

Only select permission can lock the table? Read and select

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

A client asked me why I only have select permission, and I can also lock the table with for update.

I was confused for a moment. I was not sure. I tested it first, as follows:

Create user test11 identified by test11

Create user test12 identified by test12

Grant connect,resource to test11,test12

Create table test11.objects as select * from dba_objects

Grant select on test11.objects to test12

Session 1:

Session 2:

As you can see, it is true that only with readable permissions, you can for update.

Why can for update, it seems illogical, the point is too small, can only be searched on the official documents, have to praise, oracle official documents are really detailed. Can only think of in the official documents to see if there are any clues, a check, found that there is really!

As follows:

SELECT Query the table with the SELECT statement, including SELECT... FOR UPDATE.

As you can see, select does include for update permissions.

The difference is that in addition to select, there is a read to represent the query, but read does not contain for update. This is a change after 12.1.

READ Query the table with the SELECT statement. Does not allow SELECT... FOR UPDATE.

Note: This privilege is available starting with Oracle Database 12 c Release 1 (12.1.0.2).

Why does select have for update permission? it may be out of the hope that queries can enforce consistent relationships.

But in fact, for most query scenarios, for update's table lock permissions are still too large, so starting from 12.1, separate in addition to smaller read permissions to meet customer needs.

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