oracle 锁表问题 these query results are not updateable include the rowid to get updateable results

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle 锁表问题 these query results are not updateable include the rowid to get updateable results相关的知识,希望对你有一定的参考价值。

1、我在数据库A 下 执行 select * from T for updtae 查询成功后开锁可以顺利编辑数据。2、在数据库B 下用data links 连接上数据库A 执行 select * from T@A for updtae 查询也成功后点开锁 提示 锁表 “these query results are not updateable include the rowid to get updateable results ”3、我在B库又查询编辑了A库其他表 相对来说表的数据比较小的 又是没问题的 大的几张表都会提示锁表
4、我查询了 A库下的情况 无锁表进程 、运行的job 和运行的存储过程

大表小表怎么定义的,是否大表里面包含lob字段?
你用select t.*,t.rowid from T@A t这种方式,是否可以编辑?

你也可以监控一下这个dblink的执行,在执行的时候查看A库动态性能视图中关于session情况。

或者在A库创建一个该用户的logon触发器,对session进行trace。
create or replace trigger trace_testuser
AFTER logon on dexter.schema
begin
execute immediate \'alter session set events \'\'10046 trace name context forever, level 12\'\'\';
commit ;
EXCEPTION WHEN OTHERS
THEN RAISE ;
end;
/
然后到相应的trace目的trc文件中查看是否有报错,或者其他的执行状态。
参考技术A 孩子垃圾 !!!!

SP1716 GSS3 - Can you answer these queries III 线段树

题目传送门:SP1043 GSS1 - Can you answer these queries I

更好的阅读体验

动态维护子段和最大值

前置知识

静态维护子段和最大值SP1043 GSS1 - Can you answer these queries I

题解传送

题解:

提供结构体指针线段树写法:

\(l\)为区间左端点, \(r\)为区间右端点;

\(ls\)为以\(l\)为左端点的最大子段和, \(rs\)为以\(r\)为右端点的最大子段和;

\(sum\)为区间和, \(val\)为区间子段和最大和。

\(ch[0]\)为左儿子, \(ch[1]\)为右儿子.

考虑维护:

o->sum = ch[0]->sum + ch[1]->sum;
o->ls = max(ch[0]->ls, ch[0]->sum + ch[1]->ls);
o->rs = max(ch[1]->rs, ch[1]->sum + ch[0]->rs);
o->val = max(max(ch[0]->val, ch[1]->val), max(max(o->ls, o->rs), ch[0]->rs + ch[1]->ls);

这样可以考虑到所有的转移情况;

在询问时, 若询问区间跨过左右两个子区间, 则我们利用\(ls, rs, sum\)来更新出当前区间的\(val\);

所以我们返回结构体指针。

题目中为单点修改,考虑如何写up()函数。

发现维护方式与建树时相同。

void up() 
    sum = ch[0]->sum + ch[1]->sum;
    ls = Max(ch[0]->ls, ch[0]->sum + ch[1]->ls);
    rs = Max(ch[1]->rs, ch[1]->sum + ch[0]->rs);
    val = Max(Max(ch[0]->val, ch[1]->val), Max(Max(ls, rs), ch[0]->rs + ch[1]->ls));

直接乱搞即可。

code:

#include <iostream>
#include <cstdio>
using namespace std;
const int N = 5e4 + 5;
int read() 
    int x = 0, f = 1; char ch;
    while(! isdigit(ch = getchar())) (ch == '-') && (f = -f);
    for(x = ch^48; isdigit(ch = getchar()); x = (x<<3) + (x<<1) + (ch^48));
    return x * f;

int n, m;
template <class T> T Max(T a, T b)  return a > b ? a : b; 
struct Segment 
    struct node 
        int l, r, ls, rs, sum, val;
        node *ch[2];
        node(int l, int r, int ls, int rs, int sum, int val) : l(l), r(r), ls(ls), rs(rs), sum(sum), val(val) 
            ch[0] = ch[1] = NULL;
        
        inline int mid()  return (l + r) >> 1; 
        inline void up() 
            sum = ch[0]->sum + ch[1]->sum;
            ls = Max(ch[0]->ls, ch[0]->sum + ch[1]->ls);
            rs = Max(ch[1]->rs, ch[1]->sum + ch[0]->rs);
            val = Max(Max(ch[0]->val, ch[1]->val), Max(Max(ls, rs), ch[0]->rs + ch[1]->ls));
        
     *root;
    void build(node *&o, int l, int r) 
        o = new node(l, r, 0, 0, 0, 0);
        if(l == r) 
            o->ls = o->rs = o->sum = o->val = read();
            return;
        
        build(o->ch[0], l, o->mid());
        build(o->ch[1], o->mid() + 1, r);
        o->up();
    
    void change(node *o, int x, int v) 
        if(o->l == x && o->r == x) 
            o->ls = o->rs = o->sum = o->val = v;
            return;
        
        if(x <= o->mid()) change(o->ch[0], x, v);
        if(x > o->mid()) change(o->ch[1], x, v);
        o->up();
    
    node *query(node *o, int l, int r) 
        if(l <= o->l && o->r <= r) return o;
        if(r <= o->mid()) return query(o->ch[0], l, r);
        if(l > o->mid()) return query(o->ch[1], l, r);
        node *res = new node(l, r, 0, 0, 0, 0);
        node *t1 = query(o->ch[0], l, r), *t2 = query(o->ch[1], l, r);
        res->sum = t1->sum + t2->sum;
        res->ls = Max(t1->ls, t1->sum + t2->ls);
        res->rs = Max(t2->rs, t2->sum + t1->rs);
        res->val = Max(Max(t1->val, t2->val), Max(Max(res->ls, res->rs), t1->rs + t2->ls));
        return res;
    
 tr;
int main() 
    n = read();
    tr.build(tr.root, 1, n);
    m = read();
    for(int i = 1, opt, l, r; i <= m; ++ i) 
        opt = read(); l = read(); r = read();
        if(opt & 1) printf("%d\n", tr.query(tr.root, l, r)->val);
        else tr.change(tr.root, l, r);
    
    return 0;

以上是关于oracle 锁表问题 these query results are not updateable include the rowid to get updateable results的主要内容,如果未能解决你的问题,请参考以下文章

GSS3 - Can you answer these queries III

SP1716 GSS3 - Can you answer these queries III(单点修改,区间最大子段和)

SPOJ1557 GSS2 Can you answer these queries II 线段树

CH4301 Can you answer on these queries III 题解

GSS3/1 - Can you answer these queries 3/1

SP1716 GSS3 - Can you answer these queries III 线段树