2021-11-09 18:10:26 +01:00
|
|
|
# Installation
|
|
|
|
|
|
|
|
## Database
|
|
|
|
|
|
|
|
**Important**
|
|
|
|
- Oracle database is supported only on **x86-64 architecture**
|
|
|
|
- Oracle database is **not supported on Mac ARM architecture** (either via docker or linux virtualization)
|
|
|
|
|
|
|
|
To install oracle express edition simply run `docker-compose up`
|
|
|
|
|
2022-03-02 18:40:50 +01:00
|
|
|
- A single instance pluggable database (PDB) will be created named `xepdb1`
|
2021-11-09 18:10:26 +01:00
|
|
|
- The default password is configured in the compose file as `oracle`
|
2024-07-22 22:15:05 +02:00
|
|
|
- The `system` and `pdbadmin` users share this password
|
2021-11-09 18:10:26 +01:00
|
|
|
|
2024-07-22 22:15:05 +02:00
|
|
|
## Instant Client
|
2021-11-09 18:10:26 +01:00
|
|
|
|
|
|
|
Before oracle can be connected to from nodejs, the oracle client must be installed.
|
|
|
|
For more information see https://www.oracle.com/database/technologies/instant-client/downloads.html
|
|
|
|
|
|
|
|
**Important**
|
|
|
|
- Oracle client is supported only on **x86-64 architecture**
|
2024-07-22 22:15:05 +02:00
|
|
|
- Oracle client is **not supported on Mac ARM architecture**
|
2021-11-09 18:10:26 +01:00
|
|
|
|
|
|
|
### Linux
|
|
|
|
Run the provided install script for linux from the `server` root path:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo /bin/bash -e scripts/integrations/oracle/instantclient/linux/x86-64/install.sh
|
|
|
|
```
|
|
|
|
For more information see: https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html#ic_x64_inst
|
|
|
|
|
2024-07-22 22:15:05 +02:00
|
|
|
### Mac
|
2021-11-09 18:10:26 +01:00
|
|
|
**This has not yet been tested**
|
|
|
|
|
|
|
|
See: https://www.oracle.com/database/technologies/instant-client/macos-intel-x86-downloads.html#ic_osx_inst
|
|
|
|
|
|
|
|
# Management
|
|
|
|
To connect to oracle sql command line:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
docker exec -it oracle-xe sqlplus -l system/oracle@localhost/xepdb1
|
|
|
|
```
|
|
|
|
|
|
|
|
To create a new schema (where a user is the same as a schema in oracle) named `sales`:
|
|
|
|
|
|
|
|
```sql
|
|
|
|
define USERNAME = sales
|
|
|
|
|
|
|
|
create user &USERNAME;
|
|
|
|
|
|
|
|
alter user &USERNAME
|
|
|
|
default tablespace users
|
|
|
|
temporary tablespace temp
|
|
|
|
quota unlimited on users;
|
|
|
|
|
|
|
|
grant create session,
|
|
|
|
create view,
|
|
|
|
create sequence,
|
|
|
|
create procedure,
|
|
|
|
create table,
|
|
|
|
create trigger,
|
|
|
|
create type,
|
|
|
|
create materialized view
|
|
|
|
to &USERNAME;
|
|
|
|
```
|
|
|
|
|
2024-07-22 22:15:05 +02:00
|
|
|
To set the password for the sales schema use:
|
2021-11-09 18:10:26 +01:00
|
|
|
|
|
|
|
```sql
|
|
|
|
define USERNAME = sales
|
|
|
|
define PASSWORD = sales
|
|
|
|
|
|
|
|
alter user &USERNAME identified by &PASSWORD;
|
|
|
|
```
|
|
|
|
|
|
|
|
As before the database schema can now be connected to using:
|
|
|
|
```bash
|
|
|
|
docker exec -it oracle-xe sqlplus -l sales/sales@localhost:1521/xepdb1
|
|
|
|
```
|
|
|
|
|
|
|
|
## HR Schema
|
|
|
|
|
2024-07-22 22:15:05 +02:00
|
|
|
The `HR` schema is populated with dummy data by default in oracle for testing purposes.
|
2021-11-09 18:10:26 +01:00
|
|
|
To connect to the HR schema first update the user password and unlock the account by performing
|
|
|
|
```sql
|
|
|
|
ALTER USER hr ACCOUNT UNLOCK;
|
2021-12-03 11:48:47 +01:00
|
|
|
ALTER USER hr IDENTIFIED BY hr;
|
2021-11-09 18:10:26 +01:00
|
|
|
```
|
|
|
|
You should now be able to connect to the hr schema using the credentials hr/hr
|