当前位置导航:炫浪网>>网络学院>>编程开发>>Oracle教程

10gRAC系列之使用srvctl管理RAC数据库

 srvctl即Server Control,是一个命令行工具,用以管理Oracle的RAC环境,srvctl在Oracle9i中引入,Oracle10g对其功能进行了大大增强。

在命令行下,使用-h参数可以察看srvctl支持的命令及参数:

bash-2.05$ srvctl -h
Usage: srvctl [-V]
................
Usage: srvctl add asm -n -i -o [-p ]
Usage: srvctl config database
Usage: srvctl config database -d [-a] [-t]
Usage: srvctl config service -d [-s ] [-a] [-S ]
Usage: srvctl config nodeapps -n [-a] [-g] [-o] [-s] [-l]
Usage: srvctl config asm -n
Usage: srvctl config listener -n
Usage: srvctl disable database -d
.....................

常用的命令主要如下:
1.使用srvctl status查看数据库及实例状态
查看数据库的状态

bash-2.05$ srvctl status database -d eygle
Instance eygle1 is running on node db210-rac1
Instance eygle2 is running on node db210-rac2

查看数据库实例的状态

bash-2.05$ srvctl status instance -d eygle -i eygle1,eygle2
Instance eygle1 is running on node db210-rac1
Instance eygle2 is running on node db210-rac2

2.使用srvctl stop停止数据库或实例
停止实例使用srvctl stop instance命令:

bash-2.05$ srvctl stop instance
PRKO-2001 : Invalid command line syntax
bash-2.05$ srvctl stop instance -h
Usage: srvctl stop instance -d -i "" [-o ] [-c | -q]
-d Unique name for the database
-i "" Comma separated instance names
-o Options to shutdown command (e.g. normal, transactional, immediate, or abort)
-c Connect string (default: / as sysdba)
-q Query connect string from standard input
-h Print usage

在命令行发出如下命令:

bash-2.05$ srvctl stop instance -d eygle -i eygle2

在该节点的警告日志文件中就可以看到如下关闭信息:

Thu Dec 28 14:32:04 2006
Shutting down instance: further logons disabled
Thu Dec 28 14:32:04 2006
Stopping background process QMNC
Thu Dec 28 14:32:04 2006
Stopping background process CJQ0
Thu Dec 28 14:32:06 2006
Stopping background process MMNL
Thu Dec 28 14:32:07 2006
Stopping background process MMON
Thu Dec 28 14:32:08 2006
Shutting down instance (immediate)
License high water mark = 11
Thu Dec 28 14:32:08 2006
Stopping Job queue slave processes
Thu Dec 28 14:32:08 2006
Job queue slave processes stopped
Thu Dec 28 14:32:15 2006
PMON failed to acquire latch, see PMON dump
Thu Dec 28 14:32:16 2006
ALTER DATABASE CLOSE NORMAL
Thu Dec 28 14:32:16 2006
SMON: disabling tx recovery
SMON: disabling cache recovery
Thu Dec 28 14:32:17 2006
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
Thread 2 closed at log sequence 1
Successful close of redo thread 2
Thu Dec 28 14:32:17 2006
Completed: ALTER DATABASE CLOSE NORMAL
Thu Dec 28 14:32:17 2006
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
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
Thu Dec 28 14:32:20 2006
freeing rdom 0

停止数据库使用srvctl stop database命令;

bash-2.05$ srvctl stop database -h
Usage: srvctl stop database -d [-o ] [-c | -q]
-d Unique name for the database
-o Options to shutdown command (e.g. normal, transactional, immediate, or abort)
-c Connect string (default: / as sysdba)
-q Query connect string from standard input
-h Print usage

发出如下命令后,数据库停止:

bash-2.05$ srvctl stop database -d eygle

日志文件记录如下过程:

Thu Dec 28 14:46:22 2006
Shutting down instance: further logons disabled
Thu Dec 28 14:46:22 2006
Stopping background process CJQ0
Thu Dec 28 14:46:22 2006
Stopping background process QMNC
Thu Dec 28 14:46:24 2006
Stopping background process MMNL
Thu Dec 28 14:46:25 2006
Stopping background process MMON
Thu Dec 28 14:46:26 2006
Shutting down instance (immediate)
License high water mark = 15
Thu Dec 28 14:46:26 2006
Stopping Job queue slave processes
Thu Dec 28 14:46:26 2006
Job queue slave processes stopped
Thu Dec 28 14:46:33 2006
PMON failed to acquire latch, see PMON dump
PMON failed to acquire latch, see PMON dump
PMON failed to acquire latch, see PMON dump
Thu Dec 28 14:46:46 2006
PMON failed to acquire latch, see PMON dump
Thu Dec 28 14:46:47 2006
ALTER DATABASE CLOSE NORMAL
Thu Dec 28 14:46:47 2006
SMON: disabling tx recovery
SMON: disabling cache recovery
Thu Dec 28 14:46:47 2006
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
Thread 1 closed at log sequence 16
Successful close of redo thread 1
Thu Dec 28 14:46:47 2006
Completed: ALTER DATABASE CLOSE NORMAL
Thu Dec 28 14:46:47 2006
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
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
Thu Dec 28 14:46:50 2006
freeing rdom 0

 

3.使用srvctl start命令启动数据库或实例
使用srvctl start database可以启动数据库的所有实例:

bash-2.05$ srvctl start database -d eygle

在第一个节点,警告日志记录了如下启动过程:

Thu Dec 28 14:54:27 2006
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
Interface type 1 bge1 192.168.18.0 configured from OCR for use as a cluster interconnect
Interface type 1 bge2 192.168.19.0 configured from OCR for use as a cluster interconnect
Interface type 1 bge0 172.16.19.0 configured from OCR for use as a public interface
Picked latch-free SCN scheme 3
Using LOG_ARCHIVE_DEST_1 parameter default value as /opt/oracle/product/10.2.0/db/dbs/arch
Autotune of undo retention is turned on.
LICENSE_MAX_USERS = 0
SYS auditing is disabled
ksdpec: called for event 13740 prior to event group initialization
Starting up ORACLE RDBMS Version: 10.2.0.1.0.
System parameters with non-default values:
processes = 150
__shared_pool_size = 301989888
__large_pool_size = 16777216
__java_pool_size = 16777216
__streams_pool_size = 0
spfile = /dev/vx/rdsk/xxfdg/spfile
sga_target = 1258291200
control_files = /dev/vx/rdsk/xxfdg/ctlfile1, /dev/vx/rdsk/xxfdg/ctlfile2
db_block_size = 8192
__db_cache_size = 905969664
compatible = 10.2.0.1.0
db_file_multiblock_read_count= 16
cluster_database = TRUE
cluster_database_instances= 2
thread = 2
instance_number = 2
undo_management = AUTO
undo_tablespace = UNDOTBS2
remote_login_passwordfile= EXCLUSIVE
db_domain =
remote_listener = LISTENERS_EYGLE
job_queue_processes = 10
background_dump_dest = /opt/oracle/admin/eygle/bdump
user_dump_dest = /opt/oracle/admin/eygle/udump
core_dump_dest = /opt/oracle/admin/eygle/cdump
audit_file_dest = /opt/oracle/admin/eygle/adump
db_name = eygle
open_cursors = 300
pga_aggregate_target = 418381824
Cluster communication is configured to use the following interface(s) for this instance
192.168.18.12
192.168.19.12
Thu Dec 28 14:54:29 2006
cluster interconnect IPC version:Oracle UDP/IP
IPC Vendor 1 proto 2
DIAG started with pid=3, OS id=363
PMON started with pid=2, OS id=361
PSP0 started with pid=4, OS id=381
LMON started with pid=5, OS id=393
Thu Dec 28 14:54:30 2006
WARNING: Failed to set buffer limit on IPC interconnect socket
Oracle requires that the SocketReceive buffer size be tunable upto 1MB
Please make sure the kernel parameterwhich limits SO_RCVBUF value set by
applications is atleast 1MB
LMD0 started with pid=6, OS id=398
LMS0 started with pid=7, OS id=405
LMS1 started with pid=8, OS id=409
MMAN started with pid=9, OS id=413
DBW0 started with pid=10, OS id=415
LGWR started with pid=11, OS id=417
CKPT started with pid=12, OS id=419
SMON started with pid=13, OS id=433
RECO started with pid=14, OS id=451
CJQ0 started with pid=15, OS id=457
MMON started with pid=16, OS id=459
MMNL started with pid=17, OS id=462
Thu Dec 28 14:54:31 2006
lmon registered with NM - instance id 2 (internal mem no 1)
Thu Dec 28 14:54:32 2006
Reconfiguration started (old inc 0, new inc 2)
List of nodes:
0 1
Global Resource Directory frozen
* allocate domain 0, invalid = TRUE
Communication channels reestablished
Master broadcasted resource hash value bitmaps
Non-local Process blocks cleaned out
Thu Dec 28 14:54:33 2006
LMS 1: 0 GCS shadows cancelled, 0 closed
Thu Dec 28 14:54:33 2006
LMS 0: 0 GCS shadows cancelled, 0 closed
Set master node info
Submitted all remote-enqueue requests
Dwn-cvts replayed, VALBLKs dubious
All grantable enqueues granted
Thu Dec 28 14:54:33 2006
LMS 0: 0 GCS shadows traversed, 0 replayed
Thu Dec 28 14:54:33 2006
LMS 1: 0 GCS shadows traversed, 0 replayed
Thu Dec 28 14:54:33 2006
Submitted all GCS remote-cache requests
Fix write in gcs resources
Reconfiguration complete
LCK0 started with pid=18, OS id=527
Thu Dec 28 14:54:34 2006
ALTER DATABASE MOUNT
Thu Dec 28 14:54:34 2006
This instance was first to mount
Setting recovery target incarnation to 1
Thu Dec 28 14:54:39 2006
Successful mount of redo thread 2, with mount id 1429486954
Thu Dec 28 14:54:39 2006
Database mounted in Shared Mode (CLUSTER_DATABASE=TRUE)
Completed: ALTER DATABASE MOUNT
Thu Dec 28 14:54:40 2006
ALTER DATABASE OPEN
This instance was first to open
Picked broadcast on commit scheme to generate SCNs
Thu Dec 28 14:54:43 2006
Thread 2 advanced to log sequence 2
Thread 2 opened at log sequence 2
Current log# 4 seq# 2 mem# 0: /dev/vx/rdsk/xxfdg/redo202
Successful open of redo thread 2
Thu Dec 28 14:54:43 2006
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
Thu Dec 28 14:54:43 2006
SMON: enabling cache recovery
Thu Dec 28 14:54:45 2006
Instance recovery: looking for dead threads
Instance recovery: lock domain invalid but no dead threads
Thu Dec 28 14:54:50 2006
Successfully onlined Undo Tablespace 4.
Thu Dec 28 14:54:50 2006
SMON: enabling tx recovery
Thu Dec 28 14:54:51 2006
Database Characterset is ZHS16GBK
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
QMNC started with pid=20, OS id=1234
Thu Dec 28 14:54:57 2006
Completed: ALTER DATABASE OPEN

 

