Showing posts with label Oracle Database. Show all posts
Showing posts with label Oracle Database. Show all posts

Friday, April 22, 2011

TIBCO EMS FT pair on Oracle Database 11gR2 shared storage

Related article: Read this also

In the previous article I wrote about setting up a TIBCO EMS fault tolerant pair that uses NFSv4 shared folder to store shared states. This article describes the step to set up a database-based shared state datastore.

The end-state is depicted in the following deployment diagram.


This is a 2-in-1 article. One part is to set up the required conf files and set up the Oracle Database 11gR2 for as datastore. The other part is to configure 2 separate tibemsd for the FT pairs.

1) Install hibernate package on the host machine
2) Configure tibemsd-db.conf
3) Configure stores-db.conf
4) Create EMS schema using export tool
5) Test it!

1) Install hibernate package

I will use hibernate 3.2.5 from the package hibernate_3.2.5_linux24gl23_x86.zip

1.1 Unzip the package into you temp folder.
1.2 run TIBCOUniversalInstaller-lnx-x86.bin as tibadmin, created earlier in this article.
1.3 Follow the steps in the screens below.

2) Configure tibemsd-db.conf

tibemsd-db.conf is a sample file located in $EMS_HOME/tibco/ems/5.1/sample/config folder. Copy this file from $EMS_HOME/tibco/ems/5.1/sample/config into your shared state directory.

Edit the tibemsd-db.conf and modify the following lines.

users                   = /home/tibadmin/ems_ft_cfg/users.conf
groups                  = /home/tibadmin/ems_ft_cfg/groups.conf
topics                  = /home/tibadmin/ems_ft_cfg/topics.conf
queues                  = /home/tibadmin/ems_ft_cfg/queues.conf
acl_list                = /home/tibadmin/ems_ft_cfg/acl.conf
factories               = /home/tibadmin/ems_ft_cfg/factories.conf
routes                  = /home/tibadmin/ems_ft_cfg/routes.conf
bridges                 = /home/tibadmin/ems_ft_cfg/bridges.conf
transports              = /home/tibadmin/ems_ft_cfg/transports.conf
tibrvcm                 = /home/tibadmin/ems_ft_cfg/tibrvcm.conf
durables                = /home/tibadmin/ems_ft_cfg/durables.conf
channels                = /home/tibadmin/ems_ft_cfg/channels.conf
stores                  = /home/tibadmin/ems_ft_cfg/stores-db.conf

dbstore_classpath       = /home/tibadmin/tibco/components/eclipse/plugins/com.tibco.tpcl.org.hibernate_3.2.5.001/hibernate3.jar:/home/tibadmin/tibco/components/eclipse/plugins/com.tibco.tpcl.org.com.mchange.c3p0_0.9.1.001/c3p0-0.9.1.jar:/home/tibadmin/tibco/ems/5.1/bin/antlr-2.7.6.jar:/home/tibadmin/tibco/ems/5.1/bin/asm-attrs.jar:/home/tibadmin/tibco/ems/5.1/bin/asm.jar:/home/tibadmin/tibco/ems/5.1/bin/cglib-2.1.3.jar:/home/tibadmin/tibco/ems/5.1/bin/commons-collections-2.1.1.jar:/home/tibadmin/tibco/ems/5.1/bin/commons-logging-1.0.4.jar:/home/tibadmin/tibco/ems/5.1/bin/dom4j-1.6.1.jar:/home/tibadmin/tibco/ems/5.1/bin/ehcache-1.2.3.jar:/home/tibadmin/tibco/ems/5.1/bin/jta.jar:/home/tibadmin/tibco/ems/5.1/lib/ojdbc5.jar

dbstore_driver_name     = oracle.jdbc.driver.OracleDriver
dbstore_driver_dialect  = org.hibernate.dialect.Oracle10gDialect
jre_library             = /opt/java/jre/lib/i386/server/libjvm.so
jre_option   = -Xmx256m

3) Configure stores-db.conf

