Showing posts with label eapps. Show all posts
Showing posts with label eapps. Show all posts

Sunday, January 11, 2015

Installing Oracle XE 11gR2 on a Centos Cloud based VPS

This post describes the steps taken to install Oracle XE 11gr2 on a Centos based Virtual Private Server hosted by eapps.com.

These steps are necessary due to restrictions related to the limited swap space offered by the VPS.

So, these were the steps (executed as root):

1. Create a group and name it oinstall.
groupadd oinstal

2. Create a group and name it dba.
groupadd dba

3. Create a new user (oracle) with oinstall as its primary group. Also modify the .bash_profile to set an Oracle env as shown below.

useradd -g oinstall -G dba oracle

[oracle@cloud ~]$ more .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=XE

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin

export PATH

4. Download the installation (a zip file containing the rpm). Unzip the downloaded file. A Disk1 folder is created.

5. Change to Disk1 and run the following:

rpm2cpio oracle-xe-11.2.0-1.0.x86_64.rpm > oracle-xe-11.2.0-1.0.x86_64.cpio

cpio -idv < oracle-xe-11.2.0-1.0.x86_64.cpio

This will result in the creation of the following folders:
[root@cloud Disk1]# ll
total 888924
drwxr-xr-x 3 root root      4096 Jan 11 09:46 etc
drwxr-xr-x 2 root root      4096 Aug 29  2011 response
drwxr-xr-x 3 root root      4096 Jan 11 09:46 u01
drwxrwxr-x 2 root root      4096 Aug 29  2011 upgrade
drwxr-xr-x 3 root root      4096 Jan 11 09:47 usr

6. Replace template values for the memory target:
find ./u01 -exec grep "%memory_target" '{}' \; -print
This gives two files:
memory_target=%memory_target%
./u01/app/oracle/product/11.2.0/xe/config/scripts/initXETemp.ora
memory_target=%memory_target%
./u01/app/oracle/product/11.2.0/xe/config/scripts/init.ora

. . . . . . . 
###########################################
# Miscellaneous
###########################################
. . . . . 
memory_target=268435456
. . . . . 

7. Copy/move folders to the appropriate locations:
cp -R ./usr /
cp ./etc/init.d/oracle-xe /etc/init.d/

8. Move the ./u01 folder to the root of the filesystem and assign ownership to the oracle user
mv ./u01/ /
chown -R oracle:oinstall /u01

9. Give execute permission to all configuration shell scripts
chmod +x /u01/app/oracle/product/11.2.0/xe/config/scripts/*.sh

10. Edit the  following scripts to replace #!/bin/sh with #!/bin/bash
/u01/app/oracle/product/11.2.0/xe/config/scripts/XE.sh
/u01/app/oracle/product/11.2.0/xe/bin/nls_lang.sh

11. Create the oradata directory:
cd /u01/app/oracle/
mkdir oradata
chown oracle:oinstall oradata

12. Make /etc/init.d/oracle-xe executable:
chmod +x /etc/init.d/oracle-xe

13. Run the configuration scripts
/etc/init.d/oracle-xe configure

14. Check status:
/etc/init.d/oracle-xe status

If the command above shows a BLOCKED status, then chances are that the creation of the control files has failed. Check the log.xml file in the diag directory of the XE rdbms.

In this case, create the control file manually:

1. Open a new shell as the oracle user

2. Connect vi sqlplus:
sqlplus / as sysdba

3. Create the control file yourself:
SQL > Create controlfile reuse set database "XE"
MAXINSTANCES 8
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
Datafile
'/u01/app/oracle/oradata/XE/system.dbf',
'/u01/app/oracle/oradata/XE/undotbs1.dbf',
'/u01/app/oracle/oradata/XE/sysaux.dbf',
'/u01/app/oracle/oradata/XE/users.dbf'
LOGFILE
GROUP 1 SIZE 51200K,
GROUP 2 SIZE 51200K,
RESETLOGS;
. . .  
SQL> shutdown immediate
. . . 
SQL> startup mount
. . . . . 
SQL> alter database open resetlogs;

At this point you should able to connect remotely (if the 1521 port is open).

Monday, December 22, 2008

Installing Oracle XE on a Centos based VPS


This is a summary of the steps I followed in order to be able to install Oracle XE 10g on my Centos Virtual Private Server (VPS) hosted by eapps.com.


Update: A more recent post is available concerning the installation of Oracle XE 11g in a similar environment.


The basic idea is based on the steps described in this blog entry.
The main problems that had to be addressed were the following:
  1. Lack of swap space
  2. Setting apex to be serviced on a port other than 8080.
So here are the steps to run as root:
  1. Download the rpm from here. I have used the Universal version (oracle-xe-univ-10.2.0.1-1.0.i386.rpm).
  2. Install yum (using Add Application from the Control Panel).
  3. Install packages for cpio and libaio with these commands:
    1. yum install libaio
    2. yum install cpio
  4. Extract the contents of the rpm into a temporary folder:
    1. rpm2cpio oracle-xe-univ-10.2.0.1-1.0.i386.rpm > oracle-xe-univ-10.2.0.1-1.0.i386.cpio
    2. cpio -idv < oracle-xe-univ-10.2.0.1-1.0.i386.cpio
  5. At this point the rpm contents have been extracted and we are ready to copy them to the appropriate locations:
    1. # cp -R ./usr /
    2. # cp -R ./etc /
  6. Make the following additions/changes to users/groups using the Control Panel:
    1. Create a group and name it dba.
    2. Create a new user (oracle) with dba as its primary group:
    3. Add root to the dba group.
  7. Give the ownership of the /user/lib/oracle to this user :
    chown -R oracle:dba /usr/lib/oracle
  8. Edit the nls_lang.sh script and replace #!/bin/sh by #!/bin/bash
  9. Run the oracle_env.sh to simplify the process:
    . /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
  10. Change the user rights on the oracle binary :
    1. # chmod u+s $ORACLE_HOME/bin/oracle
    2. # chmod g+s $ORACLE_HOME/bin/oracle
  11. Set the desired size of SGA and PGA (in the scripts they appear as substitution variables %sga_target% and %pga_aggregate_target%):
    1. # cd /usr/lib/oracle
    2. Find two (2) files using substitution variables using this: # find . -exec grep "%sga_" '{}' \; -print
    3. Replace the variables in these files with their desired values. I have used the following values:
      1. sga_target=246579200 (= 200 MB)
      2. pga_aggregate_target=67108864 (=64 MB)
  12. At this point oracle software is in the correct location and we are ready to run database creation and configuration scripts. Start by executing:
    # /etc/init.d/oracle-xe configure
  13. I have used the default port (1521) for the listener. However we need to use a port other than 8080 for apex since port 8080 is already used by Tomcat. The port of choice was 8084.
For the rest of the steps open a new shell and login as oracle. Continue with the following steps:
  1. Connect internally to oracle using sqlplus to change the XDB HTTP port and register the instance with the listener (this may not be necessary but just in case):
    1. sqlplus / as sysdba
    2. SQL> EXEC DBMS_XDB.SETHTTPPORT(8084);
    3. SQL> alter system register;
  2. That's all. You may want to restart oracle. Use the following to stop/start it:
    1. /etc/init.d/oracle-xe stop
    2. /etc/init.d/oracle-xe start
  3. At this point if you check your listener it should look like this:
    # lsnrctl status

    LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 22-DEC-2008 08:19:09

    Copyright (c) 1991, 2005, Oracle. All rights reserved.

    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 22-DEC-2008 08:18:30

    Uptime 0 days 0 hr. 0 min. 39 sec

    Trace Level off

    Security ON: Local OS Authentication

    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=<your hostname>)(PORT=1521)))

    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=8084))(Presentation=HTTP)(Session=RAW))

    Services Summary...

    Service "PLSExtProc" has 1 instance(s).

    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

    Service "XE" has 1 instance(s).

    Instance "XE", status READY, has 1 handler(s) for this service...

    Service "XEXDB" has 1 instance(s).

    Instance "XE", status READY, has 1 handler(s) for this service...

    Service "XE_XPT" has 1 instance(s).

    Instance "XE", status READY, has 1 handler(s) for this service...

    The command completed successfully
Finally, these are the contents of the listener.ora and tnsnames.ora files I am using:
These are the contents of the listener.ora file:
# listener.ora Network Configuration File:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /usr/lib/oracle/xe/app/oracle/product/10.2.0/server)
(PROGRAM = extproc)
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
(ADDRESS = (PROTOCOL = TCP)(HOST = <your hostname>)(PORT = 1521))
)
)

DEFAULT_SERVICE_LISTENER = (XE)

These are the contents of the tnsnames.ora file:
# tnsnames.ora Network Configuration File:

XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = <your IP>)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)

EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)

I hope that the above will help other people trying to install Oracle XE on a similar environment.

Kostas