Changes between Version 18 and Version 19 of OracleTestSetup


Ignore:
Timestamp:
Jun 26, 2013, 7:00:39 AM (11 years ago)
Author:
Michal Petrucha
Comment:

Added a howto for the Developer Day pre-installed VM.

Legend:

Unmodified
Added
Removed
Modified
  • OracleTestSetup

    v18 v19  
    379379
    380380.. _relevant Oracle documentation: http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/intro.htm#i60798
     381
     382Using the Oracle Developer Day pre-installed VM
     383===============================================
     384
     385Oracle provides pre-built virtual machine images with Oracle Database 11g Release 2 Enterprise Edition for developers in form of an OVA archive which can be imported by VirtualBox. The archive can be downloaded `here`__ (or alternately a different one can be chosen from `this list`__) after signing up for an *Oracle Developer Network* account.
     386
     387.. __: http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html
     388.. __: http://www.oracle.com/technetwork/community/developer-vm/index.html
     389
     390The server will probably be somewhat slower than if you install it directly on the host machine, but using a VM has a slightly simpler setup, there's a somewhat smaller chance you'll pollute your host system completely and in case something goes wrong, you can always just remove the virtual machine, import a fresh copy and start again.
     391
     392#. Download the OVA file from http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html and import it into VirtualBox. You'll have to accept an extensive license agreement.
     393
     394#. By default, the VM will be configured to have one NAT network interface. The database server itself starts automatically and listens on port 1521. You'll have to set up port forwarding in VirtualBox in order to access the server. Open the settings of the emulated network adapter and under *Advanced* open *Port Forwarding*. Insert a new rule with host IP set to 127.0.0.1, host port and destination port 1521 and an empty guest IP.
     395
     396#. The server comes with a number of user accounts created beforehand but I only found out how to access two of them. There's ``sys``, which is a "sysdba" account (whatever that means), and ``system``. The password for both of these is ``oracle`` and both have full privileges. Since the ``sys`` account is "sysdba", I'm not sure it can be used to run the tests (it spits out an error message on login attempt) but ``system`` seems to work just fine.
     397
     398   As for other credentials on the virtual machine, if you want to login as a regular user, just use ``oracle``/``oracle``, the root password is ``oracle`` as well. However, in order to run the test suite, you just need to boot the machine up, you don't need to start anything manually.
     399
     400#. Install *instantclient* on your host system (the one where you'll be running the test suite). On Gentoo there is an ebuild, which means it is just a matter of ``emerge -av oracle-instantclient-basic`` and fetching the appropriate zip archives from the Oracle download site as instructed, on Debian or Ubuntu you can download the RPM package, convert it to a DEB package using alien as outlined above and install that using ``dpkg -i``.
     401
     402#. Start a new shell and install cx_Oracle in your testing virtualenv::
     403
     404    pip install cx_Oracle
     405
     406   The new shell is necessary because the *instantclient* package sets various environment variables required to build the adapter.
     407
     408#. Create a settings file, the following example seems to work for me::
     409
     410    DATABASES = {
     411        'default': {
     412            'ENGINE': 'django.db.backends.oracle',
     413            'NAME': 'orcl',
     414            'USER': 'system',
     415            'PASSWORD': 'oracle',
     416            'HOST': 'localhost',
     417            'PORT': '1521',
     418        },
     419        'other': {
     420            'ENGINE': 'django.db.backends.sqlite3',
     421        }
     422    }
     423
     424    SECRET_KEY = "django_tests_secret_key"
     425
     426   As opposed to the XE server whose installation is outlined above, the server provided on the VM image uses ``orcl`` as its SID.
     427
     428#. Profit::
     429
     430    (env)johnny64@equus ~/GSoC/2011/koniiiik-django/tests $  ./runtests.py --settings=test_oracle
     431    Creating test database for alias 'default'...
     432    Creating test user...
     433    Creating test database for alias 'other'...
     434    ..............................................................................................................................................................................................................................................................................................................................x...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................s..s.s....ss.s...ss...........................................................................................................................................................................................................................................................................x...........xx..................s.........................................................................................................................s.........................................................................................................................................................................................x..............................................................................................................................................................................................s..................................................................................ss............s.....................s................s...................................................................................................................................................................................s.......x.xx....................x.............x................................................................................................................................................................................................................................................................s.........s.........................................................sss......s..........................................................................................................................................................................................................................................................................x...............................................................................................sssssss....s..............s......s..........................................................................................................................................s.....................................................................................................................................................s..................................s................s...........................................................................s.............................................................................................x.s..s..................................................................................ss.......................................................................................................s....................................................................................................x.........................................................................................ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss.......................ss..........................................................................................................................................................................................................................................ssssss.......s.........................................................................................................................................................................................................................................................................................................s.......s..........sss..........................................................................................................................................................................................s.............................................................................sss...............................ssss........ss................................................................................................................................................................................................................................................................................................................................ss..........................................................................................................................................................................................................................................................................................................ssssssssssssssssssssssssssssssssssssss............................ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss........................sssssssssssssssssss......................
     435    ----------------------------------------------------------------------
     436    Ran 5826 tests in 1290.532s
     437
     438    OK (skipped=360, expected failures=13)
     439    Destroying test database for alias 'default'...
     440    Destroying test user...
     441    Destroying test database tables...
     442    Destroying test database for alias 'other'...
     443
     444
    381445}}}
Back to Top