stores-db.conf is a sample stores.conf file located in $EMS_HOME/tibco/ems/5.1/sample/config folder. Copy this file from $EMS_HOME/tibco/ems/5.1/sample/config into your shared state directory.

[$sys.failsafe]
type=dbstore
dbstore_driver_url=jdbc:oracle:thin:emsfs/emsfs@//oradb11g01:1521/orcl
dbstore_driver_username=emsfs
dbstore_driver_password=emsfs

[$sys.meta]
type=dbstore
dbstore_driver_url=jdbc:oracle:thin:emsmeta/emsmeta@//oradb11g01:1521/orcl
dbstore_driver_username=emsmeta
dbstore_driver_password=emsmeta

#store the non failsafe message in NFS drive.
[$sys.nonfailsafe]
  type=file
  file=/home/tibadmin/ems_ft_cfg/datastore/async-msgs.db
  mode=async
  file_crc=disabled


4) Create EMS schema using export tool

TIBCO EMS comes with a tool to create the required database schema for shared states and message storage.

Before you use the tool, ensure the TIBCO EMS host has the required database connectivity. Though you only need the Oracle JDBC java library (ojdbc5.jar) to be in the classpath, I suggest that you install the entire package of Oracle Instant Client for Linux (instantclient-basic-linux32-11.2.0.2.0.zip).

Next, create an oracle db user for each EMS data store of type dbstore.

for meta dbstore
GRANT CONNECT,RESOURCE,UNLIMITED TABLESPACE TO emsmeta IDENTIFIED BY emsmeta;

ALTER USER emsmeta DEFAULT TABLESPACE USERS;

ALTER USER emsmeta TEMPORARY TABLESPACE TEMP;

for failsafe dbstore

GRANT CONNECT,RESOURCE,UNLIMITED TABLESPACE TO emsfs IDENTIFIED BY emsfs ;

ALTER USER emsfs DEFAULT TABLESPACE USERS;

ALTER USER emsfs TEMPORARY TABLESPACE TEMP;

Note: The userid and password must be same is the one specified in the store-db.conf file in step 3.

After you have created the EMS oracle user, execute the tibemsd_util.jar as follow. The util is located under $EMS_HOME/bin where EMS_HOME is /home/tibadmin/tibco/ems/5.1 in my case.

java -jar tibemsd_util.jar -tibemsdconf /home/tibadmin/ems_ft_cfg/tibemsd-db1.conf -createall -export

You should see the following output on the stdout.

