共计 4830 个字符,预计需要花费 13 分钟才能阅读完成。
Linux 操作系统中运行 Oracle RAC 10.2.0.4 双节点 (ora1 和 ora2)。ora1 的两块盘损坏导致系统故障,剩下一个 ora2 正常运行并继续对外提供服务。重做完系统后,如何保证在应用不停机的情况下快速恢复 RAC 的两节点环境呢?
方法如下:
1、ora1 重做操作系统(版本、系统参数保持一致);
2、ora1 上配置 Oracle 环境 (ASM、裸设备等);
3、ora1 上创建 Oracle 用户(UID 以及 GID 与 ora2 保持一致)并配置互信访问机制;
4、将 ora2 节点的 Oracle 家目录进行打包并传到 ora1 节点,如下:
12 [root@ora2 ~]# tar -cf u01.tar /u01/app
[root@ora2 ~]# scp u01.tar ora1:/root
5、ora1 上解压 u01.tar 并运行 CRS 的 root.sh 脚本:
运行 root.sh 就会重新将一些配置信息写入的 /etc/init.d 等目录中。OCR 中因为已经有这个节点的资源了,所以会自动显示成功配置。
[root@ora1 /]# tar -xf /root/u01.tar
[root@ora1 /]# cd /u01/app/crs
[root@ora1 crs]# ./root.sh
WARNING: directory ‘/u01/app’ is not owned by root
WARNING: directory ‘/u01’ is not owned by root
Checking to see if Oracle CRS stack is already configured
/etc/oracle does not exist. Creating it now.
Setting the permissions on OCR backup directory
Setting up NS directories
Oracle Cluster Registry configuration upgraded successfully
WARNING: directory ‘/u01/app’ is not owned by root
WARNING: directory ‘/u01’ is not owned by root
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node <nodenumber>: <nodename> <private interconnect name> <hostname>
node 1: ora1 ora1-priv ora1
node 2: ora2 ora2-priv ora2
clscfg: Arguments check out successfully.
NO KEYS WERE WRITTEN. Supply -force parameter to override.
-force is destructive and will destroy any previous cluster
configuration.
Oracle Cluster Registry for cluster has already been initialized
Startup will be queued to init within 30 seconds.
Adding daemons to inittab
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
ora1
ora2
CSS is active on all nodes.
Waiting for the Oracle CRSD and EVMD to start
Oracle CRS stack installed and running under init(1M)
Running vipca(silent) for configuring nodeapps
Creating VIP application resource on (0) nodes.
Creating GSD application resource on (0) nodes.
Creating ONS application resource on (0) nodes.
Starting VIP application resource on (2) nodes…
Starting GSD application resource on (2) nodes
Starting ONS application resource on (2) nodes
DONE.
6、复制 ora2 的 /etc/oratab 至 ora1:
[root@ora2 ~]# ls -l /etc/oratab
-rw-rw-r– 1 oracle root 765 Oct 30 2009 /etc/oratab
[root@ora2 ~]# cat /etc/oratab
………
+ASM2:/u01/app/oracle/product/10.2.0/db_1:N
odb:/u01/app/oracle/product/10.2.0/db_1:N
[root@ora2 ~]# scp /etc/oratab ora1:/etc/
[root@ora1 ~]# chown oracle:root /etc/oratab
// 编辑 /etc/oratab 文件,将里面的 +ASM2 修改为 +ASM1.
[root@ora1 ~]# cat /etc/oratab
………
+ASM1:/u01/app/oracle/product/10.2.0/db_1:N
odb:/u01/app/oracle/product/10.2.0/db_1:N
7、运行 RDBMS 的 root.sh 脚本:
[root@ora1 ~]# cd /u01/app/oracle/product/10.2.0/db_1/
[root@ora1 db_1]# ./root.sh
Running Oracle10 root.sh script…
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/10.2.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin …
Copying oraenv to /usr/local/bin …
Copying coraenv to /usr/local/bin …
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
8、修改 $ORACLE_HOME/network/admin/listener.ora 文件,将 ora2 的相关信息替换为 ora1 的。另外,监听名称不再是默认的 listener 了,而是 listener_ora1。
9、创建 $ORACLE_HOME/dbs/ 下的 spfile 以及密码文件。
[oracle@ora1 ~]$ cd $ORACLE_HOME/dbs
[oracle@ora1 dbs]$ cp initodb2.ora initodb1.ora
[oracle@ora1 dbs]$ cp init+ASM2.ora init+ASM1.ora
[oracle@ora1 dbs]$ cp orapw+ASM2 orapw+ASM1
[oracle@ora1 dbs]$ cp orapwodb2 orapwodb1
10、启动所有 rac 资源:
[oracle@ora1 ~]$ crs_start -all
Attempting to start `ora.odb.odb_taf.odb1.srv` on member `ora1`
Attempting to start `ora.ora1.LISTENER_ORA1.lsnr` on member `ora1`
Start of `ora.odb.odb_taf.odb1.srv` on member `ora1` succeeded.
Start of `ora.ora1.LISTENER_ORA1.lsnr` on member `ora1` succeeded.
[oracle@ora1 ~]$ crs_stat -t -v
Name Type R/RA F/FT Target State Host
———————————————————————-
ora.odb.db application 0/0 0/1 ONLINE ONLINE ora2
ora….b1.inst application 0/5 0/0 ONLINE ONLINE ora1
ora….b2.inst application 0/5 0/0 ONLINE ONLINE ora2
ora…._taf.cs application 0/0 0/1 ONLINE ONLINE ora1
ora….db1.srv application 0/0 0/0 ONLINE ONLINE ora1
ora….db2.srv application 0/0 0/0 ONLINE ONLINE ora2
ora….SM1.asm application 0/5 0/0 ONLINE ONLINE ora1
ora….A1.lsnr application 0/5 0/0 ONLINE ONLINE ora1
ora.ora1.gsd application 0/5 0/0 ONLINE ONLINE ora1
ora.ora1.ons application 0/3 0/0 ONLINE ONLINE ora1
ora.ora1.vip application 0/0 0/0 ONLINE ONLINE ora1
ora….SM2.asm application 0/5 0/0 ONLINE ONLINE ora2
ora….A2.lsnr application 0/5 0/0 ONLINE ONLINE ora2
ora.ora2.gsd application 0/5 0/0 ONLINE ONLINE ora2
ora.ora2.ons application 0/3 0/0 ONLINE ONLINE ora2
ora.ora2.vip application 0/0 0/0 ONLINE ONLINE ora2
到此,ora1 已成功添加进 RAC 环境。
更多 Oracle 相关信息见 Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12
本文永久更新链接地址 :http://www.linuxidc.com/Linux/2016-06/132688.htm