运行模式与切换脚本

SinoDB 的四种运行模式

离线模式

不能执行任何操作

[informix@vm84145 ~]$ onstat -
shared memory not initialized for INFORMIXSERVER 'sinodb'

[informix@vm84145 ~]$ dbaccess testdb -

  908: Attempt to connect to database server (sinodb) failed.

在线模式

可以执行各种操作。

单用户模式

可以执行SQL操作和命令行维护操作。只能管理员连接,其它普通用户不能连接。
27010: Only an administrative user can connect in administrative user mode.

[informix@vm84145 ~]$ onmode -ky
[informix@vm84145 ~]$ oninit -j
[informix@vm84145 ~]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- Single-User -- Up 00:00:58 -- 2374324 Kbytes

静态模式

只能执行命令行维护操作(如备份数据库)。
不能执行SQL命令(27002: No connections are allowed in quiescent mode.)

[informix@vm84145 ~]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- On-Line -- Up 00:01:15 -- 2374324 Kbytes
[informix@vm84145 ~]$ onmode -s

This will perform a GRACEFUL SHUTDOWN -
Do you wish to continue (y/n)? y
[informix@vm84145 ~]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- Quiescent -- Up 00:02:38 -- 2374324 Kbytes

[informix@vm84145 ~]$ dbaccess testdb -

27002: No connections are allowed in quiescent mode.

SinoDB 3种过渡状态

初始化(Initialization)

快速恢复(Fast Recovery)

关闭(Shutting Down)

SinoDB 的模式转换状态图

SinoDB 可从一个运行模式,转换到另一个运行模式.
模式转换

离线转在线

[informix@vm84145 ~]$ onstat -
shared memory not initialized for INFORMIXSERVER 'sinodb'
[informix@vm84145 ~]$ oninit
[informix@vm84145 ~]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- On-Line -- Up 00:00:15 -- 2374324 Kbytes

[informix@vm84145 ~]$ 

单用户转在线

[informix@vm84145 ~]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- Single-User -- Up 00:13:56 -- 2374324 Kbytes

[informix@vm84145 ~]$ onmode -m
[informix@vm84145 ~]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- On-Line -- Up 00:14:34 -- 2374324 Kbytes

[informix@vm84145 ~]$ 

静态转在线

[informix@vm84145 ~]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- Quiescent -- Up 00:16:37 -- 2374324 Kbytes

[informix@vm84145 ~]$ onmode -m
[informix@vm84145 ~]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- On-Line -- Up 00:17:33 -- 2374324 Kbytes

[informix@vm84145 ~]$ 

在线转单用户

[informix@vm84145 ~]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- On-Line -- Up 00:17:33 -- 2374324 Kbytes

[informix@vm84145 ~]$ onmode -j
This will change mode to single user. Only DBSA/informix can connect 
in this mode.
Do you wish to continue (y/n)? y

All threads which are not owned by DBSA/informix will be killed.
Do you wish to continue (y/n)? y
[informix@vm84145 ~]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- Single-User -- Up 00:18:28 -- 2374324 Kbytes

[informix@vm84145 ~]$ 

单用户转离线

[informix@vm84145 ~]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- Single-User -- Up 00:19:21 -- 2374324 Kbytes

[informix@vm84145 ~]$ onmode -k

This will take Sinoregal SinoDB Dynamic Server OFF-LINE -
Do you wish to continue (y/n)? y

There are 0 user threads that will be killed.
Do you wish to continue (y/n)? y
[informix@vm84145 ~]$ onstat -
shared memory not initialized for INFORMIXSERVER 'sinodb'
[informix@vm84145 ~]$ 

在线转离线

[informix@vm84145 ~]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- On-Line -- Up 00:00:32 -- 2374324 Kbytes

[informix@vm84145 ~]$ onmode -k

This will take Sinoregal SinoDB Dynamic Server OFF-LINE -
Do you wish to continue (y/n)? y

There are 0 user threads that will be killed.
Do you wish to continue (y/n)? y
[informix@vm84145 ~]$ onstat -
shared memory not initialized for INFORMIXSERVER 'sinodb'
[informix@vm84145 ~]$ 

在线转静态

[informix@vm84145 ~]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- On-Line -- Up 00:01:15 -- 2374324 Kbytes
[informix@vm84145 ~]$ onmode -s

This will perform a GRACEFUL SHUTDOWN -
Do you wish to continue (y/n)? y
[informix@vm84145 ~]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- Quiescent -- Up 00:02:38 -- 2374324 Kbytes

或者

[informix@vm84145 ~]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- On-Line -- Up 00:01:23 -- 2374324 Kbytes

[informix@vm84145 ~]$ onmode -u

This will perform an IMMEDIATE SHUTDOWN -
Do you wish to continue (y/n)? y

There are 0 user threads that will be killed.
Do you wish to continue (y/n)? y
[informix@vm84145 ~]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- Quiescent -- Up 00:02:48 -- 2374324 Kbytes

静态转离线

Do you wish to continue (y/n)? y
[informix@vm84145 ~]$ onstat -

Sinoregal SinoDB Dynamic Server Version 12.10.FC8 -- Quiescent -- Up 00:02:48 -- 2374324 Kbytes

[informix@vm84145 ~]$ onmode -k

This will take Sinoregal SinoDB Dynamic Server OFF-LINE -
Do you wish to continue (y/n)? y   

There are 0 user threads that will be killed.
Do you wish to continue (y/n)? y
[informix@vm84145 ~]$ onstat -
shared memory not initialized for INFORMIXSERVER 'sinodb'
[informix@vm84145 ~]$ 

附录
SinoDB的模式转换状态表