ubuntu
Oracle and TOra on Ubuntu Hardy
I work with Oracle a lot in my 9 to 5 existence so I like to have a setup that I can make mistakes on at home. It’s also cool to have a powerful open source tool like TOra at your disposal. I’ve found that it’s easy enough to get them both set up on Ubuntu Hardy.
Oracle (perhaps with one eye on MySQL and Postgres) started giving away binaries of their express edition a few years ago. There are restrictions on how large a database can be and it’s not free as in ‘freedom’ but it does allow you to brush up on Oracle specific features.
Installation is pretty straightforward. If you’re running a Debian based distro (like Ubuntu) you can get Oracle up and running by doing the following. First add their repository to your sources.list. Create a file named “/etc/apt/sources.list.d/oracle.list” containing the following line:
deb http://oss.oracle.com/debian unstable main non-free
Add their key:
# wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | sudo apt-key add -
Update and install:
# sudo apt-get update
# sudo apt-get install oracle-xe oracle-xe-client
After the install is complete, you need to run the configuration script:
# sudo /etc/init.d/oracle-xe configure
You will be asked a few questions. The default values are probably suitable though you might want to think about whether you want the db server to start at boot (I prefer to start it manually when required). Once completed, you should be able to log into the browser based management tool at http://127.0.0.1:8080/apex (substituting the port number if you chose something other than 8080).
You probably want to add these few lines to your .bashrc in order to make life easier.
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_HOME
export ORACLE_SID=XE
export PATH
Start a new shell or source your .bashrc and you should have useful tools such as sqlplus in your path. At this point it’s a good idea to test that your database server is up and running. Connect as SYSDBA using the password you set earlier and enable the basic user ‘HR’:
# sqlplus SYS as SYSDBA
SQL> alter user HR account unlock ;
SQL> alter user HR identified by $password ;
SQL> exit
Now you should be able to connect as user ‘HR’ and query the tables in the sample database:
SQL> select *
2 from countries
3 where country_id = 'UK';
Few programs frustrate me as much as sqlplus however and I’ve come to rely on the developer tool Toad. Happily, there is an open source equivalent to Toad, named TOra. It’s feature rich and uses many of the same key bindings as Toad and I’ve heard there was a shared history between the two applications.
It’s also available in the main Ubuntu repositories. There’s a slight problem however. For legal reasons, these packages haven’t been compiled with Oracle support. Yet with a few tweaks, it’s possible to recompile and package it yourself with Oracle support turned on using the libraries included in the oracle-xe-client package.
There are a couple of things you need to. First, Install packages required for building debs:
# sudo apt-get install build-essential fakeroot
Then download the TOra source and install packages required for building:
# apt-get source tora
# sudo apt-get build-dep tora
Now you need to tweak a few things. Make sure you set your $ORACLE_HOME environment variable, either through your .bashrc, or by doing the following:
# export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
Also, add the Oracle libraries to the paths checked by the linker by creating a file named /etc/ld.so.conf.d/oracle_xe.conf with the following line and running ldconfig:
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib
# sudo ldconfig
Next, you need to edit the file debian/rules in the TOra source package. Change the flags passed to configure to:
--prefix=/usr --with-oracle=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server --without-rpath --disable-new-check --without-kde --enable-libsuffix=
Also comment out the use of the dh_shlibdeps:
# dh_shlibdeps
This turns off shared library dependency checking for packages. This isn’t ideal but it will cause errors when building otherwise. I was a little bit uneasy about this but I came across this article that suggests doing so is sometimes necessary when packaging proprietary apps.
To actually build the package, change to the source package directory and run:
# fakeroot dpkg-buildpackage
It will take a few minutes, depending on your system, but you should see a deb created in the directory above where you ran the build command. You can install it with:
# sudo dpkg -i tora_1.3.22-5_i386.deb
You should now have TOra installed with Oracle support!
I noticed a couple of other things while playing with TOra. I didn’t have MySQL support by default until I installed the package libqt3-mt-mysql. You only need the package installed, there’s no need to re-compile TOra again. I was also struck by how nice it looked. I run Gnome and hardly ever use any Qt apps but I keep meaning to have a look at KDE4 and this was a reminder.
While I was exploring TOra, I also came across a similar project named CrunchyFrog. It’s written in Python and uses GTK. I ran into a couple of bugs but it looks promising. It uses a plugin architecture for handling connections to different databases. In theory you could simply install a plugin to handle connections to Oracle (or MySQL et al). In practice, I could only find a plugin for SQLite but it’s probably the excuse I’ve been waiting for to mess around with it. I got round to reading the manual. I’m still going to check out SQLite though.
All told, the future is bright for open source databases and tools and it’s nice to know that we’ve got the means to operate with Larry’s all pervasive product with a classy desktop app.
Cifs issues resolved
I recently bought a freecom network drive. It’s was cheap, i.e. the cheapest, but promised support for both kind of computers - Win and Mac. What could go wrong? Of course I soon ran into problems trying to mount it in Ubuntu. Both mounting directly from command line or adding an entry to fstab would give me the error:
mount error 20 = Not a directory
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)
After plenty of googling, I found a hack on the linux-cifs-client mailing list:
echo 0 > /proc/fs/cifs/LinuxExtensionsEnabled
I was then able to mount without a problem. Clearly my tinpot device only supported the basic smbfs protocol. While this worked, it wasn’t going to survive a reboot so I dug into mount.cifs (8). I found plenty of options for turning off various aspects of the extensions but nothing that disabled them all.
So I went back to google and happily came across this thread, on the same list, discussing adding a new “nounix” option to mount.cifs. It was dated from July last year. Despite it not being in the man page, I gave it a shot. It worked first time.
//diskfrog/music /media/Music cifs guest,nounix 0 0
After a reboot, the share mounted automatically, which was just what I was looking for.
This experience nicely encapsulates what’s great about open source. Faced with a problem with a piece of software, not only did I find a solution, I was able to read about the genesis of a new feature that scratched, not only the developer’s itch, but my itch too. I suppose I should really look into patching manpages and put back.
Listening to 2ser’s asf stream with Ubuntu
One thing I really miss about Sydney is listening to the fantastic community radio station radio 2ser. Staffed largely by volunteers, 2ser delivers great music, arts, news and other community programming. Salvation is at hand as they do provide an internet stream. The bad news is that it’s in Microsoft’s ASF format which poses a bit of a challenge for users of Linux and other free operating systems. However, I’ve managed to play the stream on my Ubuntu desktop - here’s how:
The instructions on 2ser’s streaming page read:
# if you are having difficulties try opening the stream directly from within Windows Media Player.
to do this use the following steps:
open the Windows Media Player application. this will ONLY work in Windows Media Player
# go to the FILE menu and choose OPEN URL
# type the following - http://138.25.162.211:8080
# this should connect you directly to the stream
OK, so I added a bit of emphasis but it’s not real encouraging is it? Happily you can play the stream using mplayer and the w32codecs. If you’re using Ubuntu you can install mplayer using the command:
sudo apt-get install mplayer
Installing the w32codecs package is a litte more complicated. The w32codecs package isn’t available as part of the Official Ubuntu distribution as the software that plays these proprietary file formats isn’t technically free (see the Ubuntu documenation). However, you can get them from various unofficial sources. Add the following line to the file /etc/apt/sources.list (i.e. edit it as root with your favourite editor):
deb http://packages.freecontrib.org/ubuntu/plf/ dapper free non-free
Next update your apt-get sources by typing the following:
sudo apt-get install update
Now the w32codecs package should be installable by typing:
sudo apt-get install w32codecs
Now mplayer should have everything it needs to play the stream. Open mplayer by typing:
gmplayer http://138.25.162.211:8080
Alternatively start mplayer from your Applications->Sound and Video menu and select Open->Play URL and enter http://138.25.162.211:8080 - it might throw up an error message but the stream should begin to play.
Please let me know if you have any difficulties and I’ll try to help you.
Note: I have been unable to get the stream to play from the webpage using either the gstreamer or mplayer plugins for firefox. Let ne know if you have any luck.
I do not want people to be very agreeable, as it saves me the trouble of liking them a great deal.
— , letter to her sister
Tags
aggregation art bike c64 cut up database DB2 debian diposable documentation england film firefox football france free geek glasgow google maps hack iceweasel linux media memory music mysql oracle paris photo politiking rant resouce review samba society spam spinvox spoken word SQL Travel tv ubuntu video voice recognition webLinkage
- Nullsleep | New York Romscapes [del.icio.us]
- MAKE: Blog: Don't just play Guitar Hero, build your own [del.icio.us]
- Dropbox - Home - Secure backup, sync and sharing made easy. [del.icio.us]
- Valery Gergiev - Wikipedia, the free encyclopedia [del.icio.us]
- Simon Willison’s Weblog [del.icio.us]
- WordPress › WP Super Cache « WordPress Plugins [del.icio.us]
- Text Filter Suite Plugin for WordPress | geek ramblings [del.icio.us]
- DOPPLR [del.icio.us]
- Text Mode Games - Snipes [del.icio.us]
- http://www.bestiario.org/research/citydistances/ [del.icio.us]