Oracle 19c via Docker on Mac: A Step-by-Step Installation Guide

作者:问题终结者2024.03.15 04:14浏览量:4

简介:In this comprehensive tutorial, we'll guide you through the installation process of Oracle 19c on Mac using Docker. We'll cover everything from setting up the environment to running the database, providing clear and concise instructions that are easy to follow even for non-technical readers. Along the way, we'll emphasize practical applications and hands-on experience, providing actionable advice and solutions to common problems.

Oracle 19c via Docker on Mac: A Step-by-Step Installation Guide

Introduction

Installing Oracle 19c on a Mac can be a challenging task, especially for those who are not familiar with the intricacies of database management. However, with the help of Docker, the process becomes significantly easier. Docker allows us to run Oracle 19c in a containerized environment, providing a seamless experience on any Mac machine.

In this tutorial, we will guide you through the installation process of Oracle 19c on Mac using Docker. We’ll start by setting up the necessary environment, then move on to configuring the database, and finally, running it. Let’s get started!

Step 1: Set up the Environment

Before we can install Oracle 19c on Mac using Docker, we need to make sure that Docker is properly installed and running on our system. You can follow the official Docker installation instructions for Mac to set it up. Once Docker is installed, we’ll need to pull the Oracle 19c image from Docker Hub. Open a terminal and run the following command:

  1. docker pull oracle/database:19.3.0-ee

This command will download the latest Oracle 19c image from Docker Hub.

Step 2: Configure the Database

Once the image is downloaded, we can create a Docker container to run our Oracle 19c database. Run the following command to create a container:

  1. docker run -d --name oracle19c -p 1521:1521 -e ORACLE_PWD=mysecretpassword oracle/database:19.3.0-ee

This command will create a container named oracle19c and expose the database port (1521) to the host machine. The -e ORACLE_PWD=mysecretpassword part sets the database password to mysecretpassword. You can choose a different password if you prefer.

After the container is created, it will start running in the background. You can verify its status by running:

  1. docker ps | grep oracle19c

If the container is running successfully, you should see it listed in the output.

Step 3: Set the Password

By default, the Oracle 19c image comes with a randomly generated password for the SYS, SYSTEM, and PDBADMIN accounts. To retrieve this password, you can run the following command:

  1. docker logs oracle19c | grep ORACLE_PASSWORD

This command will display the randomly generated password in the log output. You can use this password to connect to the database.

If you want to change the password, you can use the setPassword.sh script provided by Oracle. Run the following command to execute the script:

  1. docker exec oracle19c ./setPassword.sh SYS yournewpassword

Replace yournewpassword with the desired new password for the SYS account. You can also use the script to change the passwords for other accounts.

Step 4: Run the Database

Now that the database is configured and the password is set, we can start running our Oracle 19c database. Since we ran the container in detached mode (-d flag), it should already be running. You can check its status again by running:

  1. docker ps | grep oracle19c

If the container is running, you can now connect to the database using your preferred client tool. In this tutorial, we’ll use SQL*Plus, which is included in the Oracle 19c image. Run the following command to connect to the database:

  1. docker exec -it oracle19c sqlplus SYS as SYSDBA

You’ll be prompted to enter the password for the SYS account. Enter the password you set in the previous step. If everything is set up correctly, you should now be connected to your Oracle 19c database running on Mac using Docker.

Conclusion

In this tutorial, we’ve walked through the installation process of Oracle 19c on Mac using Docker