| 95 | |
| 96 | Using the Oracle Docker image |
| 97 | =============================================== |
| 98 | |
| 99 | Oracle provides a `Docker image`_ for its Database via Docker Hub. Once you "purchased" (it's free of charge) the Docker image, you can start the server as followed:: |
| 100 | |
| 101 | docker run -d -it -p 1521:1521 store/oracle/database-enterprise:12.2.0.1 |
| 102 | |
| 103 | Next you will need to create the django database user. This requires you to have ``sqlplus``. You simply follow the instructions above to install it. |
| 104 | |
| 105 | Connect to the database and execute the following SQL commands:: |
| 106 | |
| 107 | sqlplus sys/Oradoc_db1@localhost/ORCLCDB.localdomain as sysdba |
| 108 | SQL> ALTER SESSION SET CONTAINER=ORCLPDB1; |
| 109 | SQL> CREATE USER django IDENTIFIED BY django; |
| 110 | SQL> GRANT DBA TO django; |
| 111 | SQL> QUIT |
| 112 | |
| 113 | Next update your ``DATABASE`` setting as followed:: |
| 114 | |
| 115 | DATABASES = { |
| 116 | 'default': { |
| 117 | 'ENGINE': 'django.db.backends.oracle', |
| 118 | 'NAME': 'localhost/ORCLPDB1.localdomain', |
| 119 | 'USER': 'django', |
| 120 | 'PASSWORD': 'django', |
| 121 | 'TEST': { |
| 122 | 'USER': 'default_test', |
| 123 | 'TBLSPACE': 'default_test_tbls', |
| 124 | 'TBLSPACE_TMP': 'default_test_tbls_tmp', |
| 125 | }, |
| 126 | }, |
| 127 | 'other': { |
| 128 | 'ENGINE': 'django.db.backends.oracle', |
| 129 | 'NAME': 'localhost/ORCLPDB1.localdomain', |
| 130 | 'USER': 'django', |
| 131 | 'PASSWORD': 'django', |
| 132 | 'TEST': { |
| 133 | 'USER': 'other_test', |
| 134 | 'TBLSPACE': 'other_test_tbls', |
| 135 | 'TBLSPACE_TMP': 'other_test_tbls_tmp', |
| 136 | }, |
| 137 | }, |
| 138 | } |
| 139 | |
| 140 | .. _`Docker image`: https://hub.docker.com/_/oracle-database-enterprise-edition |
| 141 | |