Code

Changes between Version 15 and Version 16 of OracleTestSetup


Ignore:
Timestamp:
07/17/11 04:48:33 (3 years ago)
Author:
aaugustin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OracleTestSetup

    v15 v16  
    55============================== 
    66 
    7 **This document is work in progress** 
    8  
    9 This document attempts to ease the task of running the Django (or your own app's) test 
     7This document attempts to ease the task of running Django's (or your own app's) test 
    108suite against Oracle by: 
    119 
     
    1412  as efficiently as possible. 
    1513 
    16 Contributions from seasoned Oracle users are welcome!. 
     14Contributions from seasoned Oracle users are welcome! 
    1715 
    1816Chosen components are: 
    1917 
    20 * Oracle XE (10g) 
    21 * GNU/Debian Linux x86. Things should also work with Ubuntu Linux without too much tweaking. 
     18* Oracle XE 10g. This is a free version of Oracle targeted at developers. 
     19* GNU/Debian Linux x86 — not amd64, because there's no 64bit free version of Oracle (XE). Things should also work with Ubuntu Linux without too much tweaking.  
    2220 
    2321The system isn't going to be dedicated exclusively to run Oracle so we will 
     
    3634 
    3735   Contrarily to what is suggested in some places_ I've found the newer **oracle-xe-universal_10.2.0.1-1.1_i386.deb** package 
    38    you can get here_ (as of Nov 2010) and installable by using high level Debian/Ubuntu package management 
     36   you can get here_ (as of Nov 2010) and install with high level Debian/Ubuntu package management 
    3937   tools (APT, Aptitude, ...) didn't install things like the ``/etc/init.d/oracle-xe`` init 
    40    script and some files under the ``/usr/lib/oracle`` hierarchy so I went with the older 
     38   script and some files under the ``/usr/lib/oracle`` hierarchy. So I went with the older 
    4139   package plus the low-level `dpkg` package manager and took care of dependencies manually 
    4240   (see next step). 
    4341 
    44 #. Install the prerequisite packages, if you fail to do so the installation won't be successful 
    45    but won't abort either:: 
     42#. Install the prerequisite packages. If you don't do this, the Oracle package will attempt 
     43   to install anyway, will fail, and you will end up with a half-installed package:: 
    4644 
    4745       $ sudo apt-get install bc libaio1 
     
    7977   (among others) in the ``/etc/default/oracle-xe`` configuration file and we 
    8078   would be using the same script as the one executed when the system boots 
    81    (the SyV ``/etc/init.d/oracle-xe`` script) that always examines these values. 
     79   (the ``/etc/init.d/oracle-xe`` script) that always examines these values. 
    8280 
    8381   What we can do is to create a slightly modified ``/etc/init.d/xe`` script 
    84    that ignores that flag and allows us to control the Oracle process at will:: 
     82   that ignores that flag and allows us to control the Oracle process at will. 
     83   Download [[attachment:oracle-xe-script.diff]] then:: 
    8584 
    8685       $ cd /etc/init.d 
    8786       $ sudo cp -a oracle-xe xe 
    8887       $ sudo patch < /home/myuser/oracle-xe-script.diff 
    89  
    90    This is the ``oracle-xe-script.diff`` patch file:: 
    91  
    92     --- xe   2006-02-24 17:23:15.000000000 -0300 
    93     +++ xe.new  2010-11-03 07:58:43.000000000 -0300 
    94     @@ -596,13 +596,8 @@ 
    95      # See how we were called 
    96      case "$1" in 
    97        start) 
    98     -       if test -f "$CONFIGURATION" 
    99     +       if test ! -f "$CONFIGURATION" 
    100             then 
    101     -               if test "$ORACLE_DBENABLED" != "true" 
    102     -               then 
    103     -                       exit 0 
    104     -               fi 
    105     -       else 
    106             echo "Oracle Database 10g Express Edition is not configured.  You must run 
    107     '/etc/init.d/oracle-xe configure' as the root user to configure the database." 
    108                     exit 0 
    109     @@ -613,13 +608,8 @@ 
    110             configure 
    111             ;; 
    112        stop) 
    113     -       if test -f "$CONFIGURATION" 
    114     +       if test ! -f "$CONFIGURATION" 
    115             then 
    116     -               if test "$ORACLE_DBENABLED" != "true" 
    117     -               then 
    118     -                       exit 0 
    119     -               fi 
    120     -       else 
    121             echo "Oracle Database 10g Express Edition is not configured.  You must run 
    122     '/etc/init.d/oracle-xe configure' as the root user to configure the database." 
    123                     exit 0 
    12488 
    12589   Now we can start/stop Oracle manually using it:: 
     
    245209    Destroying test database tables... 
    246210 
     211If you encounter the following error many times:: 
     212 
     213    DatabaseError: ORA-12520: TNS:listener could not find available handler for requested type of server 
     214 
     215you may need to increase the value of the `processes` parameter. 
     216By default, it's 40; I've increased it to 100 and this has fixed this error — but I can't guarantee it's the "correct" solution. 
     217To change the value: 
     218 
     219* start a SQL shell with ``sqlplus`` 
     220* run ``ALTER SYSTEM SET processes = 100 scope=spfile;`` 
     221* exit the SQL shell 
     222* restart the server: ``/etc/init.d/xe restart``. 
     223 
     224 
    247225Understanding the database test setup 
    248226=====================================