DEV Community

Sharafat
Sharafat

Posted on

Setting up oracle database in Linux (podman container + vscode)

Installation

Mainly I will be focusing linux, but will work on mac as well with same commands.

For windows? You can download the installer from the official website and follow the instructions.

Setup a container

Docker and podman are the two most popular containerization tools. I will be using podman for this, and I will recommend podman as well. Why? Maybe I will write a blog on this later.

Whatever, let's install podman! You can follow the official documentation for this. I guess most of the major linux distributions have podman in their official repositories.

Like, for Arch Linux:

sudo pacman -S podman
Enter fullscreen mode Exit fullscreen mode

Pull the image

There are mainly two images available for free, full and lite.

To get the full image:

podman pull container-registry.oracle.com/database/free:latest
Enter fullscreen mode Exit fullscreen mode

And to be honest, it's a huge image around 9.48 G. So, I will recommend the lite version. It may take upto 2 G.

podman pull container-registry.oracle.com/database/free:23.5.0.0-lite
Enter fullscreen mode Exit fullscreen mode

Run the container

Now let's go ahead and actually run the container.

podman run -d -p 1521:1521 --name oracle-db container-registry.oracle.com/database/free:23.5.0.0-lite
Enter fullscreen mode Exit fullscreen mode

Here, I have used the lite version of the image. You can use the full version as well. Just replace the image name.
And the port 1521 is the default port for Oracle Database. You can change it if you want.

Flag -d is used to run the container in the background.
Flag -p is used to map the host port to the container port.
Flag --name is used to give a name to the container. (Try to remember it!)

Set a password

Here I have used 1234 as the password. You can use whatever you want.

podman exec -it oracle-db ./setPassword.sh 1234
Enter fullscreen mode Exit fullscreen mode

Connect to the database

You can use any database client to connect to the database. I will be using SQL*Plus.

podman exec -it oracle-db sqlplus
Enter fullscreen mode Exit fullscreen mode

And then enter the following details:

  • Username: system
  • Password: 1234 (Or the one you set in the previous step!)

Stop the container

podman stop oracle-db
Enter fullscreen mode Exit fullscreen mode

Start the container

podman start oracle-db
Enter fullscreen mode Exit fullscreen mode

You may need to start the container if you have restarted your system!

Misc

Port address

To get your outgoing forwarded port from podman, use the following,

podman port oracle-db     
Enter fullscreen mode Exit fullscreen mode

Integration

VSCODE

It would be weird if we have to use terminal everytime we want to access our database, right?
Let's use vscode. Simply install the following extension,

Or, Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.

ext install Oracle.sql-developer

The size of this extension is more than 300 M, so it'll take a bit of time.

  • Now on our left/ right toolbar, you will find a icon, and maybe try to add a new connection? You will asked to fill up a form.

  • For the port number try to use the one you got from podman port oracle-db.

  • For the username, use system.

  • And for the password, use the one you set in the previous steps.

  • For the service name, it should be FREE. Or you can use the following code in sqlplus to get the service name,

SELECT VALUE 
FROM V$PARAMETER 
WHERE NAME = 'service_names';
Enter fullscreen mode Exit fullscreen mode

And you are good to go!

Billboard image

Use Playwright to test. Use Playwright to monitor.

Join Vercel, CrowdStrike, and thousands of other teams that run end-to-end monitors on Checkly's programmable monitoring platform.

Get started now!

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay