為了方便閱讀,請橫屏觀看程式碼部分
一、Oracle RAC叢集測試背景
某中大型製造業公司,由於要新上專案,建設了一套業務系統-ERP系統,這套系統的資料庫環境是Oracle RAC(RHEL Linux7+Oracle11gR2 RAC)架構 。
這套ERP系統的RAC叢集資料庫在上線之前,我們需要對RAC叢集做一些功能測試,這個測試方法適用於Oracle11g/12c,也適用於Oracle18c/19c。
二、Oracle RAC叢集的介紹
在測試之前,介紹一下Oracle RAC是什麼:Oracle 真正應用叢集技術(Oracle Real Application Cluster )是Oracle 9i及以後版本,Oracle 9i之前叫OPS叢集。Oracle RAC主要支援Oracle9i、10g、11g、12c版本(18c,19c)。在Oracle RAC環境下,Oracle叢集提供了叢集軟體和儲存管理軟體,叢集軟體CRS/GRID,儲存管理軟體ASM(自動儲存管理),多個節點共享一份資料。
ORACLE RAC架構如下:
其中Oracle RAC在物理架構上,硬體裝置主要包括如下部分:
伺服器、共享儲存裝置(共享儲存,光纖交換機,HBA卡,光纖線)、網路裝置(網路交換機,光纖交換機,網線)
1)伺服器
我們稱這個伺服器為“資料庫伺服器”,“資料庫主機”,在RAC的術語中我們又稱其為“節點”,伺服器的配置應該相同,cpu,記憶體等。
2)網路裝置
每臺伺服器上至少兩塊物理網絡卡,分別用於主機間私有通訊和對外公用通訊,也可以有多快網絡卡,進行網絡卡系結,實現網絡卡的冗餘。
私有通訊的網絡卡叫private NIC,對應的IP為private IP。
公用通訊的網絡卡叫public NIC,對應的IP為public IP。
3)共享儲存裝置
共享儲存是整個RAC架構中的核心
每臺伺服器至少一塊/兩塊HBA卡,用於共享儲存的連線。
可以用光纖線直連儲存,也可以透過光纖交換機,我們建議使用光纖交換機。
RAC是一個典型的“多實體,單資料庫”架構,被所有節點共享,並行訪問。
資料庫資料檔案,控制檔案,引數檔案,聯機重做日誌檔案,甚至歸檔日誌檔案都放在共享儲存上,並保證可以被所有節點同時訪問。IO效能要求比較高,一般用光纖線連線。
另外Oracle RAC還有兩種叢集樣式:
Oracle RAC 同時具備HA(High Availiablity) 、LB(LoadBalance)。
1)Failover(故障轉移):
它指叢集中任何一個節點的故障都不會影響使用者的使用,連線到故障節點的使用者會被自動轉移到健康節點,從使用者感受而言, 是感覺不到這種切換。
2)LoadBalance(負載均衡):
就是把負載平均的分配到叢集中的各個節點,從而提高整體的吞吐能力。
三、Oracle RAC叢集功能測試
序號 | OracleRAC測試專案 | OracleRAC測試方法 | OracleRAC正確結果 | OracleRAC測試結果 |
1 | 檢查資料庫的版本和補丁 | select * from v$version; | Oracle 11/12c相應版本 | 是否正常: |
2 | 資料庫啟動和關閉 | startup | 能正常啟動和關閉 | 是否正常: |
Shutdown immediate | ||||
3 | 邏輯備份 | exp,expdp | 匯出成功 | 是否正常: |
4 | 字符集 | select name,value$ from | ZHS16GBK 、 UTF8 | 是否正常: |
props$ | ||||
where name like | ||||
‘%CHARACTERSET%’; | ||||
5 | 建立/刪除 | create tablespace fgedudata01 | 建立成功 | 是否正常: |
表空間 | datafile ‘+fgedudata1’ | 刪除成功 | ||
size 10m autoextend off; | ||||
drop tablespace fgedudata01 | ||||
including contents and files; | ||||
6 | 建立/刪除使用者 | create user fgedu identified | 建立成功 | 是否正常: |
by test default tablespace | 刪除成功 | |||
fgedudata01 temporary tablespace temp; | ||||
drop user fgedu cascade; | ||||
7 | 建立/刪除表 | create table fgedu.itpux | 建立成功 | 是否正常: |
(name varchar2(10),id number); | 刪除成功 | |||
drop table fgedu.itpux; | ||||
8 | 插入/刪除資料 | Insert into fgedu.itpux values(‘itpux01’,’1); | 插入成功 | 是否正常: |
Commit; | 刪除成功 | |||
Delete from fgedu.itpux | ||||
Commit; | ||||
9 | 客戶端連線到 | sqlplus “sys/oracle@itpuxdb as sysdba”; | 連線成功 | 是否正常: |
資料庫 | ||||
10 | 修改資料庫為歸檔樣式 | Alter system set db_recovery_file_dest=’+dgrecover’ scope=spfile; | 歸檔樣式 | 是否正常: |
alter system set db_recovery_file_dest_size=200G scope=spfile; | ||||
Srvctl stop database -d fgerpdb | ||||
Sqlplus “/as sysdba” | ||||
Startup mount; | ||||
Alter database archivelog; | ||||
Shutdown immediate | ||||
Srvctl start database -d fgerpdb |
四、Oracle RAC叢集負載測試
序號 | OracleRAC測試內容 | OracleRAC測試方法 | OracleRAC正確結果 | OracleRAC測試結果 |
1 | 客戶端連線資料庫(RAC方式) | sqlplus “sys/itpux123@itpuxdb as sysdba”; | 連線成功,並且每次連線有可能分佈到不同的實體上 | 是否正常: |
select instance_name from v$instance; | ||||
2 | CRS正常啟動關閉 | crsctl start crs | 能正常啟動和關閉 | 是否正常: |
crsctl stop crs | ||||
3 | 網路連線中斷(public網路) | 拔掉節點一public網絡卡的網線 | 本節點實體正常,vip漂移到節點二,listener,ons,network服務offline,原先連線到節點一的連線自動連線至節點二 | 是否正常: |
4 | 網路連線恢復(public網路) | 插回節點一public網絡卡的網線 | vip漂移回節點一,listener,ons,network服務自動onlien,crs資源恢復正常 | 是否正常: |
5 | 網路連線中斷(private網路) | 拔掉節點一private網絡卡的網線 | 節點二重啟,crs資源offline,vip漂移到節點一,原先連線到節點二的連線自動連線至節點1 | 是否正常: |
6 | 網路連線恢復(private網路) | 插回節點一private網絡卡的網線,使用crsctl start crs啟動crs | 節點二的vip漂移回節點二,節點二crs資源恢復正常 | 是否正常: |
7 | 網路連線中斷(public網路) | 拔掉節點二public網絡卡的網線 | 本節點實體正常,vip漂移到節點一,listener,ons,network服務offline,原先連線到節點二的連線自動連線至節點一 | 是否正常: |
8 | 網路連線恢復(public網路) | 插回節點二public網絡卡的網線 | vip漂移回節點二,listener,ons,network服務自動onlien,crs資源恢復正常 | 是否正常: |
9 | 網路連線中斷(private網路) | 拔掉節點二private網絡卡的網線 | 節點二重啟,crs資源offline,vip漂移到節點一,原先連線到節點二的連線自動連線至節點1 | 是否正常: |
10 | 網路連線恢復(private網路) | 插回節點二private網絡卡的網線,使用crsctl start crs啟動crs | 節點二的vip漂移回節點二,節點二crs資源恢復正常 | 是否正常: |
11 | 負載均衡 | 開啟多個資料庫連線 | 多次連線應分佈在兩個節點 | 是否正常: |
12 | 透明故障切換 | 使用RAC的方式連線資料庫 | 連線不中斷,查詢繼續並自動切換至另一實體 | 是否正常: |
select instance_name from v$instance; | ||||
關閉當前實體後 | ||||
select instance_name from v$instance; | ||||
13 | 正常維護,正常關閉節點1 | Crsctl stop crs | Scan vip,vip漂移到節點二,原先連線到節點一的連線自動連線至節點二 | 是否正常: |
14 | 正常維護,正常關閉節點2 | Crsctl stop crs | vip漂移到節點一,原先連線到節點二的連線自動連線至節點一 | 是否正常: |
針對測試串列中的第1點:客戶端連線到資料庫(RAC負載均衡測試)
Oracle 客戶端的tnsnames.ora樣式如下:只需要配置scan對應的name或ip地址即可,如下所示:
fgerpdb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = www.fgedu.net.cn)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = fgerpdb)
)
)
最終Oracle RAC的測試效果如下:
針對測試串列中的第12點:客戶端連線到資料庫(RAC透明切換測試),客戶端tnsnames.ora配置
fgerpdbtaf=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = www.fgedu.net.cn)(PORT = 1521))
(LOAD_BALANCE = YES)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = fgerpdb)
(FAILOVER_MODE =
(TYPE = SELECT)(METHOD = BASIC)(RETRIES = 180)(DELAY = 5)
)
)
)
tnsping fgerpdbtaf 測試連通性
連通ok後,再用第12點的方式測試透明故障切換
五、Oracle RAC叢集維護命令
5.1 Oracle RAC常用命令工具
以下內容是大家需要熟悉的常用命令,日常工作中可以參考來使用。
$ srvctl -h
Usage: srvctl [-V]
Usage: srvctl add database -d <db_unique_name> -o <oracle_home> [-m <domain_name>] [-p <spfile>] [-r {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY | SNAPSHOT_STANDBY}] [-s <start_options>] [-t <stop_options>] [-n <db_name>] [-y {AUTOMATIC | MANUAL}] [-g "<serverpool_list>"] [-x <node_name>] [-a "<diskgroup_list>"]
Usage: srvctl config database [-d <db_unique_name> [-a] ]
Usage: srvctl start database -d <db_unique_name> [-o <start_options>]
Usage: srvctl stop database -d <db_unique_name> [-o <stop_options>] [-f]
Usage: srvctl status database -d <db_unique_name> [-f] [-v]
Usage: srvctl enable database -d <db_unique_name> [-n <node_name>]
Usage: srvctl disable database -d <db_unique_name> [-n <node_name>]
Usage: srvctl modify database -d <db_unique_name> [-n <db_name>] [-o <oracle_home>] [-u <oracle_user>] [-m <domain>] [-p <spfile>] [-r {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY | SNAPSHOT_STANDBY}] [-s <start_options>] [-t <stop_options>] [-y {AUTOMATIC | MANUAL}] [-g "<serverpool_list>" [-x <node_name>]] [-a "<diskgroup_list>"|-z]
Usage: srvctl remove database -d <db_unique_name> [-f] [-y]
Usage: srvctl getenv database -d <db_unique_name> [-t "<name_list>"]
Usage: srvctl setenv database -d <db_unique_name> {-t <name>=<val>[,<name>=<val>,...] | -T <name>=<val>}
Usage: srvctl unsetenv database -d <db_unique_name> -t "<name_list>"
Usage: srvctl add instance -d <db_unique_name> -i <inst_name> -n <node_name> [-f]
Usage: srvctl start instance -d <db_unique_name> {-n <node_name> [-i <inst_name>] | -i <inst_name_list>} [-o <start_options>]
Usage: srvctl stop instance -d <db_unique_name> {-n <node_name> | -i <inst_name_list>} [-o <stop_options>] [-f]
Usage: srvctl status instance -d <db_unique_name> {-n <node_name> | -i <inst_name_list>} [-f] [-v]
Usage: srvctl enable instance -d <db_unique_name> -i "<inst_name_list>"
Usage: srvctl disable instance -d <db_unique_name> -i "<inst_name_list>"
Usage: srvctl modify instance -d <db_unique_name> -i <inst_name> { -n <node_name> | -z }
Usage: srvctl remove instance -d <db_unique_name> [-i <inst_name>] [-f] [-y]
Usage: srvctl add service -d <db_unique_name> -s <service_name> {-r "<preferred_list>" [-a "<available_list>"] [-P {BASIC | NONE | PRECONNECT}] | -g <server_pool> [-c {UNIFORM | SINGLETON}] } [-k <net_num>] [-l [PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]] [-y {AUTOMATIC | MANUAL}] [-q {TRUE|FALSE}] [-x {TRUE|FALSE}] [-j {SHORT|LONG}] [-B {NONE|SERVICE_TIME|THROUGHPUT}] [-e {NONE|SESSION|SELECT}] [-m {NONE|BASIC}] [-z <failover_retries>] [-w <failover_delay>]
Usage: srvctl add service -d <db_unique_name> -s <service_name> -u {-r "<new_pref_inst>" | -a "<new_avail_inst>"}
Usage: srvctl config service -d <db_unique_name> [-s <service_name>] [-a]
Usage: srvctl enable service -d <db_unique_name> -s "<service_name_list>" [-i <inst_name> | -n <node_name>]
Usage: srvctl disable service -d <db_unique_name> -s "<service_name_list>" [-i <inst_name> | -n <node_name>]
Usage: srvctl status service -d <db_unique_name> [-s "<service_name_list>"] [-f] [-v]
Usage: srvctl modify service -d <db_unique_name> -s <service_name> -i <old_inst_name> -t <new_inst_name> [-f]
Usage: srvctl modify service -d <db_unique_name> -s <service_name> -i <avail_inst_name> -r [-f]
Usage: srvctl modify service -d <db_unique_name> -s <service_name> -n -i "<preferred_list>" [-a "<available_list>"] [-f]
Usage: srvctl modify service -d <db_unique_name> -s <service_name> [-c {UNIFORM | SINGLETON}] [-P {BASIC|PRECONNECT|NONE}] [-l [PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]] [-y {AUTOMATIC | MANUAL}][-q {true|false}] [-x {true|false}] [-j {SHORT|LONG}] [-B {NONE|SERVICE_TIME|THROUGHPUT}] [-e {NONE|SESSION|SELECT}] [-m {NONE|BASIC}] [-z <integer>] [-w <integer>]
Usage: srvctl relocate service -d <db_unique_name> -s <service_name> {-i <old_inst_name> -t <new_inst_name> | -c <current_node> -n <target_node>} [-f]
Specify instances for an administrator-managed database, or nodes for a policy managed database
Usage: srvctl remove service -d <db_unique_name> -s <service_name> [-i <inst_name>] [-f]
Usage: srvctl start service -d <db_unique_name> [-s "<service_name_list>" [-n <node_name> | -i <inst_name>] ] [-o <start_options>]
Usage: srvctl stop service -d <db_unique_name> [-s "<service_name_list>" [-n <node_name> | -i <inst_name>] ] [-f]
Usage: srvctl add nodeapps { { -n <node_name> -A <name|ip>/<netmask>/[if1[|if2...]] } | { -S <subnet>/<netmask>/[if1[|if2...]] } } [-p <portnum>] [-m <multicast-ip-address>] [-e <eons-listen-port>] [-l <ons-local-port>] [-r <ons-remote-port>] [-t <host>[:<port>][,<host>[:<port>]...]] [-v]
Usage: srvctl config nodeapps [-a] [-g] [-s] [-e]
Usage: srvctl modify nodeapps {[-n <node_name> -A <new_vip_address>/<netmask>[/if1[|if2|...]]] | [-S <subnet>/<netmask>[/if1[|if2|...]]]} [-m <multicast-ip-address>] [-p <multicast-portnum>] [-e <eons-listen-port>] [ -l <ons-local-port> ] [-r <ons-remote-port> ] [-t <host>[:<port>][,<host>[:<port>]...]] [-v]
Usage: srvctl start nodeapps [-n <node_name>] [-v]
Usage: srvctl stop nodeapps [-n <node_name>] [-f] [-r] [-v]
Usage: srvctl status nodeapps
Usage: srvctl enable nodeapps [-v]
Usage: srvctl disable nodeapps [-v]
Usage: srvctl remove nodeapps [-f] [-y] [-v]
Usage: srvctl getenv nodeapps [-a] [-g] [-s] [-e] [-t "<name_list>"]
Usage: srvctl setenv nodeapps {-t "<name>=<val>[,<name>=<val>,...]" | -T "<name>=<val>"}
Usage: srvctl unsetenv nodeapps -t "<name_list>" [-v]
Usage: srvctl add vip -n <node_name> -k <network_number> -A <name|ip>/<netmask>/[if1[|if2...]] [-v]
Usage: srvctl config vip { -n <node_name> | -i <vip_name> }
Usage: srvctl disable vip -i <vip_name> [-v]
Usage: srvctl enable vip -i <vip_name> [-v]
Usage: srvctl remove vip -i "<vip_name_list>" [-f] [-y] [-v]
Usage: srvctl getenv vip -i <vip_name> [-t "<name_list>"]
Usage: srvctl start vip { -n <node_name> | -i <vip_name> } [-v]
Usage: srvctl stop vip { -n <node_name> | -i <vip_name> } [-f] [-r] [-v]
Usage: srvctl status vip { -n <node_name> | -i <vip_name> }
Usage: srvctl setenv vip -i <vip_name> {-t "<name>=<val>[,<name>=<val>,...]" | -T "<name>=<val>"}
Usage: srvctl unsetenv vip -i <vip_name> -t "<name_list>" [-v]
Usage: srvctl add asm [-l <lsnr_name>]
Usage: srvctl start asm [-n <node_name>] [-o <start_options>]
Usage: srvctl stop asm [-n <node_name>] [-o <stop_options>] [-f]
Usage: srvctl config asm [-a]
Usage: srvctl status asm [-n <node_name>] [-a]
Usage: srvctl enable asm [-n <node_name>]
Usage: srvctl disable asm [-n <node_name>]
Usage: srvctl modify asm [-l <lsnr_name>]
Usage: srvctl remove asm [-f]
Usage: srvctl getenv asm [-t <name>[, ...]]
Usage: srvctl setenv asm -t "<name>=<val> [,...]" | -T "<name>=<value>"
Usage: srvctl unsetenv asm -t "<name>[, ...]"
Usage: srvctl start diskgroup -g <dg_name> [-n "<node_list>"]
Usage: srvctl stop diskgroup -g <dg_name> [-n "<node_list>"] [-f]
Usage: srvctl status diskgroup -g <dg_name> [-n "<node_list>"] [-a]
Usage: srvctl enable diskgroup -g <dg_name> [-n "<node_list>"]
Usage: srvctl disable diskgroup -g <dg_name> [-n "<node_list>"]
Usage: srvctl remove diskgroup -g <dg_name> [-f]
Usage: srvctl add listener [-l <lsnr_name>] [-s] [-p "[TCP:]<port>[, ...][/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]"] [-o <oracle_home>] [-k <net_num>]
Usage: srvctl config listener [-l <lsnr_name>] [-a]
Usage: srvctl start listener [-l <lsnr_name>] [-n <node_name>]
Usage: srvctl stop listener [-l <lsnr_name>] [-n <node_name>] [-f]
Usage: srvctl status listener [-l <lsnr_name>] [-n <node_name>]
Usage: srvctl enable listener [-l <lsnr_name>] [-n <node_name>]
Usage: srvctl disable listener [-l <lsnr_name>] [-n <node_name>]
Usage: srvctl modify listener [-l <lsnr_name>] [-o <oracle_home>] [-p "[TCP:]<port>[, ...][/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]"] [-u <oracle_user>] [-k <net_num>]
Usage: srvctl remove listener [-l <lsnr_name> | -a] [-f]
Usage: srvctl getenv listener [-l <lsnr_name>] [-t <name>[, ...]]
Usage: srvctl setenv listener [-l <lsnr_name>] -t "<name>=<val> [,...]" | -T "<name>=<value>"
Usage: srvctl unsetenv listener [-l <lsnr_name>] -t "<name>[, ...]"
Usage: srvctl add scan -n <scan_name> [-k <network_number> [-S <subnet>/<netmask>[/if1[|if2|...]]]]
Usage: srvctl config scan [-i <ordinal_number>]
Usage: srvctl start scan [-i <ordinal_number>] [-n <node_name>]
Usage: srvctl stop scan [-i <ordinal_number>] [-f]
Usage: srvctl relocate scan -i <ordinal_number> [-n <node_name>]
Usage: srvctl status scan [-i <ordinal_number>]
Usage: srvctl enable scan [-i <ordinal_number>]
Usage: srvctl disable scan [-i <ordinal_number>]
Usage: srvctl modify scan -n <scan_name>
Usage: srvctl remove scan [-f] [-y]
Usage: srvctl add scan_listener [-l <lsnr_name_prefix>] [-s] [-p [TCP:]<port>[/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]]
Usage: srvctl config scan_listener [-i <ordinal_number>]
Usage: srvctl start scan_listener [-n <node_name>] [-i <ordinal_number>]
Usage: srvctl stop scan_listener [-i <ordinal_number>] [-f]
Usage: srvctl relocate scan_listener -i <ordinal_number> [-n <node_name>]
Usage: srvctl status scan_listener [-i <ordinal_number>]
Usage: srvctl enable scan_listener [-i <ordinal_number>]
Usage: srvctl disable scan_listener [-i <ordinal_number>]
Usage: srvctl modify scan_listener {-u|-p [TCP:]<port>[/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]}
Usage: srvctl remove scan_listener [-f] [-y]
Usage: srvctl add srvpool -g <pool_name> [-l <min>] [-u <max>] [-i <importance>] [-n "<server_list>"]
Usage: srvctl config srvpool [-g <pool_name>]
Usage: srvctl status srvpool [-g <pool_name>] [-a]
Usage: srvctl status server -n "<server_list>" [-a]
Usage: srvctl relocate server -n "<server_list>" -g <pool_name> [-f]
Usage: srvctl modify srvpool -g <pool_name> [-l <min>] [-u <max>] [-i <importance>] [-n "<server_list>"]
Usage: srvctl remove srvpool -g <pool_name>
Usage: srvctl add oc4j [-v]
Usage: srvctl config oc4j
Usage: srvctl start oc4j [-v]
Usage: srvctl stop oc4j [-f] [-v]
Usage: srvctl relocate oc4j [-n <node_name>] [-v]
Usage: srvctl status oc4j [-n <node_name>]
Usage: srvctl enable oc4j [-n <node_name>] [-v]
Usage: srvctl disable oc4j [-n <node_name>] [-v]
Usage: srvctl modify oc4j -p <oc4j_rmi_port> [-v]
Usage: srvctl remove oc4j [-f] [-v]
Usage: srvctl start home -o <oracle_home> -s <state_file> -n <node_name>
Usage: srvctl stop home -o <oracle_home> -s <state_file> -n <node_name> [-t <stop_options>] [-f]
Usage: srvctl status home -o <oracle_home> -s <state_file> -n <node_name>
Usage: srvctl add filesystem -d <volume_device> -v <volume_name> -g <dg_name> [-m <mountpoint_path>] [-u <user>]
Usage: srvctl config filesystem -d <volume_device>
Usage: srvctl start filesystem -d <volume_device> [-n <node_name>]
Usage: srvctl stop filesystem -d <volume_device> [-n <node_name>] [-f]
Usage: srvctl status filesystem -d <volume_device>
Usage: srvctl enable filesystem -d <volume_device>
Usage: srvctl disable filesystem -d <volume_device>
Usage: srvctl modify filesystem -d <volume_device> -u <user>
Usage: srvctl remove filesystem -d <volume_device> [-f]
Usage: srvctl start gns [-v] [-l <log_level>] [-n <node_name>]
Usage: srvctl stop gns [-v] [-n <node_name>] [-f]
Usage: srvctl config gns [-v] [-a] [-d] [-k] [-m] [-n <node_name>] [-p] [-s] [-V]
Usage: srvctl status gns -n <node_name>
Usage: srvctl enable gns [-v] [-n <node_name>]
Usage: srvctl disable gns [-v] [-n <node_name>]
Usage: srvctl relocate gns [-v] [-n <node_name>] [-f]
Usage: srvctl add gns [-v] -d <domain> -i <vip_name|ip> [-k <network_number> [-S <subnet>/<netmask>[/<interface>]]]
srvctl modify gns [-v] [-f] [-l <log_level>] [-d <domain>] [-i <ip_address>] [-N <name> -A <address>] [-D <name> -A <address>] [-c <name> -a <alias>] [-u <alias>] [-r <address>] [-V <name>] [-F <forwarded_domains>] [-R <refused_domains>] [-X <excluded_interfaces>]
Usage: srvctl remove gns [-f] [-d <domain_name>]
$ ./crsctl -h
Usage: crsctl add - add a resource, type or other entity
crsctl check - check a service, resource or other entity
crsctl config - output autostart configuration
crsctl debug - obtain or modify debug state
crsctl delete - delete a resource, type or other entity
crsctl disable - disable autostart
crsctl enable - enable autostart
crsctl get - get an entity value
crsctl getperm - get entity permissions
crsctl lsmodules - list debug modules
crsctl modify - modify a resource, type or other entity
crsctl query - query service state
crsctl pin - Pin the nodes in the nodelist
crsctl relocate - relocate a resource, server or other entity
crsctl replace - replaces the location of voting files
crsctl setperm - set entity permissions
crsctl set - set an entity value
crsctl start - start a resource, server or other entity
crsctl status - get status of a resource or other entity
crsctl stop - stop a resource, server or other entity
crsctl unpin - unpin the nodes in the nodelist
crsctl unset - unset a entity value, restoring its default
5.2 Oracle RAC叢集日常維護命令
以下內容是推薦大家必須要記住的常用操作,日常工作中必須經常使用。
1.停止資料庫上的所有節點和啟動資料庫上的所有節點
Srvctl stop database -d fgedu –o immediate
Srvctl start database -d fgedu
2.停止資料庫上的所有asm磁碟組和啟動資料庫上的所有磁碟組
Srvctl stop asm –g crs
Srvctl stop asm –g dgsystem
Srvctl stop asm –g fgedudata1
Srvctl stop asm –g dgrecover
Srvctl start asm –g crs
Srvctl start asm –g dgsystem
Srvctl start asm –g fgedudata1
Srvctl start asm –g dgrecover
3.停止對應節點上的listener和啟動對應節點上的listener
Srvctl stop listener -n fgerp61
Srvctl stop listener -n fgerp62
Srvctl start listener -n fgerp61
Srvctl start listener -n fgerp62
4.停止scan_listener和啟動scan_listener
Srvctl stop scan_listener
Srvctl start scan_listener
5.停止scan和啟動scan
Srvctl stop scan
Srvctl start scan
6.停止對應節點上的資源和啟動對應節點上的資源
Srvctl stop nodeapps -n fgerp62
Srvctl stop nodeapps -n fgerp61
Srvctl start nodeapps -n fgerp62
Srvctl start nodeapps -n fgerp61
7.停止crs和啟動crs
停止crs
crsctl stop crs
Crsctl stop crs的方式能把所有grid行程都關閉掉
啟動crs
crsctl start crs
8.檢查crs資源狀態
crsctl status resource -t
crs_stat –t
9、用asmcmd工具管理asm磁碟組
檢視磁碟組容量
asmcmd lsdg
如果大家已經有一套Oracle RAC叢集環境了,即可按照上面的過程來測試。
朋友會在“發現-看一看”看到你“在看”的內容