RAC Attack - Oracle Cluster Database at Home/RAC Attack 12c/Configure Oracle Client

From Wikibooks, open books for an open world
Jump to navigation Jump to search


In order to test failover it would be best to connect from a client outside the cluster, so we'll start by downloading and installing Oracle's Basic Instant Client (English-only) and the Instant Client SQLPlus package. Then we'll configure the DNS resolution and the local TNS naming to use the SCAN addresses.



  1. Download Oracle's Basic (English-only) Instant Client and Oracle's Instant Client SQLPlus package from Oracle's website here:
  2. http://www.oracle.com/technetwork/topics/winx64soft-089540.html


    The two files you need are:

    • instantclient-basiclite-windows.x64-12.1.0.1.0.zip
    • instantclient-sqlplus-windows.x64-12.1.0.1.0.zip
  3. Each archive contains a folder named "instantclient_12_1". Extract this folder (from both archives) into C:\. (In Explorer you can drag-and-drop or you can choose "Extract All" from the File menu.)
  4. Open the Windows Network Settings (Control Panel -> Network and Internet -> Network and Sharing Center.
  5. Click on VirtualBox Host-Only Network RA-Windows_7-Network Settings
  6. Click on Properties
  7. RA-Windows_7-Network Status
  8. Select Internet Protocol Version 4 (TCP/IPv4) and click Properties.
  9. RA-Windows_7-Network Properties
  10. Select Use the following DNS server addresses: and enter the addresses of the two virtual machines:
    • Preferred DNS server: 192.178.78.51
    • Alternate DNS server: 192.178.78.52
    Click on Advanced... RA-Windows_7-Network IPV4 Properties
  11. Select the DNS tab. Select Append these DNS suffixes (in order):, click Add... and enter racattack in the Domain suffix field that appears. Click Add.
  12. Check both Register the connection's addresses in DNS and Use this connection's DNS suffix in DNS registration. Click OK and/or Close until you exit from the Network configuration. RA-Windows_7-Network IPV4 Advanced Properties
  13. Open a Command prompt and check that the DNS resolution is working properly on your laptop:
  14. C:\Users\luc> nslookup - 192.168.78.51 Default Server: collabn1.racattack Address: 192.168.78.51 > collabn-cluster-scan Server: collabn1.racattack Address: 192.168.78.51 Name: collabn-cluster-scan.racattack Addresses: 192.168.78.252 192.168.78.253 192.168.78.251 > ^C C:\Users\luc> RA-Windows_7-Nslookup Scan
  15. Test your Instant Client installation by connecting to the database.
  16. C:\instantclient_12_1> sqlplus system/racattack@//collabn-cluster-scan/RAC.racattack SQL*Plus: Release 12.1.0.1.0 Production on Wed Aug 14 13:34:24 2013 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options SQL> select instance_name from v$instance; INSTANCE_NAME ---------------- RAC1 SQL>
  17. Let's open and test our Pluggable Database PDB (it isn't opened by default).
  18. SQL> connect sys/racattack@//collabn-cluster-scan/RAC.racattack as sysdba Connected. SQL> alter pluggable database PDB open; Pluggable database altered. SQL> connect system/racattack@//collabn-cluster-scan/PDB.racattack Connected. SQL> show con_name CON_NAME ------------------------------ PDB SQL>
  19. Create a TNSNAMES files and copy the RAC entry from either cluster database node. Also create a similar entry for the PDB service.
  20. C:\instantclient_12_1> notepad C:\instantclient_12_1\tnsnames.ora RAC = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = collabn-cluster-scan.racattack)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = RAC.racattack) ) ) PDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = collabn-cluster-scan.racattack)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PDB.racattack) ) )
  21. Test your TNSNAMES by setting the TNS_ADMIN environment variable and running SQLPLUS.
  22. C:\instantclient_12_1> set TNS_ADMIN=c:\instantclient_12_1 C:\instantclient_12_1> sqlplus system/racattack@RAC SQL*Plus: Release 12.1.0.1.0 Production on Wed Aug 14 14:21:24 2013 Copyright (c) 1982, 2013, Oracle. All rights reserved. Last Successful login time: Wed Aug 14 2013 14:20:59 +02:00 Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options SQL> connect system/racattack@PDB Connected. SQL>