DB2 DDL不是一个自冶事务

在Oracle里一个DDL操作是一个原子操作,当执行一个DDL命令时,之前的所有操作都会commit,永久生效,而DB2不是这样的,DB2的DDL不是一个自冶原子事务,下面的测试:
Linux 1: db2 connect to cmdb

Database Connection Information

Database server = DB2/LINUXX8664 9.5.2
SQL authorization ID = User001
Local database alias = testdb

Linux 2: db2 +c " create table test00(a int)"
DB20000I The SQL command completed successfully.
Linux 3: db2 +c "insert into test00 values(1),(2)"
DB20000I The SQL command completed successfully.
Linux 4: db2 +c "select * from test00"
A
-----------
1
2
2 record(s) selected.

Linux 5: db2 +c "describe table test00"
Data type Column
Column name schema Data type name Length Scale Nulls
------------------------------- --------- ------------------- ---------- ----- ------
A SYSIBM INTEGER 4 0 Yes

1 record(s) selected.

Linux 6: db2 +c " rollback"
DB20000I The SQL command completed successfully.
Linux 7: db2 +c "select * from test00"
SQL0204N "E460222.TEST00" is an undefined name. SQLSTATE=42704
Linux 8: db2 +c "describe table test00"

Data type Column
Column name schema Data type name Length Scale Nulls
------------------------------- --------- ------------------- ---------- ----- ------

0 record(s) selected.

SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a
query is an empty table. SQLSTATE=02000
Linux 9: db2 +c "select count(1) from syscat.tables where tabname='TEST00'"

1
-----------
0
1 record(s) selected.

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/45188/viewspace-1027108/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/45188/viewspace-1027108/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值