Search This Blog

Showing posts with label oracle. Show all posts
Showing posts with label oracle. Show all posts

Wednesday, August 18, 2010

Oracle XE installation

Installation of Oracle XE and configuration.

• If you downloaded the oracle-xe-univ-10.2.0.1-1.0.i386.rpm executable, you need to enter following command.
# rpm -ivh downloads/oracle-xe-univ-10.2.0.1-1.0.i386.rpm

The installation displays a status of its progress.
• When prompted, run the following command:
# /etc/init.d/oracle-xe configure




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]:8888

Specify a port that will be used for the database listener [1521]: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:
Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]

Starting Oracle Net Listener...Done
Configuring Database...Done
Starting Oracle Database 10g Express Edition Instance...Done
Installation Completed Successfully.
To access the Database Home Page go to http://127.0.0.1:8888/apex

You have now installed Oracle XE on your Linux machine.

For Installation,Documentation and Download you may refer following link .

http://www.oracle.com/technology/software/products/database/xe/files/install.102/b25144/toc.htm#CIHHJEHF

Monday, August 16, 2010

Bash and Database connectivity.

Install Database as described in below link:

http://learnlinuxwithrohan.blogspot.com/2010/08/oracle-xe-installation.html

Prerequisite:
Set following variables.

export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=XE


Description:
Script connect to the database and execute the command .


#!/bin/bash

# Validate the value of ORACLE_HOME #
if [ -z $ORACLE_HOME ]
then
echo "Set the ORACLE_HOME variable"
exit 1
fi

# If ORACLE_HOME doesn't exist #
if [ ! -d $ORACLE_HOME ]
then
echo "The ORACLE_HOME $ORACLE_HOME does not exist"
exit 1
fi

# Validate the value of ORACLE_SID #
if [ -z $ORACLE_SID ]
then
echo "Set the ORACLE_SID variable"
exit 1
fi

#Get SID for the database.

SID=`ps -ef|grep smon|grep -v grep|awk '{print $8}'`

if [ 'xe_smon_'$ORACLE_SID != $SID ] ; then
echo "ORACLE_SID IS NOT SET"
exit 1
fi


# Enter the username and password to login to oracle #
echo "Enter the username"
read username

echo "Enter password"
stty -echo
read password
stty echo
# Get the query , no validation applied for query #
echo "Enter the query"
read query

# Login and execute the query.
echo "set feedback off verify off heading off pagesize 0
$query
exit" | $ORACLE_HOME/bin/sqlplus -s $username/$password | while read output ;
do
echo $output
done

Output:



More will be coming soon.