签到成功

知道了

CNDBA社区CNDBA社区

oracle 1z-082 第4题

2022-08-15 22:21 1003 0 原创 oracle
作者: hbhe0316

4.You currently have an active transaction in your session and have been granted select access to V$TRANSACTIONhttp://www.cndba.cn/hbhe0316/article/108585http://www.cndba.cn/hbhe0316/article/108585

SQL> select xid, status from v$transaction;

XID              STATUS
---------------- ------------------------------------------------
0A000100C1330000 ACTIVE

In which three situations will re-executing this query still return a row but with a different XID indicating a new transaction has started?
A.after successfully executing a TRUNCATE statement followed by a DML statement
B.after successfully executing a CREATE TABLE AS Select statement followed by a SELECT FOR UPDATE statement
C.after successfully executing a CREATE TABLE statement followed by a CREATE INDEX statement
D.after successfully executing a commit or ROLLBACK followed by a DML statement
E.after successfully executing a DML statement following a failed DML statement
F. after successfully executing a commit or ROLLBACK followed by a Select statement
答案:ABDhttp://www.cndba.cn/hbhe0316/article/108585

针对A答案,可以看到A执行后的XID不一样,所以A正确http://www.cndba.cn/hbhe0316/article/108585

SQL> select xid, status from v$transaction;

XID              STATUS
---------------- ------------------------------------------------
03000A00DD0D0000 ACTIVE

SQL> truncate table transaction_table8;

Table truncated.

SQL> insert into transaction_table8 select * from dba_objects;

73552 rows created.

SQL> select xid, status from v$transaction;

XID              STATUS
---------------- ------------------------------------------------
06001600DE0D0000 ACTIVE

针对B答案:

http://www.cndba.cn/hbhe0316/article/108585


SQL> create table t2 as select * from t1;

Table created.

SQL> select xid, status from v$transaction;

no rows selected

SQL> select * from t2 where id=1 for update;

        ID NAME
---------- ------------------------------
         1 aa

SQL> select xid, status from v$transaction;

XID              STATUS
---------------- ------------------------------------------------
09001F0078160000 ACTIVE

针对D答案http://www.cndba.cn/hbhe0316/article/108585

SQL> create table  transaction_table8 as select * from dba_objects;

Table created.

SQL> insert into transaction_table8 select * from dba_objects;

73552 rows created.

SQL> select xid, status from v$transaction;

XID              STATUS
---------------- ------------------------------------------------
0A001A00C0330000 ACTIVE

SQL> commit;

Commit complete.

SQL> insert into transaction_table8 select * from dba_objects;

73552 rows created.

SQL> select xid, status from v$transaction;

XID              STATUS
---------------- ------------------------------------------------
06000900E40D0000 ACTIVE

由此可见,正确答案ABDhttp://www.cndba.cn/hbhe0316/article/108585http://www.cndba.cn/hbhe0316/article/108585

http://www.cndba.cn/hbhe0316/article/108585
http://www.cndba.cn/hbhe0316/article/108585

版权声明:本文为博主原创文章,未经博主允许不得转载。

oracle

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
hbhe0316

hbhe0316

关注

1.只有承认无知,才能装下新的东西; 2.进步来自一点点滴滴的积累; 3.广博让你更优秀,而专业让你无法替代; 4.挫折和失败能够转换为一种财富。

  • 889
    原创
  • 1
    翻译
  • 13
    转载
  • 24
    评论
  • 访问:1144910次
  • 积分:1523
  • 等级:核心会员
  • 排名:第6名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