Oracle 数据库关闭 之 使用NORMAL选项关闭数据库

问:如何用NORMAL选项关闭数据库?

答:使用shutdown normal命令!

场景一:在执行shutdown normal命令的时候,Oracle是否会主动断开与所有用户的连接?

会话一:

SQL> conn / as sysdba
Connected to an idle instance.
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> 

切换到会话一:
SQL> shutdown normal

此时,Oracle 将等待所有连接的用户解除与数据库的连接。

切换到会话二:

Connected.
SQL> quit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
[oracle@myCentOs admin]$ 
切换到会话一:

SQL> shutdown normal
Database closed.
Database dismounted.
ORACLE instance shut down.
结论:在数据库关闭之前, Oracle将等待所有当前连接的用户解除与数据库的连接。


场景二:在执行shutdown normal命令的时候,用户是否可以连接到数据库?

会话一:

SQL> conn / as sysdba
Connected to an idle instance.
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 normal
同时,在会话二,运行以下语句:

SQL> conn scott/tiger
此时,会产生如下结果:

会话一:

SQL> shutdown normal
Database closed.
Database dismounted.
ORACLE instance shut down.
会话二:

ERROR:
ORA-01090: shutdown in progress - connection is not permitted
结论:在执行shutdown normal命令的时候,不允许有新的连接。


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值