drop table ACK_RECS cascade constraints
drop table CONNECTION_RECS cascade constraints
drop table CONSUMER_RECS cascade constraints
drop table CONSUMER_RECS_IMPSELMAP cascade constraints
drop table EMS_HBLOCK_TABLE cascade constraints
drop table EMS_MESSAGES cascade constraints
drop table EMS_SYS_RECORDS_TABLE cascade constraints
drop table PRODUCER_RECS cascade constraints
drop table PURGE_RECS cascade constraints
drop table SESSION_RECS cascade constraints
drop table TXN_RECS cascade constraints
drop table VALID_MSGS_RECORD cascade constraints
drop table VALID_MSGS_RECORD_HELDMSGS cascade constraints
drop table VALID_MSGS_RECORD_HOLDMSGS cascade constraints
drop table VALID_MSGS_RECORD_NOHOLDMSGS cascade constraints
drop table ZONE_RECS cascade constraints
drop sequence hibernate_sequence
create table ACK_RECS (ACK_RECORD_ID number(19,0) not null, CONSUMER_ID number(19,0), SEQNO number(19,0), DISCARD_ACK_FLAG number(1,0), TXN_ID number(19,0), SESS_ID number(19,0), CONN_ID number(19,0), primary key (ACK_RECORD_ID))
create table CONNECTION_RECS (STORE_ID number(19,0) not null, CONNECTION_ID number(19,0), CONNECTION_TYPE number(10,0), CLIENT_ID varchar2(256 char), CONNECTION_USER varchar2(256 char), NEW_TEMP_DESTS_FLAG number(1,0), primary key (STORE_ID))
create table CONSUMER_RECS (STORE_ID number(19,0) not null, CONSUMER_ID number(19,0), SESSION_ID number(19,0), CONNECTION_ID number(19,0), DURABLE_NAME varchar2(255 char), SUBSCRIPTION_NAME varchar2(255 char), CLIENT_ID varchar2(255 char), ZONE_ID number(10,0), SELECTOR_STRING varchar2(4000 char), SELECTOR_BYTES long raw, NO_LOCAL number(1,0), CONNECTION_CONSUMER number(1,0), DESTINATION varchar2(255 char), DEST_TYPE number(3,0), CONSUMER_MSG_SEQNO number(19,0), MULTICAST_FLAG number(1,0), primary key (STORE_ID))
create table CONSUMER_RECS_IMPSELMAP (StoreId number(19,0) not null, HASHMAP_VALUE varchar2(255 char), HASHMAP_KEY varchar2(255 char) not null, primary key (StoreId, HASHMAP_KEY))
create table EMS_HBLOCK_TABLE (id number(19,0) not null, last_update timestamp not null, server_id varchar2(255 char) not null, JDBCURL varchar2(4000 char) not null, primary key (id))
create table EMS_MESSAGES (STORE_ID number(19,0) not null, MESSAGE_SEQNO number(19,0), TYPE number(3,0), PRIORITY number(3,0), DELIVERYMODE number(3,0), REDELIVERED number(3,0), DESTINATION varchar2(255 char), DESTINATION_TYPE number(3,0), EXPIRATION number(19,0), TIMESTAMP number(19,0), REPLYTO varchar2(255 char), REPLYTO_TYPE number(3,0), USERTYPE varchar2(255 char), MSGID varchar2(255 char), CORRELATIONID varchar2(255 char), COMPRESSED number(1,0), CLIENTFLAGS number(19,0), ENCODING varchar2(255 char), ENCODED_PROPERTIES raw(1024), ENCODED_SUPPRESS_CONSIDS raw(1024), TXNID number(19,0), ZONEID number(19,0), ROUTESRC varchar2(255 char), ROUTESEQNO number(19,0), ROUTECONSID number(19,0), PRODUCERID number(19,0), DELETED number(1,0) not null, MESSAGE_SIZE number(19,0), SMALL_MESSAGE_BODY raw(1024), LARGE_MESSAGE_BODY blob, primary key (STORE_ID))
create table EMS_SYS_RECORDS_TABLE (SYSTEM_REC_ID number(19,0) not null, VERSION varchar2(255 char), EMS_START_TIME varchar2(255 char), EMS_UPDATE_TIME varchar2(255 char), primary key (SYSTEM_REC_ID))
create table PRODUCER_RECS (STORE_ID number(19,0) not null, PRODUCER_ID number(19,0), SESSION_ID number(19,0), CONNECTION_ID number(19,0), DESTINATION varchar2(255 char), DEST_TYPE number(3,0), primary key (STORE_ID))
create table PURGE_RECS (PURGE_RECORD_ID number(19,0) not null, DEST_NAME varchar2(255 char), DEST_TYPE number(3,0), SEQ_NO number(19,0), primary key (PURGE_RECORD_ID))
create table SESSION_RECS (STORE_ID number(19,0) not null, SESSION_ID number(19,0), CONNECTION_ID number(19,0), ACKNOWLEDGE_MODE number(10,0), TRANSACTED number(1,0), IS_XA number(1,0), MSGID_PREFIX varchar2(255 char), primary key (STORE_ID))
create table TXN_RECS (TXNREC_STORE_ID number(19,0) not null, SESS_ID number(19,0), TXN_ID number(19,0), RECORD_ID number(19,0), TXN_STATE number(10,0), XID raw(1024), primary key (TXNREC_STORE_ID))
create table VALID_MSGS_RECORD (VALID_MSG_RECORD_ID number(19,0) not null, ACTIVE_HI_SEQ number(19,0), SMALL_MESSAGE_BODY raw(1024), LARGE_MESSAGE_BODY blob, primary key (VALID_MSG_RECORD_ID))
create table VALID_MSGS_RECORD_HELDMSGS (id number(19,0) not null, HELD_MSGS number(19,0), listIndex number(10,0) not null, primary key (id, listIndex))
create table VALID_MSGS_RECORD_HOLDMSGS (id number(19,0) not null, HOLD_MSGS number(19,0), listIndex number(10,0) not null, primary key (id, listIndex))
create table VALID_MSGS_RECORD_NOHOLDMSGS (id number(19,0) not null, NO_HOLD_MSGS number(19,0), listIndex number(10,0) not null, primary key (id, listIndex))
create table ZONE_RECS (STORE_ID number(19,0) not null, ZONE_ID number(10,0), ZONE_NAME varchar2(255 char), ZONE_TYPE number(5,0), primary key (STORE_ID))
alter table CONSUMER_RECS_IMPSELMAP add constraint FKD1B84D7B3B9C4484 foreign key (StoreId) references CONSUMER_RECS
create index DEL_IDX on EMS_MESSAGES (DELETED)
alter table VALID_MSGS_RECORD_HELDMSGS add constraint FK5908794BC44ABBE5 foreign key (id) references VALID_MSGS_RECORD
alter table VALID_MSGS_RECORD_HOLDMSGS add constraint FK6A06C9D5C44ABBE5 foreign key (id) references VALID_MSGS_RECORD
alter table VALID_MSGS_RECORD_NOHOLDMSGS add constraint FK610EB196C44ABBE5 foreign key (id) references VALID_MSGS_RECORD
create sequence hibernate_sequence

