Install SQL Developer 3.0 on Ubuntu 10.04

Ok, so I needed to perform some tests of Oracle's SQL Developer 3.0 runing on Ubuntu, so I decided to install it on a machine running Lucid Lynx 10.4. These are the steps I followed (following the guidelines that mick has posted.)

Requirement: Ensure you have a JDK installed
SQL Developer requires that the Sun Java J2SE JDK 1.6.11 or later be installed on the system. To install JDK, use the command:
$ sudo apt-get install sun-java6-jdk

Here you may receive the error message below:
Package sun-java6-jdk is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package sun-java6-jdk has no installation candidate

To solve this problem, add a new source to the aptitude repository, then try installing again:
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk

Download the files below
(a) Download the software
You will need to log in the OTN site and go to the address below and download the file titled “Oracle SQL Developer for other platforms.”

http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html

(b) Install the make-sqldeveloper-package package
$ sudo apt-get install sqldeveloper-package
sqldeveloper-package
builds a .deb package
// builds a Debian package of Oracle SQL Developer from the architecture independent archive from , identified as "Oracle SQL Developer for other platforms."

// you can check the contents of a package with

$ dpkg -L

To download the sqldeveloper-package you will need Ubuntu’s multiverse software repository.





(c) Install the tofrodos package
$ sudo apt-get install tofrodos

// Create symbolic links to the tofrodos commands to 
// allow the sqldeveloper-package to work:
$ sudo ln -s /usr/bin/fromdos /usr/bin/dos2unix
$ sudo ln -s /usr/bin/todos /usr/bin/unix2dos
tofrodos package
Converts DOS <-> Unix text files
// DOS text files have CR/LF pairs as their new line delimiters while Unix text files have LFs (line feeds) only
// Tofrodos comprises one program, "fromdos" alias "todos", which converts text files to and from these formats. Use "fromdos" to convert DOS text files to the Unix format, and "todos" to convert Unix text files to the DOS format.










Convert the ZIP file to .DEB package
To convert the .zip file to a .deb package, use the command below::

The make-sqldeveloper-package command will
(1) create a temporary directory at the location indicated by (i.e. /tmp/build)
(2) use the temporary directory to build the .deb package
(3) write the new package in the directory
(4) remove the temporary directory

So, if you saved the .zip file in the current directory, you could issue the command:



Install SQL Developer
To install, run:

$ sudo dpkg -i sqldeveloper_3.0.04.34+0.2.3-1_all.deb

This should install Oracle SQL Developer and you'll end up with a new entry in Gnome's menu:
Applications->Programming->SQL Developer








Inform the location of JDK
When you run SQL Developer for the first time, you may receive the message below on a terminal window, if it cannot find the location of JDK (SQL Developer expects to find the path information in the file ~/.sqldeveloper/jdk):
Oracle SQL Developer
Copyright (c) 2008, Oracle. All rights reserved.

Type the full pathname of a J2SE installation (or Ctrl-C to quit), the path will be stored in ~/.sqldeveloper/jdk

To fix this, you need to (a) create the directory .sqldeveloper; (b) create the jdk file and type in the path to the JDK:
$ mkdir -p ~/.sqldeveloper
$ vi ~/.sqldeveloper/jdk
# enter the path to JDK: /usr/lib/jvm/java-6-sun

Now you should be able to use SQL Developer 3.0

Install Oracle XE 10gr2 on Ubuntu 10.4


Oracle XE 10.2 licence limitations
Before you install, please consider the restrictions below. Oracle XE is offered as a free server for developers and small applications. The only way to overcome the limitations indicated below is to use the standard or enterprise editions.

(a) XE Server will use only one CPU
- If installed on a computer with more than one CPU (including dual-core CPUs), Oracle XE will consume, at most, processing resources equivalent to one CPU. In other words, even with available CPUs, Oracle XE will not do concurrent processing of CPU-intensive queries.

(b) Only one instance per computer
- Only one installation of Oracle XE can be performed on a single computer. This will not affect any existing installation or new installations of Standard or Enterprise Editions. In addition, users can run only one instance of Oracle XE on each individual computer.