节点2记录了如下启动过程:

Thu Dec 28 15:04:53 2006
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
Interface type 1 bge1 192.168.18.0 configured from OCR for use as a cluster interconnect
Interface type 1 bge2 192.168.19.0 configured from OCR for use as a cluster interconnect
Interface type 1 bge0 172.16.19.0 configured from OCR for use as a public interface
Picked latch-free SCN scheme 3
Using LOG_ARCHIVE_DEST_1 parameter default value as /opt/oracle/product/10.2.0/db/dbs/arch
Autotune of undo retention is turned on.
LICENSE_MAX_USERS = 0
SYS auditing is disabled
ksdpec: called for event 13740 prior to event group initialization
Starting up ORACLE RDBMS Version: 10.2.0.1.0.
System parameters with non-default values:
processes = 150
__shared_pool_size = 318767104
__large_pool_size = 16777216
__java_pool_size = 16777216
__streams_pool_size = 0
spfile = /dev/vx/rdsk/xxfdg/spfile
sga_target = 1258291200
control_files = /dev/vx/rdsk/xxfdg/ctlfile1, /dev/vx/rdsk/xxfdg/ctlfile2
db_block_size = 8192
__db_cache_size = 889192448
compatible = 10.2.0.1.0
db_file_multiblock_read_count= 16
cluster_database = TRUE
cluster_database_instances= 2
thread = 1
instance_number = 1
undo_management = AUTO
undo_tablespace = UNDOTBS1
remote_login_passwordfile= EXCLUSIVE
db_domain =
remote_listener = LISTENERS_EYGLE
job_queue_processes = 10
background_dump_dest = /opt/oracle/admin/eygle/bdump
user_dump_dest = /opt/oracle/admin/eygle/udump
core_dump_dest = /opt/oracle/admin/eygle/cdump
audit_file_dest = /opt/oracle/admin/eygle/adump
db_name = eygle
open_cursors = 300
pga_aggregate_target = 418381824
Cluster communication is configured to use the following interface(s) for this instance
192.168.18.11
192.168.19.11
Thu Dec 28 15:04:55 2006
cluster interconnect IPC version:Oracle UDP/IP
IPC Vendor 1 proto 2
PMON started with pid=2, OS id=1123
DIAG started with pid=3, OS id=1125
PSP0 started with pid=4, OS id=1127
LMON started with pid=5, OS id=1129
Thu Dec 28 15:04:56 2006
WARNING: Failed to set buffer limit on IPC interconnect socket
Oracle requires that the SocketReceive buffer size be tunable upto 1MB
Please make sure the kernel parameterwhich limits SO_RCVBUF value set by
applications is atleast 1MB
LMD0 started with pid=6, OS id=1131
LMS0 started with pid=7, OS id=1133
LMS1 started with pid=8, OS id=1137
MMAN started with pid=9, OS id=1141
DBW0 started with pid=10, OS id=1143
LGWR started with pid=11, OS id=1153
CKPT started with pid=12, OS id=1156
SMON started with pid=13, OS id=1167
RECO started with pid=14, OS id=1172
CJQ0 started with pid=15, OS id=1182
MMON started with pid=16, OS id=1184
MMNL started with pid=17, OS id=1186
Thu Dec 28 15:04:57 2006
lmon registered with NM - instance id 1 (internal mem no 0)
Thu Dec 28 15:04:57 2006
Reconfiguration started (old inc 0, new inc 2)
List of nodes:
0 1
Global Resource Directory frozen
* allocate domain 0, invalid = TRUE
Communication channels reestablished
Master broadcasted resource hash value bitmaps
Non-local Process blocks cleaned out
Thu Dec 28 15:04:59 2006
LMS 0: 0 GCS shadows cancelled, 0 closed
Thu Dec 28 15:04:59 2006
LMS 1: 0 GCS shadows cancelled, 0 closed
Set master node info
Submitted all remote-enqueue requests
Dwn-cvts replayed, VALBLKs dubious
All grantable enqueues granted
Post SMON to start 1st pass IR
Thu Dec 28 15:04:59 2006
LMS 0: 0 GCS shadows traversed, 0 replayed
Thu Dec 28 15:04:59 2006
LMS 1: 0 GCS shadows traversed, 0 replayed
Thu Dec 28 15:04:59 2006
Submitted all GCS remote-cache requests
Post SMON to start 1st pass IR
Fix write in gcs resources
Reconfiguration complete
LCK0 started with pid=18, OS id=1237
Thu Dec 28 15:05:00 2006
ALTER DATABASE MOUNT
Thu Dec 28 15:05:08 2006
Setting recovery target incarnation to 1
Thu Dec 28 15:05:09 2006
Successful mount of redo thread 1, with mount id 1429486954
Thu Dec 28 15:05:09 2006
Database mounted in Shared Mode (CLUSTER_DATABASE=TRUE)
Completed: ALTER DATABASE MOUNT
Thu Dec 28 15:05:10 2006
ALTER DATABASE OPEN
Picked broadcast on commit scheme to generate SCNs
Thu Dec 28 15:05:10 2006
Thread 1 opened at log sequence 16
Current log# 2 seq# 16 mem# 0: /dev/vx/rdsk/xxfdg/redo102
Successful open of redo thread 1
Thu Dec 28 15:05:10 2006
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
Thu Dec 28 15:05:10 2006
SMON: enabling cache recovery
Thu Dec 28 15:05:13 2006
Successfully onlined Undo Tablespace 1.
Thu Dec 28 15:05:13 2006
SMON: enabling tx recovery
Thu Dec 28 15:05:13 2006
Database Characterset is ZHS16GBK
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
QMNC started with pid=20, OS id=1721
Thu Dec 28 15:05:20 2006
Completed: ALTER DATABASE OPEN

-The End-

原文地址:http://www.eygle.com/archives/2007/01/srvctl_oracle10g_rac.html

相关内容
赞助商链接