Note: For some reasons the required tables are not created in database, probably due to missing/incorrect configuration of hibernate ddl properties.

Anyway, I have converted the output above into a sql script and simply run them with sqlplus.

[oradb11g01 $] sqlplus emsmeta/emsmeta @meta.sql
[oradb11g01 $] sqlplus emsfs/emsfs @fs.sql

This following paragraphs describe the step to setting up a FT pair.

Make 2 copies of the tibemsd-db.conf files made in step 1. Call them tibemsd-db1.conf and tibemsd-db2.conf respectively.

In both files, make sure the stores parameter points to the same conf file.

stores                  = /home/tibadmin/ems_ft_cfg/stores-db.conf

In each files, do the following:

tibemsd-db1.conf

listen = tcp://tibems01:7222
ft_active = tcp://tibems02:7222

tibemsd-db2.conf

listen = tcp://tibems02:7222
ft_active = tcp://tibems01:7222

The config file referencing can be visualised in the following picture.


Start EMS on both servers using tibemsd-db1.conf and tibemsd-db2.conf, in any sequence. The EMS FT pair on Oracle Database 11g R2 are now operational.

tibadmin@tibems02:~/ems_ft_cfg$ startEMS-db.sh 

TIBCO Enterprise Message Service.
Copyright 2003-2010 by TIBCO Software Inc.
All rights reserved.

Version 5.1.5 V3 3/29/2010

