跳转到内容

RAC 攻击 - Oracle 集群数据库在家/安装 Instant Client

来自 Wikibooks,开放世界开放书籍


为了测试故障转移,最好从集群外部的客户端连接,因此我们将从下载和安装 Oracle 的基本 Instant Client(仅限英语)和 Instant Client SQLPlus 包开始。



  1. 登录到节点 collabn1 作为用户 oracle,并打开到数据库的连接作为 SYSDBA,并解锁 SH 用户帐户。还授予 DBA 访问权限。SQL> alter user sh identified by sh account unlock; 用户已更改。SQL> grant dba to sh; 授权成功。
  2. 下载 Oracle 的基本(仅限英语)Instant Client 和 Oracle 的 Instant Client SQLPlus 包。实验室指导老师可能已提供这些包,或者也可以从 Oracle 的网站下载:http://www.oracle.com/technetwork/topics/winsoft-085727.html 您需要的两个文件是
    • instantclient-basiclite-*.zip
    • instantclient-sqlplus-*.zip
  3. 每个存档都包含一个名为“instantclient_11_2”的文件夹。将此文件夹(来自两个存档)提取到 C:\。(在资源管理器中,您可以拖放或从文件菜单中选择“全部提取”。)
  4. 编辑 c:\windows\system32\drivers\etc\hosts 并添加 RAC 节点的 IP 地址。
    192.168.78.250	collab-scan.vm.ardentperf.com collab-scan
    192.168.78.61	collabn1-vip.vm.ardentperf.com collabn1-vip
    192.168.78.62	collabn2-vip.vm.ardentperf.com collabn2-vip
    192.168.78.51	collabn1.vm.ardentperf.com collabn1
    192.168.78.52	collabn2.vm.ardentperf.com collabn2
    


  5. 通过连接到数据库测试您的 Instant Client 安装。C:\instantclient_11_2> sqlplus sh/sh@//collab-scan/RAC.vm.ardentperf.com


  6. 创建一个 TNSNAMES 文件,并从任何集群数据库节点复制 RAC、RAC1 和 RAC2 条目。C:\instantclient_11_2> notepad C:\instantclient_11_2\tnsnames.ora RAC = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = collab-scan)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = RAC.vm.ardentperf.com) ) ) RAC2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = collabn-scan)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = RAC.vm.ardentperf.com) (INSTANCE_NAME = RAC2) ) ) RAC1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = collabn-scan)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = RAC.vm.ardentperf.com) (INSTANCE_NAME = RAC1) ) )
  7. 通过设置 TNS_ADMIN 环境变量并运行 SQLPLUS 测试您的 TNSNAMES。C:\instantclient_11_2>set TNS_ADMIN=c:\instantclient_11_2 C:\instantclient_11_2>sqlplus sh/sh@RAC



华夏公益教科书