RAC&Dataguard switchover 切换
1. 用户组检查
RAC01:oracle:db1 > grep dba /etc/group
dba:!:121:oracle
RAC01:oracle:db1 > grep oinstall /etc/group
oinstall:!:120:
2. ssh 互通性检查
RAC01:oracle:db1 > ssh RAC02 date
Tue Jun 12 14:12:42 CST 2012
RAC01:oracle:db1 > ssh RAC03 date
Tue Jun 12 14:12:52 CST 2012
RAC01:oracle:db1 > ssh RAC01 date
Tue Jun 12 14:12:59 CST 2012
RAC02:oracle:db2 > ssh RAC01 date
Tue Jun 12 14:13:37 CST 2012
RAC02:oracle:db2 > ssh RAC02 date
Tue Jun 12 14:13:42 CST 2012
RAC02:oracle:db2 > ssh RAC03 date
Tue Jun 12 14:13:45 CST 2012
RAC01:oracle:db1 > ssh RAC01 date
Tue Jun 12 14:14:23 CST 2012
RAC01:oracle:db1 > ssh RAC02 date
Tue Jun 12 14:14:26 CST 2012
RAC01:oracle:db1 > ssh RAC03 date
Tue Jun 12 14:14:29 CST 2012
BJ-ZDJK-04:oracle:db1 > ssh BJ-ZDJK-04 date
Tue Jun 12 14:13:20 CST 2012
BJ-ZDJK-04:oracle:db1 > ssh BJ-ZDJK-05 date
Tue Jun 12 14:14:54 CST 2012
BJ-ZDJK-04:oracle:db1 > ssh BJ-ZDJK-06 date
Tue Jun 12 14:15:07 CST 2012
BJ-ZDJK-05:oracle:db2 > ssh BJ-ZDJK-04 date
Tue Jun 12 14:14:14 CST 2012
BJ-ZDJK-05:oracle:db2 > ssh BJ-ZDJK-05 date
Tue Jun 12 14:15:47 CST 2012
BJ-ZDJK-05:oracle:db2 > ssh BJ-ZDJK-06 date
Tue Jun 12 14:15:55 CST 2012
3. 系统参数检查
RAC01:oracle:db1 > cat /etc/security/limits.conf |grep oracle
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
RAC01:oracle:db1 > cat /etc/pam.d/login |grep pam_limits
session required /lib/security/pam_limits.so
RAC01:oracle:db1 > cat /etc/sysctl.conf |grep kernel
kernel.acct = 100 100 30
kernel.shmall = 786432 (已经更改为2097152)
#set "kernel.shmmax" to the half of the physical memory.
kernel.shmmax = 12884901887
kernel.shmmni = 4096
kernel.sem = 250 32000 100 256
kernel.sysrq = 1
kernel.core_uses_pid = 1
kernel.msgmni = 2878
kernel.msgmax = 8192
kernel.msgmnb = 65535
RAC01:oracle:db1 > cat /etc/sysctl.conf |grep fs.file-max
fs.file-max = 6553600
RAC01:oracle:db1 > cat /etc/sysctl.conf |grep net
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.conf.all.rp_filter = 1
#net.ipv6.conf.all.forwarding = 1
net.ipv4.conf.all.arp_ignore = 2
net.ipv4.conf.default.arp_ignore = 2
net.ipv4.conf.default.arp_announce = 1
net.ipv4.conf.all.arp_announce = 1
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_fin_timeout=15
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.conf.default.rp_filter = 1
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
4. Hangcheck-timer Module verification procedure
此部分缺少,建议按照如下方式增加 (已经添加完成)
1. Log in as root, and enter the following command to check the kernel version:
# uname -a
2. Enter the following command on each node to determine which kernel modules are loaded:
# /sbin/lsmod
3. If the hangcheck-timer module is not listed for any node:
on Kernel 2.4 enter a command similar to the following to start the module on that node:
# /sbin/insmod hangcheck-timer hangcheck_tick=1 hangcheck_margin=10 hangcheck_reboot=1
on Kernel 2.6 enter a command similar to the following to start the module located in the directories of the
current kernel version:
# insmod /lib/modules/kernel_version/kernel/drivers/char/hangcheck-timer.ko hangcheck_tick=1
hangcheck_margin=10 hangcheck_reboot=1
In the preceding command example, the variable kernel_version is the kernel version running on your system
that you have got from uname -a.
4. To confirm that the hangcheck module is loaded, enter the following command:
# lsmod | grep hang
The output should be similar to the following:
hangcheck_timer 3289 0
5. To ensure that the module is loaded every time the system restarts, verify that the local system startup file
contains the command shown in the previous step, or add it if necessary:
on Red Hat: On Red Hat Enterprise Linux systems, add the command to the /etc/rc.d/rc.local file.
on SUSE: On SUSE systems, add the command to the /etc/init.d/boot.local file.
5. Platform Specific Setup (已经更改完成)
As per Metalink Note:464061.1, on SuSE Linux disable RUN_PARALLEL by setting it to "no" in
/etc/sysconfig/boot. The default setting of "yes" prevents the Oracle Clusterware to start in most cases. For a
different workaround refer to the note for details.
经过检查,此部分没有更改,建议根据文档更改如下。
/etc/sysconfig/boot
## Type: yesno
## Default: yes
#
# Run all scripts or rather start/stop all services
# which are independent from each other in parallel.
#
#RUN_PARALLEL="yes"
RUN_PARALLEL="no"
6. 数据库补丁检查
Oracle Interim Patch Installer version 11.1.0.9.6
Copyright (c) 2012, Oracle Corporation. All rights reserved.
Oracle Home : /home/oracle/product/11g
Central Inventory : /home/oracle/oraInventory
from : /home/oracle/product/11g/oraInst.loc
OPatch version : 11.1.0.9.6
OUI version : 11.1.0.7.0
Log file location : /home/oracle/product/11g/cfgtoollogs/opatch/opatch2012-06-12_15-53-55PM_1.log
Lsinventory Output file location : /home/oracle/product/11g/cfgtoollogs/opatch/lsinv/lsinventory2012-06-12_15-53-55PM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (2):
Oracle Database 11g 11.1.0.6.0
Oracle Database 11g Patch Set 1 11.1.0.7.0
There are 2 products installed in this Oracle Home.
Interim patches (5) :
Patch 7715339 : applied on Wed Apr 25 18:03:26 CST 2012
Unique Patch ID: 13924592
Created on 16 Jul 2011, 13:49:23 hrs PST8PDT
Bugs fixed:
7715339
This patch overlays patches:
12419384
This patch needs patches:
12419384
as prerequisites
Patch 9549042 : applied on Wed Apr 25 18:02:49 CST 2012
Unique Patch ID: 14015216
Created on 10 Aug 2011, 08:58:54 hrs PST8PDT
Bugs fixed:
9549042
This patch overlays patches:
12419384
This patch needs patches:
12419384
as prerequisites
Patch 12419384 : applied on Wed Apr 25 17:59:14 CST 2012
Unique Patch ID: 13774334
Created on 11 Jul 2011, 01:51:36 hrs PST8PDT
Bugs fixed:
9068088, 7207654, 8865718, 7835247, 7648406, 9054253, 6851110, 7206858
9744252, 7497788, 9956713, 8251486, 6434104, 8851675, 7502237, 8211920
9352179, 7013124, 7643188, 7135702, 7529174, 7196532, 8300793, 9049725
7705669, 7119382, 9001453, 7424804, 7408621, 7426336, 8856696, 6843972
10264680, 8437213, 8836375, 8216875, 7527650, 7454752, 8290478, 9499302
7412296, 6805009, 8318050, 7185113, 7639602, 8539335, 9711859, 9011088
7131291, 9109536, 8199266, 9114072, 8230457, 7420394, 8914979, 9713537
8876094, 7348847, 9311909, 8408887, 7183523, 7441663, 7329252, 8622613
10249534, 7719668, 8577450, 9458811, 8534338, 9272086, 8339404, 8517426
9458814, 9458816, 7384419, 7690421, 9458819, 8419383, 7447559, 8247855
8394351, 6772911, 7175513, 7417614, 9143376, 8243648, 8367827, 8365141
8761101, 7350127, 8462173, 9027691, 11724999, 9485429, 7572069, 9458829
8825048, 8328853, 7585314, 8341623, 8409848, 10358019, 6988517, 8860821
9830111, 8306933, 8306934, 9166322, 6840740, 9458831, 6981690, 8304329
8281906, 7480809, 8339352, 7340448, 7393258, 6599920, 7630416, 8342506
8717461, 6407486, 7416901, 7281382, 8599477, 7475055, 8217795, 8982191
8362693, 12687462, 9702142, 7436152, 7680907, 9702143, 8481935, 7657365
7345543, 10046072, 7670135, 10648873, 10187168, 7708340, 8499043, 12419265
8224083, 7385253, 7225720, 8354686, 8399549, 9118620, 6856345, 9118622
9311954, 9209238, 7484102, 7661251, 8771916, 6991626, 5552232, 9229631
7022234, 7462112, 8248911, 7296258, 9369783, 6812439, 6870937, 7828187
7263842, 8287680, 8870559, 9488887, 8990527, 9242411, 9448311, 7500792
8352304, 8352309, 8565359, 8324760, 7019313, 8686128, 8775066, 7486595
7643632, 9032717, 8658581, 7499911, 6734871, 7411865, 10094989, 7276960
8360192, 8890026, 7522002, 7613481, 7452373, 9267837, 10399808, 8763922
6770443, 7334226, 8284438, 7318049, 8214576, 9021155, 6679303, 8815639
8740993, 7516536, 7675269, 8244734, 8490879, 7646055, 8268330, 9255542
8496830, 12419384, 6647480, 9473270, 8416414, 6858062, 7189645, 8476517
7436280, 5970301, 9363145, 9312879, 7506785, 6977167, 10426994, 6445948
5929055, 7298982, 8348464, 6522654, 8737065, 9774756, 8833297, 7606362
8332021, 8502963, 8285404, 8391256, 9399991, 9776431, 6798427, 11829892
7138523, 6971433, 7829321, 7311601, 8433270, 11829897, 8563941, 8563942
8563943, 8563944, 8563945, 8563946, 7345904, 8563947, 8563948, 6870994
7523787, 9135679, 7697360, 9210925, 7378322, 8348481, 8974548, 7331867
7273819, 7254221, 7036284, 8847439, 7515779, 9434549, 9637033, 8402548
8608377, 7510766, 9066130, 8364676, 7628387, 7553884, 8565708, 7694979
6972189, 7682745, 10209232, 6598432, 6768362, 6501490, 9841005, 8402551
7719143, 7484261, 8402555, 8284633, 7719148, 10009222, 7307821, 8613137
9714832, 8940197, 7650993, 6970731, 12560400, 10009229, 12560402, 7589862
9170608, 12560404, 8263441, 12560405, 6709070, 7586451, 7446163, 7460818
6618461, 7451927, 7373196, 7336031, 7338648, 9399090, 8413059, 8402562
8402637, 7190092, 7393804, 6196748, 7627743, 8834425, 8531282, 9145541
7720494, 8645846, 8539923, 8236851, 7602341, 7036453, 8855553, 7610362
8855559, 8543737, 10336518, 10009241, 7626014, 9654987, 10009246, 10009173
8649055, 7292503, 7706138, 7341598, 6797677, 8603465, 8342923, 8549480
8483871, 7593835, 7356443, 8242410, 7044551, 7639121, 9275072, 8855565
9795214, 7253531, 10336525, 6851669, 8257122, 7318276, 7013817, 8450529
7309458, 11807302, 8855570, 8499600, 8501439, 8588540, 8855575, 8790767
7652915, 8855577, 7426959, 6980601, 9857702, 6452375, 8607693, 7653579
9341448, 8582594, 7535429, 12560374, 7409110, 7432514, 9655014, 8764031
9689310, 7332001, 9084111, 7707103, 9007102, 10336548, 7013835, 8361398
6784747, 6780602, 7524944, 12560385, 7662620, 7496908, 10127716, 12560386
9189647, 12560459, 7417140, 6941717, 7122161, 8668823, 8898852, 8363210
7477246, 7377810, 6798650, 7299153, 8213302, 8755082, 8909984, 8702276
12560461, 7497640, 12560390, 7630874, 9368549, 7133740, 12560464, 9703463
7614692, 7311909, 12560393, 7432601, 8650719, 7352414, 7213937, 12560398
7516867, 8199107, 7662491, 8856478, 7041254, 10336560, 10336565, 7219752
9952228, 6900214, 8981059, 6882739, 11807271, 8546332, 8813366, 8296070
11807278, 7508788, 7538000, 9165206, 8834636, 7242222, 7652888, 10336577
7330434, 7113299, 8592394, 7307972, 8487273, 8660422, 7462709, 8650661
11807283, 11699057, 8244217, 7515145, 7202451, 7432556, 10019218, 7022905
8674263, 8221425, 7694273, 8211733, 9074535, 9188010, 7438445, 9197917
11807291, 11807293, 8803762, 7494333, 8250643, 7834195, 11807297, 7298601
8277580, 7172752, 7326645, 7171015, 7715244, 9241202, 7461921, 6980597
8301559, 7499353, 9532911, 7357609, 7462589, 8768374, 7610592, 10248531
7830065, 7203349, 8702535, 8669679, 9768907, 8268775, 6955744, 9952269
7366290, 8433693, 10145558, 8570572, 7702085, 7185872, 11724936, 8625762
6059178, 7336280, 7257038, 9744092, 8595043, 8542307, 8578132, 7330611
8226397, 7628866, 7278231, 10324526, 6903819, 7676737, 9231605, 9620202
7258928, 9264021, 10169304, 7511040, 8315482, 7434194, 8369094, 7716219
9246245, 7556778, 8220734, 7597354, 7710260
Patch 7388579 : applied on Wed Apr 25 03:36:11 CST 2012
Unique Patch ID: 11171118
Created on 9 Apr 2009, 04:15:20 hrs PST8PDT
Bugs fixed:
7388579
Patch 11724953 : applied on Wed Apr 25 03:34:20 CST 2012
Unique Patch ID: 13604006
Created on 23 Mar 2011, 16:09:28 hrs PST8PDT
Bugs fixed:
4175345, 8619821, 6760284, 8531031, 8429716, 6608472, 8996060, 7691864
9147779, 9066051, 9294495, 7255659, 7836239, 9189171, 7191125, 7162704
8287931, 8441769, 7483048, 6892798, 9577921, 9189026, 7527410, 9646831
7592933, 8586117, 8262786, 8317708, 9074696, 7631837, 8373758, 9207257
8737425, 6986682, 7683940, 8216553, 7374972, 7851612, 6355663, 8328904
8637357, 6486556, 9159057, 8604549, 8595233, 9131555, 6964659, 8321319
8289580, 7357394, 8662477, 8557163, 4587300, 8374326, 8214307, 7364519
6140790, 8476516, 7277672, 8733944, 7353884
Rac system comprising of multiple nodes
Local node = 01
Remote node = 02
Remote node = 03
--------------------------------------------------------------------------------
OPatch succeeded.
7. RAC cluster 检查
RAC02:oracle:db2 > crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.db.db application ONLINE ONLINE zjhz...ac01
ora....b1.inst application ONLINE ONLINE zjhz...ac01
ora....b2.inst application ONLINE ONLINE zjhz...ac02
ora....b3.inst application ONLINE ONLINE zjhz...ac03
ora....SM1.asm application ONLINE ONLINE zjhz...ac01
ora....01.lsnr application ONLINE ONLINE zjhz...ac01
ora....c01.gsd application ONLINE ONLINE zjhz...ac01
ora....c01.ons application ONLINE ONLINE zjhz...ac01
ora....c01.vip application ONLINE ONLINE zjhz...ac01
ora....SM2.asm application ONLINE ONLINE zjhz...ac02
ora....02.lsnr application ONLINE ONLINE zjhz...ac02
ora....c02.gsd application ONLINE ONLINE zjhz...ac02
ora....c02.ons application ONLINE ONLINE zjhz...ac02
ora....c02.vip application ONLINE ONLINE zjhz...ac02
ora....SM3.asm application ONLINE ONLINE zjhz...ac03
ora....03.lsnr application ONLINE ONLINE zjhz...ac03
ora....c03.gsd application ONLINE ONLINE zjhz...ac03
ora....c03.ons application ONLINE ONLINE zjhz...ac03
ora....c03.vip application ONLINE ONLINE zjhz...ac03
RAC02:oracle:db2 > ./opatch lsinventory
Invoking OPatch 11.1.0.6.2
Oracle Interim Patch Installer version 11.1.0.6.2
Copyright (c) 2007, Oracle Corporation. All rights reserved.
Oracle Home : /home/crs
Central Inventory : /home/oracle/oraInventory
from : /etc/oraInst.loc
OPatch version : 11.1.0.6.2
OUI version : 11.1.0.7.0
OUI location : /home/crs/oui
Log file location : /home/crs/cfgtoollogs/opatch/opatch2012-06-12_15-58-37PM.log
Lsinventory Output file location : /home/crs/cfgtoollogs/opatch/lsinv/lsinventory2012-06-12_15-58-37PM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (2):
Oracle Clusterware 11.1.0.6.0
Oracle Database 11g Patch Set 1 11.1.0.7.0
There are 2 products installed in this Oracle Home.
Interim patches (1) :
Patch 11724953 : applied on Wed Apr 25 12:21:00 CST 2012
Created on 23 Mar 2011, 16:09:33 hrs PST8PDT
Bugs fixed:
4175345, 8619821, 6760284, 8531031, 8429716, 6608472, 8996060, 7691864
9147779, 9066051, 9294495, 7255659, 7836239, 9189171, 7191125, 7162704
8287931, 8441769, 7483048, 6892798, 9577921, 9189026, 7527410, 9646831
7592933, 8586117, 8262786, 8317708, 9074696, 7631837, 8373758, 9207257
8737425, 6986682, 7683940, 8216553, 7374972, 7851612, 6355663, 8328904
8637357, 6486556, 9159057, 8604549, 8595233, 9131555, 6964659, 8321319
8289580, 7357394, 8662477, 8557163, 4587300, 8374326, 8214307, 7364519
6140790, 8476516, 7277672, 8733944, 7353884
Rac system comprising of multiple nodes
Local node = 01
Remote node = 02
Remote node = 03
--------------------------------------------------------------------------------
OPatch succeeded.
8. OCR 和 Voting Disk 检查
RAC01:oracle:db1 > ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 293140
Used space (kbytes) : 5412
Available space (kbytes) : 287728
ID : 1094233665
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check bypassed due to non-privileged user
RAC01:oracle:db1 > ocrconfig -showbackup
rac01 2012/06/13 07:22:59 /home/crs/cdata/_cluster/backup00.ocr
rac01 2012/06/13 03:22:59 /home/crs/cdata/_cluster/backup01.ocr
rac01 2012/06/12 23:22:59 /home/crs/cdata/_cluster/backup02.ocr
rac02 2012/06/11 09:58:09 /home/crs/cdata/_cluster/day.ocr
rac01 2012/05/29 03:31:48 /home/crs/cdata/_cluster/week.ocr
RAC01:oracle:db1 > crsctl query css votedisk
0. 0 /dev/raw/raw2
Located 1 voting disk(s).
客户的OCR 和Votedisk 只含有一裸设备,并没有多路复用
9. Listener 和 tnsname 配置
经过调整。相关local listener 和 remote listener 配置如下:
SQL> show parameter remote_listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_listener string LISTENERS_DB
SQL> show parameter local_listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string (address=(protocol=tcp)(port=1
521)(host=10.0.12.18))
建议使用如下tnsnames 设置以提供 load banlance 和failover
test =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.12.18)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.12.20)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.12.22)(PORT = 1521))
(LOAD_BALANCE = yes)
(FAILOVER = ON)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = db)
(FAILOVER_MODE =
(TYPE = SESSION)
(METHOD = BASIC)
)
)
)
10. SGA 和 PGA 内存调整
经过检查,由于默认安装时内存设置并不符合应用需求,现做调整,以后可以根据使用情况作出微调。
sga_max_size=6000m
sga_target=6000m
shared_pool_size=1024m
db_cache_size=1024m
11. Dataguard 配置检查
主备库基本配置正确,部分参照以下做参数修改
主库:
alter system set log_archive_dest_1='location=+DATA valid_for=(all_logfiles,all_roles) db_unique_name=db' sid='*';
alter system set log_archive_format='%t_%s_%r.arc' scope=spfile sid='*';
alter system set log_archive_dest_2='service=db_st arch valid_for=(online_logfile,primary_role) db_unique_name=db_st' sid='*';
备库:
alter system set db_file_name_convert='+DATA/db','+DATA/db_st' scope=spfile sid='*';
alter system set log_file_name_convert='+DATA/db','+DATA/db_st' scope=spfile sid='*';
alter system set log_archive_dest_1='location=+DATA valid_for=(all_logfiles,all_roles) db_unique_name=db_st' sid='*';
alter system set log_archive_format='%t_%s_%r.arc' scope=spfile sid='*';
alter system set log_archive_dest_2='service=db arch valid_for=(online_logfile,primary_role) db_unique_name=db' sid='*';
12. 备库内存参数修改
alter system set shared_pool_size=1024m scope=both sid='db1';
alter system set shared_pool_size=1024m scope=both sid='db2';
alter system set shared_pool_size=1024m scope=both sid='db3';
alter system set db_cache_size=1024m scope=both sid='db1';
alter system set db_cache_size=1024m scope=both sid='db2';
alter system set db_cache_size=1024m scope=both sid='db3';
alter system set sga_target=6000m scope=both sid='db1';
alter system set sga_target=6000m scope=both sid='db2';
alter system set sga_target=6000m scope=both sid='db3';
alter system set sga_max_size=6000m scope=spfile sid='db1';
alter system set sga_max_size=6000m scope=spfile sid='db2';
alter system set sga_max_size=6000m scope=spfile sid='db3';
13. 备库网络配置修改
alter system set remote_listener='LISTENERS_DB_ST' sid='*';
alter system set local_listener='(ADDRESS=(PROTOCOL=tcp)(HOST=10.0.13.24)(PORT=1521))' scope=both sid='db1';
alter system set local_listener='(ADDRESS=(PROTOCOL=tcp)(HOST=10.0.13.25)(PORT=1521))' scope=both sid='db2';
alter system set local_listener='(ADDRESS=(PROTOCOL=tcp)(HOST=10.0.13.26)(PORT=1521))' scope=both sid='db3';
建议使用以下tnsnames 连接备库
test_st =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.13.24)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.13.25)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.13.26)(PORT = 1521))
(LOAD_BALANCE = yes)
(FAILOVER = ON)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = db_st)
(FAILOVER_MODE =
(TYPE = SESSION)
(METHOD = BASIC)
)
)
)
1.3 SWITCHOVER 切换
请注意以下操作Primary 表明当前主库,Standby 表明当前备库
1. 停止应用连接,重启Primary
登录每个Primary 节点切换日志
alter system switch logfile;
2. 停止Primary第二第三节点
srvctl stop instance -d db -i db2,db3
srvctl status database -d db
(状态须为如下:
Instance db1 is running on node RAC01
Instance db2 is not running on node RAC02
Instance db3 is not running on node RAC03
)
重启第一节点
srvctl stop instance -d db -i db1
srvctl start instance -d db -i db1
3. 检查Primary 状态
select database_role ,switchover_status from v$database;
主库状态需要为“TO STANDBY”
如果状态为session active 则需要检查是否有不必要的session 连接
select sid,serial#,username,machine,program from v$session;
如果没有应用连接可以下一步切换
4. Pirmary 切换为备库并且重启至mount 状态
alter database commit to switchover to PHYSICAL STANDBY WITH SESSION SHUTDOWN;
shutdown immediate
srvctl start instance -d db -i db1 -o mount
5. 登录备库检查备库Standby 状态
select database_role ,switchover_status from v$database;
备库状态需要为“TO PRIMARY”
6. 备库Standby 切换为主库并且重启
ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
shutdown immediate
startup
7. 至此主备库已经完成了角色切换
关停当前主库并且启动其他2个节点
shutdown immediate
srvctl start database -d db
状态须为如下
oracle:db1 > srvctl status database -d db
Instance db1 is running on node BJ-ZDJK-04
Instance db2 is running on node BJ-ZDJK-05
Instance db3 is running on node BJ-ZDJK-06
8. 登录目前的备库启动恢复进程
alter database recover managed standby database disconnect;
9. 在当前主库中创建临时表空间
|