Oracle 数据库关闭 之 使用TRANSACTIONAL选项关闭数据库
2012-02-03 18:23
981 查看
问:如何用NORMAL选项关闭数据库?
答:使用shutdown transactional命令!
场景一:在执行shutdown transactional命令的时候,是否还可以有新的用户连接到数据库?
会话一:
会话一:
会话二:
结论:在执行shutdown transactional命令之后,不允许有新的用户连接到数据库。
场景二:在执行shutdown
transactional命令的时候,假设用户scott执行DDL语句,请问是否会执行成功?
会话一:
会话一:
同时,在会话二,执行以下DDL语句:
会话一:
会话二:
场景三:在执行shutdown
transactional命令的时候,假设用户scott执行DML语句,启动新的事务,请问是否会执行成功?
会话一:
会话二:
会话一:
会话一:
会话二:
场景四:在执行shutdown transactional命令的时候,假设用户scott执行Insert语句,事务没有提交,请问是否会自动提交还是会回滚?
会话一:
此时,会话一一直处于等待状态,直到会话二提交事务之后,会话一才会关闭数据库。
结论:在执行shutdown transactional命令之后,在完成所有事务后,任何一个仍连接到实例的客户都将被解除连接。
答:使用shutdown transactional命令!
场景一:在执行shutdown transactional命令的时候,是否还可以有新的用户连接到数据库?
会话一:
SQL> startup ORACLE instance started. Total System Global Area 236000356 bytes Fixed Size 451684 bytes Variable Size 201326592 bytes Database Buffers 33554432 bytes Redo Buffers 667648 bytes Database mounted. Database opened.再运行以下语句:
SQL> shutdown transactional同时,在会话二,新连接一个用户到数据库,执行以下语句:
SQL> conn scott/tiger此时,会产生如下结果:
会话一:
SQL> shutdown transactional Database closed. Database dismounted. ORACLE instance shut down.
会话二:
SQL> conn scott/tiger ERROR: ORA-01089: immediate shutdown in progress - no operations are permitted
结论:在执行shutdown transactional命令之后,不允许有新的用户连接到数据库。
场景二:在执行shutdown
transactional命令的时候,假设用户scott执行DDL语句,请问是否会执行成功?
会话一:
SQL> startup ORACLE instance started. Total System Global Area 236000356 bytes Fixed Size 451684 bytes Variable Size 201326592 bytes Database Buffers 33554432 bytes Redo Buffers 667648 bytes Database mounted. Database opened.会话二:
SQL> conn scott/tiger Connected
会话一:
SQL> shutdown transactional
同时,在会话二,执行以下DDL语句:
SQL> create table t (x number);此时,会产生如下结果:
会话一:
SQL> shutdown transactional Database closed. Database dismounted. ORACLE instance shut down.
会话二:
SQL> conn scott/tiger ERROR: ORA-01089: immediate shutdown in progress - no operations are permitted结论:在执行shutdown transactional命令之后,所有连接到数据库的用户执行的DDL语句都无效。
场景三:在执行shutdown
transactional命令的时候,假设用户scott执行DML语句,启动新的事务,请问是否会执行成功?
会话一:
SQL> startup ORACLE instance started. Total System Global Area 236000356 bytes Fixed Size 451684 bytes Variable Size 201326592 bytes Database Buffers 33554432 bytes Redo Buffers 667648 bytes Database mounted. Database opened.
会话二:
SQL> conn scott/tiger Connected
SQL> create table t(x number);
Table created.
会话一:
SQL> shutdown transactional同时,在会话二,执行以下DML语句:
SQL> insert into t values(1);此时,会产生如下结果:
会话一:
SQL> shutdown transactional Database closed. Database dismounted. ORACLE instance shut down.
会话二:
SQL> insert into t values(1); insert into t values(1) * ERROR at line 1: ORA-01089: immediate shutdown in progress - no operations are permitted结论:在执行shutdowntransactional命令之后,不允许启动新的事务。
场景四:在执行shutdown transactional命令的时候,假设用户scott执行Insert语句,事务没有提交,请问是否会自动提交还是会回滚?
会话一:
SQL> startup ORACLE instance started. Total System Global Area 236000356 bytes Fixed Size 451684 bytes Variable Size 201326592 bytes Database Buffers 33554432 bytes Redo Buffers 667648 bytes Database mounted. Database opened.会话二:
SQL> conn scott/tiger Connected.
SQL> create table t(x number);
Table created.
SQL> insert into t values(1);
1 row created.
此时,会话一一直处于等待状态,直到会话二提交事务之后,会话一才会关闭数据库。
结论:在执行shutdown transactional命令之后,在完成所有事务后,任何一个仍连接到实例的客户都将被解除连接。
相关文章推荐
- Oracle 数据库关闭 之 使用NORMAL选项关闭数据库
- Oracle 数据库关闭 之 使用IMMEDIATE选项关闭数据库
- Oracle 数据库关闭 之 使用ABORT选项关闭数据库
- 要打开数据库则必须使用 RESETLOGS 或 NORESETLOGS 选项 SQL> startup ORACLE 例程已经启动。 Total System Global Area 135338
- 非正常关机,oracle启动报错,要打开数据库则必须使用 RESETLOGS 或 NORESETLOGS 选项
- 使用 Python 和 Oracle 数据库实现高并发性
- oracle 使用sql获取数据库表、表的字段的多种方法
- 使用Oracle SQLDeveloper连接数据库并创建用户
- oracle 11g---------启动、关闭数据库实例
- 使用Oracle SQLDeveloper连接数据库并创建用户
- 数据库的升降序及克隆去重克隆方法的使用(DB2和Oracle的使用)
- Oracle Db10g 启动和关闭数据库
- ArcGIS——数据库空间SQL(二、oracle中ST_GEOMETRY函数使用)
- oracle 非正常关闭下的数据库无法启动
- 使用DBExportDoc V1.0 For Oracle导出数据库表结构详细步骤
- 使用 Navicat111_premium 将 oracle 数据库迁移到 mysql
- 使用oracle数据库开发,异常总结
- oracle 数据库中,应用程序里的连接探測语句的正确使用
- 数据库使用-oracle位图索引
- 有oracle 10g,但没有安装arcgis,又想使用空间数据库的解决方案