|
A rough ride through Oracle XE installation on Linux |
|
|
|
|
Written by Chintan Rajyaguru
|
|
Tuesday, 23 January 2007 16:40 |
When you are installing a product, it pays to pay attention to the installation instructions. I learned this the hard way when I tried to install Oracle XE on my Linux box with plans to also install netbeans and glassfish and play with JPA.
As described in Oracle-XE's installation instructions available at http://download-east.oracle.com/docs/cd/B25329_01/doc/install.102/b25144/toc.htmI downloaded the rpm file from http://www.oracle.com/technology/products/database/xe/index.html, right clicked the file and selected Open with install Software option. The installer asked for the root password and happily installed the product. Again, as described in the installation instructions, I ran /etc/init.d/oracle-xe configure and selected the port to access the database using the out of the box web interface, selected port on which oracle database server would run, picked the password for System and Sys accounts and selected 'No' when asked if I wanted to start oracle server every time my machine started. Everything went smooth. I was able to access the database home page and even create a database user.
The trouble popped up when I rebooted my machine (I run Linux and windows on my laptop). I knew I had to start the database manually by running /etc/init.d/oracle-xe start as a root (/etc/init.d/oracle-xe stop to stop the database). When I issued the command, the prompt returned rather quickly without displaying any messages - the first sign that something was wrong. Of course I couldn't get to the database home page, nor did ps -ef | grep oracle showed any signs of oracle running nor did netstat -an | grep 1521 gave any results indicating the port hadn't been taken by the oracle process. I thought, "I don't want to be the Linux guru who can figure out what went wrong during oracle installation. I will just reinstall." So, I removed oracle by issuing rpm -e oracle-xe-univ-10.2.0.1-1.0 where oracle-xe-univ-10.2.0.1-1.0 is the name of the package installed when oracle was installed. The next step was to reinstall oracle. This time I issued the command instead of right clicking the file. I used su to become root and then issued rpm -ivh <full_path_to_oracle_xe_rpm_file> command to installed oracle. Again, installation went smooth, I ran /etc/init.d/oracle-xe configure as root to configure the database, which also went smooth BUT, to my surprise, neither the database server started nor could I access the database homepage. In my first attempt, they both worked right after install, only after reboot they stopped working, whereas this time they didn't work even after the install.
I deleted the directory where oracle installed, deleted the oracle Linux user and dba group created by the oracle installation script, picked various options while configuring the database, googled a few hundred times and even searched through the oracle xe support forum but nothing worked. I even started thinking about upgrading to SUSE Linux 10.2 hoping that would solve the problem.
This is where "it pays to pay attention to the installation instructions" part comes in. The installation instructions clearly says, "Log on to your computer with root permissions." This means you must install oracle as root and the way you become root through command line is su - (su space dash) not just su. I missed this even though I knew the difference between su and su -. For newbies, when you use su - you get the environment of the root user, which is needed for oracle installation. If you just use su, you still become the root user but it will keep your environment (e.g. your $PATH variable as opposed to root's).
Anyway, after the light bulb went off, I reinstalled oracle with su - and gain, I was able to access the database and the database homepage right after the install. HOWEVER, this just brought me back to where I was after the first install. Everything worked fine until I rebooted my machine. As soon as I rebooted (I always picked - do not start oracle on machine startup - option), I was unable to start oracle listener or the database. Again the google searches and oracle xe help forum searches started. Finally, I found two different (could be related) explanations of the problem. 1. The oracle install script has a bug, as a result, it can't assign proper permissions to various files resulting in this problem 2. The oracle install script does not create the oracle Linux user and the dba group correctly. If they are created manually, this problem goes away
Both of these explanations didn't have much concrete information. For example, the first explanation didn't explain what permissions to set to which files and what to do after setting them. And, I had decided that I didn't want to be a Linux guru so this is what I did to start oracle manually every time I rebooted my machine: 1. Install oracle using the standard installation instructions, right after the install the database should be working fine 2. Become root using su - and then by entering root password 3. Become oracle using su - oracle. The oracle user is created by the installation script when oracle is installed. This user does NOT have any password so the way to become that user would be to become root first and then su - to oracle. The oracle user's home directory is /usr/lib/oracle/xe 4. Change to the oracle server bin directory cd /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin 5. Copy oracle environment script to oracle user's bash profile using cp oracle_env.sh $HOME/.bash_profile. This command overwrites oracle user's bash profile (a script executed every time the user logs in) but that's ok 6. Change to oracle user's home directory issuing cd command 7. I changed oracle user's bash profile in step 5 above so I need to activate that profile for the current command prompt using . ./.bash_profile. Note again that this command is dot slash dot bash_profile 8. Start oracle listener using lsncrtl start 9. Start sqlplus tool using sqlplus / as sysdba 10. Start the database using SQL> startup
The next time I reboot my machine, I don't have to execute steps 1 through 7. I just need to become oracle user and execute steps 8 through 10. I know it would be easier to simply issue /etc/init.d/oracle-xe start to start everything in one command but that's not working and until I figure out why and how to fix it (which I probably won't), I will use the 3 steps above to start oracle.
|
|
Last Updated on Monday, 26 February 2007 14:19 |