| Installing Oracle 10g On Ubuntu Karmic 64 Bit Or Otherwise (Part 2) |
|
|
|
| Written by Josh B |
| Friday, 08 January 2010 19:17 |
|
This is Part 2 of my guide to install Oracle on Ubuntu Karmic, 32-bit and 64-bit. Part 1 can be found here. Automating Startup & ShutdownOracle themselves supply two scripts called dbstart and dbshut, both found in the ORACLE_HOME/bin directory. Those scripts read another file called /etc/oratab to determine what databases actually need to automatically startedup and shutdown. All you have to do is write a script of your own that calls dbstart or dbshut, and then integrate this new script into Ubuntu's standard runlevel/service control mechanism.
Editing OratabYou will need to edit the contents of the /etc/oratab : sudo gedit /etc/oratab You'll find at the moment that the file contains this one line (apart from all the commented-out ones, that is): orcl10:/oracle/10g:N This entry tells the system all the details of the Oracle database on your machine. Its called orcl10, it's ORACLE_HOME is /oracle/10g, and it's Not to be automatically started or stopped. So... To make sure its started automatically switch that N to a Y. NB: Even if you don't want the database to be started and stopped you will need to do this. If you don't the next step won't do anything useful orcl10:/oracle/10g:Y Save the file.
Editing dbstart
There's not much to change here but its one of the more important and non-obvious changes. su - oracle Towards the beginning of that file, you'll find these lines: # Set this to bring up Oracle Net Listener ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle if [ ! $ORACLE_HOME_LISTNER ] ; then Ignore Oracle's intentional spelling mistake and change "/ade/vikrkuma_new/oracle" to your ORACLE_HOME. Eg, for me this is: ORACLE_HOME_LISTNER=/oracle/10g The subtle point going on here is that you might have a server running many different versions of Oracle, but using only one Listener. A 10g Listener can listen for various different databases. So the place where the Listener's own executables should be found may be different from where the database's own executables are found -and that's why the two things are separately configurable. In most development cases they will be the same.
DbshutThe second script, ORACLE_HOME/bin/dbshut might also need editing for a production environment, but you probably won't need to change for a Development machine. Dbshut will do an immediate shutdown of the database and rudely kick everyone off. This is fine for Testing but real users don't like this...!
Seeing if it WorksTry starting oracle dbstart Should get nothing much for a response, but look in the log. - Production Adding An AutoStart ScriptNB : Can skip this section if you just want to have it running on command. You now need to write a script which itself calls the dbshut and dbstart scripts. This script is usually stored in the /etc/init.d directory (and thus will require root privileges to create) and gets called dbora (though it can actually be called anything you like. The script should look like this: #!/bin/bash Make the file executable: sudo chmod 775 /etc/init.d/dbora You then need to link the new calling script into the runlevel scripts that Ubuntu uses to control general service startup and shutdown. That can be done by issuing the one command: sudo update-rc.d dbora defaults 99 If you now reboot your server, you should find that immediately it comes back up, you can become the oracle user and connect to the database via SQL*Plus without any hassles
Giving it a gome@erewhon:~$ su - oracle Had the thing not been started correctly, however, I would have seen something more like this: oracle@erewhon:~$ sqlplus / as sysdba So, provided you don't get the 'idle instance' message after a server reboot everything is working fine...! Well done...!
Running Enterprise ManagerThere's also a handy Management Interface to Oracle called "Enterprise Manager". Start this with: me@erewhon:~$ su - oracle Password: It will take a while to get going so hang in there...! To stop it use: emctl stop dbconsole Then browse to the management url http://erewhon:1158/em and then login with SYS and the password you entered earlier ("oraclepass"). Most actual routine administration tasks can be found by clicking the Administration link towards the top of the page; backup and recovery options can be found under the Maintenance link; and performance tuning diagnostics can be found under (surprise, surprise!) the Performance link.
Setup EnvironmentAdd the following to /~/.bashrc # NB : these should not have trailing spaces Double check these are correct by calling sqlplus... If we get : Error 6 initializing SQL*Plus Might need to add main user to the Oracle groups (eg "dba" and "oinstall"). Use the Ubuntu Users/Groups client for this. Might need to set permissions as well. chmod -R 755 * If we get: ERROR: It means there are trailing spaces on the paths. Also try giving 755 permissions to tnslsnr in the bin directory. If we get, me@erewhon:~$ sqlldr then do: sudo chmod -R o+rx /oracle/10g/ Well Done (Part 2)You now have a functioning Oracle install on your machine. Its now time to add tablespaces, users and even some test data...! Have fun...! (And let me know any feedback on this guide / run-through) Alternative GuidesIf this didn't get Oracle working for you, can also try this guide.
|
| Last Updated on Tuesday, 16 February 2010 21:49 |




