This documentation is for WSO2 CEP 3.1.0. View the home page of the latest release.

Unknown macro: {next_previous_links}
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Oracle Real Application Clusters (RAC) is an option for the Oracle Database for clustering and high availability in Oracle database environments. In the Oracle RAC environment, some of the commands used in oracle.sql are considered inefficient. Therefore, the product has a separate SQL script oracle_rac.sql for Oracle RAC. The Oracle RAC-friendly script is located in the dbscripts folder together with other .sql scripts.

To test products on Oracle RAC, rename oracle_rac.sql to oracle.sql before running -Dsetup.

The following sections describe how to replace the default H2 databases with Oracle RAC:

Creating the database

Follow the steps below to set up an Oracle RAC database:

Setting up the database user

  1. Set environment variables <ORACLE_HOME>, PATH, and ORACLE_SID with the corresponding values /oracle/app/oracle/product/11.2.0/dbhome_1, $PATH:<ORACLE_HOME>/bin, and orcl1 as follows:
  2. Connect to Oracle using SQL*Plus as SYSDBA.
  3. Create a database user and grant privileges to the user as shown below:

    Create user USER_NAME identified by PASSWORD account unlock;
    grant connect to USER_NAME;
    grant create session, dba to USER_NAME;
    commit;
  4. Exit from the SQL*Plus session by executing the quit command.

Copying the JDBC driver

Copy the Oracle JDBC libraries (for example, the <ORACLE_HOME>/jdbc/lib/ojdbc14.jar file) to the <PRODUCT_HOME>/repository/components/lib/ directory. 

Remove the old database driver from the <PRODUCT_HOME>/repository/components/dropins/ directory when you upgrade the database driver.

Creating the database tables

Create the database tables either manually by running a script or automatically by using a startup parameter as described below.

Using a script

You can create database tables manually by logging in to the created database and executing the following script in SQL*Plus:

  1. Use the scripts given in the following locations to change the respective database and then restart the server.

    • To create tables for the registry and user manager database, run the below command:

      SQL> @$<PRODUCT_HOME>/dbscripts/oracle.sql
    • To create tables for the  identity databases , run the below command:

      SQL> @$<PRODUCT_HOME>/dbscripts/identity/oracle.sql
    • To create tables for the  storage databases , run the below command:

      SQL> @$<PRODUCT_HOME>/dbscripts/storage/oracle.sql
  2. Start the product as follows:
    $ ./${PRODUCT_HOME}/bin/wso2server.sh
Using a startup parameter

You can create database tables automatically when starting the product for the first time by using the -Dsetup parameter as follows:

When starting the product for the first time, use the following commands to create the database tables:

  • For Windows users:
    $PRODUCT_HOME/bin/wso2server.bat -Dsetup
  • For Linux Users
    $ ./${PRODUCT_HOME}/bin/wso2server.sh -Dsetup

Creating a datasource for the database

After creating the database, you create a datasource to point to it in the following files:

  1. Edit the default database configuration defined in the  master-datasources.xml file located in the <PRODUCT_HOME>/repository/conf/datasources/ directory as follows. The database configurations in both registry.xml and user-mgt.xml refer to this data source.

    Replace these settings with your own custom values:

    <datasource>
         <name>WSO2_CARBON_DB</name>
         <description>The datasource used for registry and user manager</description>
         <jndiConfig>
              <name>jdbc/WSO2CarbonDB</name>
         </jndiConfig>
         <definition type="RDBMS">
              <configuration>
                <url>jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)
       			       (ADDRESS=(PROTOCOL=TCP)(HOST=racnode1) (PORT=1521))
       			       (ADDRESS=(PROTOCOL=TCP)(HOST=racnode2) (PORT=1521))
       			       (CONNECT_DATA=(SERVICE_NAME=rac)))</url>
                <username>regadmin</username>
                <password>regadmin</password>
                <driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>
                <maxActive>80</maxActive>
                <maxWait>60000</maxWait>
                <minIdle>5</minIdle>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1 FROM DUAL</validationQuery>
                <validationInterval>30000</validationInterval>
              </configuration>
         </definition>
    </datasource>

    The database configuration options

    • url - The URL of the database.
    • username - The name of the database user.
    • password - The password of the database user.
    • driverClassName  - The class name of the database driver.
    • maxActive - The maximum number of active connections that can be allocated from this pool at the same time, or enter a negative value for no limit.
    • maxWait - The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception. You can enter zero or a negative value to wait indefinitely.
    • minIdle - The minimum number of active connections that can remain idle in the pool without extra ones being created, or enter zero to create none.
    • testOnBorrow - Whether objects will be validated before being borrowed from the pool. If the object fails to validate, it will be dropped from the pool, and another attempt will be made to borrow another. 
    • validationQuery - The SQL query that will be used to validate connections from this pool before returning them to the caller.
    • validationInterval - Whether to avoid excess validation and only run validation at this frequency (time in milliseconds) at most. If a connection is due for validation, but it has been validated previously within this interval, it will not be validated again. 

      For more information on other parameters that can be defined in the master-datasources.xml file, see Tomcat JDBC Connection Pool.

  2. If you changed the databases used for identity and storage , copy the WSO2_CARBON_DB datasource configuration for each of them in < PRODUCT_HOME>/repository/conf/datasources/master-datasources.xml file and replace its default values with your custom values.
  3. Replace the default values in the datasource configurations of the following files with your custom values accordingly, to point to the created registry and user manager, identity and storage databases.

    • <PRODUCT_HOME>/repository/conf/identity.xml
    • <PRODUCT_HOME>/repository/conf/user-mgt.xml
    • <PRODUCT_HOME>/repository/conf/registry.xml
  • No labels