2011-04-19 06:02:33.785 Process started from '/home/tibadmin/tibco/ems/5.1/bin/tibemsd'.
2011-04-19 06:02:33.785 Process Id: 1629
2011-04-19 06:02:33.786 Hostname: tibems02
2011-04-19 06:02:33.786 Hostname IP address: 172.16.10.11
2011-04-19 06:02:33.786 Detected IP interface: 127.0.0.1 (lo)
2011-04-19 06:02:33.786 Detected IP interface: 172.16.10.11 (eth0)
2011-04-19 06:02:33.786 Detected IP interface: 192.168.50.11 (eth1)
2011-04-19 06:02:33.786 Reading configuration from '/home/tibadmin/ems_ft_cfg/tibemsd-db2.conf'.
2011-04-19 06:02:34.891 Java Version 1.6.0_24
2011-04-19 06:02:34.904 Server name: 'EMS-SERVER'.
2011-04-19 06:02:34.904 Storage Location: '.'.
2011-04-19 06:02:34.904 Routing is disabled.
2011-04-19 06:02:34.904 Authorization is disabled.
2011-04-19 06:02:37.451 Active server 'tcp://tibems01:7222' not found.
2011-04-19 06:02:37.451 Continuing as active server.
2011-04-19 06:02:37.456 Accepting connections on tcp://tibems02:7222.
2011-04-19 06:02:37.456 Recovering state, please wait.
2011-04-19 06:04:13.561 Store '$sys.failsafe' locked by 'EMS-SERVER'
2011-04-19 06:04:13.561 Creating system record for store '$sys.failsafe' ...
2011-04-19 06:04:13.660 Store '$sys.meta' locked by 'EMS-SERVER'
2011-04-19 06:04:13.660 Creating system record for store '$sys.meta' ...
2011-04-19 06:04:14.342 Server is active.
2011-04-19 06:06:00.481 Backup server 'EMS-SERVER@tibems01' has connected.

tibadmin@tibems01:~/ems_ft_cfg$ startEMS-db.sh 

TIBCO Enterprise Message Service.
Copyright 2003-2010 by TIBCO Software Inc.
All rights reserved.

Version 5.1.5 V3 3/29/2010

2011-04-19 06:05:58.102 Process started from '/home/tibadmin/tibco/ems/5.1/bin/tibemsd'.
2011-04-19 06:05:58.103 Process Id: 10071
2011-04-19 06:05:58.103 Hostname: tibems01
2011-04-19 06:05:58.103 Hostname IP address: 172.16.10.10
2011-04-19 06:05:58.103 Detected IP interface: 127.0.0.1 (lo)
2011-04-19 06:05:58.103 Detected IP interface: 172.16.10.10 (eth0)
2011-04-19 06:05:58.103 Detected IP interface: 192.168.50.10 (eth1)
2011-04-19 06:05:58.103 Reading configuration from '/home/tibadmin/ems_ft_cfg/tibemsd-db1.conf'.
2011-04-19 06:05:58.410 Java Version 1.6.0_24
2011-04-19 06:05:58.419 Server name: 'EMS-SERVER'.
2011-04-19 06:05:58.419 Storage Location: '.'.
2011-04-19 06:05:58.419 Routing is disabled.
2011-04-19 06:05:58.420 Authorization is disabled.
2011-04-19 06:06:00.401 Accepting connections on tcp://tibems01:7222.
2011-04-19 06:06:00.401 Server is in standby mode for 'tcp://tibems02:7222'.

Lastly, I have a Gigabit connection between the EMS host and the DB host, so I will just let the shared state traffic to pass through my MSG_VLAN. For detail of the Laboratory network topology, refer to this article.

Cheers,

Friday, April 1, 2011

Oracle Service Bus (11.1.1.4.0) on Ubuntu 10.10, deployment into ESXi Virtual Infrastructure

In our previous article, we installed Oracle SOA Suite PS3 into a host on a Virtual Infrastructure.

This article discusses the installation of Oracle Service Bus 11.1.1.4.0 into the same middleware home of the SOA Suite. This is possible because Oracle has released OSB 11g as a component of SOA Suite of products. OSB 11g PS3 and SOA Suite 11g PS3 shares the same Oracle Weblogic Server version, 10.3.4.

Pre-requisite:
- Minimum swap space = 512MB. Instructions to add file-based swap space is available here.
- Java Runtime Environment. Reuse the one from previous installation of Oracle Service Bus
- NFS mount to the existing Oracle installation file system.
- oracle user account and oinstall group are created on the target host. Ensure identical uid and gid (in this case, 500 and 1001 respectively)

Required binary
- ofm_osb_generic_11.1.1.4.0_disk1_1of1.zip downloadable from Oracle website.

Installation Steps:
- unzip downloaded files to a temp folder. You will get 2 directories after unzip. Disk1 and Disk2
- cd to Disk1
- execute runInstaller. When asked for java directory, use the one (either Sun JDK or JRockit) installed in WLS.
- select the previously created middleware home of SOA Suite 11.1.1.4.0. This reduces the installation footprint because it contains the Oracle WebLogic Server 11gR1 (10.3.4) and the optional component Oracle Enterprise Pack for Eclipse (OEPE) required by the OSB 11.1.1.4.0. The other middleware home (of Weblogic Portal, wlpmw) cannot be used because it contains Oracle Weblogic Server 10.3.2 which is not compatible with SOA PS3/OSB PS3.

Oracle Server Bus OSB Installation Screens













Upon completion of OSB installation in a SOA Suite middleware home, the following elements are added to the inventory.xml file in the oraInventory/ContentsXML directory.


    
       
    

 

The following image depicts the summary of the resultant directory structure after WLS and SOA installations.
The final step is to make sure your operating environment has the right variables set up.As root,
#vi /etc/bash.bashrc
Add the following lines
export ORACLE_BASE=/u01/app/oracle
export MW_HOME=$ORACLE_BASE/product/soamw
export WLS_HOME=$MW_HOME/wls_10.3
save the file.

VoilĂ , Oracle Service Bus in the same home as SOA Suite.

Happy OSB'ing,

Saturday, March 5, 2011

Oracle Database 11g R2 Deployment into ESXi Virtual Lab

With the infrastructure in place, the Oracle 11g R2 (non-clustered) database server is now deployed.

For instructions on how to install Oracle Database 11g in Ubuntu 10.10, please refer to this article.


Following is a summary of the server configuration.

Hardware Configuration

Server Name
IP Address
Gateway
OS
CPU #
RAM
oradb11g01.a.kein.com
eth0- 10.10.30.10
eth1 - 192.168.50.10
10.10.30.1
-
Ubuntu Linux 10.10
1
1GB

Storage Configuration

File System
Mounted On
Available Space
192.168.50.100:/mnt/sharedvol/shared/u1
/u01
1 TB

Software Configuration

Component
Application location
Data files location
Comments
Oracle Database 11g R2
(11.2.0.1.0)
/u01/app
/u01/app/oracle/oradata



Port Configuration

Type
Port and Port Range
Protocol/Application
Comments
Listener
1521
TCP/IP

Enterprise Manager DB Console
5560
HTTP



Testing the deployment

Connectivity from APP_VLAN (for TIBCO BW)

TIBCO BW Admin Server ip address. Currently DHCP, we will need to assign a static IP address later.

C:\XEClient\bin>ipconfig

Windows IP Configuration

Ethernet adapter Local Area Connection 3:

        Connection-specific DNS Suffix  . : a.kein.com
        IP Address. . . . . . . . . . . . : 172.16.20.100
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 172.16.20.1

» ping test

C:\XEClient\bin>ping 10.10.30.10
Pinging 10.10.30.10 with 32 bytes of data:

Reply from 10.10.30.10: bytes=32 time=5ms TTL=63
Reply from 10.10.30.10: bytes=32 time<1ms TTL=63
Reply from 10.10.30.10: bytes=32 time<1ms TTL=63
Reply from 10.10.30.10: bytes=32 time<1ms TTL=63

Ping statistics for 10.10.30.10:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 5ms, Average = 1ms

C:\XEClient\bin>

» sqlplus test

C:\XEClient\bin>sqlplus system/xxxxxxx@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.10.30.10)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl)))

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Feb 28 22:25:19 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

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

SQL>

» jdbc connection test

Copy the JdbcCheckup.java codes from the official Oracle documentation "Oracle® Database - JDBC Developer’s Guide 11g Release 2 (11.2)". We will use this program unmodified. Compile and run to test your jdbc connection.

You will need the ojdbc6.jar libraries, and a JDK for this to compile.  ojdbc6.jar comes with the Oracle Database 11g Release 2 Client (11.2.0.1.0) for both Windows and Linux.

To compile:
javac -classpath .;[path_to_ojdbc6.jar]\ojdbc6.jar JdbcCheckup.java

To execute:
java -cp .;[path_to_ojdbc6.jar]\ojdbc6.jar JdbcCheckup

The outcome:

Please enter information to test connection to the database
user: youruserid
password: yourpassword
database(a TNSNAME entry): yourservicename
Connecting to the database...Connecting...
connected.
Hello World
Your JDBC installation is correct.

Important notes about the TNSNAME parameter:

If you encounter the following error,
Exception in thread "main" java.sql.SQLException: ORA-12154: TNS:could not resolve the connect identifier specified

        at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:737)
        at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:401)
        at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:531)
        at oracle.jdbc.driver.T2CConnection.(T2CConnection.java:148)
        at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:53)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
        at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:280)
        at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:207)
        at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:157)
        at JdbcCheckup.main(JdbcCheckup.java:45)

it usually means your tnsnames.ora cannot be located.

In order for the program to locate your tnsnames.ora, you need to specify the environment variable TNS_ADMIN to the path containing the file.

Example (Linux)

export TNS_ADMIN=$ORACLE_HOME/network/admin

If you do not have tnsnames.ora (probably because you do not use SQL*Net) file on your system, you can specify at the TNSNAME parameter input with the following format.

host:port:service_name

Example:
database(a TNSNAME entry):10.10.30.10:1521:orcl

» telnet test

bash-4.1$ telnet 10.10.30.10 1521
Trying 10.10.30.10...
Connected to 10.10.30.10.
Escape character is '^]'.
Connection closed by foreign host.
bash-4.1$ 

Connectivity from MSG_VLAN (for EMS)

» ping test

kj@tibems01:~$ ping 10.10.30.10
PING 10.10.30.10 (10.10.30.10) 56(84) bytes of data.
64 bytes from 10.10.30.10: icmp_seq=1 ttl=63 time=1.32 ms
64 bytes from 10.10.30.10: icmp_seq=2 ttl=63 time=0.596 ms
64 bytes from 10.10.30.10: icmp_seq=3 ttl=63 time=0.549 ms
^C
--- 10.10.30.10 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.549/0.822/1.323/0.355 ms
kj@tibems01:~$ 

» sqlplus test

kj@tibems01:~/app/kj/product/11.2.0/client_1$ ./sqlplus system/xxxxx@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.10.30.10)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl)))
SQL*Plus: Release 11.2.0.1.0 Production on Tue Mar 1 17:20:00 2011

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

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

SQL> 

» telnet test

kj@tibems01:~$ telnet 10.10.30.10 1521
Trying 10.10.30.10...
Connected to 10.10.30.10.
Escape character is '^]'.

Cheers,

Tuesday, October 26, 2010

Oracle XE user for TIBCO Admin Domain repository

If you elect to use TIBCO EMS as the transport of the administration domain, you need to use database as the domain repository. If you plan to use Oracle XE Universal as the database, you might be looking for the reference on what privilege to grant to the user of the schema for the TIBCO Administrator Domain. The following information might help.

Assuming the user you want to create is called "tibpg", run the following sql commands to create the user and grant the privileges. You should be able to specify and use this user in the DomainUtility to create your domain without problem.


GRANT CONNECT,RESOURCE,UNLIMITED TABLESPACE TO tibpg IDENTIFIED BY tibpg

ALTER USER tibpg DEFAULT TABLESPACE USERS;

ALTER USER tibpg TEMPORARY TABLESPACE TEMP;

Cheers

Tuesday, June 15, 2010

YAIG - Yet another Oracle Database 11g R2 on Ubuntu 10.04 (Lucid) Installation Guide

Rather than re-inventing the wheel, this is my experience installing the oracle database 11gR2 on a 'virgin' ubuntu 10.04 32bit guest OS on vmware workstation, using the steps found here http://www.pythian.com/news/13291/installing-oracle-11gr2-enterprise-edition-on-ubuntu-10-04-lucid-lynx/, which in turn was based on the good work done here http://www.pythian.com/news/2329/installing-oracle-11gr1-on-ubuntu-904-jaunty-jackalope/.

I have tested the steps and found the following additional works are needed. The installation of the guest OS has on the vmware workstation been 'vanila', accepted all default settings.

VM hardware configurations:
RAM = 1048MB (1024MB doesn't work, failed the oracle installer pre-req check)
Vdisk = 20GB
CPU = 1
Core = 1

Additional step 1 - Fix the swap space
Oracle installer complained that I do not have enough swap space. The default is only around 850MB while the doco says 1.5GB of swap space is required for RAM between 1GB to 2GB (section 2.2.1 Memory Requirements of Oracle database installation guide). To setup additional swap space, follow the instruction in http://www.cyberciti.biz/faq/linux-add-a-swap-file-howto/

How-To
# dd if=/dev/zero of=/swapfile1 bs=1024 count=1572864

note: 1.5GB = 1024MB + 512MB = 1536MB (1024 * 1536MB = 1572864 block size)

# mkswap /swapfile1
# swapon /swapfile1

to mount on startup, edit the fstab file
# vi /etc/fstab

add the following line
/swapfile1 swap swap defaults 0 0

reboot the system. Or simply run these commands in the said order.

# swapoff -a
# swapon -a

Additional step 2 - The run level
Bump up the runlevel from 2 to 3. The default run level for ubuntu is 2. According to the doco, run level 2 up to 5 in ubuntu are the same. This step is just to make the installer happy.

How-To.
Issue the following command as root. 

# init 3

Additional step 3 - Kernel Parameters
The pre-req also fails one of the recommended kernel parameters. It seems that the installer is taking the required value literally even if the configured value is larger than the recommended ones.

It says:
This is a prerequisite condition to test whether the OS kernel parameter "ip_local_port_range" is properly set. (more details)
Expected Value
 : between 9000 & 65500
Actual Value
 : between 9000 & 65535

Obviously to make the installer happy again, we will need to change the /etc/sysctl.conf again. 

Changing from

net.ipv4.ip_local_port_range = 9000 65535

to

net.ipv4.ip_local_port_range = 9000 65500

should suffice.

Additional step 4 - Limits
The same thing as in step 3 needs to happen to /etc/security/limits.conf

The pre-req statuses:

This is a prerequisite condition to test whether the hard limit for "maximum open file descriptors" is set to at least 65536. (more details)
Expected Value
 : 65536
Actual Value
 : 65535

This is a prerequisite condition to test whether the soft limit for "maximum open file descriptors" is set to at least 1024. (more details)
Expected Value
 :  1024
Actual Value
 :  1023

This is a prerequisite condition to test whether the hard limit for "maximum user processes" is set to at least 16384. (more details)
Expected Value
 :  16384
Actual Value
 :  16383

We need to fix all of that. It is weird, but the fix is easy. The root cause? I don't know.

oracle soft nproc 2047
oracle hard nproc 16384  #(was 16383)
oracle soft nofile 1024 #(was 1023)
oracle hard nofile 65536 #(was 65535)

Until you see a list of 'Failed' status with regards to missing package, you should be able to safely check the 'ignore' box and proce installation. They are ignorable as stated in the cvu_prereq.xml. (yeah, the standalone installation appears to be using the pre-req definition file which is part of the 'cluster verification utility')

My screen looked like this before I proceed with success.

Lastly, if you have elected to create a new database instance during installation and if you want to install RCU (repository creation utility) for the SOA suite on this instance, you must use AL32UTF8 as the character set encoding.
After the installation, you can try to startup the dbconsole. One of the internet forums also suggested that you need to change the emctl script (located in /$ORACLE_HOME/bin/) to use the bash shell, else you will see error like ulimit: 25: bad number if you attempt to start the dbconsole.

To start the Enterprise Manager, just type the following command as oracle user.

oracle@oradb-lucid:~$ emctl start dbconsole

For Oracle RCU installation on this database instance, please refer to this article.