探索 Oracle 10g RAC 数据库环境

RAC安装参考点击打开链接

rac1上执行

rac1-> sqlplus sys/test1234@devdb1 as sysdba


SQL*Plus: Release 10.2.0.4.0 - Production on Sun Jul 20 17:04:01 2014


Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.




Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options


SQL> show parameter service


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      CRM, devdb




rac2上执行
rac2-> sqlplus sys/test1234@devdb2 as sysdba


SQL*Plus: Release 10.2.0.4.0 - Production on Sun Jul 20 17:04:59 2014


Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.




Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options


SQL> show parameter service;


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      devdb








在rac1上用CRM服务连接:
rac1-> sqlplus sys/test1234@crm as sysdba


SQL*Plus: Release 10.2.0.4.0 - Production on Sun Jul 20 17:08:15 2014


Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.




Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options


SQL> select instance_number instance#,instance_name,host_name,status from v$instance;


 INSTANCE# INSTANCE_NAME
---------- ----------------
HOST_NAME                                                        STATUS
---------------------------------------------------------------- ------------
         1 devdb1
rac1                                                             OPEN




SQL> select failover_type,failover_method,failed_over from v$session where username='SYS';


FAILOVER_TYPE FAILOVER_M FAI
------------- ---------- ---
SELECT        BASIC       NO
NONE          NONE       NO
NONE          NONE       NO
NONE          NONE       NO
NONE          NONE       NO
NONE          NONE       NO


6 rows selected.


新打开一个putty,从其他会话中关闭该实例。在CRM所在的实例上以 sys 用户身份连接,并关闭该实例。
rac1-> export ORACLE_SID=devdb1
rac1-> sqlplus / as sysdba


SQL*Plus: Release 10.2.0.4.0 - Production on Sun Jul 20 17:19:20 2014


Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.




Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options


SQL> select instance_number instance#,instance_name,host_name,status from v$instance;


 INSTANCE# INSTANCE_NAME
---------- ----------------
HOST_NAME                                                        STATUS
---------------------------------------------------------------- ------------
         1 devdb1
rac1                                                             OPEN




SQL> shutdown abort;
ORACLE instance shut down.


验证会话已经完成故障切换:从先前打开的CRM 会话执行以下查询,以验证该会话已经故障切换到其他实例。
SQL> select instance_number instance#,instance_name,host_name,status from v$instance;


 INSTANCE# INSTANCE_NAME
---------- ----------------
HOST_NAME                                                        STATUS
---------------------------------------------------------------- ------------
         2 devdb2
rac2                                                             OPEN




SQL> select failover_type,failover_method,failed_over from v$session where username='SYS';


FAILOVER_TYPE FAILOVER_M FAI
------------- ---------- ---
NONE          NONE       NO
SELECT        BASIC       YES
NONE          NONE       NO
NONE          NONE       NO
NONE          NONE       NO
NONE          NONE       NO


6 rows selected.


将 CRM 服务重新定位到首选实例。恢复 devdb1 之后,CRM 服务不会自动重新定位到首选实例。您必须手动将服务重新定位到 devdb1。
rac1-> export ORACLE_SID=devdb1
rac1-> sqlplus / as sysdba


SQL*Plus: Release 10.2.0.4.0 - Production on Sun Jul 20 17:24:54 2014


Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to an idle instance.


SQL> startup;
ORACLE instance started.


Total System Global Area  272629760 bytes
Fixed Size                  1266996 bytes
Variable Size              96471756 bytes
Database Buffers          171966464 bytes
Redo Buffers                2924544 bytes
Database mounted.
Database opened.
SQL> show parameter service;


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      devdb
在rac2上执行
rac2-> export ORACLE_SID=devdb2
rac2-> sqlplus / as sysdba


SQL*Plus: Release 10.2.0.4.0 - Production on Sun Jul 20 17:31:50 2014


Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.




Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options


SQL> show parameter service;


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      CRM, devdb
SQL>


在rac1上手工切换
rac1-> srvctl relocate service -d devdb -s crm -i devdb2 -t devdb1
rac1-> sqlplus / as sysdba


SQL*Plus: Release 10.2.0.4.0 - Production on Sun Jul 20 17:35:28 2014


Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.




Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options


SQL> show parameter service;


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      CRM
SQL> alter system set service_names='CRM,devdb' scope=both sid='devdb1';


System altered.


SQL> show parameter service;


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      CRM,devdb




(刚开始为啥只有CRM,没有devdb,还有待于研究。所以我在这里是手工修改了service_names参数)


在rac2上执行:
rac2-> sqlplus / as sysdba


SQL*Plus: Release 10.2.0.4.0 - Production on Sun Jul 20 17:39:03 2014


Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.




Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options


SQL> show parameter service;


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      devdb
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值