Code

Changes between Version 12 and Version 13 of OracleTestSetup


Ignore:
Timestamp:
11/18/10 03:00:49 (3 years ago)
Author:
ramiro
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OracleTestSetup

    v12 v13  
    1313* Hopefully collecting information (best practices, tuning tips) to do that 
    1414  as efficiently as possible. 
     15 
     16Contributions from seasoned Oracle users are welcome!. 
    1517 
    1618Chosen components are: 
     
    8688       $ sudo patch < /home/myuser/oracle-xe-script.diff 
    8789 
    88    This is the ``oracle-xe-script.diff`` patch file (you can also download it):: 
     90   This is the ``oracle-xe-script.diff`` patch file:: 
    8991 
    9092    --- xe   2006-02-24 17:23:15.000000000 -0300 
     
    144146    $ source /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh 
    145147 
    146 #. Decide if you will perform the following two tasks 
     148#. Decide if you will perform the following two tasks: 
    147149 
    148150   * Access the administrative web app 
     
    150152 
    151153   from the same system where the DB engine is running or from another system through the network. If you chose the 
    152    first option you can skit to the next step, if you chose the second option for any of the two kinds of access then you 
     154   first option you can skip to the next step, if you chose the second option for any of the two kinds of access then you 
    153155   need to solve the following two issues first (see the `Oracle installation documentation`_ for 
    154156   detailed instructions): 
     
    161163 
    162164#. Create an user to be used to connect to the DB when running the tests. (e.g. ``djangotest``) 
    163    -- Go to *Home > Administration > Database Users > CREATE* assign it a password (e.g. ``tehsekret``) 
     165   -- Go to *Home > Administration > Database Users > CREATE*, assign it a password (e.g. ``tehsekret``) 
    164166 
    165167#. Give the user the needed privileges. 
     
    173175Install cx_Oracle 
    174176================= 
    175 Do this in the system where youwill run your tests:: 
     177Do this in the system where you will run your tests:: 
    176178 
    177179    $ sudo apt-get install python-dev 
     
    215217    } 
    216218 
    217 The key is that ``NAME`` should be the same (``'xe'``) for both entries, since you're really establishing two connections to the same database. The ``TEST_USER``, ``TEST_TBLSPACE``, and ``TEST_TBLSPACE_TMP`` entries must be different, however. 
     219The key is that ``NAME`` should be the same (``'xe'``) for both entries, since you're really establishing two connections to the same database (see *Understanding the database test setup* below for details about this). The ``TEST_USER``, ``TEST_TBLSPACE``, and ``TEST_TBLSPACE_TMP`` entries must be different, however. 
    218220 
    219221Thanks Ian Kelly for providing the correct settings file. 
     
    246248===================================== 
    247249 
    248 An Oracle instance allows the existence of only one database. This is somewhat different from what we could be accustomed from working with other RDBMS. For more details see the Oracle documentation. 
    249  
    250 When the Django ORM testing code needs to test multi-DB functionality added in version 1.2, the Django Oracle backend implements that by creating tablespaces. The overall scheme of things is like this: 
     250An Oracle instance allows the existence of only one database. This is somewhat different from what we could be accustomed from working with other RDBMS. For more details see the `relevant Oracle documentation`_. 
     251 
     252*Oracle XE* allows the existence of only one database instance (named ``'xe'``). So, when the Django ORM testing code needs to test multi-DB functionality added in version 1.2, the Django Oracle backend implements that by creating what is know as *tablespaces*. The overall scheme of things is like this: 
    251253 
    252254For every DB alias defined in ``DATABASES``: 
    253255 
    254 * The ``'NAME'`` variable value specifies the name of the DB we ask the Oracle engine for ('xe' in the case of XE). This can be further controlled by using the ``tnsnames`` infrastructure. 
     256* The ``'NAME'`` variable value specifies the name of the DB we ask the Oracle engine for ('xe' in the case of XE). AFAIK This can be further controlled by using the ``tnsnames`` infrastructure. 
    255257* Both a data tablespace and a temporary data tablespace are created. 
    256258* The names of such tablespaces are derived from the value of the ``NAME`` var (the data tablespace gets a name prefixed by ``'test_'`` and the temporary tablespace one prefixed by ``'test_'`` and suffixed by ``'_tmp'``. 
    257259* But their names can also be overridden by the ``'TEST_TBLSPACE'`` and ``'TEST_TBLSPACE_TMP'`` vars, respectively. 
    258260* For these tablespaces, a temporary user is created beforehand that has full ownership and control over them. 
    259 * The username of such user isn't the same as the ``'USER'`` var, is derived from it with a prefix added. It can be overridden with the value of the ``'TEST_USER'`` var. 
     261* The username of such user isn't the same as the ``'USER'`` var, is derived from it by adding a ``'test_'`` prefix. It can be overridden with the value of the ``'TEST_USER'`` var. 
    260262* The password assigned to that user is hardcoded, but can be overridden by the value of the ``'TEST_PASSWD'`` var. 
    261263* The tablespaces and the user are removed when test execution finishes. 
    262264* Some variables are provided to control parts of this process: 
    263265 
    264   * ``'TEST_CREATE'`` -- Skips creation and deletion of the tablespaces 
    265   * ``'TEST_USER_CREATE'`` -- Skip creation and deletion of the temporary user 
     266  * ``'TEST_CREATE'`` -- Skips creation and deletion of the tablespaces. 
     267  * ``'TEST_USER_CREATE'`` -- Skip creation and deletion of the temporary user. 
    266268 
    267269In summary, Oracle has the following extra ``DATABASES`` vars when compared with other Django DB backends: ``'TEST_TBLSPACE'``, ``'TEST_TBLSPACE_TMP'``, ``'TEST_USER'``, ``'TEST_PASSWD'``, ``'TEST_CREATE'`` and ``'TEST_USER_CREATE'``. 
     270 
     271.. _relevant Oracle documentation: http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/intro.htm#i60798 
    268272 
    269273Notes 
     
    278282 
    279283Platform is GNU/Debian Linux 5.0 aka *Lenny* (stable as of Nov 2010) because it still is in 
    280 its support period and as a bonus contains Python 2.4 in pre-packaged form. 
     284its support period. As a bonus contains Python 2.4 in pre-packaged form. 
    281285 
    282286Things to review: