Sunday, September 28, 2008

USER DEFINED DEVICE NAMES

I got a chance to go thru this link which dealt with the user defined device names in linux.
This red hat manual entry can be found HERE

A gist of this manual entry is presented here:

1. The /dev/ directory contains virtual files that represent devices. Device names for IDE devices begin with hd, and device names for SCSI devices begin with sd.For example, /dev/hda is the first IDE hard drive, /dev/hdb is the second IDE hard drive.If the device name is followed by a number, the number represents the partition number. For example, /dev/hda1 represents the first partition on the first IDE drive

2. Configuration: User-defined device names can be added based on the device name, partition name, or the UUID of the drive.
[a]: syntax to add a user-defined device name for a storage device
devlabel add -d -s
[b]: To add a device name for a device based on a UUID:
devlabel add -u -s
[c]: To use devlabel to retrieve the UUID for a device:
devlabel printid -d
[d]: To remove the symbolic link
devlabel remove -s

[e]: To determine the status of the devlabel symbolic links:
devlabel status

3. FOR HOTPLUG Devices:
A program called hotplug performs actions when a system event, such as hardware being added or removed, takes place while the system is running. For example, if a USB hard drive or a USB media card reader is attached to the system, hotplug notifies users by logging a message in the system log file (/var/log/messages) and loads the proper kernel modules so the device works.

After inserting the USB card reader into the USB port of the computer, issue the following command as root (where /dev/sda1 is the device name for the media card and /dev/usbcard is the user-defined device name to use:
devlabel add -d /dev/sda1 -s /dev/usbcard --automount
This commands adds an entry for the mount point to /etc/sysconfig/devlabel and creates a symbolic link from /dev/usbcard to /dev/sda1.The --automount option to devlabel specifies that the device should be automatically mounted when devlabel restarts if an entry for it is located in /etc/fstab and if the device exists (a device with the same UUID is found).

The updfstab is a program that scans the IDE and SCSI buses for new devices and adds entries to /etc/fstab for them if entries do not already exist. It also adds entries for USB devices since they appear as SCSI devices.

When a USB device is inserted, hotplug runs the updfstab program, which adds an entry to /etc/fstab for the storage device (such as the media card) if it exists. (If a card reader without a card in it is inserted, an entry is not added.) The line added contains the actual device name (such as /dev/sda1) and the kudzu option. The kudzu option tells Kudzu [1] that it can remove the line if the device does not exist. Since the line is required by devlabel, the kudzu option must be removed so the line remains in the file. Also change the device name to the devlabel device name (such as /dev/usbcard) and create the mount point (such as /mnt/usbcard).

Because of --automount, when devlabel is restarted, the storage media in the USB card reader device is mounted in /mnt/usbcard when the USB device is plugged into the computer. The trick is that when the USB card reader is plugged into the computer, the card must already be in the reader. If not, devlabel can not find the storage device, and thus it can not automatically mount it.

If the USB card reader is already plugged in without a card, when the card is inserted, run the command devlabel restart as root to mount the media card.






Wednesday, September 24, 2008

Oracle 10.1.0.3 installation to Oracle 10.1.05 upgrade patchset

While upgrading to 10.1.0.5, we need to stop the cssd.bin .
How do we do it:
-goto /etc/init.d directory
-say ./init.cssd stop
it will stop the css demon saying
Shutting down CRS demon
Shutting down EVM demon
Shutting down CSS demon.
go back to continue with patchset installation ..

finish.

Tuesday, September 16, 2008

RAC/CRS installation

Here we are continuing with the RAC installation on an installed CRS.
We say that its a two node RAC installation. let it be stamy04 and stamy05
1. Before going for RAC installation to confirm if crs is present, we can just do
'ps -ef |grep crs'
Searching for the process crs if its running. we get the bin location of the installed crs.
Go there and check for crs_stat and it lists the status of the crs. If it lists process like LISTENER and .gsd .ora files we know our crs is up and working.
Alternative in the bin directory go for ./crsctl check crs
if things are fine you find ::::
CSS appears healthy
CRS appears healthy
EVM appears healthy

Can go to other node to confirm the same situation there also.

We can view RAC as two standalone databases installation on 2 nodes( i am using a 2 node cluster). So it will have three standard steps:
1. db install(software install)
2. netca
3. dbca

db install command will be very similar to the silent command fired for a standalone installation. we just have to take care to add few other parameters.
a) first goto the corrosponding response file (.rsp) file. and edit at the CLUSTER_NODES location. CLUSTER_NODES= { "node1","node2"} add all nodes of your cluster to it.
b) fire the command . now i have a problem that i cannot enter the node1 or node2 but have to fire the command from a third location, so i will use a ssh connection for this.
The command goes as:
ssh @node1 /runInstaller -responseFile FROM_LOCATION=/stage/products.xml ORACLE_HOME= $ORACLE_HOME(oracle home path) ORACLE_HOME_NAME= -silent -ignoreSysPrereqs -nowait -waitForCompletion -noConfig -clusterware oracle.crs, -crsLocation

So the only addition from normal silent installation is clusterware oracle.crs, and crslocation.

c) Additionally if one wants to explore all the options provided with the runinstaller just go

/runInstaller -help

and you will find all options and their meanings. there are things like -cfs or -local which might confuse and the usage will depend on experience.

d) Problem comes with Netca as you dont have the -help option to find out what arguments to give.
here i am pasting something i got from some blog. which will help for silent installation of netca and for majority it would of some help.

THE LINK FOR THIS BLOG IS

http://www.pythian.com/blogs/1045/oracle-silent-mode-part-7-installing-an-111-rac-database

Install the Oracle RAC Database Base Release

Once the clusterware has been installed, installing RAC Database software is very similar to installing a non-RAC database software, you just need to specify which servers you want the software to be installed on. The first step is downloading the software and unzipping it:

$ unzip linux.x64_11gR1_database.zip
$ cd database
$ export DISTRIB=`pwd`

To install the database software, you don’t need to modify the response files. You only have to run a command like the one below, in the case of an Enterprise Edition:

export DISTRIB=`pwd`

runInstaller -silent \
-responseFile $DISTRIB/response/enterprise.rsp \
FROM_LOCATION=$DISTRIB/stage/products.xml \
ORACLE_BASE=/u01/app/oracle \
ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1 \
ORACLE_HOME_NAME=ORADB111_Home1 \
CLUSTER_NODES={"rac-server1","rac-server2",\
"rac-server3","rac-server4"} \
n_configurationOption=3 \
s_nameForDBAGrp="dba" \
s_nameForASMGrp="dba"

Or in the case of a Standard Edition:

runInstaller -silent                                   \
-responseFile $DISTRIB/response/standard.rsp \
FROM_LOCATION=$DISTRIB/stage/products.xml \
ORACLE_BASE=/u01/app/oracle \
ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1 \
ORACLE_HOME_NAME=ORADB111_Home1 \
CLUSTER_NODES={"rac-server1","rac-server2"} \
n_configurationOption=3

As you can see, only a few parameters differ from the non-RAC database installation described in Part 1 of this series:

  • CLUSTER_NODES contains the list of cluster nodes you want to install the database software on.
  • FROM_LOCATION is used when the response file doesn’t point to the location of the products.xml file.
  • s_nameForDBAGrp, s_nameForASMGrp, and s_nameForOPERGrp are used to specify non-default groups for SYSDBA, SYSASM, and SYSOPER.

Once the software is installed, you have to execute the root.sh script from the ORACLE_HOME. Connect as root on every server and run:

rac-server1# /u01/app/oracle/product/11.1.0/db_1/root.sh
rac-server2# /u01/app/oracle/product/11.1.0/db_1/root.sh
rac-server3# /u01/app/oracle/product/11.1.0/db_1/root.sh
rac-server4# /u01/app/oracle/product/11.1.0/db_1/root.sh

Install the Oracle RAC database Patch Set

The first 11.1 Patch Set is not available at the time of this writing.

Configure the Listeners

The fastest way to create and configure the listeners is to use NETCA as below:

$ export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
$ export PATH=$ORACLE_HOME/bin:$PATH
$ netca /silent \
/responsefile $ORACLE_HOME/network/install/netca_typ.rsp \
/nodeinfo rac-server1,rac-server2,rac-server3,rac-server4

Unlike other tools, NETCA uses the “/” character instead of “-” for its flags. With 11.1, the DISPLAY environment variable can stay empty.

Configure Automatic Storage Management

If you plan to use ASM from the newly installed ORACLE_HOME or another one you’ve installed earlier, you can use DBCA to configure it in silent mode. The syntax is the same as the 10.2 asm configuration syntax:

$ dbca -silent                   \
-nodelist rac-server1,rac-server2,\
rac-server3,rac-server4 \
-configureASM \
-asmSysPassword change_on_install \
-diskString "/dev/sd*" \
-diskList "/dev/sde,/dev/sdf" \
-diskGroupName DGDATA \
-redundancy EXTERNAL \
-emConfiguration NONE

Create a RAC Database with DBCA

You can use DBCA again to create the RAC database. The syntax is the same as that explained in the 10.2 RAC post:

$ dbca -silent                             \
-nodelist rac-server1,rac-server2,\
rac-server3,rac-server4 \
-createDatabase \
-templateName General_Purpose.dbc \
-gdbName ORCL \
-sid ORCL \
-SysPassword change_on_install \
-SystemPassword manager \
-emConfiguration NONE \
-storageType ASM \
-asmSysPassword change_on_install \
-diskGroupName DGDATA \
-characterSet WE8ISO8859P15 \
-totalMemory 500
================================================================

Back to business:
1.This is a guide to 11g installation. So you can avoid ORACLE_BASE which was not there in earlier version. Other options will work as possible.
2. From where did ASM come from?
RAC can be a standalone database on the various nodes or it can be on ASM which has disks on various nodes to manage data. A more effective way of doing things!!
So if you have ASM below the RAC setup do see the installations for ASM
else forget it and come along with me..

IF its so well documented why to repeat things. My problem is i am using a third machine to remotely fire all commands and i do not find a solution how to fire netca commands because first we need to set $ORACLE_HOME env.

Finally some R n D we get the solution to the above problem as:
user@machine_name 'export ORACLE_HOME=$ORACLE_HOME; $ORACLE_HOME/bin/netca /orahome $ORACLE_HOME /instype custom /inscomp client,oraclenet,javavm,server,ano /insprtcl tcp,tcps /cfg local /authadp NO_VALUE /nodeinfo stamy04,stamy05 /responseFile $ORACLE_HOME/network/install/netca_typ.rsp /silent'

So for us a ";" works!!! :)

The DbCa works as illustrated in the blog i have named earlier or the text written above w.r.t blog.
except for a cliche. The problem here is that the dbca is unable to recognize the shared location as a shared location. Here we took the two nodes and ran a simple program which just engages mounting and dismounting the shared location and touching the files. So that the dbca could figure out that their is a shared location which is engaged in some process. and thus knows the shared location.

On a shell prompt
for EACH in `seq 1 80`
do
each $EACH
mount -o remount shared
tuch shared/X$EACh
sleep 5
rm shared/X$EACH
we tried on both machine and then from a third machine gave a try to dbca onto the local node.
Hence RAC installation compeletes


Detecting shared locations in linux

first to find out the conditions about  all location, we can just fire a 'mount' command.
Now i have a case where i have to install a Real Application cluster on a 2 node CRS installation. The CRS installation has a shared space between nodes. To find out that we just need to go to the directory
/etc and vi the file exports.

The details are clear about the location which is being shared by the two nodes.

Monday, September 1, 2008

Interview related:Hard Link and soft Links.

1. hard link and soft link: the best place to get it exactly and the motivation behind its differentiation is : http://www.ugrad.cs.ubc.ca/~cs219/CourseNotes/Unix/commands-links.html

A bit from this site is as follows:

A link is simply a way to refer to the contents of a file. There are two types of links: Hard links: a hard link is a pointer to the file's i-node. For example, suppose that we have a file a-file.txt that contains the string "The file a-file.txt":
% cat a-file.txt
The file a-file.txt
%

Now we use the ln command to create a link to a-file.txt called b-file.txt:

% ls
./ ../ a-file.txt
% ln a-file.txt b-file.txt
% ls
./ ../ a-file.txt b-file.txt

The two names a-file.txt and b-file.txt now refer to the same data:

% cat b-file.txt The file a-file.txt %

If we modify the contents of file b-file.txt, then we also modify the contents of file a-file.txt and vice versa

Soft links (symbolic links): a soft link, also called symbolic link, is a file that contains the name of another file. We can then access the contents of the other file through that name. That is, a symbolic link is like a pointer to the pointer to the file's contents. For instance, supposed that in the previous example, we had used the -s option of the ln to create a soft link:

% ln -s a-file.txt b-file.txt

Let us first add another symbolic link using the -s option:

% ln -s a-file.txt Symbolicb-file.txt.If we change the file Symbolicb-file.txt, then the file a-file.txt is also modified.
If we remove the file a-file.txt, we can no longer access the data through the symbolic link Symbolicb-file.txt.
The link Symbolicb-file.txt contains the name a-file.txt, and there no longer is a file with that name. On the other hand, b-file.txt has its own pointer to the contents of the file we called a-file.txt, and hence we can still use it to access the data.
IMPORTANT::::The  most significant drawback is  that  hard links cannot  be created to
link a file from one file system to another file on another file system. A Unix file
structure hierarchy can consist of several different file systems (possibly on several
physical disks). Each file system maintains its own information regarding the internal
structure of the system and the individual files on the system. Hard links only know this
system-specific information, which make hard links unable to span file systems. Soft
links, on the other hand, know the name of the file, which is more general, and are able
to span file systems.