Monday, July 25, 2011

How install Ubuntu on Fedora on dual boot system

Following are the assumptions:
1. You have dual boot system with windows XP & Fedora

I followed following steps:
1. On Windows XP:
Click Start->Run and then type diskmgmt.msc and press Enter. The Disk Management tool opens.




Reference:
http://docs.fedoraproject.org/en-US/Fedora/13/html/Installation_Guide/sn-x86-uninstall-dual.html

Wednesday, July 20, 2011

Oracle 11gR2 on Ubuntu 11.04

I'm a newbie to Ubuntu. After installing Ubuntu on my machine, I figured out that Oracle 11g doesn't support Ubuntu officially. At first I felt bad for installing Ubuntu, then I searched in net and I came across some wonderful blogs which explains procedure to install the Oracle on Ubuntu:

http://www.pythian.com/news/1355/installing-oracle-11gr1-on-ubuntu-810-intrepid-ibex
http://lesscode.blogspot.com/2010/04/install-oracle-11g-r2-on-ubuntu-104.html
http://mikesmithers.wordpress.com/2010/03/14/installing-oracle-11gr2-on-ubuntu-9-10

I followed info in the above blogs along with some little effort kept on searching web to install Oracle 11gR2 on Ubuntu 11.04 on 32 bit Machine.

Now lets start as a root

sudo su

You might already downloaded Oracle 11g R2:
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

You need to create an account to download the software. There will be two files for Oracle 11g R2. Now unzip the software at your home directory (/home/username/). Username will be your Ubuntu login username

unzip linux_11gR2_database_1of2.zip
unzip linux_11gR2_database-2of2.zip

unzipped files will be at /home/username/database.

At first make sure you install or upgrade following packages(as a root):
apt-get install gcc
apt-get install make
apt-get install binutils
apt-get install gawk
apt-get install x11-utils
apt-get install rpm
apt-get install build-essential
apt-get install libaio1
apt-get install libaio-dev
apt-get install libmotif4
apt-get install libtool
apt-get install expat
apt-get install alien
apt-get install ksh
apt-get install pdksh
apt-get install unixODBC
apt-get install unixODBC-dev
apt-get install sysstat
apt-get install elfutils
apt-get install libelf-dev
apt-get install binutils
apt-get install lesstif2
apt-get install lsb-cxx
apt-get install lsb-rpm
apt-get install libstdc++5

May be too long...But it won't take much time to install those packages.

Now lets create some softlinks to the binaries so that our beloved Oracle takes it up(as a root):
ln -sf /bin/bash /bin/sh
ln -s /usr/bin/awk /bin/awk
ln -s /usr/bin/rpm /bin/rpm
ln -s /usr/bin/basename /bin/basename

ln -s /usr/lib/i386-linux-gnu/libpthread_nonshared.a /usr/lib/libpthread_nonshared.a
ln -s /usr/lib/i386-linux-gnu/libc_nonshared.a /usr/lib/libc_nonshared.a
ln -s /lib/i386-linux-gnu/libgcc_s.so.1 /lib/libgcc_s.so.1
ln -s /usr/lib/i386-linux-gnu/libstdc++.so.6 /usr/lib/libstdc++.so.6

Time to create some users(as a root):
addgroup oinstall
addgroup dba
addgroup nobody
usermod -g nobody nobody
useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle
mkdir /home/oracle
chown -R oracle:dba /home/oracle
mkdir /etc/rc.d
for i in 0 1 2 3 4 5 6 S ; do ln -s /etc/rc$i.d /etc/rc.d/rc$i.d ; done
mkdir -p /u01/app/oracle
chown -R oracle:dba /u01

mv /home/username/download/database /media/database
chown -R oracle:oinstall /media/database

Now lets change some system configuration files:

Add the following lines at the end of the file /etc/sysctl.conf:
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 1048576
net.core.wmem_max = 1048576
net.ipv4.ip_local_port_range = 9000 65500
fs.aio-max-nr = 1048576

Add the following lines at the end of the file /etc/security/limits.conf:
oracle soft nproc 2047
oracle hard nproc 16384
oracle hard nofile 65536
oracle soft nofile 1024

Add the following lines at
/etc/pam.d/login just above the line "session required pam_limits.so":

session required /lib/security/pam_limits.so

Lets activate the new settings from /etc/sysctl.conf with this command:
sysctl -p

Now run the following commands as root:
init 3
DISPLAY=:0; export DISPLAY; xhost +;

Till now we have done everything as a root, Now lets move to user oracle to install Oracle 11g R2(as a user oracle):
su - oracle

DISPLAY=:0 ; export DISPLAY
xclock
Make sure that clock window got popped up and then press Ctrl-c on the terminal.

cd /media/database
./runInstaller -ignoreSysPrereqs

Last command intiates Oracle 11g R2 installation.

1. Configure Security Updates:
You want to get security updates you can register with your mail id or else ignore it.

2. Installation option:
select "Create and configure a database"

3. System Class:
select "Desktop Class"

4. Typical Installation:
Update your Administrative password.

5. Pre-requisite Checks:
Select "Ignore All" and press next.

and now onwards go with defaults. Till it creates the database

Note: If you want SCOT user, at the password management option activate the user SCOT.

By default at the end of the installation you will get the database named "orcl".

After Installation completes lets do some cross checkings & little config changes:

As a root run the following commands:
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/dbhome_1/root.sh

creating startup/init script:
Update the following script in /etc/init.d/oracledb. Follow the referenced blogs above for explanation.

