...
Info |
---|
This page briefly describes how to set up a DSpace test instance that runs with the Oracle DB. Note that this method is not suitable for production environments; rather it is intended for committers and other community members who don't normally have access to an Oracle database but wish to test patches and other code relevant to DSpace with Oracle. |
Table of Contents |
---|
Using a Virtual Machine
Install Virtualbox
You will need Oracle VM Virtualbox. Binaries for all major operating sytems are available free of charge from https://www.virtualbox.org/.
...
Open a terminal and log on to the database as a superuser (password: oracle):
Code Block sqlplus logon AS SYSDBA # NOTE: If you get at "invalid username/password; logon denied" error, try THIS COMMAND INSTEAD: sqlplus 'sys as sysdba'
Then create the database user and database (which is referred to as a "schema" in oracle terms): (Thanks to user-6062e for the SQL statements.)
Code Block language sql CREATE USER dspace IDENTIFIED BY dspace; GRANT CONNECT TO dspace; GRANT CREATE TABLE TO dspace; GRANT CREATE SEQUENCE TO dspace; GRANT CREATE VIEW TO dspace; GRANT CREATE PROCEDURE TO dspace; GRANT UNLIMITED TABLESPACE TO dspace;
...
- You can run DSpace remotely (e.g. on your host machine), and just point it at this Oracle Virtual Machine (see: "Run DSpace Remotely")
- OR, you can install DSpace directly on this Oracle Virtual Machine and run it there (see: "Install DSpace on Virtual Machine")
If you elect to run DSpace remotely, the following aliases may be helpful to you, if you are using a Unix or Linux-based OS for your host machine.
Code Block | ||
---|---|---|
| ||
alias ostart='vboxmanage startvm "Oracle DB Developer VM" -type headless'
alias oshut='vboxmanage controlvm "Oracle DB Developer VM" savestate' |
The ostart alias will start up your oracle database, the oshut alias will shut it down very quickly, essentially pausing your server in the state it is in.
If you are using Vagrant-DSpace as your development environment, you will want to create a new vagrant.properties file. Name it something else, vagrant-oracle.properties works. Here are the settings you'll want to use for the database.
Code Block | ||
---|---|---|
| ||
db.name=oracle
# Uncomment the appropriate block below for your database.
# postgres
#db.driver=org.postgresql.Driver
#db.url=jdbc:postgresql://localhost:5432/dspace
#db.username=dspace
#db.password=dspace
# oracle
db.driver= oracle.jdbc.OracleDriver
db.url=jdbc:oracle:thin:@10.0.2.2:1521/orcl
db.username=username_you_chose_above
db.password=password_you_set_above
|
Things to note: you will want to comment out the Postgres configuration, and change the db.name to oracle. And you'll need to install the Oracle driver as per the usual.
Info |
---|
The remainder of this how-to assumes that you wish to run a test DSpace instance in the virtual machine. If you prefer to run DSpace on the host machine instead, you could instead set up port forwarding for the Virtualbox appliance and use only the database in the virtual machine. In that case, skip the rest of this how-to. |
...
and your DSpace+Oracle instance should come up at http://localhost:8080/xmlui/.
Using a Docker Container
There is also a docker container image that you can pull from the Docker hub which will start up an Oracle database container that is configured to work with DSpace. In order to use this image, you need to install Docker on your development machine.
Starting the DSpace Oracle database container
Create a directory where the Oracle database server can store its data, for example /tmp/dspace-oracle-data. Then execute the following command to start the Oracle database server:
Code Block | ||
---|---|---|
| ||
$ docker run -d -p 1521:1521 -v /tmp/dspace-oracle-data:/u01/app/oracle --name dspace-oracle atmire/dspace-oracle:11g2 |
This will create a new Docker container with name "dspace-oracle" that will run the Oracle database server.
Configure the DSpace database connection
Next, update your DSpace database configuration so that it has the following property values:
Code Block |
---|
db.dialect = org.hibernate.dialect.Oracle10gDialect
db.schema = dspace
db.name = oracle
db.driver = oracle.jdbc.OracleDriver
db.url = jdbc:oracle:thin:@//localhost:1521/XE
db.username = dspace
db.password = dspace |
Double check the database server is running and start Tomcat
Before starting Tomcat, you should make sure that the initialisation of the database server completed. You can check the logs of the database server by executing the command
Code Block |
---|
$ docker logs dspace-oracle |
You should see a message that starts with "Database ready to use.". If that is not the case, wait until the message appears (you need to re-execute the "logs" command each time).
When the database is ready, you can double check that your DSpace database configuration is correct by running this command an verifying the output:
Code Block |
---|
$ bin/dspace database test
Attempting to connect to database using these configurations:
- URL: jdbc:oracle:thin:@//localhost:1521/XE
- Driver: oracle.jdbc.OracleDriver
- Username: dspace
- Password: [hidden]
- Schema: dspace
Testing connection...
Connected successfully! |
If DSpace is configured correctly, you can then start Tomcat
Stop, restart or remove the database server.
Here are some commands to stop, restart or completely remove the Oracle database container:
To stop the container:
Code Block |
---|
$ docker stop dspace-oracle |
To start a previously stopped container:
Code Block |
---|
$ docker start dspace-oracle |
To completely remove the complete database container and its data (in order to start over with a clean database):
Code Block |
---|
$ docker rm dspace-oracle
$ rm -rf /tmp/dspace-oracle-data |