Saturday, August 16, 2008

On RHL5 rawdevices: unrecognized service

On you RHL4 you can use the rawdevices service by enabling via,
# chkconfig --level 345 rawdevices on

But on RHL5 it shows the error message like,
[root@racnode-1 ~]# service rawdevices start
rawdevices: unrecognized service

Check your linux version by,
[root@racnode-1 ~]# uname -a
Linux racnode-1 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:21 EST 2007 i686 i686 i386 GNU/Linux

This is because that raw device technology had been deprecated in RedHat Linux 5 (RHEL5) and Oracle Enterprise Linux 5 OEL5). / Linux Kernel 2.6

As we see this is linux version EL5 and kernel 2.6, so rawdevices technology had been deprecated.

So you may think can we use rawdevices into RHEL5 or OEL5? In fact rawdevice is enabled on RHL4 by
# chkconfig --level 345 rawdevices on

The answer is yes you can still use the disk partition by means of UDEV technique and Oracle 11g & 10gR2 has options to configure components to access the block devices directly instead of rawdevices.

You might be curious why RHL4 can do and why RHL5 can't. This is beacuse in RHEL5 and OEL5 there is missing,

1. /etc/sysconfig/rawdevices file.
2. /dev/raw file.
3. Service by the name "rawdevices".


So, trying to run the command "service rawdevices restart" will result in "rawdevices: unrecognized service".

In my blog there is shown how to do it if you use RHL4.

To make access of disk block devices in RHL5/OEL5,

Step 1: Make an entry in /etc/udev/rules.d/60-raw.rules or create your own file for example ., /etc/udev/rules.d/-oracle-raw.rules (eg. 63-oracle-raw.rules)

Here I made like this,
#vi /etc/udev/rules.d/63-oracle-raw.rules
ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdc1", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="sdd1", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sde1", RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", KERNEL=="sdf1", RUN+="/bin/raw /dev/raw/raw5 %N"
KERNEL=="raw[1-2]*", OWNER="root", GROUP="oinstall", MODE="640"
KERNEL=="raw[3-5]*", OWNER="oracle", GROUP="oinstall", MODE="644"


So our sdb1 will be recognized as /dev/raw/raw1, sdb2 will be as /dev/raw/raw2 and so on.

Step 2: For the mapping to have immediate effect, run below command

#/bin/raw /dev/raw/raw1 /dev/sdb1
/bin/raw /dev/raw/raw2 /dev/sdc1
/bin/raw /dev/raw/raw3 /dev/sdd1
/bin/raw /dev/raw/raw4 /dev/sde1
/bin/raw /dev/raw/raw5 /dev/sdf1


Step3: Adjust the permission settings by,
chown root:oinstall /dev/raw/raw1
chown root:oinstall /dev/raw/raw2
chown oracle:oinstall /dev/raw/raw3
chown oracle:oinstall /dev/raw/raw4
chown oracle:oinstall /dev/raw/raw5
chmod 640 /dev/raw/raw1
chmod 640 /dev/raw/raw2
chmod 640 /dev/raw/raw3
chmod 640 /dev/raw/raw4
chmod 640 /dev/raw/raw5


Related Documents
Configure Shared Storage in Oracle RAC installation

Friday, August 15, 2008

ORA-12560: TNS:protocol adapter error on windows machine while starting oracle

Error Description
On my windows server machine whenever I try to logon to database as a sysdba user it fails with the message ORA-12560.
C:\Documents and Settings\Oracle>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Aug 16 11:01:58 2008

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

ERROR:
ORA-12560: TNS:protocol adapter error

Cause of The Error
Oracle classify this as a 'generic protocol adapter error'. In my experience while practice the happening of this error oracle indicates that Oracle client does not know what instance to connect to or what TNS alias to use. This may be due to incorrect ORACLE_SID environmental value setting or Oracle Service is not started yet.

Note that you will hit similar error if the Oracle client software home was set as the first entry in the PATH and not the Oracle database software home. If client home is set as first path then the client version of sqlplus was used. In this case, the connection as SYSDBA was unable to make a connection using the client software because a password file was not in use and this is deemed as a remote connection. Connection as a user other than SYSTEM/SYS worked because a password file from a remote connection is not needed for this type of user.

Solution of The Problem
1)If you have server running then while connecting to database as a sysdba user ensure that you have set properly your ORACLE_SID variable. Try explicitly set your envionmental variable on windows machine by,
>set ORACLE_SID=db_name

2)Ensure that you have right services running on your database. You can check whether oracle is running or not by right click on taskbar then select task manager and see whether oracle.exe is running or not.

If it is not running then it is likely to get ORA-12560: TNS:protocol adapter error on your windows machine. To avoid this error you have to run the service. You can do it from right click on my computer> select manage> Click on services and Applications> Double click on services> find the service name OracleSERVICE$ORACLE_SID. If your database name is ARJU then find the service name OracleSERVICEARJU and start it.

You can start the service also by command prompt,
C:>sc start OracleSERVICE$ORACLE_SID

Using oradim by,
C:>oradim -startup -sid $ORACLE_SID

After starting try to connect to database as sysdba and likely you will be able to connect to your database.

C:\Documents and Settings\Oracle>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Aug 16 11:03:16 2008

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

3)If you are connecting to a remote database then try easy naming method. Don't try to connect by tnsnames alias. Easy naming method is described in http://arjudba.blogspot.com/2008/06/ora-12514-tnslistener-does-not.html

4)Ensure that you are using correct tnsnames.ora and you have correct settings in your tnsnames alias. Whether you have correct tnsnames entry or not you can check that by >tnsping hostname

On unix machine, if you see tnsnames.ora is most likely accurate then at the Unix prompt, echo the TNS_ADMIN environment variable.

% echo $TNS_ADMIN

•If nothing is returned, try to set the TNS_ADMIN environment variable to explicitly point to the location of the TNSNAMES.ORA file.

In C Shell, the syntax is:
% setenv TNS_ADMIN full_path_of_tnsnames.ora_file

In K Shell or bash, the syntax is:
% export TNS_ADMIN=full_path_of_tnsnames.ora_file

On windows machine try setting the environment variable 'LOCAL' to the required connection alias instead. In windows machine environmental variable is set by set keyword.

Now try to connect to database.

5)If you use DHCP to assign IP of the server then try by putting a static IP to the database server.

Important point if you installed Oracle client and Server on same machine
6) Use path environmental variable to check the settings of ORACLE_HOME on windows. An example output,
C:\Users\Administrator>path
PATH=E:\app\Administrator\product\11.2.0\client_1;E:\app\Administrator\product\11.2.0\dbhome_1\bin;C:\Program Files\HP\N
CU;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files
(x86)\The Open Group\WMI Mapper\bin;C:\WINDOWS\SYSTEM32;
Here we see client home is set before server home path and so local SYSDBA connection will fail.
C:\Users\Administrator>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 28 12:59:01 2011

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

ERROR:
ORA-12560: TNS:protocol adapter error
Now, lets set ORACLE_HOME environmental variable to server binary files.
C:\Users\Administrator>set ORACLE_HOME=e:\app\Administrator\product\11.2.0\dbhome_1

C:\Users\Administrator>set PATH=%ORACLE_HOME%;%ORACLE_HOME%\bin;%PATH%

C:\Users\Administrator>path
PATH=e:\app\Administrator\product\11.2.0\dbhome_1;e:\app\Administrator\product\11.2.0\dbhome_1\bin;E:\app\Administrator\
product\11.2.0\client_1;E:\app\Administrator\product\11.2.0\dbhome_1\bin;C:\Program Files\HP\NCU;C:\Windows\system32;C:\
Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\The Open Group\WMI M
apper\bin;C:\WINDOWS\SYSTEM32;
and now it is working fine.
C:\Users\Administrator>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 28 13:01:26 2011

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
Related Documents
http://arjudba.blogspot.com/2008/06/ora-12154-tnscould-not-resolve-connect.html
http://arjudba.blogspot.com/2008/06/ora-12514-tnslistener-does-not.html

How to load data using external table into oracle database

Using SQL*Loader we can load data from flat data file to oracle database which is described in How to load data using sql*loader into oracle database. The external tables feature is a complement to existing SQL*Loader functionality.

In the following section, I will show with an example of how you can load data using external table.

1)Prepare your data file.
This file is where my input data is which will be loaded to database table. Here my datafile data.dat.txt is as follows,
045 Faruk
012 Arju
022 Momin

2)Create the database directory where data file resides.
This data file is not oracle data file rather it is the file where data resides. This oracle database directory is just a operating system path synonym. This directory is the logical path of physical datafile path. As my data file is in the directory c:\oracle\data\ so I create the directory as

SQL> create directory exter_dir as 'E:\oracle\work';

Directory created.

Note that user must have grant create any directory privilege. If other user create the directory then current user must have read access to the directory.
SQL> GRANT READ ON DIRECTORY exter_dir TO Arju;
Here current user is Arju. So execute above statement with a user that have privilege.

3)Prepare the original Table: You should ignore this step if your desired table already exist in your database. If not exist then create a new one. I created as,

SQL> create table std_name (id varchar2(10), name varchar2(20));
Table created.

4)Create the external table: I created the external table as,
SQL> create table external_tab(id char(4),
name char(10))
organization external
(default directory exter_dir
ACCESS parameters
(records delimited by newline
fields (id char(4), name char(10)
)
)
location ('data.dat.txt')
);


Table created.

Here "organizational external" indicates this one is external table.
"default directory" indicates the name of the directory where data file resides.
"location" indicates the name of the data file.

In this phase data from the data file is loaded into the external table. You can check whether it is successfully load or not by issuing,
SQL> select * from external_tab;
ID NAME
---- ----------
045 Faruk
012 Arju
022 Momin

5) Load the data from the external table to database table:
Load data from external_tab into the table std_name by,

SQL> insert into std_name select * from external_tab;
3 rows created.

SQL> commit;
Commit complete
.

6)Test the data.
SQL> select * from std_name;

ID NAME
---------- --------------------
045 Faruk
012 Arju
022 Momin

Thursday, August 14, 2008

Automtic and Manually sized Components of SGA

The parameter SGA_TARGET specifies the total size of all SGA components. If SGA_TARGET is set to a value greater than zero then
DB_CACHE_SIZE,
SHARED_POOL_SIZE,
LARGE_POOL_SIZE and
JAVA_POOL_SIZE are automatically sized.

are automatic sized components.

On the other hand,
LOG_BUFFER,
BUFFER_POOL_KEEP,
BUFFER_POOL_RECYCLE,
DB_nK_CACHE_SIZE other than DB_CACHE_SIZE,
STREAMS_POOL_SIZE ,
Fixed SGA and
other internal components are manually sized components.


However setting the value to manually sized components automatically reduce the value from SGA_TARGET if SGA_TARGET is set to value greater than zero.

When SGA_TARGET>0 then automatic sized components of SGA are automatically allocated and this is called Automatic Shared Memory Management.

Both the automatic and manually sized components of SGA are dynamic components because they dynamically can be changed. You can see them from V$SGA_DYNAMIC_COMPONENTS.

Related Documents

How to determine free memory and used memory in Oracle

Configure Shared Storage in Oracle RAC installation

An Oracle RAC database is logically or physically shared everything database. All
datafiles, control files, PFILEs, and redo log files in Oracle RAC environments must
reside on shared disks. This is so that all of the cluster database instances
can access them.

IN that shared disk you can use the following file storage options for Oracle RAC database.

1)ASM: Which stands for Automatic Storage Management. And oracle recommends ASM.

2)Oracle Cluster File System (OCFS):
OCFS is available for Linux and Windows
platforms, or a third-party cluster file system that is certified for Oracle RAC.

3)A network file system: This is not supported on AIX, POWER, or on IBM zSeries-based Linux.

4)Raw devices

In this post I will show how to configure RAW device to install oracle RAC.

Before discussing it is good to know the difference between single instance database and RAC instance database.

Oracle RAC databases differ architecturally from Oracle RAC single-instance Oracle
databases in that each Oracle RAC database instance also has,
At least one additional thread of redo for each instance
An instance-specific undo tablespace

To configure RAW storage device as a shared storage in RAC database first you have to think about clusterware part. Oracle clusterware has two components OCR and voting disk.

Before you install Oracle Clusterware, you will need to configure 5 raw partitions,
each 256 MB in size, one storing the Oracle Cluster Registry (OCR), another one for duplicate OCR file on a different disk, referred to as the OCR mirror, and three voting disks.

And then If you plan to use raw devices for storing the database files, you will need to create additional raw partitions for each tablespace, online redo log file, control file, SPFILE and password file.

Below is the procedure of how to configure RAW device.

Step 1:
Be sure that you have storage box purchased that is shared on both nodes.
Now to see available shared disk on your system as a root user on racnode-1 use,
# /sbin/fdisk -l
It gave me output like,
.
.
.
Disk /dev/sdb: 161.0 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/sdc: 161.0 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdc doesn't contain a valid partition table

Disk /dev/sdd: 161.0 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdd doesn't contain a valid partition table

Disk /dev/sde: 161.0 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sde doesn't contain a valid partition table

Disk /dev/sdf: 91.2 GB, 91268055040 bytes
255 heads, 63 sectors/track, 11096 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdf doesn't contain a valid partition table

Since I have sdb, sdc, sdd, sdf, sde disks on my storage box so all five are shown.

Step 2:
Now as a root user on racnode-1 create two raw partitions 256 MB in size for the OCR and its mirror, and three partitions 256 MB in size for the Oracle Clusterware voting disks. To store first OCR partition I use sdb for this. So, I use
# /sbin/fdisk /dev/sdb
After issuing it,

Use the p command to list the partition table of the device.

Use the n command to create a partition.

After you have created the required partitions on this device, use the w command to write the modified partition table to the device.

Here is the example of creating my first 256 raw partition of sdb disk.
The bolded one is input by me.
[root@racnode-1 ~]# /sbin/fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 19581.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/sdb: 161.0 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-19581, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-19581, default 19581): +256M

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@racnode-1 ~]#
Similarly configure other 256MB partition from rest of the disk. I created raw 256MB partition from /dev/sdc for OCR mirror. From the three disks /dev/sdd, /dev/sde and /dev/sdf create each 256MB partition for voting disk.

That is,
#fdisk /dev/sdc

#fdisk /dev/sdd

#fdisk /dev/sde

#fdisk /dev/sdf


After you configure your all 5 disks on your system your fdisk -l output will look like below.
[root@racnode-1 ~]# fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 1275 10241406 83 Linux
/dev/sda2 1276 3723 19663560 83 Linux
/dev/sda3 3724 6145 19454715 83 Linux
/dev/sda4 6146 9729 28788480 5 Extended
/dev/sda5 6146 8440 18434556 83 Linux
/dev/sda6 8441 9205 6144831 83 Linux
/dev/sda7 9206 9727 4192933+ 82 Linux swap / Solaris

Disk /dev/sdb: 161.0 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 32 257008+ 83 Linux

Disk /dev/sdc: 161.0 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 1 32 257008+ 83 Linux

Disk /dev/sdd: 161.0 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdd1 1 32 257008+ 83 Linux

Disk /dev/sde: 161.0 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sde1 1 32 257008+ 83 Linux

Disk /dev/sdf: 91.2 GB, 91268055040 bytes
255 heads, 63 sectors/track, 11096 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdf1 1 32 257008+ 83 Linux

Step 3:
As the root user on racnode-1, edit the /etc/sysconfig/rawdevices file and add the mappings for the raw devices used by Oracle Clusterware.
[root@racnode-1 ~]# vi /etc/sysconfig/rawdevices
#OCR Devices
/dev/sdb /dev/sdb1
/dev/sdc /dev/sdc1
#Voting Disk Devices
/dev/sdd /dev/sdd1
/dev/sde /dev/sde1
/dev/sdf /dev/sdf1


Step 4: Just ignore this step if you use RHL5. To configure it on RHL5 it is discussed on http://arjudba.blogspot.com/2008/08/on-rhl5-rawdevices-unrecognized-service.html
If you are using RHL4 then as the root user, on the node racnode1, enable the raw devices so that the mappings become effective at the operating system level using,
[root@racnode-1 ~]# service /etc/sysconfig/rawdevices start

If you are using RHL5 then you will get
[root@racnode-1 ~]# service rawdevices start
rawdevices: unrecognized service

To do it in RHL5 it is discussed in http://arjudba.blogspot.com/2008/08/on-rhl5-rawdevices-unrecognized-service.html

Step 5:
In the racnode-2 inform the OS of partition table changes. This is done by partprobe program that informs the operating system kernel of partition table changes, by requesting that the operating system re-read the partition table.

#/sbin/partprobe /dev/sdb
/sbin/partprobe /dev/sdc
/sbin/partprobe /dev/sdd
/sbin/partprobe /dev/sde
/sbin/partprobe /dev/sdf

This forces the operating system on the other node in the cluster to refresh its picture of the shared disk partitions.

Step 6:

On RHL4 for each node make an entry in /etc/sysconfig/rawdevices and use following command,
service rawdevices start
In RHL do as it is in http://arjudba.blogspot.com/2008/08/on-rhl5-rawdevices-unrecognized-service.html

Step 7:
As the root user, on each node in the cluster, enter commands similar to the following to set the owner, group, and permissions on the newly created device files:

chown root:oinstall /dev/raw/raw1
chown root:oinstall /dev/raw/raw2
chown oracle:oinstall /dev/raw/raw3
chown oracle:oinstall /dev/raw/raw4
chown oracle:oinstall /dev/raw/raw5
chmod 640 /dev/raw/raw1
chmod 640 /dev/raw/raw2
chmod 640 /dev/raw/raw3
chmod 640 /dev/raw/raw4
chmod 640 /dev/raw/raw5

Wednesday, August 13, 2008

How to change date and time on Linux using hand and NTP

I will write about two methods to change the time in Linux.
1. By hand. This setting may be be accurate as lots of clocks tend to drift over time.
2. Using NTP (Network Time Protocol). With this settings, you can get accurate time from a network time server.

1.By hand.
In order to see the current time and date settings issue,
[root@racnode-2 ~]# date
Thu Aug 14 17:49:04 BDT 2008
So current time is month 8 day 17, year 2008, time 17:49:04.

Now to change only time to 11:51.30 issue,
[root@racnode-2 ~]# date 08141151.30
Thu Aug 14 11:51:30 BDT 2008
Now issue date,
[root@racnode-2 ~]# date
Thu Aug 14 11:51:32 BDT 2008

Note that setting date in this way will not cause the date to remain after a reboot. The date command sets the Linux system clock which is separate from the hardware clock.
We can check linux hardware clock by,
[root@racnode-2 ~]# hwclock
Thu 14 Aug 2008 05:57:01 PM BDT -0.788181 seconds

To make date setting persistent update the hardware clock with the date from the Linux system clock.
[root@racnode-2 ~]# /sbin/hwclock --systohc
If you are using universal time then use,
hwclock --utc --systohc

An alternative way is if you want to set the hardware(BIOS) clock so the system will keep the time when it reboots using,

clock -w
or
setclock
after changing date and time by date command.

To set date and time we can also use,
# date -s "2 OCT 2008 8:00:00"

If you wanted to change the year as well, for example to change year to 2007 of 30th April time 11:16pm you could type
#date 043023162007

To change only the time to 10:10 am you also can use,
#date -s 10:10

2.Using NTP (Network Time Protocol).
This is simple process. Just adding the time server to /etc/ntp.conf and to /etc/ntp/step-tickers Here I use time server as 192.168.1.91.
#vi /etc/ntp.conf
server 192.168.1.91
#vi /etc/ntp/step-tickers
192.168.1.91
Then of course make sure that ntp will start at boot time by,
chkconfig --level 2345 ntpd on
chkconfig --list ntpd


And let's start the service now by,
service ntpd start

It will display output as
ntpd: Synchronizing with time server: [ OK ]
Starting ntpd: [ OK ]
Related Documents
http://arjudba.blogspot.com/2008/08/how-to-change-hostname-in-linux.html

Configure Network for oracle RAC installation

1)Determine public node names, private node names, and virtual node names for each node in the cluster.
For the public node name, use the primary host name of each node.
In my environment my one node name is racnode-1 and another node name is racnode-2. So I determine the public, private and virtual node name for node racnode-1 as racnode-1, racnode-1-priv and racnode-1-vip accordingly.

Similarly on racnode-2 as racnode-2, racnode-2-priv and racnode-2-vip accordingly.

2)Identify the interface names and associated IP addresses.

On racnode-1,
#/sbin/ifconfig
eth0 Link encap:Ethernet HWaddr 00:16:76:B0:46:7D
inet addr:192.168.1.91 Bcast:192.168.15.255 Mask:255.255.240.0
inet6 addr: fe80::216:76ff:feb0:467d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:96114 errors:0 dropped:0 overruns:0 frame:0
TX packets:1769 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7704446 (7.3 MiB) TX bytes:215309 (210.2 KiB)

eth1 Link encap:Ethernet HWaddr 00:11:3B:0A:42:DC
inet addr:192.168.150.30 Bcast:192.168.150.255 Mask:255.255.255.0
inet6 addr: fe80::211:3bff:fe0a:42dc/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:27116 errors:0 dropped:0 overruns:0 frame:0
TX packets:48666 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7171014 (6.8 MiB) TX bytes:4353054 (4.1 MiB)
Interrupt:58 Base address:0xa000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1201 errors:0 dropped:0 overruns:0 frame:0
TX packets:1201 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3069384 (2.9 MiB) TX bytes:3069384 (2.9 MiB)

On racnode-2,

[root@racnode-2 ~]# /sbin/ifconfig
eth0 Link encap:Ethernet HWaddr 00:16:76:B2:EB:27
inet addr:192.168.1.92 Bcast:192.168.15.255 Mask:255.255.240.0
inet6 addr: fe80::216:76ff:feb2:eb27/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:104567 errors:0 dropped:0 overruns:0 frame:0
TX packets:1424 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8546472 (8.1 MiB) TX bytes:197747 (193.1 KiB)
Interrupt:169 Base address:0x6200

eth1 Link encap:Ethernet HWaddr 00:11:95:1F:02:09
inet addr:192.168.150.20 Bcast:192.168.150.255 Mask:255.255.255.0
inet6 addr: fe80::211:95ff:fe1f:209/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:27495 errors:0 dropped:0 overruns:0 frame:0
TX packets:50130 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6697016 (6.3 MiB) TX bytes:4488642 (4.2 MiB)
Interrupt:177 Base address:0x8100

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1203 errors:0 dropped:0 overruns:0 frame:0
TX packets:1203 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2857788 (2.7 MiB) TX bytes:2857788 (2.7 MiB)

Here I will use network interface eth0 for the public network and eth1 is for the private network. So, on racnode-1 IP address on public network will be 192.168.1.91 and IP address on private network will be 192.168.150.30. Similarly on racnode-2 IP address on public network will be 192.168.1.92 and IP address on private network is 192.168.150.20

3)On each node in the cluster, determine a third IP address that will serve as a virtual IP address which must not use currently in the network and its subnet must be same as on public network. I determine virtual IP address for racnode-1 as 192.168.1.95 and on racnode-2 as 192.168.1.96

4)After completing the network configuration, the IP address and network interface configuration should be as follows,
Node(Hostname) Node Name Type IP Address
racnode-1 racnode-1 public 192.168.1.91
racnode-1 racnode-1-vip virtual 192.168.1.95
racnode-1 racnode-1-priv private 192.168.150.30
racnode-2 racnode-2 public 192.168.1.92
racnode-2 racnode-2-vip virtual 192.168.1.96
racnode-2 racnode-2-priv private 192.168.150.20


5)In all nodes modify /etc/hosts file so that they contain the host IP addresses, virtual IP addresses, and private network IP addresses from both nodes in the cluster, as follows,
[root@racnode-2 ~]# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.1.91 racnode-1
192.168.1.95 racnode-1-vip
192.168.150.30 racnode-1-priv

192.168.1.92 racnode-2
192.168.1.96 racnode-2-vip
192.168.150.20 racnode-2-priv


6)Verify the network configuration by using the ping command to test the connection.
ping -c 3 racnode-2
ping -c 3 racnode-2-vip
ping -c 3 racnode-2-priv

ping -c 3 racnode-1
ping -c 3 racnode-1-vip
ping -c 3 racnode-1-priv


Note that in this stage ping to the virtual ip address will fail until after Oracle Clusterware is installed and running. But ping to your private and public network address should work.

How to change the hostname in Linux

There are several ways by which we can change the hostname in linux. The process may vary based on distribution of linux.

To see your system current host name use,
# hostname
# cat /bin/hostname


On debian system you can use,
# uname -n
To see the fully qualified domain name if you have use,
#hostname –fqd

Temporary Change hostname
To change the hostname temporary issue,
#hostname new_name which will change your current hostname to the new_name. You will most probably need to exit the current shell in order to see the change in your shell prompt. However changes in this way is not persistent because if the system reboot it will show the hostname values from a particular field.

Permanently change hostname of Debian Linux
To change the hostname of debian linux distribution edit the file /etc/hostname as debian based systems use the file /etc/hostname to read the hostname of the system at boot time and set it up using the init script /etc/init.d/hostname.sh

So, to change it in debian issue,
#vi /etc/hostname
and put a new entry there.

After changing to make it active run the script /etc/init.d/hostname.sh
# /etc/init.d/hostname.sh

Use sysctl to change the hostname both in RHL and debian
This process can be used both debian and red hat linux distribution. In this process use sysctl to change the variable kernel.hostname.

To read the current hostname issue,
#sysctl kernel.hostname

To change the current hostname to new_name issue,

#sysctl kernel.hostname=new_name

Change the hostname permanently in RHL Linux
This system is avilable for RHL distribution. Not apply for debian distribution. In this system change the network configuration file /etc/sysconfig/network in RHL.
Edit the /etc/sysconfig/network and change the hostname parameter to the new_name.
#vi /etc/sysconfig/network
HOSTNAME=new-host-name

Restart the network which relied on the hostname. You can perform reboot here.
# service network restart
Or,
#/etc/sysconfig/network-scripts/ifcfg-eth0

You may need to restart your console.
#init 3
#init 5


Related Documents
Vi Command in Unix.
Terminate Process on UNIX
umask and permission in unix.
How to change/configure IP Address on Linux/ Fedora /Ubuntu
Copy files between Unix and Windows with rcp
Screen -A very useful unix tool to work with remote system
Different ways to take Screenshot on Linux
Memory Usage of Solaris Operating System

Pre-Installation RAC environement setup check with CVU

Checking the Network Setup with CVU
To verify node connectivity among all nodes in your cluster use following syntax as an oracle user,
/mount_point/crs/Disk1/cluvfy/runcluvfy.sh comp nodecon -n node_list [-verbose]

If you have two nodes node1 and node2 and your mountpoint is /dev/cdrom then enter following command.
/dev/cdrom/crs/Disk1/cluvfy/runcluvfy.sh comp nodecon -n node1,node2 -verbose

Checking the Hardware and Operating System Setup with CV
As an oracle user use the following command syntax to start Cluster Verification Utility (CVU) stage verification to check hardware and OS setup:

/mountpoint/crs/Disk1/cluvfy/runcluvfy.sh stage –post hwos –n node_list [-verbose]
If you have two nodes node1 and node2 and your mountpoint is /dev/cdrom then enter following command,
/dev/cdrom/crs/Disk1/cluvfy/runcluvfy.sh stage –post hwos –n node1,node2

Checking the Operating System Requirements Setup with CVU
To check if your system meets the operating system requirement pre-installation tasks use the following syntax,
/mountpoint/crs/Disk1/cluvfy/runcluvfy.sh comp sys -n node_list -p {crs|database}
-osdba osdba_group -orainv orainv_group -verbose


If you have two nodes node1 and node2 and your mountpoint is /dev/cdrom with the OSDBA dba and Oracle inventory group oinstall then enter following command,
/dev/cdrom/crs/Disk1/cluvfy/runcluvfy.sh comp sys -n node1,node2 -p crs -osdba crs -orainv oinstall

How to Avoid mozilla firefox to hang to load webpage

In my system mozilla firefox browser often hangs initially while loaded serveral tabbed web page. In fact on my debian version linux the program is iceweasol. If the tabbed browser load is higher or if there is many tabbed webpage then while initially loading the webpage mozilla get stuck and I can't work with it. Though I kill by using kill -9 everytime and try to load again it hangs. It is really cumbersome work.

The extra work if you run program as root and the later pid of process is not 1 then while killing process as root at exists as root user and goes as normal user. So again I have to logon as root and have to run firefox. But if later process id is 1 then it remains as a root user.

Like,
debian:/home/Arju# kill -9 4502 4495
Arju@debian:~$ ----It switches to normal user

debian:/home/Arju# kill -9 4447 1
debian:/home/Arju# -----As later process id is 1 so does not exit root user.

In order to avoid the problem while loading your mozilla firefox browser with multiple tabbed page just click some tabs and select the stop button. Now firefox will load the other page. And after loading successfully other pages you can reload pages that you stopped.

Related Documents
Terminate Process on UNIX

How to configure(modify,see) Kernel Parameters in Linux

Kernel Parameters, Recommended Values to install Oracle and Associated Files
1)semmsl semmns semopm semmni: Corresponding recommended values to install oracle are 250 32000 100 128 or over and associated the default settings of these kernel parameter are in file /proc/sys/kernel/sem

2)shmmax:
Recommended value to install oracle is the half the size of physical memory (in bytes) or over. The default setting of this kernel parameter is in /proc/sys/kernel/shmmax

3)shmmni:
Recommended value to install oracle is 4096 or over. The default setting of this kernel parameter is in /proc/sys/kernel/shmmni

4)shmall: Recommended value to install oracle is 2097152 or over. The default setting of this kernel parameter is in /proc/sys/kernel/shmall

5)ip_local_port_range: Recommended value to install oracle is Minimum: 1024 and Maximum: 65000 or over. The default setting of this kernel parameter is in /proc/sys/net/ipv4/ip_local_port_range

6)rmem_default: Recommended value to install oracle is 1048576 or over. The default setting of this kernel parameter is in /proc/sys/net/core/rmem_default

7)rmem_max:
Recommended value to install oracle is 1048576 or over. The default setting of this kernel parameter is in /proc/sys/net/core/rmem_max

8)wmem_default: Recommended value to install oracle is 262144 or over. The default setting of this kernel parameter is in /proc/sys/net/core/wmem_default

9)wmem_max: Recommended value to install oracle is 262144 or over. The default setting of this kernel parameter is in /proc/sys/net/core/wmem_max

How to see the current value of the kernel parameters

1)semmsl, semmns, semopm, and semmni: # /sbin/sysctl -a | grep sem

2)shmall, shmmax, and shmmni: # /sbin/sysctl -a | grep shm

3)ip_local_port_range: # /sbin/sysctl -a | grep ip_local_port_range

4)rmem_default, rmem_max, wmem_default, and wmem_max: # /sbin/sysctl -a | grep net.core


How to modify the Kernel Parameter in Linux
1)Modifying /etc/sysctl.conf startup file.
With any text editor you can edit /etc/sysctl.conf file and then either put of change the entry like,
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=262144
net.core.wmem_max=262144


Or to change a certain parameter like kernel.shmmax you can insert it in the /etc/sysctl.conf like,
# echo "kernel.shmmax=2147483632" >> /etc/sysctl.conf

Note that settings in /etc/sysctl.conf is persistent but not immediate affect. That is whenever your system will restart then it will in effect. In order the affect the setting of the value immediately use,
/sbin/sysctl -p -On Red Hat Linux system.

On SUSE linux to set persistently use
# /sbin/chkconfig boot.sysctl on

2)Modifying /proc file system.
If you wanted to dynamically alter the value of SHMMAX without rebooting the machine, you can make this change directly to the /proc file system. This command can be made permanent by putting it into the /etc/rc.local startup file:
Like,
debian:/home/Arju# echo "6553" > /proc/sys/fs/file-max

3) Using sysctl command


With sysctl command you can also change the value of SHMMAX:

# sysctl -w kernel.shmmax=2147483228

Configure server to install Oracle RAC

Configuring Operating System Users and Groups in All Nodes
On windows you don't need to create separate user to install oracle or don't need to create groups. OUI automatically do it. However on unix you must create the following operating system groups are required if you are installing Oracle RAC for the first time.

•The OSDBA group (typically, dba) -This is the OS user who has SYSDBA privilege.

•The Oracle Inventory group (typically, oinstall) -This group owns all Oracle software installed on the system.

The following operating system users are required

•A user that owns the Oracle software (typically, oracle).

•An unprivileged user (for example, the nobody user on Linux systems).

Create the required groups and users
Do this steps on all nodes of your cluster.
As a root user,

/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
useradd -u 200 -g oinstall -G dba -d /home/oracle -r oracle

Change the password by,
passwd oracle

Verify the user by,
id oracle

Note that in this example in stead of using node1 use your original node name and instead of using node2 use your original node name.

Configuring SSH on All Cluster Nodes
When installing Oracle RAC on UNIX and Linux platforms, the software is installed on one node, and OUI uses secure communication to copy the software binary files to the other cluster nodes. OUI uses the Secure Shell (SSH) for the communication.

So you must have configured SSH on all nodes.

•To configure SSH, you must first create Rivest-Shamir-Adleman (RSA) keys and Digital Signature Algorithm (DSA) keys on each cluster node. After you have created the private and public keys, you copy the keys from all cluster node members into an authorized keys file that is identical on each node.

Generating RSA and DSA Keys
1)Log on as oracle user.

2)See whether .ssh directory exist or not. If does not exist then create one.
$ mkdir ~/.ssh
$ chmod 700 ~/.ssh


3)Create the RSA-type public and private encryption keys by,
/usr/bin/ssh-keygen -t rsa
This command creates the public key in the /home/oracle/.ssh/id_rsa.pub file and the private key in the /home/oracle/.ssh/id_rsa file.

4)Create the DSA type public and private keys.
/usr/bin/ssh-keygen -t dsa
This command creates the public key in the /home/oracle/.ssh/id_dsa.pub file and the private key in the /home/oracle/.ssh/id_dsa file.

5)Repeat step 1 through 4 in all the nodes.

Adding the Keys to an Authorized Key File
1)Go to .ssh directory
$ cd ~/.ssh

2)Add the RSA and DSA keys to the authorized_keys files.
$ cat id_rsa.pub >>authorized_keys
$ cat id_dsa.pub >>authorized_keys


3)Using SCP copy the authorized_keys file to the oracle user .ssh directory on a remote node.
scp authorized_keys node2:/home/oracle/.ssh/

4)Using SSH, log in to the node where you copied the authorized_keys file, using the passphrase you created. Then change to the .ssh directory, and using the cat command, add the RSA and DSA keys for the second node to authorized_keys file.
ssh node2
Enter passphrase for key '/home/oracle/.ssh/id_rsa':
cd ~/.ssh
cat id_rsa.pub >> authorized_keys
cat id_dsa.pub >> authorized_keys


5)If you have more than 2 nodes in your cluster, repeat step 3 and step 4 for each node you intend to add to your cluster. Copy the most recently updated authorized_keys file to the next node, then add the public keys for that node to the authorized_keys file.

6)After updating the authorized_keys file on all nodes, use SCP to copy the complete authorized_keys file from the last node to be updated to all the other cluster nodes, overwriting the existing version on the other nodes. For example,
scp authorized_keys node1:/home/oracle/.ssh/

Configure SSH User Equivalency on Cluster Member Nodes
1)Log on as a oracle user.

2)Start the SSH agent and load the SSH keys into memory.
$ exec /usr/bin/ssh-agent $SHELL
$ /usr/bin/ssh-add


3)Complete the SSH configuration by using the ssh command to retrieve the date on each node in the cluster.
$ ssh node1 date
$ ssh node2 date


Related Documents

Authentication failed!null

Problem Description After upgrading the database containing dbconsole's repository whenever you try to logon to Enterprise Manager or DBCONSOLE it succeed but return with error,

Authentication failed!null

In the trace file I saw the following entry,
ERROR = ORA-04063: package body "SYSMAN.MGMT_USER" has errors
ORA-06508: PL/SQL: could not find program unit being called: "SYSMAN.MGMT_USER"
ORA-06512: at "SYSMAN.SETEMUSERCONTEXT", line 5
ORA-06512: at line 1

Cause of The Problem
This error occured due to following reasons,

The package MGMT_USER is invalid in the database.

Other Invalid objects under SYSMAN schema remain after the upgrade of the database.

Missing privileges for SYSMAN user which prevents the compilation of MGMT_USER
package, and other packages aswell.

Solution of The Problem
Grant the required privilege to the SYSMAN user,
GRANT EXECUTE ON SYS.DBMS_AQ TO SYSMAN;
GRANT EXECUTE ON SYS.DBMS_JOB TO SYSMAN;
GRANT EXECUTE ON SYS.DBMS_LOB TO SYSMAN;
GRANT EXECUTE ON SYS.DBMS_LOCK TO SYSMAN;
GRANT EXECUTE ON SYS.DBMS_REDEFINITION TO SYSMAN;
GRANT EXECUTE ON SYS.DBMS_RLS TO SYSMAN;
GRANT EXECUTE ON SYS.DBMS_SHARED_POOL TO SYSMAN;
GRANT SELECT ON SYS.USER_TAB_COLUMNS TO SYSMAN;

And try to reconnect to dbconsole.

Related Documents
Login to Dbconsole, Authentication failed!null Returned

Tuesday, August 12, 2008

Requirements to check before install Oracle RAC

1)Checking the Hardware Requirements
•Physical memory: At least 1GB RAM.

•Swap space: If RAM is between 1 GB and 2 GB then make swap space to 1.5 times of the size of RAM.
If RMAN is more than 2GB then make swap space to the equal of the size of the RAM.

•Temporary space: At least 400 MB. Typically in /tmp directory.

•Processor type (CPU): Need to be certified with the version of the Oracle software being installed.

•Hard Disk Space: 1.5 GB for oracle database home directory+1.5GB for the ASM home directory+120 oracle clusterware software installation+Two Oracle Clusterware components OCR 256 MB each, or 512 MB total disk space+Three Oracle Clusterware components Voting Disk 256 MB each, or 768 MB total disk space.

•All the nodes in the cluster must have same hardware architecture. However can have machines of different speeds and size in the same cluster.

On *nix system you can check hardware components as follows.

•To determine physical RAM size, # grep MemTotal /proc/meminfo

•To determine the configured swap space, # grep SwapTotal /proc/meminfo

•To determine the amount of disk space available in the /tmp directory, # df -k /tmp

•To determine free disk space on the system, #df -h or #df -k

•To determine whether the system architecture, # grep "model name" /proc/cpuinfo

Checking the Network Requirements
Network Hardware Requirements
•One private interconnect is needed for Oracle Custerware for the use to synchronize each instance's use of the shared resources and for Oracle RAC to interconnect to transmit data blocks that are shared between the instances. Thus each node need at least two network interface cards, or network adapters. One adapter is for the public network and the other adapter is for the private network

•The public interface names associated with the network adapters for each network must be the same on all nodes, and the private interface names associated with the network adaptors should be the same on all nodes. For example if in server1/node1, eth0 is the public interface then on server2/node2 eth0 must be the public interface.

•For the public network, each network adapter must support TCP/IP.

•For the private network, the interconnect must support the user datagram protocol (UDP) using high-speed network adapters and switches that support TCP/IP.

•Note UDP is the default interconnect protocol for Oracle RAC, and TCP is the interconnect protocol for Oracle Clusterware.

•For the private network, the endpoints of all designated interconnect interfaces must be completely reachable on the network. All nodes must be accessible between through private network. You can check the reachability by ping command.

Network Parameter Requirements

If NFS is used for the shared storage, then you must set the values for the NFS buffer size parameters rsize and wsize to at least 16384. Oracle recommends that you use the value 32768.
You can set the value by updating the /etc/fstab file on each node with an entry similar to the following,

clusternode:/vol/DATA/oradata /home/oradata/app nfs
rw,bg,vers=3,tcp,hard,nointr,timeo=600,rsize=32768,wsize=32768,actimeo=0 1 2


IP Address Requirements

•You must have at least three IP addresses available for each node
1.An IP address for the public interface. Interface name should be the name of the node name.
2.An IP address for the private interface. Interface name should be hostname-priv.
3.One virtual IP address with an associated network name. Interface name should be hostname-vip.

•The VIP is on the same subnet as your public interface and it address will be not used currently in the network.

•For public and virtual addresses register with an associated network name in DNS. If you do not have an available DNS, then record the all network names and interface names in the system hosts file, /etc/hosts.

•Identify the interface names and associated IP addresses for all network adapters by running the following command on each node:

# /sbin/ifconfig


Node Time Requirements
Ensure that each member node of the cluster is set as closely as possible to the same date and time. Oracle strongly recommends using the Network Time Protocol (NTP) feature of most operating systems for this purpose.

Verifying the Installed Operating System and Software Requirements
•To determine which distribution and version of Linux is installed, run the following command as the root user:
#cat /etc/issue

•The Linux kernel is updated to fix bugs. These kernel updates are referred to as erratum kernels or errata levels. To determine if the required errata level is installed, use the following procedure as the root user:

#uname -r