1.关闭数据库的四个模式:
shutdown immediate;
shutdown abort;
shutdown normal;
shutdown transactional;
2.生产环境关闭数据库步骤:
关库大致步骤:
lsnrctl stop;
alter system checkpoint;
alter system switch logfile;
shutdown abort or init 6
安全关闭数据库步骤如下:
1、有条件的话,先关闭应用,比如weblogic等,因为在很多情况下weblogic连接池配置了很多与数据库连接的进程。
2、关闭监听程序,目的是不允许其他应用程序或者客户端新建连接到数据库
$lsnrctl stop —单机
$ srvctl stop listener -n 节点主机名 —rac环境,两个节点的监听都需要关闭,这两种方式都可以
3、如果不能先关闭应用的情况下也没关系,那我们就先把通过应用或者pl/sql远程连接到数据库的连接杀死,脚本如下:
$ ps -ef|grep oracle|grep LOCAL=NO|grep -v grep|awk ‘{print $2}’|xargs kill -9
4、把内存中和redo log 中的数据写入到磁盘(这步完成的话SHUTDOWN IMMEDIATE速度将很快)
alter system checkpoint; alter system switch logfile;
—单机环境,执行两次 alter system archive log current;
—rac 环境,可以把两个实例的当前日志归档,执行两次 alter system checkpoint ; 执行一次
5、一致性关闭数据库,通过上面几步的操作,下面的命令会很迅速的关闭数据库
shutdown immediate; —-单机
srvctl stop database -d 数据库名 ; —rac环境
3.shutdown immediate方式关闭数据库日志如下
可以看到依次是关闭数据库,NOMOUNT,然后关闭实例。和打开库的过程相反。
Sat Sep 07 09:14:46 2013
Shutting down instance (immediate)
Shutting down instance: further logons disabled
Sat Sep 07 09:14:46 2013
Stopping background process CJQ0
Stopping background process QMNC
Stopping background process MMNL
Stopping background process MMON
License high water mark = 4
All dispatchers and shared servers shutdown
ALTER DATABASE CLOSE NORMAL
Sat Sep 07 09:14:50 2013
SMON: disabling tx recovery
SMON: disabling cache recovery
Sat Sep 07 09:14:50 2013
Shutting down archive processes
Archiving is disabled
Sat Sep 07 09:14:50 2013
ARCH shutting down
ARC3: Archival stopped
Sat Sep 07 09:14:50 2013
ARCH shutting down
ARC2: Archival stopped
Sat Sep 07 09:14:50 2013
ARCH shutting down
ARC1: Archival stopped
Sat Sep 07 09:14:50 2013
ARCH shutting down
ARC0: Archival stopped
Thread 1 closed at log sequence 50
Successful close of redo thread 1
Completed: ALTER DATABASE CLOSE NORMAL
ALTER DATABASE DISMOUNT
Completed: ALTER DATABASE DISMOUNT
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
Sat Sep 07 09:14:51 2013
Stopping background process VKTM:
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
Sat Sep 07 09:14:53 2013
Instance shutdown complete
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.e1idc.net