Saturday, September 24, 2011

Ksplice on Ubuntu Installation: Video

With the recent acquisition of Ksplice by Oracle - I got to discover a really cool tool for Linux. Ksplice allows you to apply updates to a live running kernel without the need for rebooting your machine. Yeah right! That was my initial reaction too. But thanks to  some really smart guys from MIT Ksplice does just that. No need to reboot your linux kernel after an upgrade. Sounds too good to be true? Well the proof is in the pudding they say (I like the potato kind :) Well check out the video below to see how easy it is to setup and use Ksplice. For a quick overview of Ksplice check out the FAQ. If you want more details as to the inner workings read the whitepaper.

Ksplice is available on Oracle Linux via subscription through ULN. However it is free for Ubuntu Desktop and Fedora. This means that if you're running Red Hat Enterprise Linux or any other enterprise Linux flavor you're out of luck.

A few notes about installing Ksplice on Ubuntu

  • The installation was done on Ubuntu 11.04 - Natty Narwhal running in VirtualBox 4.12. The Ksplice documentation lists 10.04, 10.10 and 11.04 as being supported.
  • I chose the manual installation method after trying the GUI method and getting the error message seen below.



















  • There is a ksplice package available via the Software Center in Ubuntu. DO NOT install this package. This provides the ksplice raw utilities which is not recommended for general use. This is a demo of the ksplice uptrack package instead.
  • You need to provide an email address for a key required to complete the installation.
Here is the demo
Unable to display content. Adobe Flash is required.




Monday, September 5, 2011

Oracle Database 11g XE in the Cloud

Oracle Database 11g XE has been in beta for several months now. On September 2, the production release was made available for Windows 32-bit and Linux 64-bit platforms. This lightweight version of the juggernaut database of world is geared towards students, developer and ISVs. You can find the full feature list here.

Having played around with the beta version I decided it was time to take a stab at deploying it in the cloud - more specifically Amazon AWS EC2. 
I started off by selecting the Oracle Linux 5.6 x86_64 - OVM (ami-42778a2b) to launch a micro-instance of Oracle Linux. The micro-instance has 613MB of physical memory, 2GB swap and 15GB EBS storage. 

[root@ip-10-242-49-142 ~]# cat /proc/meminfo | grep SwapTotal

SwapTotal: 2104504 kB

[root@ip-10-242-49-142 ~]# cat /proc/meminfo | grep MemTotal
MemTotal: 629760 kB

Once you download the installation archive from OTN and save it to your computer, you'll have to transfer it to your EC2 instance.

You will have to unzip the rpm package from the archive and then install the package.
Note: If you are familiar with the full database installation process and try to create your ORACLE_BASE before hand, the installer will complain.

root@ip-10-242-49-142 Disk1]# rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm

Preparing... ########################################### [100%]

The install cannot proceed because ORACLE_BASE directory (/u01/app/oracle)

is not owned by "oracle" user. You must change the ownership of ORACLE_BASE
directory to "oracle" user and retry the installation.
error: %pre(oracle-xe-11.2.0-1.0.x86_64) scriptlet failed, exit status 1
error: install: %pre scriptlet failed (2), skipping oracle-xe-11.2.0-1.0

Follow the installation instructions to install the rpm as root:

[root@ip-10-242-49-142 Disk1]# rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm

Preparing... ########################################### [100%]

1:oracle-xe ########################################### [100%]

Executing post-install steps...

You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.


Next run the configure script to set your listener and APEX ports and passwords for the SYS/SYSTEM users:
Note: Before you create your instance, make sure you apply the correct security groups to allow access to your database listener and APEX ports. Otherwise you will have to modify the default security group to allow access.

[root@ip-10-242-49-142 Disk1]# /etc/init.d/oracle-xe configure
Oracle Database 11g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 11g Express
Edition.  The following questions will determine whether the database should
be starting upon system boot, the ports it will use, and the passwords that
will be used for database accounts.  Press to accept the defaults.
Ctrl-C will abort.
Specify the HTTP port that will be used for Oracle Application Express [8080]:8181
Specify a port that will be used for the database listener [1521]:1523
Specify a password to be used for database accounts.  Note that the same
password will be used for SYS and SYSTEM.  Oracle recommends the use of
different passwords for each database account.  This can be done after
initial configuration:
Confirm the password:
Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:
Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.
[root@ip-10-242-49-142 Disk1]# 
In order to connect to your database instance remotely via SQL Developer or APEX you first need to disable the iptables firewall or setup rules to enable access to the ports. I disabled the firewall in my instance since security groups are already setup to allow access to only the these ports.

[root@ip-10-242-49-142 ~]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- anywhere anywhere

Chain FORWARD (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain RH-Firewall-1-INPUT (2 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT icmp -- anywhere anywhere icmp any
ACCEPT esp -- anywhere anywhere
ACCEPT ah -- anywhere anywhere
ACCEPT udp -- anywhere 224.0.0.251 udp dpt:mdns
ACCEPT udp -- anywhere anywhere udp dpt:ipp
ACCEPT tcp -- anywhere anywhere tcp dpt:ipp
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited


You can stop iptables using:
[root@ip-10-242-49-142 ~]# service iptables stop
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
[root@ip-10-242-49-142 ~]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

   
To prevent the service from running on startup use chkconfig to disable iptables:

[root@ip-10-242-49-142 ~]# chkconfig iptables --list
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@ip-10-242-49-142 ~]# chkconfig iptables off levels 2,3,4,5
[root@ip-10-242-49-142 ~]# chkconfig iptables --list
iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off


You should now be able to connect to the database using and Oracle client such as SQL Developer or SQL*Plus.



By default, remote HTTP access to the Database Start Page is disabled. In order to access disable it you need to execute the following procedure:


SQL> conn system/oracle11xe
Connected.
SQL> exec dbms_xdb.setlistenerlocalaccess(false);


PL/SQL procedure successfully completed.
Note: This enabled all information included usernames and passwords transmitted via HTTP to be sent unencrypted.

You should now be able to access your 11gXE start page using your public endpoint for your EC2 instance.


Deploying databases in the cloud has gotten a lot simpler thanks to Oracle Database11gXE. If you are a developer looking to build an application on top of Oracle database then this would be a big plus for  you. Given that this would cost less than an RDS instance of Oracle database and if you can live with the storage and CPU limitations and limited features then give it a go.