Pages

Monday 3 June 2013

Ubuntu Milestones - Oracle

For many, many years I've yearned to move away from windows. Everyone has their reasons, some have motivation, I finally had opportunity to make some baby steps.

I needed to set up an environment using APEX 3.2, and I had an old XP laptop that I finally moved my ipod synch off so I figured it was free to experiment with. I was already running it with dual boot, but I never pulled my finger out to restart & play around with the Ubuntu half.

Earlier in the year I experimented a little with Ubuntu using VirtualBox on my existing Windows7 laptop - I've even drafted a blog post rambling about my experience, but I've got some fresh thoughts with my recent jump in the deep end.

First impressions - it's an OS worth me pursuing.

It's certainly a cultural change. Of course, you need to be able to do many of the same type of operations - move files, close windows, setup Oracle... but to use a balinese catch phrase - it's same same, but different.

Installing Oracle

I was a little bit of a cowboy with this - while I was keeping note of the websites that I was using as a reference, I didn't take note of each command I performed. This was going to be a temporary db, and I figured this first attempt justified a little gun-ho action.

Besides, my ultimate plan is to use Virtualbox to run different environments in their own confined buckets. This old laptop is destined to be a sandpit.

I used this Linoob address to help install the db. In the end I'm pretty sure the apt-get just opened up the software centre.
Oracle in Ubuntu Software Centre
I think it's a selling point for this particular distribution of *nix based systems, installing software is just like searching Google Play or the Apple Store - they aren't the scary domain of sysadmins anymore.

Setting up SQL Developer was a little more tricky since there is no download available specifically for Ubuntu. Instead, there is a package builder for .deb packages, so I still just needed to download the base file, run a few commands and it could be installed no problem.

Installing a JDK to support SQL Developer was a little more interesting. I used the manual option, which again is just a list of commands. I'm positive I haven't put the JDK folder in a 'typical' location, but that's the burn of learning.

Having to run commands like this in a way reminds me of the days of DOS, which you could take as no really progressing from the Windows environment of just clicking "Next" - but I don't see this as a con. I see it as liberation, a way to gain flexibility. Some of the commands seem foreign now, but I don't think it's far away from recognisable, then second nature.

All that being said, you could look at setting up SQL Developer in Ubuntu on par with setting it up in Windows. In the latter, I still need do download a set of files, extract, and on first run point it to the java.exe that I always need a few attempts with getting the path just right. In Ubuntu, I surprisingly got this path first go!

The only oops I did was download the latest and greatest JDK (7), which SQL Developer is not ready to support, though it ran anyway. I'll fix that later...

The closest I got to the OS was when I had to add my user account to the DBA group. I needed to do this before the database fired up. After an initial scare of making it all this way and not being sure why it wouldn't start - I found a pretty clear instruction on the OTN forum.

With all this gun slinging, I forgot to configure the DB.
/etc/init.d/oracle-xe configure

Configuring APEX

From here it was familiar territory in upgrading APEX from v2 to my target of v3.2.1

These commands I could run from SQL Developer
Upgrade
@apexins SYSAUX SYSAUX TEMP /i/

Load images to EPG (I wasn't game to attempt APEX Listener just yet)
@apxldimg.sql /home/scott

Unlock the public user account (I was doing this mostly from memory, after setting up APEX so often, I even remembered this one after my attempt to log in just stalled in the browser)
ALTER USER APEX_PUBLIC_USER ACCOUNT UNLOCK;

The only script that didn't want to run from SQL Developer was the one to change the ADMIN password (apxchpwd.sql)
Instead, I just pasted the code in the SQL worksheet and ran it from there.

Restarting the OS

After restarting, the database didn't restart (an option I chose), but the scripts in the menu did not work. Again, I think this just came down to me lacking understanding of some permission issues, and I found a command that worked for me.
sudo /etc/init.d/oracle-xe restart

Conclusion

I got up and running in a few distracted hours. While there was a few hurdles, there was never anything that really concerned me or had me stuck for too long. Google was my dear friend, but I'll keep perusing my Beginning Ubuntu Linux book.

Next I'll be looking for alternatives to some programs I regularly use in Windows.

1 comment:

  1. Two Google+ comments that look worthy to save:

    Mike Smithers1 year ago

    Scott,

    Congratulations for getting Oracle XE running on Ubuntu - it's no mean feat !

    You've said that you added your user to the DBA group so permissions shouldn't be an issue. However, XE is written specifically for RPM based Linux Distros as opposed to Debian based ( which includes Ubuntu). This means that there can be one or two unusual quirks.

    The issue with menu options not working are typically down to one or more of :
    - having incorrect permissions on the scripts that the menu options run
    - not having the correct environment variables set in your .bashrc

    To check the permissions, you can open a terminal session and :

    cd /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts
    ls -l startdb.sh

    This is the script that gets run when you choose the Start Database menu option.

    The permissions on startdb.sh should be :

    -rwxr-xr-x

    If their not, you can change them by doing the following :

    sudo chmod 755 startdb.sh

    This gives all permissions to the file owner, read and execute permissions to all other users.


    These scripts will be referencing the following three environment variables :

    $ORACLE_HOME
    $ORACLE_SID
    $NLS_LANG

    You need to make sure that these are set when you invoke the menu options.
    Therefore, the best place to put them is in a file called .bashrc which will be in your home directory.
    The simplest way to do this is to copy the contents of the file :

    /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh

    and paste it into the .bashrc in your home directory.

    I've written an installation guide for 10gXE on Ubuntu, which includes these setps.
    You can find it at http://mikesmithers.wordpress.com/2009/12/07/installing-oracle-xe-on-ubuntu-9-10/ if you're interested.

    Linto Thomas1 year ago - Shared publicly

    It's really a Milestone; 

    ReplyDelete