#实例启停

本章节将介绍YashanDB数据库的实例启停方式。数据库安装过程中将实例自动切换成OPEN阶段,并创建名为yashandb的数据库。

执行如下SQL命令查看当前实例状态及数据库名称:

SELECT status FROM V$INSTANCE;

STATUS
-----------------
OPEN

SELECT database_name FROM V$DATABASE;

DATABASE_NAME
----------------------------------------------------------------
yashandb

执行如下命令关闭YashanDB服务:

$ yasboot cluster stop -c yashandb
 type | uuid             | name             | hostid | index    | status  | return_code | progress | cost
----------------------------------------------------------------------------------------------------------
 task | 3b62bda48bad7fd1 | StopYasdbCluster | -      | yashandb | SUCCESS | 0           | 100      | 1
------+------------------+------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS

执行如下命令开启YashanDB服务,同时会将实例切换至OPEN阶段:

$ yasboot cluster start -c yashandb
 type | uuid             | name             | hostid | index    | status  | return_code | progress | cost
----------------------------------------------------------------------------------------------------------
 task | 3b62bda48bad7fd1 | StopYasdbCluster | -      | yashandb | SUCCESS | 0           | 100      | 1
------+------------------+------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS

执行如下命令重启YashanDB数据库,并将实例启动至OPEN阶段:

$ yasboot cluster restart -c yashandb
 type | uuid             | name                | hostid | index    | status  | return_code | progress | cost
-------------------------------------------------------------------------------------------------------------
 task | 78d6449df62594b5 | ReStartYasdbCluster | -      | yashandb | SUCCESS | 0           | 100      | 3
------+------------------+---------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS

执行如下命令重启YashanDB数据库,并将实例启动至NOMOUNT阶段:

$ yasboot cluster restart -c yashandb -m nomount
 type | uuid             | name                | hostid | index    | status  | return_code | progress | cost
-------------------------------------------------------------------------------------------------------------
 task | 78d6449df62594b5 | ReStartYasdbCluster | -      | yashandb | SUCCESS | 0           | 100      | 3
------+------------------+---------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS

执行如下命令重启YashanDB数据库,并将实例启动至MOUNT阶段:

$ yasboot cluster restart -c yashandb -m mount
 type | uuid             | name                | hostid | index    | status  | return_code | progress | cost
-------------------------------------------------------------------------------------------------------------
 task | 78d6449df62594b5 | ReStartYasdbCluster | -      | yashandb | SUCCESS | 0           | 100      | 3
------+------------------+---------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS

Note:

如需进行正常的数据库操作,请将实例切换至OPEN阶段。

pdf-btn 下载文档
copy-btn 复制链接