Oracle

This article need editing and rewriting!

Oracle Install Tips - 10g on RHEL5

Install requisite packages

  yum -y install setarch-2*
  yum -y install make-3*
  yum -y install glibc-2*
  yum -y install libaio-0*
  yum -y install compat-libstdc++-33-3*
  yum -y install compat-gcc-34-3*
  yum -y install compat-gcc-34-c++-3*
  yum -y install gcc-4*
  yum -y install libXp-1*
  yum -y install openmotif-2*
  yum -y install compat-db-4*

Update /etc/hosts with correct servername

      10.1.4.200     oracle.sysxperts.com oracle

Update /etc/security/limits.conf

  oracle soft nproc 15360
  oracle hard  nproc  16384
  oracle soft  nofile 64512
  oracle hard  nofile 65536

Create users and groups

  groupadd dba
  useradd -g dba oracle; echo "mypass" |passwd --stdin oracle

Create directories and chown for oracle

   mkdir -p /u01/app/oracle/product/10.2.0/db_1
   chown -R oracle.dba /u01

Make sure SELINUX is disabled in /etc/selinux/config and reboot if it was enabled:

          SELINUX=disabled

Update /etc/sysctl.conf with:

  # Controls the maximum shared segment size, in bytes  - see kernel and hugepages info
  kernel.shmmax = 68719476736
  # Controls the maximum number of shared memory segments, in pages
  kernel.shmall = 4294967296
  kernel.sem = 250 32000 100 128
  fs.file-max = 104032
  net.ipv4.ip_local_port_range = 1024 65000
  net.core.rmem_default = 1048576
  net.core.rmem_max = 1048576
  net.core.wmem_default = 262144
  net.core.wmem_max = 262144
   
  run sysctl -p  #activates new kernel parameters  

To mount an NFS share for backups: nas.sysxperts.com:/Archive /archive_fs nfs hard,nolock,vers=3,proto=tcp,bg,rsize=32768,wsize=32768,timeo=600,intr 0 0 nas.sysxperts.com:/Brchive /backup_fs nfs hard,nolock,vers=3,proto=tcp,bg,rsize=32768,wsize=32768,timeo=600,intr 0 0

Edit the oracle users ~/.bash_profile

  # Oracle Settings
  TMP=/tmp; export TMP
  TMPDIR=$TMP; export TMPDIR
  ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
  ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
  ORACLE_SID=TEST; export ORACLE_SID
  ORACLE_TERM=xterm; export ORACLE_TERM
  PATH=/usr/sbin:$PATH; export PATH
  PATH=$ORACLE_HOME/bin:$PATH; export PATH
  LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
  CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
  if [ $USER = "oracle" ]; then
    if [ $SHELL = "/bin/ksh" ]; then
      ulimit -p 16384
      ulimit -n 65536
    else
      ulimit -u 16384 -n 65536
    fi
  fi 

Start vncserver with (install with yum -y install vnc-server if necessary):

  vncserver
  vncpasswd

Establish vnc session and run xhost + as root

Extract cpio with:

cpio -idmv < 10201_database_linux_x86_64.cpio

cd to directory where cpio command was run

./database/runInstaller

download latest patch and unzip

./Disk1/runInstaller

To uninstall run the deinstaller from the latest patch Disk1/runInstaller

Edit /etc/oratab and set restart flag for TEST instance

  TEST:/u01/app/oracle/product/10.2.0/db_1:Y

sar and dstat is useful for stats on server - yum -y install sysstat dstat ls -lattr /var/log/sa and choose the filename with the date you want to see stats for then

  sar -A /var/log/sa/saXX

man sar and dstat are your friends

See oracle automated startup for init setup (http://docs.google.com/View?docid=dfxjbxcc_155dbzfvtg8)

++++++++++++++++++++++++++

Oracle 10g/11g Automated Startup and Shutdown on RedHat Create file /etc/init.d/oracle with following code and change file to be executable

#!/bin/sh # chkconfig: 345 99 01 # description: Oracle # # ORACLE=oracle case $1 in 'start')

      cat <<-"EOF"|su - ${ORACLE}
      # Start Oracle Net
      if [ -f ${ORACLE_HOME}/bin/tnslsnr ] ;
      then
              echo "starting Oracle Net Listener"
              ${ORACLE_HOME}/bin/lsnrctl start
      fi
      echo "Starting Oracle databases"
      ${ORACLE_HOME}/bin/dbstart
      ${ORACLE_HOME}/bin/emctl start dbconsole

EOF

      ;;

'stop')

      cat <<-"EOF"|su - ${ORACLE}
      echo "shutting down dbconsole"
      ${ORACLE_HOME}/bin/emctl stop dbconsole
      # Stop Oracle Net
      if [ -f ${ORACLE_HOME}/bin/tnslsnr ] ;
      then
              echo "stopping Oracle Net Listener"
              ${ORACLE_HOME}/bin/lsnrctl stop
      fi
      echo "stopping Oracle databases"
      ${ORACLE_HOME}/bin/dbshut

EOF

      ;;

*)

      echo "usage: $0 {start|stop}"
      exit
      ;;

esac # exit

Run: chkconfig oracle on

Update the oracle user .bash_profile as follows: export ORACLE=oracle export ORACLE_SID=`cat /etc/oratab |sed -e 's/:.*' -e 's/#.*' -e '/^$/d'|head -1` export PATH=$PATH:/usr/local/bin export ORAENV_ASK=“NO” . /usr/local/bin/oraenv

Update /etc/oratab with your instances orcl:/u01/oracle/product/11.1.0/db_1:Y orcltest:/u01/oracle/product/11.1.0/db_1:Y

Alternatively if you want to use your own start scripts you could do the following (BUT WHY?):

Create an /etc/init.d/oracle script with: #!/bin/sh # #oracle agent init script #chkconfig: 2345 97 05 #description: oracle # Source function library. if [ -f /etc/init.d/functions ] ; then

      . /etc/init.d/functions

elif [ -f /etc/rc.d/init.d/functions ] ; then

      . /etc/rc.d/init.d/functions

else

      exit 0

fi prog=oracle ORAHOME=/oracle/home/scripts AGENT_USER=oracle email=pvalentino@sysxperts.com start () {

      echo -n $"Starting $prog: "
      # start daemon
      if [ -e "/tmp/orastat" ]
      then
      su - ${AGENT_USER} -c "cd ${ORAHOME}; ./orastart"
      rm -rf /tmp/orastat
      else
      mail -s "`hostname` orastart failed" $email < /tmp/stat
      fi
      RETVAL=$?
      echo
      [ $RETVAL = 0 ] && touch /var/lock/subsys/oracle
      return $RETVAL

} stop () {

      # stop daemon
      echo -n $"Stopping $prog: "
      su - ${AGENT_USER} -c "cd ${ORAHOME};./orastop"
      RETVAL=$?
      if  "$RETVAL" = 0  ;then touch /tmp/orastat;else mail -s "`hostname` orastop failed" $email < /tmp/stat;fi
      echo
      [ $RETVAL = 0 ] && touch /var/lock/subsys/oracle
      return $RETVAL

} restart() {

      stop
      start

} case $1 in

      start)
              start
      ;;
      stop)
              stop
      ;;
      restart|reload)
              restart
      ;;
      condrestart)
              [ -f /var/lock/subsys/ora ] && restart || :
      ;;
      *)
      echo $"Usage: $prog {start|stop|restart|condrestart|reload }"
      exit 1

esac exit $RETVAL

And your orastart and orastop scripts would have all of the startup procedures you would like to run in a custom fashion i.e.

orastart: . /home/oracle/scripts/orastart_TEST lsnrctl start # mail -s “ TEST databases started ***” _DBA@sysxperts.com < /home/oracle/scripts/orastart

orastart_TEST: . /home/oracle/ora10.env ############# This will start Oracle in TEST ###################### export ORACLE_SID=TEST sqlplus '/ as sysdba' «EOF startup EOF #

oracle.txt · Last modified: 2013/11/01 18:56 by a
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready