Deploy an Oracle database

Updated at:

Oracle Database is a powerful and highly reliable relational database management system (RDBMS) that manages and processes enterprise data. This topic shows you how to deploy an Oracle database on an ECS instance.

Deploy an Oracle database with Docker

Before you deploy an Oracle database by using Docker, your ECS instance must meet the following requirements:

  • A public IP address is automatically assigned to the ECS instance. Alternatively, an elastic IP address (EIP) is associated with the ECS instance. For instructions on how to enable public bandwidth, see Enable public bandwidth.

  • In the security group of the ECS instance, a security group rule must be in place to allow inbound traffic on port 22.

  • At least 9 GB of disk space is available.

Important

Run the following commands as the root user.

  1. Install and use Docker and Docker Compose.

  2. Pull the Oracle image.

    docker pull container-registry.oracle.com/database/free:latest
  3. Start the Oracle container and configure it to restart automatically.

    docker run -d --name oracle --restart always \
      -p 1521:1521 \
      container-registry.oracle.com/database/free:latest

    Parameters:

    • -d: Runs the container in the background.

    • --name: Specifies a name for the container.

    • --restart always: Configures the container to restart automatically.

    • -p: Maps a container port to a host port. The default database port for Oracle is 1521.

    • container-registry.oracle.com/database/free:latest: Specifies the image and its tag.

  4. Check the container status.

    docker ps

    If the container is running as expected, the output is similar to the following:

    [root@iZxxx ~]# docker ps
    CONTAINER ID   IMAGE                                               COMMAND                  CREATED       STATUS                 PORTS                                       NAMES
    20dcxxx        container-registry.oracle.com/database/free:latest   "/bin/bash -c $ORACL…"   2 hours ago   Up 2 hours (healthy)   0.0.0.0:1521->1521/tcp, :::1521->1521/tcp   oracle
  5. Set the password.

    Replace <YOUR_PASSWORD> with the password that you want to set.

    docker exec -it oracle ./setPassword.sh <YOUR_PASSWORD>
  6. Use SQL*Plus to connect to the database.

    docker exec -it oracle sqlplus sys@localhost:1521/FREE as sysdba

    If output similar to the following appears, the connection is successful.

    [root@ixxxgZ ~]# docker exec -it oracle sqlplus sys@localhost:1521/FREE as sysdba
    SQL*Plus: Release 23.0.0.0.0 - for Oracle Cloud and Engineered Systems on Fri Dec 20 05:30:20 2024
    Version 23.5.0.24.07
    Copyright (c) 1982, 2024, Oracle.  All rights reserved.
    Enter password:
    Connected to:
    Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
    Version 23.5.0.24.07
    SQL>

Remote connection

Note

In the instance's security group, add an inbound rule to allow traffic on port 1521. For more information, see Add a security group rule.

  1. Go to the Oracle SQL Developer page, download the required version, and install it.

  2. After the installation is complete, connect to the Oracle database using the following settings.

    Open Oracle SQL Developer and create a database connection. In the Name field, enter a name for the connection, such as oracle-auto. For Username, enter sys. From the Role drop-down list, select SYSDBA, and then enter your password. For Connection Type, select Basic. In the Hostname field, enter the public IP address of your instance. For Port, enter 1521. Select SID and enter FREE.

References