Sunday 20 April 2014

How To  Drives in Windows

How To  Drives in Windows:

1.Go to run .
2.Type "diskpart".
3.Type "list volume".
4.Now select the volume you want to hide by typing "select volume n"(n is the volume number against the drive you want to hide).
eg: select volume 2.
5.Type "revome letter x"(x is the drive name).eg: remove letter D.
Done, now check my computer .
If you want to show the drive again then repeat step 1 to 4 then type "assign letter x".
Note :
**Dont try with drive C **
** If you have locked something with Folderlock or other software then after assigning the drive everything will be unlocked ;)**

Monday 7 April 2014

Oracle Database 10g Installation on RHEL5.5 64-bit


Oracle Database 10g Installation on RHEL5.5 64-bit

Make sure when partitioning...
 / 15 GB
 swap 4 GB
 /u01 15 GB

Unpack Files
Login as super user.
32-bits Oracle Unzip database the files.
# unzip 10201_database_linux32.zip

64-bits Oracle Unzip database the files.

 #  cd /home/oracle/Desktop/
 #  gunzip 10201_database_linux_x86_64.tar.gz
 #  cpio -idm < 10201_database_linux_x86_64.tar.gz

You should now have a single directory containing installation files. Depending on the age of the download this may either be named  "database".

Make network configuration Static, basically System provide DHCP IP Address.
# system-config-network-tui
Here edit the Device---> eth0-----> Uncheck Use DHCP-----> give Static IP---> Netmask-----Default gateway IP..

Hosts File
The "/etc/hosts" file must contain a fully qualified name for the server.

    <IP-address>  <fully-qualified-machine-name>  <machine-name>
   e.g- 192.168.0.14       desktop20.example.com       localhost


Set Kernel Parameters
# vim /etc/sysctl.conf

    #kernel.shmall = 2097152
    #kernel.shmmax = 536870912
    kernel.shmmni = 4096
    # semaphores: semmsl, semmns, semopm, semmni
    kernel.sem = 250 32000 100 128
    fs.file-max = 65536
    net.ipv4.ip_local_port_range = 1024 65000
    net.core.rmem_default=262144
    net.core.rmem_max=262144
    net.core.wmem_default=262144
    net.core.wmem_max=262144

Run the following command to change the current kernel parameters.

   # /sbin/sysctl -p


Add the following lines to the "/etc/security/limits.conf" file.
As it is given below...

 *       soft    nproc   2047
 *       hard    nproc   16384
 *       soft    nofile  1024
 *       hard    nofile  65536

Add the following line to the "/etc/pam.d/login" file, if it does not already exist.

    session    required     pam_limits.so

Disable secure linux by editing the "/etc/selinux/config" file, making sure the SELINUX flag is set as follows.

    SELINUX=disabled

Alternatively, this alteration can be done using the GUI tool (System > Administration > Security Level and Firewall). Click on the SELinux tab and disable the feature.
Setup

Edit the "/etc/redhat-release" file replacing the current release information (Red Hat Enterprise Linux Server release 5 (Tikanga)) with the following:

    redhat-4

Configure your /etc/yum.repos.d/rhel.repo
    [redhat]
    name=rhel6.5
    baseurl=http://192.168.0.254/rhel-6-64
    enabled=1
    gpgcheck=0

Save the file.

#  yum clean all
#  yum list all 

Install the following packages.
rhel5.5 64-bits
    # yum install setarch make glibc compat-libstdc++-33 compat-gcc-34 compat-gcc-34-c++ gcc libXp openmotif compat-db java* -y

Create the new groups and users.

   # groupadd oinstall
   # groupadd dba
   # groupadd oper

   # useradd -g oinstall -G dba,oper -d /home/oracle oracle
   # passwd oracle

Create the directories in which the Oracle software will be installed.

   # mkdir -p /u01/app/oracle/product/10.2.0/db_1
   # chown -R oracle:oinstall /u01
   # chmod -R 775 /u01

Restart the system and switch to the user oracle.

-- Let's see which shell is being used by the user Oracle.
$ echo $SHELL
/bin/bash

Add the following lines at the end of the ".bash_profile" file.
$ vim ~/.bash_profile
   
#ORACLE SETTING
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_HOSTNAME=desktop2.example.com; export ORACLE_HOSTNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
LD_LIBRARY_PATH=$ORACLE_HOME/jdk/jre/i386:$ORACLE_HOME/jdk/jre/lib/i386/server:$ORACLE_HOME/rdbms/lib:$ORACLE_HOME/lib:$LD_LIBRARY_PATH;
export LD_LIBRARY_PATH
PATH=$PATH:$HOME/bin; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
export username

if [ $USER = "oracle" ]; then
  if [ $SHELL = "/bin/ksh" ]; then
     ulimit -p 16384
     ulimit -n 65536
  else
     ulimit -u 16384 -n 65536
  fi
fi

umask 022


Save the file.
Now run the following command to make these changes effective in the current session of user oracle.

-- for bash shell
$ source ~/.bash_profile



Login as root and issue the following command.
Allow the user oracle to use X server, which it will need to run Oracle Universal Installer.
e.g.~ xhost +<machine-name>
# xhost +SI:localuser:oracle
or, # xhost +

Flush the firewall
#  iptables -F


Installation
Start the Oracle Universal Installer (OUI) by issuing the following command in the database directory.

  $ cd Desktop/linux/database/
  $ ./runInstaller

During the installation enter the appropriate ORACLE_HOME and name then continue installation.

If any problem occured during installation, contact me.
Prepared By: Tapas Kumar Sen
email:  tapas.93028@gmail.com

Oracle Database 11g Release 2 (11.2) Installation On RedhatLinux 6


Oracle Database 11g Release 2 (11.2) Installation On RedhatLinux 6

--------------------------------------------------------------
While Installation RHEL6 make sure Swap memory will be 4GB minimum, along with /u01 partition 15GB minimum space.

Unzip the files.

    # 11.2.0.1
    unzip linux.x64_11gR2_database_1of2.zip
    unzip linux.x64_11gR2_database_2of2.zip

 You should now have a single directory called "database" containing installation files.

Hosts File

The "/etc/hosts" file must contain a fully qualified name for the server.

    <IP-address>  <fully-qualified-machine-name>  <machine-name>

For example.

    127.0.0.1       localhost.localdomain  localhost
    192.168.0.181   desktop2.example.com   desktop2

Add or amend the following lines in the "/etc/sysctl.conf" file.

    fs.suid_dumpable = 1
    fs.aio-max-nr = 1048576
    fs.file-max = 6815744
    kernel.shmall = 2097152
    kernel.shmmax = 536870912
    kernel.shmmni = 4096
    # semaphores: semmsl, semmns, semopm, semmni
    kernel.sem = 250 32000 100 128
    net.ipv4.ip_local_port_range = 9000 65500
    net.core.rmem_default=4194304
    net.core.rmem_max=4194304
    net.core.wmem_default=262144
    net.core.wmem_max=1048586

Run the following command to change the current kernel parameters.

    /sbin/sysctl -p


Configure your /etc/yum.repos.d/rhel.repo
    [redhat]
    name=rhel6.5
    baseurl=http://192.168.0.254/rhel-6-64
    enabled=1
    gpgcheck=0

Save the file.

#  yum clean all
#  yum list all 
Install these Packages:

# yum install binutils* compat-libcap* compat-libstdc++-33* compat-libstdc++-33* gcc* gcc-c++* glibc* glibc* glibc-devel* libaio* libaio-devel* libgcc* libstdc++* libstdc++-devel* libXext* libXtst* openmotif* openmotif22* sysstat* ksh* java* numactl-devel-2*x86_64* make-3.81*x86_64* elfutils-libelf-0*x86_64* elfutils-libelf-devel-0*x86_64* -y


Add the following lines to the "/etc/security/limits.conf" file.

    oracle              soft    nproc   2047
    oracle              hard    nproc   16384
    oracle              soft    nofile  4096
    oracle              hard    nofile  65536
    oracle              soft    stack   10240

Add the following line to the "/etc/pam.d/login" file, if it does not already exist.

    session    required     pam_limits.so


Amend the "/etc/security/limits.d/90-nproc.conf" file as described below.

    # Change this
    *          soft    nproc    1024

    # To this
    * - nproc 16384

Set secure Linux to permissive by editing the "/etc/selinux/config" file, making sure the SELINUX flag is set as follows.

    SELINUX=permissive

Once the change is complete, restart the system.

Create the new groups and users.

    groupadd -g 501 oinstall
    groupadd -g 502 dba
    groupadd -g 503 oper


    useradd -u 502 -g oinstall -G dba,oper oracle
    passwd oracle

Create the directories in which the Oracle software will be installed.

    mkdir -p /u01/app/oracle/product/11.2.0/db_1
    chown -R oracle:oinstall /u01
    chmod -R 775 /u01

Login as the oracle user and add the following lines at the end of the ".bash_profile" file.

-- Let's see which shell is being used by the user Oracle.
$ echo $SHELL
/bin/bash

Add the following lines at the end of the ".bash_profile" file.
# vim ~/.bash_profile
   
#ORACLE SETTING
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_HOSTNAME=desktop2.example.com; export ORACLE_HOSTNAME
ORACLE_UNQNAME=orcl; export ORACLE_UNQNAME 
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
LD_LIBRARY_PATH=$ORACLE_HOME/jdk/jre/i386:$ORACLE_HOME/jdk/jre/lib/i386/server:$ORACLE_HOME/rdbms/lib:$ORACLE_HOME/lib:$LD_LIBRARY_PATH;
export LD_LIBRARY_PATH
PATH=$PATH:$HOME/bin; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
export username

if [ $USER = "oracle" ]; then
  if [ $SHELL = "/bin/ksh" ]; then
     ulimit -p 16384
     ulimit -n 65536
  else
     ulimit -u 16384 -n 65536
  fi
fi

umask 022


Save the file.
Now run the following command to make these changes effective in the current session of user oracle.

-- for bash shell
$ source ~/.bash_profile

Login as root and issue the following command.

  #  xhost +<machine-name>

Flush the Iptables

#   iptables -F

Start the Oracle Universal Installer (OUI) by issuing the following command in the database directory.

  $ cd Desktop/database/
  $ ./runInstaller

A Shell Script To Take RMAN Cold/Hot and Export Backup


A Shell Script To Take RMAN Cold/Hot and Export Backup


#!/bin/bash
# A Shell Script To Take RMAN Cold/Hot and Export Backup
ORACLE_SID=orcl;export ORACLE_SID
echo $ORACLE_SID

echo “Which kind of backup you want to take?”
echo “1) RMAN COLD BACKUP”
echo “2) RMAN HOT BACKUP”
echo “3) LOGICAL OR EXPORT BACKUP”
echo “Enter your option”

read option

while [ $option -gt 3 ]||[ $option -le 0 ]
do
echo “Please Enter the correct option”
read option
done

case $option in
1|2) echo “You are taking RMAN backup of orcl Database”
   rman target sys/oracle@orcl @/ORACLE/RMAN_BACKUP/rman_backup_$option.txt;exit;;
3) echo “You are taking export backup of orcl Database”
   exp system/oracle file=/ORACLE/EXPORT_BACKUP/exp_dat.dmp log=/oracle/export_backup/exp_dat.log full=y;
   exit;;
esac

exit

# Now Create two simple text file for Rman Cold and Hot backup.
# The above script can call anyone of the following RMAN script depending on the option 1-cold or 2-hot backup.

rman_backup_1.txt:

run
{
shutdown immediate;
startup mount;
allocate channel d1 type disk FORMAT "H:\Cold_Backup\COLD_BACKUP_%T_%d-%s_%p.db";
allocate channel d2 type disk FORMAT "H:\Cold_Backup\COLD_BACKUP_%T_%d-%s_%p.db";
backup full format "H:\Cold_Backup\COLD_BACKUP_%T_%d-%s_%p.db" (database);
copy current controlfile to 'H:\Cold_Backup\COLD_BACKUP_Control.db';
release channel d1;
release channel d1;
alter database open;
}

rman_backup_2.txt:

run {
allocate channel d1 type disk FORMAT "H:\Hot_Backup\Hot_BACKUP_%T_%d-%s_%p.db";
allocate channel d2 type disk FORMAT "H:\Hot_Backup\Hot_BACKUP_%T_%d-%s_%p.db";
sql 'alter system archive log current';
 backup
 
  tag Catalog_Full_Rman
  filesperset 10
  format "H:\Hot_Backup\Hot_Backup_%T_FULL_%d-%s_%p.db"
  database archivelog all;
release channel d1;
release channel d1;
}