Changes between Version 12 and Version 13 of OracleTestSetup
- Timestamp:
- Nov 18, 2010, 5:00:49 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
OracleTestSetup
v12 v13 13 13 * Hopefully collecting information (best practices, tuning tips) to do that 14 14 as efficiently as possible. 15 16 Contributions from seasoned Oracle users are welcome!. 15 17 16 18 Chosen components are: … … 86 88 $ sudo patch < /home/myuser/oracle-xe-script.diff 87 89 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:: 89 91 90 92 --- xe 2006-02-24 17:23:15.000000000 -0300 … … 144 146 $ source /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh 145 147 146 #. Decide if you will perform the following two tasks 148 #. Decide if you will perform the following two tasks: 147 149 148 150 * Access the administrative web app … … 150 152 151 153 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 ski tto the next step, if you chose the second option for any of the two kinds of access then you154 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 153 155 need to solve the following two issues first (see the `Oracle installation documentation`_ for 154 156 detailed instructions): … … 161 163 162 164 #. 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``) 164 166 165 167 #. Give the user the needed privileges. … … 173 175 Install cx_Oracle 174 176 ================= 175 Do this in the system where you will run your tests::177 Do this in the system where you will run your tests:: 176 178 177 179 $ sudo apt-get install python-dev … … 215 217 } 216 218 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.219 The 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. 218 220 219 221 Thanks Ian Kelly for providing the correct settings file. … … 246 248 ===================================== 247 249 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:250 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 `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: 251 253 252 254 For every DB alias defined in ``DATABASES``: 253 255 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. 255 257 * Both a data tablespace and a temporary data tablespace are created. 256 258 * 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'``. 257 259 * But their names can also be overridden by the ``'TEST_TBLSPACE'`` and ``'TEST_TBLSPACE_TMP'`` vars, respectively. 258 260 * 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. 260 262 * The password assigned to that user is hardcoded, but can be overridden by the value of the ``'TEST_PASSWD'`` var. 261 263 * The tablespaces and the user are removed when test execution finishes. 262 264 * Some variables are provided to control parts of this process: 263 265 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. 266 268 267 269 In 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 268 272 269 273 Notes … … 278 282 279 283 Platform 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.284 its support period. As a bonus contains Python 2.4 in pre-packaged form. 281 285 282 286 Things to review: