A Virtualized Oracle Database Installation
Rather than just doing a native installation of Oracle Database onto your machine, I instead opt to use a virtualized approach. This has many merits, not the least of which is the educational benefit. It’s a good thing to come to grips with containers and images because they represent what might be called a heavyweight, global technology.
Containers differ from virtual machines (VMs) in that they have a lighter footprint, so you can typically install many containers on the same platform. VMs have many merits but they do require a hypervisor layer and hardware emulation, and this tends to make them hog a lot of resources. Containers, on the other hand, communicate directly with the host platform and don’t require the hypervisor layer. Also, containers can share common files and are quick to start and stop.
Let’s install an Oracle Database instance and Oracle SQL Developer. There are a number of ways of going about this. You may already have existing installations ready for use, or access to an installation. If not, we’ll set up a Docker-based Oracle Database installation, which has numerous advantages, including the following:
- Repeatability
- Ease of use
- Continued operation after system updates
- Isolation from operational databases
The benefit of repeatability is that you can simply delete a Docker container and image and then re-create them at any time. This makes for an easier user experience than if you directly install the software onto your system. With a Docker container, it’s as if you have installed a new machine inside your existing hardware. The great thing is that you can then create new containers and delete old ones at will.
Docker containers are easy to use once you understand a few key features. There are also additional tools you can install that provide an improved Docker user interface. This can be a lot less intimidating than using the command line, but it is optional. If you want to use such tools, there is a wide variety of options, including Portainer and Docker Desktop. There’s a quick tour of Portainer and Docker Desktop in “An Alternative to the Command-Line Use of Docker”.
Once you create a Docker container and get it working, it doesn’t tend to subsequently stop working. This is a big benefit when learning a new technology and it means that you don’t have the hassle of wrestling with system changes brought about by updates or modifications due to other software installations. Docker tends to insulate you from most or all of these difficulties.
Tip
The need to isolate yourself from existing databases might not seem so important at the beginning of learning PL/SQL. However, it is possible that an experimental PL/SQL code change might have a negative impact on the database or on other users.
I experienced this myself a few years ago. I was running a PL/SQL batch job on a large shared development database. The job deadlocked for some reason and resolving this required the assistance of a database administrator. Sharing development databases always has its difficulties. If you can remove the problem of other users, then your learning experience becomes a lot less fraught. In other words, if your database runs inside a Docker container, then you have total control over it and can stop and start it with no impact on anyone but yourself.
After reading this chapter, you should be able to do the following:
- Install and run Oracle Database in a containerized environment.
- Access the database using SQL Developer.
I also hope that you will acquire some new virtualization skills that can be reused in other, similar work.