Skip to content

Commit

Permalink
Merge pull request #2 from Scalified/#1
Browse files Browse the repository at this point in the history
feat: #1 Oracle Database 19.3.0.0
  • Loading branch information
vbaidak committed Oct 20, 2024
2 parents ae590e7 + 3eb72dc commit 364ab76
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 91 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Publish Docker image

on:
release:
types: [ "published" ]

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Log in to Oracle Container Registry
uses: docker/login-action@v3
with:
registry: container-registry.oracle.com
username: ${{ secrets.ORACLE_USERNAME }}
password: ${{ secrets.ORACLE_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: scalified/oracle-database
tags: |
type=ref,event=tag
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

4 changes: 0 additions & 4 deletions 11g-r2/Dockerfile

This file was deleted.

11 changes: 0 additions & 11 deletions 11g-r2/init.sql

This file was deleted.

10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM container-registry.oracle.com/database/enterprise:19.3.0.0

ENV ORACLE_SCRIPTS_PATH /opt/scripts

ENV PATH "$PATH:$ORACLE_SCRIPTS_PATH"

COPY setup /opt/oracle/scripts/setup

COPY scripts /opt/scripts

96 changes: 24 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,37 @@
# Oracle Database Docker
# Docker Oracle Database

[![Docker Pulls](https://img.shields.io/docker/pulls/scalified/oracle-database.svg)](https://hub.docker.com/r/scalified/oracle-database)
[![](https://images.microbadger.com/badges/image/scalified/oracle-database.svg)](https://microbadger.com/images/scalified/oracle-database)
[![](https://images.microbadger.com/badges/version/scalified/oracle-database.svg)](https://microbadger.com/images/scalified/oracle-database)

## Description

This repository is used for building a [**Docker**](https://www.docker.com) image containing [**Oracle Database**](https://www.oracle.com/database/index.html)
This repository contains an official [**Oracle Database**](https://container-registry.oracle.com/ords/f?p=113:4:113443227637136:::4:P4_REPOSITORY,AI_REPOSITORY,AI_REPOSITORY_NAME,P4_REPOSITORY_NAME,P4_EULA_ID,P4_BUSINESS_AREA_ID:9,9,Oracle%20Database%20Enterprise%20Edition,Oracle%20Database%20Enterprise%20Edition,1,0&cs=3ngPvo9IXPi_O4ZXhv09DqTdDeSyjEdM9Bllql6pu2wJzhQdAu8XltTmhgof2DCjvAGrBWeSfyWTMj3xRtT3yQw) images with additional scripts

## Official Documentation

* [Oracle Database Container Registry](https://container-registry.oracle.com/ords/f?p=113:4:113443227637136:::4:P4_REPOSITORY,AI_REPOSITORY,AI_REPOSITORY_NAME,P4_REPOSITORY_NAME,P4_EULA_ID,P4_BUSINESS_AREA_ID:9,9,Oracle%20Database%20Enterprise%20Edition,Oracle%20Database%20Enterprise%20Edition,1,0&cs=3ngPvo9IXPi_O4ZXhv09DqTdDeSyjEdM9Bllql6pu2wJzhQdAu8XltTmhgof2DCjvAGrBWeSfyWTMj3xRtT3yQw)
* [Creating an Oracle Database Docker image](https://blogs.oracle.com/developer/entry/creating_and_oracle_database_docker)
* [Oracle Database Software Downloads](http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html)
* [Docker Images from Oracle](https://github.com/oracle/docker-images)
* [Docker Images from Oracle](https://github.com/oracle/docker-images)* [Creating an Oracle Database Docker image](https://blogs.oracle.com/developer/entry/creating_and_oracle_database_docker)

## Dockerhub

**`docker pull scalified/oracle-database:<version>`**
`docker pull scalified/oracle-database:<version>`

| Version | Description |
|-----------------------------|-------------------------------|
| **11g-r2** | 11g Release 2 Express Edition |
| **19.3.0.0-ee** | 19.3.0.0 Enterprise Edition |
| **12.2.0.1-ee** | 12.2.0.1 Enterprise Edition |
| **12.1.0.2-se2** | 12.1.0.2 Standard Edition |
| **12.1.0.2-ee** | 12.1.0.2 Enterprise Edition |

## Oracle 11.x Releases

Currently only 11g Release 2 is supported
| **11g-r2** | 11g Release 2 Express Edition |

### Running Container

```
docker run -it --name oracle -p 1521:1521 scalified/oracle-database:<tag>
```

### Connection Settings

#### JDBC URL

```
jdbc:oracle:thin:@//localhost:1521/xe
```

#### Credentials

| User | Password | Description |
|-----------|----------|--------------|
| system | oracle | System user |
| sys | oracle | System user |
| scalified | 123456 | Regular user |

## Oracle 12.x Releases
`docker run -it --name oracle -p 1521:1521 scalified/oracle-database:<tag>`

### Building Docker Images

1. Increase Docker container size by adding the following option to the daemon start:
**`--storage-opt dm.basesize=20G`**
2. Download Oracle installation files from [Oracle Database Software Downloads](http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html)
3. Put downloaded files from *step 2* into the correspondent Oracle version folder in the:
**`oracle-docker-images/OracleDatabase/dockerfiles`**
4. Proceed with [official building instructions](https://github.com/oracle/docker-images/tree/master/OracleDatabase#building-oracle-database-docker-install-images)

### Connecting to Database
### Connecting to the Database

Once the container has been started and the database created you can connect to it just like to any other database:

Expand All @@ -73,56 +42,37 @@ sqlplus sys/<your password>@//localhost:1521/<Your PDB name> as sysdba
sqlplus pdbadmin/<your password>@//localhost:1521/<Your PDB name>
```

### Database Configuration

#### Default Admin Accounts Passwords

On the first startup of the container a random password is generated for the database and shown in log message:

`ORACLE AUTO GENERATED PASSWORD FOR SYS, SYSTEM AND PDBAMIN: <password goes here>`

#### Creating a User Inside Pluggable Database
#### Creating PDB

```sql
CREATE USER <username> IDENTIFIED BY <password>
;
GRANT ALL PRIVILEGES TO <username>
;
```

#### Creating Pluggable Database

```sql
CREATE PLUGGABLE DATABASE <pdb_name> ADMIN USER <username> IDENTIFIED BY <password>
FILE_NAME_CONVERT=('/opt/oracle/oradata/<cdb_name>/pdbseed/','/opt/oracle/oradata/<cdb_name>/<pdb_name>')
;
ALTER PLUGGABLE DATABASE <pdb_name> OPEN
;
ALTER PLUGGABLE DATABASE <pdb_name> SAVE STATE
;
docker exec <oracle_container_name> create-pdb.sh <db_name> <username> <password>
```

where:

* **\<pdb_name\>** - pluggable database name to create
* **\<cdb_name\>** - container database name (**SID**)
* `<db_name>` - PDB name
* `<username>` - PDB username
* `<password>` - PDB password

#### Changing Enterprise Manager Endpoint

Check the listener status:
```cmd
lsnrctl status
```

`lsnrctl status`

This will output endpoints:
```cmd

```
...
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=67e0ca534f7b)(PORT=5500))(Presentation=HTTP)(Session=RAW))
...
```

Login to sql as sysdba and execute procedure:

```sql
exec dbms_xdb_config.setListenerEndPoint(dbms_xdb_config.xdb_endpoint_http2, '67e0ca534f7b', 5500, dbms_xdb_config.xdb_protocol_tcp);
```
Expand All @@ -133,6 +83,7 @@ https://www.morganslibrary.org/reference/pkgs/dbms_xdb_config.html
```

Setting EM ports:

```sql
exec DBMS_XDB_CONFIG.SETHTTPSPORT(5500);
exec DBMS_XDB_CONFIG.SETHTTPPORT(5510);
Expand All @@ -149,4 +100,5 @@ echo "SQLNET.INBOUND_CONNECT_TIMEOUT=0" >> $ORACLE_HOME/network/admin/sqlnet.ora

* [Scalified](http://www.scalified.com)
* [Scalified Official Facebook Page](https://www.facebook.com/scalified)
* <a href="mailto:info@scalified.com?subject=[Squash TM Docker Image]: Proposals And Suggestions">Scalified Support</a>
* <a href="mailto:info@scalified.com?subject=[Oracle Docker Image]: Proposals And Suggestions">Scalified Support</a>

1 change: 0 additions & 1 deletion oracle-docker-images
Submodule oracle-docker-images deleted from 709157
14 changes: 14 additions & 0 deletions scripts/create-pdb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/env bash

DB_NAME="$1"
USERNAME="$2"
PASSWORD="$3"

SCRIPT_DIR=$(dirname "$(readlink -f "$0")")

sqlplus -S /nolog <<EOF
CONNECT / as sysdba
@$SCRIPT_DIR/sql/pdb.sql $ORACLE_SID $DB_NAME $USERNAME $PASSWORD
EXIT
EOF

20 changes: 20 additions & 0 deletions scripts/sql/pdb.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
SET VERIFY OFF;

DEFINE sid = &1
DEFINE db_name = &2
DEFINE username = &3
DEFINE password = &4

CREATE PLUGGABLE DATABASE "&db_name" ADMIN USER &username IDENTIFIED BY &password FILE_NAME_CONVERT=('/opt/oracle/oradata/&sid/pdbseed/','/opt/oracle/oradata/&sid/&db_name');
ALTER PLUGGABLE DATABASE "&db_name" OPEN;
ALTER PLUGGABLE DATABASE "&db_name" SAVE STATE;

ALTER SESSION SET CONTAINER="&db_name";
GRANT ALL PRIVILEGES TO &username;
ALTER PROFILE DEFAULT LIMIT password_life_time UNLIMITED;
SELECT resource_name, limit FROM dba_profiles WHERE PROFILE = 'DEFAULT';

ALTER TABLESPACE UNDOTBS1 OFFLINE;
DROP TABLESPACE UNDOTBS1 INCLUDING CONTENTS AND DATAFILES;
ALTER SESSION SET CONTAINER=CDB$ROOT;

20 changes: 20 additions & 0 deletions setup/setup.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
SHUTDOWN IMMEDIATE;

STARTUP UPGRADE;

ALTER DATABASE LOCAL UNDO OFF;

SHUTDOWN IMMEDIATE;

STARTUP;

SELECT * FROM database_properties WHERE property_name='LOCAL_UNDO_ENABLED';

ALTER SYSTEM SET PGA_AGGREGATE_LIMIT = 0;

ALTER SYSTEM SET PROCESSES=2000 SCOPE=SPFILE;

SHUTDOWN IMMEDIATE;

STARTUP;

0 comments on commit 364ab76

Please sign in to comment.