#!/bin/bash
#
# /etc/init.d/oracledb
#
# Run-level Startup script for the Oracle Listener and Instances
# It relies on the information on /etc/oratab

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_OWNR=oracle
export PATH=$PATH:$ORACLE_HOME/bin

if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi

case "$1" in
start)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
touch /var/lock/oracle
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
rm -f /var/lock/oracle
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|restart|reload"
exit 1
esac

exit 0
#####################################################

Run following commands as a root.
chmod a+x /etc/init.d/oracledb
update-rc.d oracledb defaults 99

Testing:
connect to the user oracle from root:
su - oracle
Run the following commands to connect to the sqlplus as an oracle user.
. oraenv
ORACLE_SID = [oracle] ? orcl //output, give the orcl at the '?'
sqlplus '/as sysdba'
Now you will be having the sql prompt.


To make the Oracle start at the system boot:
in /etc/oratab change the 'N' on orcl line to Y as follows;

orcl:/u01/app/oracle/product/11.2.0/dbhome_1:Y


Wednesday, July 6, 2011

Lectures

Here I will be listing Lectures which are worth to go through them:

http://www.stanford.edu/class/cs110/ : This is about the Principles of computer systems. It consitutes very good lectures on linux, GDB, VIM, EMACS and brush up on network programming.

http://linuxpoison.blogspot.com: This blog contains good linux related articles. Have a peep into them.

http://www.thegeekstuff.com: Ramesh Natarajan is an author of the blog. It includes very nice articles on instruction guides, How-Tos, troubleshooting tips and tricks Linux and open source technologies. You can peek into "About" section of the blog for more info.


Disclaimer: I'm not sure that those links work for ever, But I hope they will be maintained.

Tuesday, July 5, 2011

Emacs

Will be updating evil-mode

Installing latest emacs:
sudo port install emacs
sudo port install emacs-app

http://wikemacs.org/wiki/Installing_Emacs_on_OS_X


Using following link to install mac ports
https://guide.macports.org/chunked/installing.macports.html


Start playing tetris:
M-x tetris

Grep with in Emacs:
M-x grep

Emacs can compare two files and highlight their differences (M-x ediff)
Emacs is a file manager (M-x dired)
Emacs can read news, mail, and RSS feeds (M-x gnus)
You can even play tetris in Emacs (M-x tetris)

Emacs with Cscope:
To run Cscope in Emacs you need cscope-indexer and xcscope.el in appropriate folders. They can be found at contrib/xcscope/ in cscope source code.
File cscope-indexer must be executable and placed in some directory in system PATH. File xcscope.el must be copied in some folder in Emacs’s load path. Usually, my .el files are in folder ~/elisp and this folder can be included in Emacs load path by adding this line to ~/.emacs:

(add-to-list 'load-path "~/elisp")

When this is done, we can include cscope in Emacs by adding this line to ~/.emacs :
(require 'xcscope)

Start Emacs, type M-x cscope and type TAB key (one or more times). If you see a list of cscope functions in other buffer, everything is fine. Set the cscope-initial-directory variable by typing M-x cscope-set-initial-directory and ~/projects/foo in the mini buffer (we can check variable values in Emacs by typing M-x describe-variable following the variable name).

Create list of files to index and cscope database with M-x cscope-index-files (this should create files cscope.files and cscope.out)

To move between the Cscope tags: "SPACE BAR"
To know the help commands in cscope file: C-h m

(From file xcscope.el)
;; * Keybindings:
;;
;; All keybindings use the "C-c s" prefix, but are usable only while
;; editing a source file, or in the cscope results buffer:
;;
;;      C-c s s         Find symbol.
;;      C-c s d         Find global definition.
;;      C-c s g         Find global definition (alternate binding).
;;      C-c s G         Find global definition without prompting.
;;      C-c s c         Find functions calling a function.
;;      C-c s C         Find called functions (list functions called
;;                      from a function).
;;      C-c s t         Find text string.
;;      C-c s e         Find egrep pattern.
;;      C-c s f         Find a file.
;;      C-c s i         Find files #including a file.
;;
;; These pertain to navigation through the search results:
;;
;;      C-c s b         Display *cscope* buffer.
;;      C-c s B         Auto display *cscope* buffer toggle.
;;      C-c s n         Next symbol.
;;      C-c s N         Next file.
;;      C-c s p         Previous symbol.
;;      C-c s P         Previous file.
;;      C-c s u         Pop mark.
;;
;; These pertain to setting and unsetting the variable,
;; `cscope-initial-directory', (location searched for the cscope database
;;  directory):
;;
;;      C-c s a         Set initial directory.
;;      C-c s A         Unset initial directory.
;;
;; These pertain to cscope database maintenance:
;;
;;      C-c s L         Create list of files to index.
;;      C-c s I         Create list and index.
;;      C-c s E         Edit list of files to index.
;;      C-c s W         Locate this buffer's cscope directory
;;                      ("W" --> "where").
;;      C-c s S         Locate this buffer's cscope directory.
;;                      (alternate binding: "S" --> "show").
;;      C-c s T         Locate this buffer's cscope directory.
;;                      (alternate binding: "T" --> "tell").
;;      C-c s D         Dired this buffer's directory


References:
http://kliketa.wordpress.com/2010/07/09/using-cscope-source-browsing-tool
http://stackoverflow.com/questions/364495/non-gui-emacs-with-cscope
http://www.stanford.edu/class/cs110/other/emacsrefcard.pdf
http://lists.gnu.org/archive/html/help-gnu-emacs/ -- Emacs mailer list