Opened 3 years ago

Closed 2 years ago

Last modified 21 months ago

#21775 closed New feature (fixed)

No facility to specify the datafile of a django test Oracle tablespace

Reported by: smeatonj Owned by: alvaro@…
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords: oracle
Cc: shai, alvaro@… Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


There is no way to customise the name of the datafile for the Oracle test database. This is required for RAC installations which use shared storage. I propose a new option to the DATABASES dict:


Without these options, it is impossible to test against RAC, so I'm classifying it as a bug rather than a new feature.

And the existing code that creates the tablespaces:

# django/db/backends/oracle/
    def _execute_test_db_creation(self, cursor, parameters, verbosity):
        if verbosity >= 2:
            print("_create_test_db(): dbname = %s" % parameters['dbname'])
        statements = [
            """CREATE TABLESPACE %(tblspace)s
               DATAFILE '%(tblspace)s.dbf' SIZE 20M
            """CREATE TEMPORARY TABLESPACE %(tblspace_temp)s
               TEMPFILE '%(tblspace_temp)s.dbf' SIZE 20M
        self._execute_statements(cursor, statements, parameters, verbosity)

Since not many people have access to an Oracle RAC installation, I'll throw together a patch in the near future.

Change History (9)

comment:1 Changed 3 years ago by shai

  • Cc shai added
  • Keywords oracle added
  • Needs documentation set
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Bug to New feature

You should be able to test even against RAC by creating (or even just using) your own tablespace, and setting TEST_CREATE = False. Of course, it is much better to allow the use of test-only tablespaces and give the user more control over where they are created; but that is an enhancement.

I have just run into a related problem myself -- the 200M size limit on the test tablespace does not allow testing the GIS oracle backend; so, I'd like to "hijack" this ticket into one which allows complete control over the creation of the test tablespaces.

While at it, I don't like much the current set of Oracle-specific-test-only parameters in the general database settings dictionary. I'd like to collect them into a TESTING entry, or maybe into the OPTIONS entry; I'll take that to the developers list.

comment:2 Changed 3 years ago by alvaro@…

  • Cc alvaro@… added
  • Owner changed from nobody to alvaro@…
  • Status changed from new to assigned

I'd like to try to create a patch for this.

Could you please elaborate more on how to you imagine this patch to look like?

comment:3 Changed 3 years ago by smeatonj

Alvaro, there is a discussion happening at the moment on the django developers mailing list:!topic/django-developers/2aJuLbMRARU

The discussion is currently centred on cleaning up how test database settings should be structured. It'd be worth reading that, and either waiting on an outcome, or writing the patch as you think it should work and submitting for review.


comment:4 Changed 3 years ago by timo

  • Easy pickings unset

comment:5 Changed 2 years ago by Shai Berger <shai@…>

In 41afae4ce906838fc87d63962104cfb47991f68b:

Reorganized the database test settings

Change database test settings from "TEST_"-prefixed entries in the
database settings dictionary to setting in a dictionary that is itself
an entry "TEST" in the database settings.

Refs #21775

Thanks Josh Smeaton for review.

comment:6 Changed 2 years ago by jarshwah

This patch allows specifying the DATAFILE and MAXSIZE of each tablespace (the primary and the tmp). The default maxsize has been increased from 200M to 500M to better support GIS on Oracle. This default may need to be increased to correctly support GIS as it was just a guess - Shai to confirm.

I've also changed the tablespace creation to be test_USER rather than test_NAME - which should make more sense for an Oracle deployment. NAME will be "xe" (or some other like-value) for every single django app running on the same database, which could lead to clobbering if running two different django applications on the same server. NAME will at least be linked to the actual django application under test, rather than the server.

comment:7 Changed 2 years ago by jarshwah

  • Has patch set
  • Version changed from 1.6 to master

comment:8 Changed 2 years ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In 0eb5cde9da3252fbdbbb59ae6e421ca04814ad3c:

Fixed #21775 -- Allowed customization of datafile for Oracle tablespace

comment:9 Changed 21 months ago by Shai Berger <shai@…>

In 991f523753baff73b32859c906649767a2bc8061:

[1.7.x] Fixed #23969: Made Oracle default test-tablespace larger.

It seems our test suite has grown...
Refs #21775

Note: See TracTickets for help on using tickets.
Back to Top