Category Archives: Technical Article

Asterisk Calling Card Applications

Asterisk is a powerful PBX solution, that we already know. But what else can it do. In this article we’ll explain how to setup Asterisk to handle Call Data Records (CDR data) in MySQL. Once you have that configured, there are a number of calling card applications which can be integrated with Asterisk to provide you with the makings of a serious calling gateway.


Setup Asterisk CDR with MySQL

By default Asterisk pumps all it’s call data information to text-based log files. That’s fine for normal use, but what if you want to put that data to use in a calling card application? First you have to get Asterisk to use a database. Luckily the support is already there, all you have to do is configure it.


Start by editing your cdr_manager.conf file as follows:


enabled = yes

Next edit your modules.conf file, and somewhere in the [modules] section, add:


load => cdr_addon_mysql.so

We’re going to compile this, don’t worry. Next edit your cdr_mysql.conf file in /etc/asterisk or create it if necessary:


[global]

hostname=localhost

dbname=asteriskcdrdb

user=astxuser

;user=

password=astxpass

;password=

port=3306

sock=/var/lib/mysql/mysql.sock

;sock=/tmp/mysql.sock

userfield=1

Next install MySQL. Luckily for all you lazy bums out there, this is the simplest of all. You’ll need to download three RPMs and install them. You’ll need the latest version of mysql-server, mysql-client and finally mysql-devel.


Next you’ll create a database called “asteriskcdrdb” with mysqladmin, create a table named “cdr” with the Asterisk provided script, and then set user grants.


Now it’s time to compile the asterisk-addons package. Be sure you have zlib-devel and mysql-devel packages installed on your system or you may get errors. Checkout the source from cvs. I got some strange errors which I had to track down on the email lists, and then edit the makefile as shown below:


CFLAGS+=-DMYSQL_LOGUNIQUEID

Now stop asterisk, and start it up again, and monitor the asterisk logfile for errors as follows:


tail -f /var/log/asterisk/messages

You can finally verify that you are dumping cdr information into mysql as follows:


$ mysql asteriskcdrdb

mysql> select uniqueid, src, calldate from cdr;



There should be one entry for every call. Make some calls to local

extensions and verify that records show up here. New cdr records

will still show up in the /var/log/asterisk/cdr-csv/Master.csv

file. Not sure if this can be disabled.


Calling Card Applications


ASTCC

Though the homepage is just a voip-info wiki page

and the download available through CVS, this calling card application was updated in late December 2004. This application seems to be the winner in terms of popularity on the voip-info wiki. It comes from Digium, it supports MySQL, and setup is pretty straightforward.

AreskiCC

With a strange name, it nevertheless seems a pretty complete system. Last updated end of December, 2004, it includes a web interface, though no support for MySQL. That’s fine, but my MySQL setup instructions will need to change slightly as you’ll need to configure Asterisk to dump CDR data into Postgres.


Asterisk Billing – Prepaid application

Last updated in July, I had trouble compiling this application. There is a basic sourceforge download page, but no real homepage. I’m guessing this one is still sort of in the development stages. Also, it doesn’t come with any sound files, so you’ll have to record your own, or *borrow* from some of these other applications.

Part 7: RAC/Linux/Firewire – Cluster Database Setup

Cluster Database Setup


Setting up a clustered database is a lot like setting up an normal Oracle database. You have datafiles, controlfiles, redologs, rollback segments, and so on. With a clustered database you have a few new settings in your init.ora, and an second undo tablespace.

init.ora + config.ora setup

In a RAC environement, we finally see while Oracle has been recommending a separate config.ora and init.ora file all these years. config.ora contains instance specific parameters, such as the dump directories, name of the undo tablespace (there is one for each instance), and the instance and thread number. init.ora contains all common parameters two the database.

# config.ora for WEST instance

background_dump_dest=/home/oracle/admin/WEST/bdump

core_dump_dest=/home/oracle/admin/WEST/cdump

user_dump_dest=/home/oracle/admin/WEST/udump

undo_tablespace=UNDO_WEST

instance_name=WEST

instance_number=1

thread=1

# config.ora for EAST instance

background_dump_dest=/home/oracle/admin/EAST/bdump

core_dump_dest=/home/oracle/admin/EAST/cdump

user_dump_dest=/home/oracle/admin/EAST/udump

undo_tablespace=UNDO_EAST

instance_name=EAST

instance_number=2

thread=2

Notice that their are *TWO* undo tablespaces. In previous versions of Oracle this was rollback segment tablespace. At any rate each instance needs one. In the creating a RAC database section below, you’ll learn when and how these are created.

– initWEST.ora (on node 2 it’s initEAST.ora) –

# this is the only line that changes for each instance

ifile = /home/oracle/admin/WEST/pfile/configWEST.ora

control_files=
(/ocfs/oradata/EASTWEST/cntlEASTWEST01.ctl,

/ocfs/oradata/EASTWEST/cntlEASTWEST02.ctl,

/ocfs/oradata/EASTWEST/cntlEASTWEST03.ctl)

db_block_size=8192

# new Oracle9i parameter to set buffer cache size

db_cache_size=37108864

# if you have more instances, this number will be higher

cluster_database_instances=2

# see below for details

filesystemio_options=”directIO”

open_cursors=300

timed_statistics=TRUE

db_domain=localdomain

remote_login_passwordfile=EXCLUSIVE

# some stuff for Java

dispatchers=”(PROTOCOL=TCP)(SER=MODOSE)”, “(PROTOCOL=TCP)(PRE=Oracle.aurora.server.GiopServer)”, “(PROTOCOL=TCP)(PRE=Oracle.aurora.server.SGiopServer)”, “(PROTOCOL=TCP)”

compatible=9.0.0

# notice db name is different than instance names

db_name=EASTWEST

java_pool_size=12428800

large_pool_size=10485760

shared_pool_size=47440512

processes=150

fast_start_mttr_target=300

resource_manager_plan=SYSTEM_PLAN

sort_area_size=524288

undo_management=AUTO

cluster_database=true

That should do it. You may have more or less memory so adjust these values accordingly. Many of them are standard for non-RAC databases, so you’ll already be familiar with them. The Oracle docs are decent on explaining these in more detail, so check them for more info.

The init.ora parameter filesystemio_options is no longer a hidden parameter as of Oracle 9.2. The setting I use above is from Wim Coekaerts documentation. Arup Nanda says in the OPS days, “setall” was the setting he usually used. Your mileage may vary.

Steve Adam’s recommenations with respect to this parameter:

http://www.ixora.com.au/notes/filesystemio_options.htm

17. Creating the RAC database

This is much like creating a normal database. Most of the special stuff is in the init.ora and config.ora. The only new stuff is creating and enabling a separate undo tablespace, as well as second sets of redologs. Well you’re probably used to mirroring these anyway. Run this from node1.

– crEASTWEST.sql –

– send output to this logfile

spool crEASTWEST.log

startup nomount

– the big step, creates initial datafiles

create database EASTWEST

maxinstances 5

maxlogfiles 10

character set “we8iso8859p1″

datafile
‘/ocfs/oradata/EASTWEST/sysEASTWEST01.dbf’ size 500m reuse

default temporary tablespace tempts tempfile ‘/ocfs/oradata/EASTWEST/tmpEASTWEST01.dbf’ size 50m reuse

undo tablespace UNDO_WEST datafile ‘/ocfs/oradata/EASTWEST/undEASTWEST01.dbf’ size 50m reuse

logfile
‘/ocfs/oradata/EASTWEST/logEASTWEST01a.dbf’ size 25m reuse,

‘/ocfs/oradata/EASTWEST/logEASTWEST01b.dbf’ size 25m reuse;

– create the data dictionary

@?/rdbms/admin/catalog.sql

@?/rdbms/admin/catproc.sql

– create the second undo tablespace

create undo tablespace UNDO_EAST datafile
‘/ocfs/oradata/EASTWEST/undEASTWEST02.dbf’ size 50m reuse;

– create a second set of redologs

alter database add logfile thread 2 ‘/ocfs/oradata/EASTWEST/logEASTWEST02a.dbf’ size 25m reuse;

alter database add logfile thread 2 ‘/ocfs/oradata/EASTWEST/logEASTWEST02b.dbf’ size 25m reuse;

alter database enable thread 2;

shutdown immediate;

18. Startup of all instances

The magic step. Not a lot to it if all the above steps went

properly, but exciting none the less.

First on node1

$ sqlplus /nolog

SQL> connect / as sysdba

SQL> startup

Then the same thing on node2

$ sqlplus /nolog

SQL> connect / as sysdba

SQL> startup

Voila! You should be up and running at this point.

Errors. If you’re getting ORA-32700 like this:

SQL> startup

ORACLE instance started.

Total System Global Area 93393188 bytes

Fixed Size 450852 bytes

Variable Size 88080384 bytes

Database Buffers 4194304 bytes

Redo Buffers 667648 bytes

ORA-32700: error occurred in DIAG Group Service

It probably means oracm didn’t start properly. This would probably

give you trouble *CREATING* a database as well.


Part 1 – Introduction

Part 2 – Basic Costs + Hardware Platform Outline

Part 3 – Software Requirements, Versions, etc

Part 4 – Initial Oracle Setup

Part 5 – Firewire + OCFS Setup

Part 6 – Cluster Manager Setup

Part 7 – Cluster Database Setup

Part 8 – Review of Clustered Features + Architecture

Part 9 – A quick 9iRAC example

Part 10 – Summary

Part 8: RAC/Linux/Firewire – Review of Clustered Features + Architecture

Review of Clustered Features + Architecture

Oracle 9iRAC has some important hardware and software components which are distinct from a standard single-instance setup.

On the hardware side, you have the IPC interconnect. On high-end specialized hardware such as sun clusters, you have a proprietary interconnect. On our low-cost working-mans clustering solution, you simply use a private or public ethernet network. The Oracle software components which we’ll describe in detail below, use this interconnect for interprocess communication, sending messages to syncronize caches, locks, and datablocks between each of the instances. This sharing of cache information is called Cache Fusion, and creates what Oracle calls the Global Cache.

Another important piece of the 9iRAC pie is the storage subsystem, and the Oracle cluster filesystem. What we’ve created with our cheap firewire shared drive is affectively a SAN or Storage Area Network. In high-end systems this SAN would probably be built with fiber-channel technology and switches. This storage subsystem is sometimes called a shared-disk subsystem. In order to write to the same disk being accessed by two machines, you have your choice of raw devices, or OCFS. Raw devices can also be used with a single instance database. They eliminate completely the OS filesystem, and all associated caching and management, providing direct raw access to the device. This type of arrangement is more difficult to manage. You don’t have datafiles to work with, so your backups, and database management become a bit more complex. Also, adding new datafiles is always adding a new partition, thus they are more difficult to delete, resize, and rearrange. OCFS provides you this functionionality, but with the flexibility and simplicity of a filesystem. Definitely the recommended option.

Oracle’s cluster manager (the oracm process we started above) coordinates activities between the cluster of instances. It monitors resources, and makes sure all the instances are in sync. If one becomes unavailable, it handles that eventuality.

With a 9iRAC database, aside from the normal SMON, PMON, LGWR, CKPT, + DBWR processes, you have a number of new processes which show up. They are as follows:

PROCESS NAME DESCRIPTION

——- —————– ———————-

LMSn global cache services controls the flow of data blocks + messages

LMON global enqueue monitor monitors global locks

LMD global enqueue service daemon: manages remote resource requests

LCK lock process manages local library and row cache req

DIAG diagnosability daemon reports process failures to alert.log

In 9iRAC there are two important components which manage shared resources. They are Global Cache Services (GCS) (Block Server Process or BSP in 8iOPS) and Global Enqueue Services (GES) components. GCS shares physical blocks from the buffer caches of each instance in the cluster, passing them back and forth as necessary. The GES shares locking information. In the local context you have three types of resource locks – null, shared, and exclusive. A null lock generally escalates to other types of locks, and strange as it may seem, doesn’t convey any access rights. Multiple instances can gain a null lock. Multiple instances can acquire a shared lock for reading, however, while it is in shared mode, other instances cannot write to it. And an exclusive lock can be held by only one instance. It gives exclusive access for writing. In the global context, ie whenever Cache Fusion is invoked, or whenever two instances in a cluster want the same data, you have those same three locks in two modes. Ownership of the current image or past image. The issue of the past image comes up because in a single instance, another session can construct the past image from undo, however, in the global context, this has to be put together and passed along to the other instance in the cluster.

The physical database in and Oracle 9iRAC environment has a lot in common with a single instance database. In 9iRAC, each instance has it’s own ORACLE_HOME where the Oracle software, ORACLE_BASE/admin/ORACLE_SID directory in OFA where the bdump, udump, cdump, pfile, and create directories all are. Each instance also has it’s own archive logs, if you are running in archivelog mode. The example above I was not running in archivelog mode, for simplicity sake. All the other files which make up your database are shared, including datafiles for data, datafiles for index, redo, system, temp, and other tablespaces, as well as controlfiles.


Part 1 – Introduction

Part 2 – Basic Costs + Hardware Platform Outline

Part 3 – Software Requirements, Versions, etc

Part 4 – Initial Oracle Setup

Part 5 – Firewire + OCFS Setup

Part 6 – Cluster Manager Setup

Part 7 – Cluster Database Setup

Part 8 – Review of Clustered Features + Architecture

Part 9 – A quick 9iRAC example

Part 10 – Summary

Part 9: RAC/Linux/Firewire – A Quick 9iRAC Example

A quick 9iRAC example


The names of the two instances I’m using are EAST and WEST, so I’ll use them here to refer to commands you’ll execute at the sqlplus prompt. This test assumes you’re logged into the same schema on both instances. I used ‘sys’ but you can create your own schema if you like.

1. On WEST do:

SQL> create table rac_test (c1 number, c2 varchar2 (64));

2. On EAST do:

SQL> desc rac_test

3. On WEST do:

SQL> insert into rac_test values (1, ‘SEAN’);

SQL> insert into rac_test values (2, ‘MIKE’);

SQL> insert into rac_test values (3, ‘JANE’);

4. On EAST do: (notice no rows are returned)

SQL> select * from rac_test;

5. On WEST do:

SQL> commit;

6. On EAST do: (notice the rows appear now)

SQL> select * from rac_test;

7. On WEST do:

SQL> update rac_test set c2 = ‘SHAWN’ where c1 = 1;

8. On EAST do: (notice the error Oracle returns)

SQL> select * from rac_test where c1 = 1 for update nowait;

select * from rac_test where c1 = 1 for update nowait

*

ERROR at line 1:

ORA-00054: resource busy and acquire with NOWAIT specified

9. Again on EAST do: (notice Oracle waits…)

SQL> update rac_test set c2 = ‘JOE’ where c1 = 1;

10. On WEST do:

SQL> commit;

11. On EAST the transaction completes.

This simple exercise illustrates that two sessions running on different instances, against the same database are behaving just like two sessions on a single instance or machine against a database. This is key. Oracle must maintain transactional consistency. Oracle maintains ACID properties which are Atomicity, Consistency, Isolation, and Duarability. Atomicity means a transaction either executes to completion, or fails. Consistency means that the database operates in discrete transactions, and moves from one consistent state to another. Isolation means that actions of other transactions are invisible until they are completed (commited). Finally Durability means when a transaction has finally completed and commited, it becomes permanent.

Our example above demonstrates that Oracle maintains all these promises, even in a clustered environment. How Oracle does this behind the scenes involves the null, shared, and exclusive locks we described above, and current and past image management. A lot of these details are reserved for a 9iRAC internals article. Take a look below at Madhu Tumma’s article for more on 9iRAC internals.

Part 1 – Introduction

Part 2 – Basic Costs + Hardware Platform Outline

Part 3 – Software Requirements, Versions, etc

Part 4 – Initial Oracle Setup

Part 5 – Firewire + OCFS Setup

Part 6 – Cluster Manager Setup

Part 7 – Cluster Database Setup

Part 8 – Review of Clustered Features + Architecture

Part 9 – A quick 9iRAC example

Part 10 – Summary

Part 10: RAC/Linux/Firewire – Summary

Summary

We covered a lot of ground in this article and it should serve as an introduction to 9iRAC on cheap Linux hardware. There are plenty of other topics to dig into including tuning, backup, SQL*Net setup and Load Balancing, I/O Fencing, NIC Failover and so on.

9iRAC is *NOT* a silver bullet as any good DBA knows. It will protect you from a single instance failure because of memory, kernel panic, or an interconnect failure, but there are still cases where your database could go down, for instance if the cluster manager software fails, or you lose a datafile either from human error, or a storage subsystem problem. Further redundancy can help you, but there are risks associated with an accidentally deleted object, or even and Oracle software bug.

Take a look at some of the documents listed below for further reading.

Other References

Red Hat Linux Advanced Server 2.1 – docs

Oracle Technology Network’s Linux Center

Oracle Cluster Filesystem FAQ

Oracle Cluster File System docs

Internals of Real Application Clusters by Madhu Tumma

Oracle9i Real Application Clusters Concepts

Oracle9i Real Application Clusters Administration

Linux HOWTO Docs – Networking, kernel config, hardware compatability etc


Part 1 – Introduction

Part 2 – Basic Costs + Hardware Platform Outline

Part 3 – Software Requirements, Versions, etc

Part 4 – Initial Oracle Setup

Part 5 – Firewire + OCFS Setup

Part 6 – Cluster Manager Setup

Part 7 – Cluster Database Setup

Part 8 – Review of Clustered Features + Architecture

Part 9 – A quick 9iRAC example

Part 10 – Summary

Oracle 10g Laptop/nodeless RAC Howto

INTRODUCTION

————

Let me start by saying that this whole article is rather unorthodox.

That’s why I thought the analogy of hitchhiking was so apt. Also

if you are a hitchhiker, and you happen to be carrying your laptop,

well you can bring along an Oracle 10g Real Application Cluster

to show all your friends. Now there’s a road warrior!

Seriously though, this step-by-step guide does not describe any

supported solution by Oracle. So what good is it? Well a lot

actually. By taking the uncommon route, you often see the

colorful streets, the surprising highways, and undiscovered

nooks. What a great analogy because this is also true in software!

In 2002 I went to Open World and was very excited by the discovery

of the Open Source initiative headed up by Wim Coekerts. One of

their most exciting projects to me was this Oracle 9i RAC running

on Linux with a special Firewire driver patched to allow multiple

systems to mount the same filesystem. That was a tremendous learning

experience, and I wrote up an article, and presented that at the

New York Oracle User Group. Afterward, someone from the audience

came to me and asked if I would present at their user group out

in Edison New Jersey. Both presentations were exciting, and I

think well received.

Of late I’ve happened upon some articles floating around the internet

discussing a single-node AKA laptop RAC setup. How could that work,

I wondered? Perhaps they install virtualization software such as

VMWare to allow a single machine to look like more than one. This

would certainly work in theory. Once I started digging a bit more I

discovered Amit Poddar’s excellent article over at dizwell.com, and

I was intrigued. No virtualization seemed to be required other than

some virtual ethernet interfaces.

I decided to dig my heels in and give it a try. After struggling with

the illustrious and very universally beloved installer for a few months

I finally managed to get all the pieces in place, and get Oracle Real

Application Clusters running with no clustering hardware!!!

Here, my fine friends, are all the gory details of that adventure, which

I hope you’ll enjoy as much as I did writing them down.

Oracle’s model of clustering involves multiple instances (software processes)

talking to a single database (physical datafiles). We’re doing the same

thing here, but both instances will reside on the same machine. This

helps you travel light, save on transportation and learn concepts,

commands, and the architecture. Remember this is not an HA solution,

as there is little redundancy, and with a single disk, you will surely get

abysmal performance.

Let’s get started, what will we need to do? Here’s a quick outline of the

steps involved:

1. setup ip addresses of the virtual servers

2. setup ssh and rsh with autologin configured

3. setup the raw devices Oracle’s ASM software will use

4. install the clusterware softare, and then Oracle’s 10g software

5. setup the listener and an ASM instance

6. create an instance, start it, and register with srvctl

7. create a second instance & undo tablespace, & register it

1. Setup IP Addresses

———————-

Oracle wants to have a few interfaces available to it. To follow our analogy

of a hitchhiker traveling across America, we’ll name our server route66.

So add that name to your /etc/hosts/ file along with the private and vip

names:

192.168.0.19 route66

192.168.0.75 route66-priv

#192.168.0.76 route66-vip

Notice that we’ve commented out route66-vip. We’ll explain more about

this later, but suffice it to say now that the clusterware installer

is very finicky about this.

In order for these two additional names to be reachable, we need

ethernet devices to associate with those IPs. It’s a fairly straightforward

thing to create with ifconfig as follows:

$ /sbin/ifconfig eth0:1 192.168.0.75 netmask 255.255.255.0 broadcast 192.168.0.255

$ /sbin/ifconfig eth0:2 192.168.0.76 netmask 255.255.255.0 broadcast 192.168.0.255

If your IPs, or network is configured differently, adjust the IP or broadcast

address accordingly.

2. setup ssh and rsh with autologin

————————————

Most modern Linux systems do *NOT* come with rsh installed. That’s for

good reason, because it’s completely insecure, and shouldn’t be used at

all. Why Oracle’s installer requires it is beyond me, but you’ll need

it. You can probably disable it once the clusterware is installed.

Head over to http://rpmfind.net and see if you can find a copy for

your distro. You might also have luck using up2date or yumm if you

already have those configured, as they handle dependencies, and always

download the *right* version. With rpm, install this way:

$ rpm Uvh rsh-server-0.17-34.1.i386.rpm

$ rpm Uvh rsh-0.17-34.1.i386.rpm

Next enable autologin by adding names to your /home/oracle/.rhosts file.

After starting rsh, you should be able to login as follows:

$ rsh route66-priv

Once that works, move on the the sshd part. Most likely ssh is already on

your system, so just start it (as root):

$ /etc/rc.d/init.d/sshd start

Next, as the “oracle” user, generate the keys:

$ ssh-keygen -t dsa

Normally you would copy id_dsa.pub to a remote system, but for us we

just want to login to self. So copy as follows:

$ cd .ssh

$ cp id_dsa.pub authorized_keys

$ chmod 644 authorized_keys

Verify that you can login now:

$ ssh route66-priv

3. setup the raw devices

————————-

Most of the time when you think of files on a Unix system, you’re

thinking of files as represented through a filesystem. A filesystem

provides you a way to interact with the underlying disk hardware

through the use of files. A filesystem provides buffering, to

improve I/O performance automatically. However in the case of a

database like Oracle, it already has a sophisticated mechanism for

buffering which is smart in that it knows everything about it’s

files, and how it wants to read and write to them. So for an

application like Oracle unbuffered I/O is ideal. It bypasses a

whole layer of software, making your overall throughput faster!

You achieve this feat of magic using raw devices. We’re going to

hand them over to Oracle’s Automatic Storage Manager in a minute

but first let’s get to work creating the device files for our

RAC setup.

Create three 2G disks. These will be used as general storage space

for our ASM instance:

$ mkdir /asmdisks

$ dd if=/dev/zero of=/asmdisks/disk1 bs=1024k count=2000

$ dd if=/dev/zero of=/asmdisks/disk2 bs=1024k count=2000

$ dd if=/dev/zero of=/asmdisks/disk3 bs=1024k count=2000

Create two more smaller disks, one for the Oracle Cluster Registry,

and another for the voting disk:

$ dd if=/dev/zero of=/asmdisks/disk4 bs=1024k count=100

$ dd if=/dev/zero of=/asmdisks/disk5 bs=1024k count=20

Now we use a loopback device to make Linux treat these FILES as

raw devices.

$ /sbin/losetup /dev/loop1 /asmdisks/disk1

$ raw /dev/raw/raw1 /dev/loop1

$ chown oracle.dba /dev/raw/raw1

You’ll want to run those same three commands on disk2 through disk5 now.

4. Install the Clusterware & Oracle’s 10g Software

————————————————–

Finally we’re done with the Operating System setup, and we can move on

to Oracle. The first step will be to install the clusterware. I’ll

tell you in advance that this was the most difficult step in the entire

RAC on a laptop saga. Oracle’s installer tries to *HELP* you all along

the way, which really means standing in front of you!

First let’s make a couple of symlinks to our OCR and voting disks:

$ ln -sf /dev/raw/raw4 /home/oracle/product/disk_ocr

$ ln -sf /dev/raw/raw5 /home/oracle/product/disk_vot

As with any Oracle install, you’ll need a user, and group already

created, and you’ll want to set the usual environment variables such

as ORACLE_HOME, ORACLE_SID, etc. Remember that previous to this point

you already have ssh and rsh autologin working. If you’re not sure

go back and test again. That will certainly hold you up here, and

give you all sorts of confusing error messages.

If you’re running on an uncertified version of Linux, you may want

to fire up the clusterware installer as follows:

$ ./runInstaller -ignoreSysPrereqs

If your Linux distro is still giving you trouble, you might try

downloading from centos.org where you can find complete ISOs for

RHEL, various versions. You can also safely ignore memory warnings

during startup. If you’re short on memory, it will certainly slow things

down, but we’re hitchhikers right?

You’ll be asked to specify the cluster configuration details. You’ll

want route66-vip to be commented out, so if you haven’t done that and

get an error to the affect of route66-vip already in use go ahead and

edit your /etc/hosts file.

I also got messages saying “route66-priv not reachable”. Check again

that sshd is running, and possibly disable your firewall rules:

$ /etc/rc.d/init.d/iptables stop

Also verify that eth0:1, and eth0:2 are created. Have you rebooted

since you created them? Be sure they’re still there with:

$ /sbin/ifconfig -a

Specify the network interface. This defaults to PRIVATE, just edit

and specify PUBLIC.

The next two steps ask for the OCR disk and voting disk. Be sure to

specify external redundancy. This is your way of telling Oracle that

you’ll take care of mirroring these important disks yourself, as loss

of either of them will get you in deep doodoo. Of course we’re

hitchhikers so we’re not trying to build a system that is never going

to breakdown, but rather we want to get the feeling of the wind blowing

in our hair. Click through to install and you should be in good shape.

At the completion, the installer will ask you to run the root.sh

script. I found this worked fine up until the vipca (virtual ip

configuration assistant). I then ran this one manually. You’ll need

to uncomment route66-vip from your /etc/hosts file as well. Once

all configuration assistants have completed successfully, return to

the installer and click continue, and it will do various other sanity

checks of your cluster configuration.

Since the clusterware install is rather testy, you’ll probably be doing

it a few times before you get it right. Here’s the cleanup if you

have to run through it again:

$ rm rf /etc/oracle

$ rm rf /home/oracle/oraInventory

$ rm rf $CRS_HOME

# these two commands cleanup the contents of these disks

$ /bin/dd if=/dev/zero of=/asmdisks/disk4 bs=1024k count=100

$ /bin/dd if=/dev/zero of=/asmdisks/disk5 bs=1024k count=20

$ rm /etc/rc.d/init.d/init.crs

$ rm /etc/rc.d/init.d/init.crsd

$ rm /etc/rc.d/init.d/init.cssd

$ rm /etc/rc.d/init.d/init.evmd

$ rm /etc/rc.d/rc3.d/S96init.crs

$ rm /etc/rc.d/rc5.d/S96init.crs

Now reboot the server. This will kill any clusterware processes still running.

If you’ve finished the Oracle Universal Installer at this point, and things

seem to be working, check at the command line with the ps command:

$ ps auxw | grep 10.2.0s

root 3728 0.0 0.3 2172 708 ? S May30 0:00 /bin/su -l oracle -c sh -c ‘ulimit -c unlimited; cd /home/oracle/product/10.2.0s/log/bebel/evmd; exec /home/oracle/product/10.2.0s/bin/evmd ‘

root 3736 0.0 5.0 509608 11240 ? S May30 4:51 /home/oracle/product/10.2.0s/bin/crsd.bin reboot

oracle 4047 0.0 2.8 192136 6284 ? S May30 0:00 /home/oracle/product/10.2.0s/bin/evmd.bin

root 4172 0.0 0.3 2164 708 ? S May30 0:00 /bin/su -l oracle -c /bin/sh -c ‘ulimit -c unlimited; cd /home/oracle/product/10.2.0s/log/bebel/cssd; /home/oracle/product/10.2.0s/bin/ocssd || exit $?’

oracle 4173 0.0 0.4 4180 900 ? S May30 0:00 /bin/sh -c ulimit -c unlimited; cd /home/oracle/product/10.2.0s/log/bebel/cssd; /home/oracle/product/10.2.0s/bin/ocssd || exit $?

oracle 4234 0.0 3.9 180108 8808 ? S May30 0:16 /home/oracle/product/10.2.0s/bin/ocssd.bin

oracle 4476 0.0 2.0 24048 4576 ? S May30 0:00 /home/oracle/product/10.2.0s/bin/evmlogger.bin -o /home/oracle/product/10.2.0s/evm/log/evmlogger.info -l /home/oracle/product/10.2.0s/evm/log/evmlogger.log

oracle 6989 0.0 0.1 2676 404 ? S May30 0:00 /home/oracle/product/10.2.0s/opmn/bin/ons -d

oracle 6990 0.0 1.9 93224 4280 ? S May30 0:00 /home/oracle/product/10.2.0s/opmn/bin/ons -d

oracle 7891 0.0 0.2 3676 660 pts/3 S 23:35 0:00 grep 10.2.0s

Also list the nodes you have available to your clusterware software:

$ olsnodes n

route66 1

The Oracle 10g install itself is very trivial, assuming you’ve installed

Oracle before. Use the -ignoreSysPrereqs flag if necessary to start

up the Oracle Universal Installer, and use the software-only option,

as we’ll be creating our RAC database by hand. Also select Enterprise

Edition and things should proceed smoothly. Oracle will recognize that

you have the clusterware installed, and let you know during the

installation.

5. setup the listener and an ASM instance

——————————————-

The listener.ora file is setup as usual, the only difference is you will

include both route66 and route66-vip.

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = PLSExtProc)

(ORACLE_HOME = /home/oracle/product/10.2.0)

(PROGRAM = extproc)

)

)

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))

)

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL=TCP)(HOST=route66)(PORT = 1521)(IP = FIRST))

)

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL=TCP)(HOST=route66-vip)(PORT = 1521)(IP = FIRST))

)

)

)

You may also choose to use the actual IP addresses of these hostnames if

you like. One other difference is that you will use Oracle 10g’s new

srvctl utility to start th listener.

$ srvctl start nodeapps -n route66

Ok, on to the fun stuff. It’s time to configure our ASM instance.

Our instance name will be +ASM1, and we’ll set the ORACLE_SID as usual.

In the init+ASM1.ora file specify:

user_dump_dest=/home/oracle/admin/+ASM1/udump

background_dump_dest=/home/oracle/admin/+ASM1/bdump

core_dump_dest=/home/oracle/admin/+ASM1/cdump

large_pool_size=15m

instance_type=asm

asm_diskstring=’/dev/raw/raw1′, ‘/dev/raw/raw2′,’/dev/raw/raw3′

Then in sqlplus startup the ASM instance:

SQL> startup nomount

Next tell ASM how we want to utilize the space we have by creating disk

groups:

SQL> create diskgroup DBDATA external redundancy disk

‘/dev/raw/raw1′,’/dev/raw/raw2;

SQL> create diskgroup DBRECO external redundancy disk ‘/dev/raw/raw3′;

Now that you have diskgroups, you want to make a note of it in your

init.ora:

SQL> !echo “asm_diskgroups=’DBDATA’,'DBRECO’” >> init+ASM1.ora

Now startup your ASM instance:

SQL> startup force

Exit sqlplus and let srvctl know about the new ASM instance:

$ srvctl add asm -n route66 -i +ASM1 -o /home/oracle/product/10.2.0.1

Now you can shutdown in sqlplus, and startup with srvctl:

SQL> shutdown immediate

$ srvctl start asm -n route66

And lastly use the ps command to check for your new instance.

6. create an instance, start it, and register with srvctl

———————————————————

We’re getting to our clustered database slowly but surely. We’re

just getting over the mountains now, and the open road is ahead of

us.

We’re going to create the first of our two instances and call it

BEATNIK. Edit your initBEATNIK.ora as follows:

db_block_size=8192

db_multiblock_read_count=8

db_name=kerouac

BEATNIK.background_dump_dest=/home/oracle/admin/BEATNIK/bdump

BEATNIK.user_dump_dest=/home/oracle/admin/BEATNIK/udump

BEATNIK.core_dump_dest=/home/oracle/admin/BEATNIK/cdump

BEATNIK.instance_number=1

BEATNIK.instance_name=BEATNIK

BEATNIK.thread=1

BEATNIK.undo_tablespace=beatnikundo

HIPPY.background_dump_dest=/home/oracle/admin/BEATNIK/bdump

HIPPY.user_dump_dest=/home/oracle/admin/BEATNIK/udump

HIPPY.core_dump_dest=/home/oracle/admin/BEATNIK/cdump

HIPPY.instance_number=2

HIPPY.instance_name=HIPPY

HIPPY.thread=2

HIPPY.undo_tablespace=hippyundo

You’ll also have to create the /home/oracle/admin/BEATNIK/* and

/home/oracle/admin/HIPPY/* directories.

Now edit the file crKEROUAC.sql as follows:

CREATE DATABASE KEROUAC”

DATAFILE SIZE 250M EXTENT MANAGEMENT LOCAL

SYSAUX DATAFILE SIZE 125M

DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE SIZE 20M

UNDO TABLESPACE “beatnikundo” DATAFILE SIZE 200M

CHARACTER SET WE8ISO8859P1

LOGFILE GROUP 1 SIZE 10240K,

GROUP 2 size 10240k,

GROUP 3 size 10240k;

There are other parameters you can specify in this create statement, such as

maxinstances, maxlogmembers, and the sys password. However I’ve tried to

simplify it, to make it easier to review and understand. Check the Oracle

docs for details.

Now startup sqlplus and issue:

SQL> startup nomount pfile=/home/oracle/admin/BEATNIK/pfile/initBEATNIK.ora

SQL> @crKEROUAC.sql

Now get the names of your controlfiles from v$parameter and add them to

the initBEATNIK.ora file.

Now add a couple more parameters to your initBEATNIK.ora file:

*.cluster_database=true

*.cluster_database_instances=5

Use sqlplus to stop and start the db again:

SQL> shutdown immediate

SQL> startup force

Now register our new database:

$ srvctl add database d KEROUAC -o /home/oracle/product/10.2.0.1/

$ srvctl add instance -d KEROUAC -i BEATNIK -n route66

Now one more time, shutdown with sqlplus, and then use srvctl to

start the db. From now on srvctl can stop + start the db.

$ srvctl start instance -d KEROUAC -i BEATNIK

7. create a second instance & undo tablespace, & register it

———————————————————–

Since the database is already created, you don’t have to do that step

again. At this point all you have to do is create another instance.

First fire up sqlplus and create another undo tablespace:

SQL> create undo tablespace hippyundo datafile ‘+DBDATA’ size 100m;

Make a copy of your init.ora for the hippy instance like this:

$ cp initBEATNIK.ora initHIPPY.ora

Then set your ORACLE_SID and use sqlplus to startup:

SQL> startup

Finally register with srvctl:

$ srvctl add instance -i HIPPY -d KEROUAC -n route66

8. create data dictionary

————————–

SQL>@?/rdbms/admin/catalog.sql

SQL>@?/rdbms/admin/catclust.sql

10. Some Things to Understand

————————–

Automatic Storage Management

Global Cache Services

Global Enqueue Services

Clusterware procs crsd, evmd, ocssd,oprocd

RAC processes lms, lmd, lmon, lck0

GV$ data dictionary

11. Further Reading

—————–

Clusterware & RAC Install & Configuration Guide for Linux

Clusterware & RAC Administration Deployment Guide

Oracle Technology Network – http://otn.oracle.com

Please visit http://www.iheavy.com or email me at

Thanks to Amit Poddar & dizwell.com

Apress, Oracle Press books

Part 3: Rac/Linux/Firewire – Software Requirements, Versions, etc.

Software Requirements, versions, etc


Advance notice for beginners out there. I’ve installed Linux probably 20-30 times over the last 10 years, and it’s gotten a lot easier, however, you’ll need to have some decent skill at kernel installations. I’ll outline what I did that finally worked, but I’ll also say that I tried getting this setup to work on a couple of other boxes before I ended up using the emachines ones. I think the kernel which the Linux Firewire team has compiled and patched to their liking is pretty finicky, hardware-wise.

RedHat 8.0

I can’t go into the details of installing Linux in this short article, and there are plenty of resources on the web to help you. You’ll need to get that up and running first, with the 1394 card in the box.

Oracle 9.2.0.1

Oracle is a beast to install, and challenging for the beginner. Luckily there are a number of resources on the web.

patch 9.2.0.2

This patch is a *REQUIRED* patch. The guys on the Linux Firewire project assure me that the Oracle Cluster Manager has a lot of bugs and won’t work straight out of the box from the 9.2.0.1 release. Here’s a little twist. Although this is an *OPEN SOURCE* project, and the source is all free, and you can download Oracle and play with it to your heart’s content, to download a patch, you need access to Oracle’s Metalink, which requires you to have a software license. Not much I can say here folks. Use your imagination on getting ahold of this patch. Maybe if you place nice, someone on an email list will post it temporarily for you or something. It’s 235M. :-)

Login to Metalink (some like to call it metastink)

Click on the “patches” link along the left.

Search for patch 2632931

Also, take a look at this note:

Doc ID: Note:217811.1

Subject: ALERT: 9.2.0.2 Patchset for Linux Does Not

Apply Correctly in the RAC Environment

Type: ALERT

Status: PUBLISHED

Content Type: TEXT/PLAIN

Creation Date: 07-NOV-2002

Last Revision Date: 08-JAN-2003

Part 1 – Introduction

Part 2 – Basic Costs + Hardware Platform Outline

Part 3 – Software Requirements, Versions, etc

Part 4 – Initial Oracle Setup

Part 5 – Firewire + OCFS Setup

Part 6 – Cluster Manager Setup

Part 7 – Cluster Database Setup

Part 8 – Review of Clustered Features + Architecture

Part 9 – A quick 9iRAC example

Part 10 – Summary