本文主要是介绍Oracle 11gR2中SQL*Plus中的新设置exitcommit,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
--Oracle 11gR2中SQL*Plus中的新设置exitcommitThe default setting is ON, which means that work is committed on exit, whether you expected it to be committed or not.
Set EXITCOMMIT OFF to rollback work on exit.--默认情况下exitcommit为ON状态
SCOTT@PROD1> show exitcommit
exitcommit ON--创建表进行对比实验
SCOTT@PROD1> create table t (id number);Table created.--插入数据后直接exit退出,发现退出时完成了自动commit
SCOTT@PROD1> insert into t values (1);1 row created.SCOTT@PROD1> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@ocm1 ~]$ sqlplus scott/tiger SQL*Plus: Release 11.2.0.3.0 Production on Wed Apr 5 16:48:58 2017Copyright (c) 1982, 2011, Oracle. All rights reserved.Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsSCOTT@PROD1> select * from t;ID
----------1--清空数据,并把exitcommit参数置为OFF
SCOTT@PROD1> truncate table t;Table truncated.SCOTT@PROD1> set exitcommit off
SCOTT@PROD1> show exitcommit
exitcommit OFF--插入数据后直接exit退出,发现退出时完成了自动rollback
SCOTT@PROD1> insert into t values (1);1 row created.SCOTT@PROD1> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@ocm1 ~]$ sqlplus scott/tiger SQL*Plus: Release 11.2.0.3.0 Production on Wed Apr 5 16:49:32 2017Copyright (c) 1982, 2011, Oracle. All rights reserved.Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsSCOTT@PROD1> select * from t;no rows selected
这篇关于Oracle 11gR2中SQL*Plus中的新设置exitcommit的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!