(c) Maximum 4Gb of user data
- The maximum amount of user data in an Oracle XE database cannot exceed 4Gb. (In the oracle XE 11g - beta version, this limit was increased to 11Gb). If the user data grows beyond the 4Gb limit, then an ORA-12592 error will occur.

(d) Maximum 1Gb RAM
- An Oracle XE database will use at most 1Gb of RAM, even if more is available.

(e) No native support for HTTPS
- HTTPS is not supported natively with the HTTP listener built into Oracle Database XE. If you want HTTPS support, use an alternative Web listener, such as Apache, that does provide HTTPS support, and provide proxies for the URLs provided by Oracle Database XE.

With the limitations indicated above and with the idea of providing a RDBMS with a small footprint, it is not surprising that many of the features available in the Standard and Enterprise editions are not included with Oracle XE. Some of these are partitioning, OLAP, clusterware, the "Packs" (change and configuration management, diagnostic and tuning). See the full list here.


Installation Requirements
(a) Kernel requirements
The installation program checks for the kernel parameter settings below. If the current parameter values are less than the values listed below, they will be modified by the installation program.
ParameterValue
semmsl, semmns, semmni, semopm250, 32000, 128, 100
shmax, shmmni, shmall536870912, 4096, 2097152
file-max65536
ip_local_port_range1024-65000

(b) Required packages
You need to have glibc and libaio installed.


Download the software
You need to be logged in on your OTN account. You may use the link below:
http://www.oracle.com/technetwork/database/express-edition/downloads/102xelinsoft-102048.html
Download the debian package (.deb).

Installation
(a) To install the package, run the command below. The installation program automatically creates user oracle, if it not yet exists.


(b) Alternative Installation mode
On Debian-based systems such as Ubuntu, you can download and install the .deb package through these steps:

(1) Edit the /etc/apt/sources.list and add:
# Repository for Oracle XE
deb http://oss.oracle.com/debian unstable main non-free

(2) install with:
$ sudo apt-get update
$ sudo apt-get install oracle-xe

(c) Configuring default ports, passwords, and startup options.
When prompted, run the command below. It allows you to change the default http and listener ports, set up the initial password for SYS and SYSTEM, and decide whether the server will be automatically started during boot:


Oracle Database 10g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 10g 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]:

Specify a port that will be used for the database listener [1521]:

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 10g Express Edition to be started on boot (y/n) [y]:n

Starting Oracle Net Listener...Done
Configuring Database...
Done
Starting Oracle Database 10g Express Edition Instance...Done
Installation Completed Successfully.

Set the Oracle XE Environment Variables

bash shell configuration scripts:
.bash_profile
// executed during initial login
.bashrc
// executed in each new terminal window

To connect to the XE server you must set your environment variables. One way to do it is to edit your .bashrc login script and include the line below. After this when you open a new terminal window the environment variables will be automatically set.

$ vi ~/.bashrc
# paste the two lines below at the end of the file:
# set Oracle XE environment variables
. /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh 

If you are using the bash shell, the execution of the oracle_env.sh script may produce the error message below:
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh: 114: [[: not found


To fix this problem, edit the nls_lang.sh file indicated in the error message. As root (or though sudo) you need to tell the script to use the proper shell. In this case:

$ sudo vi /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh
change the first line in the file nls_lang.sh 
from #! /bin/sh 
to   #! /bin/bash 

Acessing the database
After the installation, the database should be up and running.
To use the XE database, you can go to the Database Home Page in the Oracle Database XE graphical user interface.:
http://host:port/apex or httpL//127.0.0.1:8080/apex (if you kept the default port for the http listener)

The installation creates a database and an instance named XE.


Starting and Shutting down
You can startup the database either through the Desktop Menus:
Applictations -> Oracle Database 10g Express Edition -> Start Database
or using SQL*Plus:
# Log in as a user who is a member of the dba group
$ sqlplus / as sydba
SQL> startup

If all went well, you should see:

ORACLE instance started.

Total System Global Area 805306368 bytes
Fixed Size 1261444 bytes
Variable Size 218103932 bytes
Database Buffers 583008256 bytes
Redo Buffers 2932736 bytes
Database mounted.
Database opened.
SQL>

Network connections
The Listener manages database (default port 1521) and HTTP (default port 8080) connections.
To manage the listener (status/start/shutdown) you need to be logged in as oracle.
LSNRCTL> start

Starting /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
Log messages written to /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=niels.blump)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 13-JAN-2011 09:14:42
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: xxxx
SNMP OFF
Default Service XE
Listener Parameter File /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
Listener Log File /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=niels.blump)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

Resizing a logical volume on Oracle Enterprise Linux (OEL) 5.6


I was running OEL 5.6 as the guest OS on VMWare hosted in a Fedora machine.
The machine had a 20Gb virtual disk and I had initially allocated about 11Gb to the root system.
I know it is not within best practice, but I was doing some quick configuration tests with Oracle so I had decided to install software and database files in the root file system.
Well, a couple of oracle releases later I had run out of space in the file system.


So the scenario was:
  1. The VM had a 20Gb disk allocated, but
  2. The disks partitions were only about 12Gb big, divided in two logical volumes: lv00 mapped to the root file system and lv01 used by the swap file system.
  3. Its usually pretty easy to extend a file system. Just unmount it and run a couple of commands. But you can't unmount the root file system and keep the system going.

(?) So how to extend the logical volume and the file system?
  • Well, it turns out that this can be done without having to unmount the root file system for systems with a 2.6 kernel. You just need to use lvextend and resize2fs.

Here is some output of the initial scenario:
jdoe@quark # fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          19      152586   83  Linux
/dev/sda2              20        2610    20812207+  8e  Linux LVM

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-1 doesn't contain a valid partition table

jdoe@quark # df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VG00-LV00
                       12G   11G     0 100% /
/dev/sda1             145M   20M  118M  15% /boot
tmpfs                 944M     0  944M   0% /dev/shm

The output of vgdisplay:
jdoe@quark # vgdisplay
--- Volume group ---
VG Name               VG00
System ID             
Format                lvm2
Metadata Areas        1
Metadata Sequence No  3
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                2
Open LV               2
Max PV                0
Cur PV                1
Act PV                1
VG Size               19.84 GB
PE Size               32.00 MB
Total PE              635
Alloc PE / Size       439 / 13.72 GB
Free  PE / Size       196 / 6.12 GB
VG UUID               y8WrXG-06ej-erEH-k3QV-fqvy-VJ8O-1hV4uT

The output of pvscan:
jdoe@quark # pvscan
PV /dev/sda2   VG VG00   lvm2 [19.84 GB / 6.12 GB free]
Total: 1 [19.84 GB] / in use: 1 [19.84 GB] / in no VG: 0 [0   ]

Solution:
  • Since the total disk space on /dev/sda was already allocated to the Volume group,
    what I needed to do was just to extend the logical volume to use the free space in the volume group.

jdoe@quark # lvextend -l+196 /dev/VG00/LV00
Extending logical volume LV00 to 17.84 GB
Logical volume LV00 successfully resized
jdoe@quark #
jdoe@quark # resize2fs /dev/VG00/LV00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VG00/LV00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VG00/LV00 to 4677632 (4k) blocks.
The filesystem on /dev/VG00/LV00 is now 4677632 blocks long.

And that did it.
Here are some printouts of the final scenario:
jdoe@quark # fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          19      152586   83  Linux
/dev/sda2              20        2610    20812207+  8e  Linux LVM

jdoe@quark # df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VG00-LV00
                       18G   11G  5.7G  66% /
/dev/sda1             145M   20M  118M  15% /boot
tmpfs                 944M     0  944M   0% /dev/shm

jdoe@quark # vgdisplay
--- Volume group ---
VG Name               VG00
System ID             
Format                lvm2
Metadata Areas        1
Metadata Sequence No  4
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                2
Open LV               2
Max PV                0
Cur PV                1
Act PV                1
VG Size               19.84 GB
PE Size               32.00 MB
Total PE              635
Alloc PE / Size       635 / 19.84 GB
Free  PE / Size       0 / 0   
VG UUID               y8WrXG-06ej-erEH-k3QV-fqvy-VJ8O-1hV4uT