Tuesday, November 11, 2008

neopi, oracle on linux...10gr2..and my birthday.

oh, and today is my birthday. yay.

so, i finally got around to writing about this. I succesfully got ora 10gr2 installed on RHEL5. thanks to the help of gathering dependencies by this free product called NEOPI. Its pretty nice...just a kind of automatic dependency generator, and it runs some other checks too, but it helped solve the issues I was running into with the misplaced/mislinked libraries. hopefully that puts the RHEL5 Oracle10gr2 fears to rest...and I can move on.

Thursday, November 6, 2008

Oracle 10gR2 on RHEL5

Preamble

This manual is directed show how to install Oracle database 10g on RedHat Enterprise Linux 5. The article show the process from system administrator point of view ad try to simplicity most of the tasks not related to system administration will in deep explanation of tasks and impacts of them. Be aware RHEL 5 x86 is not supported platform (in this moment) for Oracle 10g so when you ask questions in metalink don't be surprised get no answer. According to the product documentation supported platforms for x96 are RHEL AS/ES 3.4 or later, RHEL 4, SUSE Linux Enterprise Server 9.0SP2 or later and Asianux 1.0 and 2.0. Additionally you can't expect reliability from this system for production environment.

Hardware requirements

From documentation you read Oracle 10g need at least 1 gigabyte of memory, but the absolute minimum is 512 MB. OK, with so little memory you are on the bottom line for required shared memory, but database can start. for testing 768 MB sound's much better. Similar is the situation with swap. Everything will work fine with only 1024 MB of swap.

Software requirements

List of packages you will need for install Oracle 10g on RHEL include

binutils
compat-db
compat-libstdc++
control-center
gcc
gcc-c++
glibc
glibc-common
gnome-libs
libstdc++
libstdc++-devel
make
pdksh (RHEL 5 ships with ksh instead)
sysstat
xscreensaver
setarch
libXp (to start runInstaller)

Preinstalation tasks

Let's create users and groups for installation

# groupadd dba
# groupadd oinstall
# useradd -G dba -d /home/oracle -g oinstall oracle
# passwd oracle

Next create filesystem for oracle files and database. Do not forget to create appropriate changes in /etc/fstab to mount this filesystem on startup. In documentation of product is mentioned to use only RAID10 array(s) and for production is wise to use hardware based arrays, but here we just play and any filesystem and volume will be OK. Transfer files to the machine and extract zip's somewhere. I write files, because i recommend for installation not only Oracle database server, but 10g Release 2 (10.2.0.3) Patch Set 2 ever only for testing and playing. For more info about the the patch set read document 316900.1 and download file p5337014_10203_LINUX.zip from metalink. Now is time to login on the machine as root to set some parameters in linux kernel and operating system

- check if FQHN exist in /etc/hosts
- check the id of oracle user to ensure oinstall is primary group of user and user is member of group dba
- check for existence of user nobody
- check and set if need the parameters for semaphors:
semmsl - 250
semmns - 32000
semopm - 100
semmni – 128

Semaphores explanation

semmsl – maximum number of semaphores per semaphore identifier. Should be increased carefully because very big number will eat memory not used later
semmns - maximum number of semaphores in the system. Size it carefully because of above reason
semopm - Define maximum number of semaphore operations per system call
semmni – maximum number of semaphores per semaphore identifier. Do not increase it over needed limit, because of waste of memory
if you have attached to the server additional hardware read carefully documentation of drivers for this hardware, because for example some drivers for FC controllers need additional semaphors to be set per controller


- check and set if need the parameters for shared memory
shmall 2097152
shmmax Half the size of physical memory (in bytes) or current value if bigger
shmmni 4096

Shared memory explanation

shmall - maximum number of shared memory pages. If you set it to too low value can slowdown any program usng shared memory
shmmax – maximum size of shared memory segment that can be allocated in the memory. For servers with lots of memory can be increased to 80% of memory to avoid shared memory fragmentation
shmmni – maximum number of segments. It's good idea to change it only by vendor recommendation


- check and set if need the parameters for maximum number of file handlers, supported by system
file-max 65536

- check and set if need the parameters for network
ip_local_port_range Minimum:1024 Maximum:65000
rmem_default 1048576
rmem_max 1048576
wmem_default 262144
wmem_max 262144

Network setting explanation

ip_local_port_range – define full range of local ports in Linux, normally upper limit is 32000
rmem_default Default Receive Window
rmem_max Maximum Receive Window
wmem_default Default Send Window
wmem_max Maximum Send Window



So you can add you /etc/sysctl.conf file something like

kernel.shmall = 2097152
kernel.shmmax = 2147483648
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 = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144

and execute

# sysctl -p

Next is time to set some environment variables for oracle user. Do not forget to put the in shell profile for oracle user. They should look's like

ORACLE_BASE=/home/oracle
ORACLE_HOME=$ORACLE_BASE/product/10.2.0
ORACLE_SID=test01

On this point it is very good idea to check the available diskspace in directory where will be installed oracle – you will need 4 GB average for software and database. To start successfully installer it's need to edit /etc/redhat-release and to change release from 5 to 4. Do not forget to return the value back later, otherwise you will be no able to update your server. Next is time to run runInstall. You will need running X server, because interactive installation need graphic display

Actual installation

On the first step we choose advanced installation to have better control over the packages and options to be installed on the server. Later if it's need we can install additional packages almost seamless. Our target is Enterprise Server as more powerful and complex. on the next step Oracle Installer check for prerequisites for installation as physical memory, swap, networking, environment variables, etc. If you get warning about the amount of memory you can skip it without any problem. Next we will install only software without create new database. There is program, named dbca – database configuration assistant which one can help to create new database. Then read the summary screen and go back to change some packages you do not need or other parameter. It's out of scope of this document to discuss the idea and purpose of packages you can find in oracle database. Next we press install and wait a lot, because of very long process of installation. On the bottom part of the screen you can see the path to log file for current installation and you can inspect it if you get some errors or just from curiosity. In on of the stages of installation (almost on the end) you should execute 2 scripts as root user. And at the end we have installed Oracle database 10g. If you have patch mentioned above installation process for patch is similar: runInstaller....

Et voila, we are ready to play and test oracle on our RHEL 5 server :-)

Tuesday, November 4, 2008

tar over ssh to pipe files..

I didn't have enough space on a vm i just built to copy all the data over as a tar and then untar it, so I went on a search...I found this and it worked VERY well:

From: http://www.cyberciti.biz/faq/howto-use-tar-command-through-network-over-ssh-session/

Q. How do I use tar command over secure ssh session?

A. The GNU version of the tar archiving utility (and other old version of tar) can be use through network over ssh session. Do not use telnet command, it is insecure. You can use Unix/Linux pipes to create actives. Following command backups /wwwdata directory to dumpserver.nixcraft.in (IP 192.168.1.201) host over ssh session.

The default first SCSI tape drive under Linux is /dev/st0. You can read more about tape drives naming convention used under Linux here.

# tar zcvf - /wwwdata | ssh root@dumpserver.nixcraft.in "cat > /backup/wwwdata.tar.gz"OR# tar zcvf - /wwwdata | ssh root@192.168.1.201 "cat > /backup/wwwdata.tar.gz"

Output:

tar: Removing leading `/' from member names
/wwwdata/
/wwwdata/n/nixcraft.in/
/wwwdata/c/cyberciti.biz/
....
..
...
Password:

You can also use dd command for clarity purpose:# tar cvzf - /wwwdata | ssh ssh root@192.168.1.201 "dd of=/backup/wwwdata.tar.gz"It is also possible to dump backup to remote tape device:# tar cvzf - /wwwdata | ssh ssh root@192.168.1.201 "cat > /dev/nst0"OR you can use mt to rewind tape and then dump it using cat command:# tar cvzf - /wwwdata | ssh ssh root@192.168.1.201 $(mt -f /dev/nst0 rewind; cat > /dev/nst0)$You can restore tar backup over ssh session: # cd /
# ssh root@192.168.1.201 "cat /backup/wwwdata.tar.gz" | tar zxvf -
If you wish to use above command in cron job or scripts then consider SSH keys to get rid of the passwords.