Saturday, October 9, 2010

Oracle Instance

Clapton

http://www.arikaplan.com/oracle/ari111897b.html

http://www.devx.com/dbzone/Article/20713

http://www.pcs-computing.com/support/oracle_mkdb.html

 

 

 

 

Oracle: Instance creation checklist

 

 
  For all of you people out there that are really dbas, forgive me. This is a work in progress. I'm currently reading the Oracle 8i Handbook and I need a place to stash all the things they tell me to do when creating databases. Hopefully, once I'm done, this'll be a pretty complete document. In the mean time, it's what it is.

Later - much later

Well, studying has progressed. I'm to the point where I'm verifying/troubleshooting the checklist. If anyone has suggestions/comments/concerns, please send 'em. Please realize that I built this checklist on a Pentium 200 with one disk drive, so the details below aren't what would match a production environment. It's not the sizes or the specific environment that I'm after - more the steps that should be taken for most database creation exercises.
  1. Install Oracle
  2. Create instance
    1. Create the appropriate directory structure for your environment. Using the Oracle installed defaults, I have:
      ls -ld /oracle/admin/${ORACLE_SID}/*
      
      drwxr-xr-x   2 oracle   oinstall     1024 Mar 20 20:49 /oracle/admin/BITE/adhoc/
      
      drwxr-xr-x   2 oracle   oinstall     1024 Mar 20 20:49 /oracle/admin/BITE/arch/
      
      drwxr-xr-x   2 oracle   oinstall     1024 Mar 21 12:39 /oracle/admin/BITE/bdump/
      
      drwxr-xr-x   2 oracle   oinstall     1024 Mar 20 20:49 /oracle/admin/BITE/cdump/
      
      drwxr-xr-x   2 oracle   oinstall     1024 Mar 21 12:39 /oracle/admin/BITE/create/
      
      drwxr-xr-x   2 oracle   oinstall     1024 Mar 20 20:49 /oracle/admin/BITE/exp/
      
      drwxr-xr-x   2 oracle   oinstall     1024 Mar 21 12:36 /oracle/admin/BITE/pfile/
      
      drwxr-xr-x   2 oracle   oinstall     1024 Mar 20 20:49 /oracle/admin/BITE/udump/
      
    2. Update the user's environment (Oracle?). Either .kshrc, .bashrc, or .cshrc
      egrep -i "ora|nls" ~/.bashrc
      
      ORACLE_HOME="/oracle/product/8.1.5"
      
      ORACLE_BASE="/oracle"
      
      ORACLE_SID=BITE
      
      ORACLE_TERM=vt100
      
      LD_LIBRARY_PATH=${ORACLE_HOME}/lib
      
      ORA_NLS33=${ORACLE_HOME}/ocommon/nls/admin/data
      
      NLS_LANG="american"
      
      export SQLPATH=${HOME}:${HOME}/orabin
      
      PATH=${ORACLE_HOME}/bin:${PATH}
      
      export ORACLE_HOME ORACLE_BASE ORACLE_SID ORACLE_TERM
      
      export LD_LIBRARY_PATH ORA_NLS33 NLS_LANG 
      
    3. Copy an init.ora file to the OS default file location. Edit it as appropriate.
    4. Copy, create, edit, or otherwise enter manually, the create database statement
      create database "BITE"
      
              maxdatafiles 254
      
              maxlogfiles 32
      
              character set US7ASCII
      
              national character set US7ASCII
      
      datafile '/oracle/oradata/bite/system01.dbf' size 200m
      
      logfile '/oracle/oradata/bite/redo01.log' size 500k,
      
              '/oracle/oradata/bite/redo02.log' size 500k,
      
              '/oracle/oradata/bite/redo03.log' size 500k,
      
              '/oracle/oradata/bite/redo04.log' size 500k
      
  3. Run cat scripts:
    1. ${ORACLE_HOME}/rdbms/admin/catalog.sql
    2. ${ORACLE_HOME}/rdbms/admin/catproc.sql
    3. ${ORACLE_HOME}/rdbms/admin/catexp.sql
    4. catdbsyn.sql (Oracle 7.3 and lower): Creates the data dictionary views
    5. ${ORACLE_HOME}/sqlplus/admin/pupbld.sql
      1. Oracle 8.05 and lower
      2. Creates product_user_profile table & prevents annoying errors.
      3. Except, I had to run it on my Linux 8i (8.1.5) box.
    6. helpins.sql (Oracle 8.05 and lower): Creates and populates help utility.

  4. Create second system based rollback segment:

    create rollback segment r0
    tablespace system;
    alter rollback segment r0 online;

  5. Create tablespaces (Obviously you should size them per your needs)
    1. Rollback segment tablespace:
      create tablespace rbs
      
      datafile '/oracle/oradata/bite/rbs01.dbf' size 10m
      
      default storage (initial 128k next 128k pctincrease 0 maxextents unlimited)
      
    2. Index tablespace:
      create tablespace indexes
      
      datafile '/oracle/oradata/bite/index01.dbf' size 30m
      
      default storage (initial 50k next 50k pctincrease 0 maxextents unlimited);
      
    3. Temporary tablespace:
      create tablespace temp
      
      datafile '/oracle/oradata/bite/temp01.dbf' size 10m
      
      temporary
      
      default storage (initial 256k next 256k pctincrease 0 maxextents unlimited)
      
    4. Users tablespace:
      create tablespace users
      
      datafile '/oracle/oradata/bite/users01.dbf' size 50m
      
      default storage (initial 50k next 50k pctincrease 0 maxextents unlimited)
      
    5. Other tablespaces as local and OFA standards dictate.
  6. Create additional rollback segments in RBS tablespace
    1. Commands:
      
      
      create rollback segment r1
      
      tablespace RBS;
      
      alter rollback segment r1 online;
      
      
      
      create rollback segment r2
      
      tablespace RBS;
      
      alter rollback segment r2 online;
      
      
      
      create rollback segment r3
      
      tablespace RBS;
      
      alter rollback segment r3 online;
      
      
      
      create rollback segment r4
      
      tablespace RBS;
      
      alter rollback segment r4 online;
    2. Edit init.ora file to add private rollback segments.
      rollback_segments = (r1, r2, r3, r4)
      
  7. Deactivate the second system based rbs.

    alter rollback segment r0 offline;
  8. Change sys/system passwords
    1. sys
    2. system
    3. outln
    4. dbsnmp
  9. Alter system's default tablespace
    alter user system 
    
       quota 0 on system
    
       temporary tablespace TEMP;
    
    alter user sys temporary tablespace TEMP;
    
  10. Create example tables, if desired.
    1. ${ORACLE_HOME}/sqlplus/admin/pupbld.sql
    2. Lock the user accounts if not actively using them.
      set heading off
      
      spool /tmp/biteme.sql
      
      select 'alter user '||username||' account lock;'
      
      from dba_users
      
      where username in ('ADAMS','BLAKE','CLARK','JONES','SCOTT');
      
      spool off
      
      @/tmp/biteme
      
  11. Create users
    1. Constraints
      1. Default tablespace = USERS
      2. Default temporary tablespace = TEMP
    2. Example:
      create user dkoleary
      
      identified by ${passwd}
      
      default tablespace users
      
      quota unlimited on users
      
      temporary tablespace temp
      
      quota unlimited on temp;
      
      
      
      grant resource, dba, connect to dkoleary;
      
      
  12. Update Net8 configuration.
  13. Create/load database tables as needed.

Friday, October 8, 2010

Oracle Install

Oracle & PHP Installfest guide - Oracle 10gR2 on RHEL4 - OTN Night 2005
-----------------------------------------------------------------------
Installing Oracle 10g (10.2.0.1) on RHEL4

*** This guide is for test purposes only - not production ***

Boot from RHEL4 disc1
press enter for graphical install
 ** Need at least 512MB RAM / 2.5GB Space **
+ Automaticaly or Manually partition your hard drive with Disk Druid
 /tmp = 512MB ext3 fixed size
 /boot = 128MB ext3 fixed size
 swap = 1024MB fixed size
 / = fill to maximum allowable size

+ Accept defaults for GRUB boot loader, and configure networking.

+ Most Linux distros and RHEL4 ship with default security preferences locked down.
For testing purposes I typically turn off the firewall and disable SE Linux.

+ Set language preferences and root password

+ Select 'Customize software to be installed'
 - make sure the packages essential for installing Oracle are selected.
  Desktop : X Window System; Gnome or KDE
  Editors : at least one editor - vi etc.
  Graphical Internet : a web browser - firefox
  Development : Development Tools, and Compat Legacy Languages

For post-install configuration login as root
--------------------------------------------
+ create groups
 /usr/sbin/groupadd oinstall
 /usr/sbin/groupadd dba
 /usr/sbin/groupadd oper

+ create OS user oracle with group permissions and home /opt/oracle
 /usr/sbin/useradd -g oinstall -G dba,oper -d /opt/oracle oracle

+ set user oracle's password
 /usr/bin/passwd oracle

+ Append user oracle's bash profile with PATH and ORACLE:BASE,HOME and SID information
 vi /opt/oracle/.bash_profile

 umask 022
 PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
 LD_LIBRARY_PATH=/usr/lib:/usr/X11R6/lib

 ORACLE_BASE=/opt/oracle
 ORACLE_HOME=$ORACLE_BASE/product/10gR2
 ORACLE_SID=orcl
 PATH=$ORACLE_HOME/bin:$PATH

 export PATH LD_LIBRARY_PATH ORACLE_BASE ORACLE_HOME ORACLE_SID

+ Create the directory for the software installation and assign ownership to oracle:oinstall
 chown -R oracle:oinstall /opt
 chmod -R 775 /opt

+ Make sure the correct kernel parmeters are appended to sysctl.conf
 vi /etc/sysctl.conf (these can be easily copied from the Quick Installation Guide
                              for Linux x86 doc on the Oracle10g CD)
 kernel.shmall = 2097152
 kernel.shmmax = 2147483648
 kernel.shmmni = 4096
 kernel.sem = 250 32000 100 128
        net.core.rmem_default = 262144
 net.core.rmem_max = 262144
 net.core.wmem_default = 262144
 net.core.wmem_max = 262144
 fs.file-max = 65536
 net.ipv4.ip_local_port_range = 1024 65000

+ set the kernel parameters or reboot
 /sbin/sysctl -p

Login in to xwindows session as user oracle
-------------------------------------------
+ Mount the Oracle10g CD and run the installer
 mount /media/cdrom
 (cd $HOME && /media/cdrom/runInstaller)
 - follow the installer instructions 
 - use password mgmt to unlock DBuser scott & set password 'tiger'
+ open http://localhost.localdomain:1158/em in a browser or
 As root # vi /etc/oratab  change :N to :Y 
           # cp /etc/oratab /var/opt/oracle/oratab
+ This enables the oracle user to dbshut, dbstart and lsnrctl start 
 
 
 
 
Ref:
http://www.oracle-base.com/articles/11g/OracleDB11gR1InstallationOnEnterpriseLinux4and5.php 
http://www.oracle.com/technetwork/articles/smiley-rac10g-install-082032.html
http://www.oracle.com/technetwork/articles/smiley-10gdb-install-092939.html 
http://www.akadia.com/services/ora_linux_install_10g.html
http://www.oracle-base.com/articles/10g/OracleDB10gR2InstallationOnRHEL5.php
======
RAC
http://www.oracle-base.com/articles/10g/OracleDB10gR2RACInstallationOnCentos4UsingVMware.php
http://decipherinfosys.wordpress.com/2007/01/24/estimating-projecting-the-size-of-a-table-in-oracle/ 
http://anuj-singh.blogspot.com/2008/01/oracle-11g-installation-on-suse-103.html 

Friday, October 1, 2010

JVM Monitoring

http://cupi2.uniandes.edu.co/web/javadoc/j2se/1.5.0/docs/tooldocs/share/jstatd.html
http://www.herongyang.com/Java-Tools/jstat-JVM-Statistics-Monitoring-Tool.html
http://prefetch.net/blog/index.php/2008/01/16/monitoring-garbage-collection-with-jstat/
http://www.opennms.org/wiki/JVM_Monitoring_using_SNMP
http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html
http://support.hyperic.com/display/hypcomm/Set+up+Java+JVM+Monitoring

=======
http://www.ibm.com/developerworks/library/j-rtm1/index.html?ca=dgr-jw22javaruntime1&S_TACT=105AGX59&S_CMP=GR
http://www.ibm.com/developerworks/library/j-rtm2/index.html
 http://www.ibm.com/developerworks/library/j-rtm3/index.html
===========
http://tomcat.apache.org/tomcat-5.5-doc/monitoring.html
http://code.google.com/p/javamelody/
http://www.eginnovations.com/web/java-monitoring.htm
---------------
http://www.hyperic.com/products/tomcat-monitoring
http://www.torsten-horn.de/techdocs/jmx.htm
http://www.bpurcell.org/blog/index.cfm?entry=967&mode=entry

JVM Performance Tuning

http://www.javaworld.com/javaforums/showflat.php?Number=30206&page=44
http://java.sun.com/performance/jvmstat/
http://www.caucho.com/resin-3.0/performance/jvm-tuning.xtp
http://publib.boulder.ibm.com/infocenter/javasdk/v5r0/index.jsp?topic=/com.ibm.java.doc.diagnostics.50/diag/appendixes/cmdline/cmdline_x.html
http://forums.sun.com/thread.jspa?threadID=756468
------
http://viralpatel.net/blogs/2009/01/jvm-java-increase-heap-size-setting-heap-size-jvm-heap.html
------
http://download.oracle.com/javase/1.5.0/docs/tooldocs/share/jstat.html

 Linux Interview  Linux booting process EXT4 XFS file system runlevel scan disk hba driver systool -c fc_host lspci -nn | grep -i hba single...