I finally got a new computer and its main purpose is to work of the rust that covers my joints and install an oracle database. Of course this is not exactly complicated, when you just click a few buttons. I’ve seen colleagues developing their software for the demo-database that can be installed on mouse-click when running the oracle installer, but this is not what I’ll be doing here. I’ll rather go into some details of database installation and configuration mostly skipped by software developers.
It all starts with limited resources and decision making. To make it clear in advance: brains is the most limited resource and while wishes are high, it must be clear from the beginning that not everything will be paid by the management. In my case I was happy to get a computer with an Intel i7 quad-core CPU which amounts to 8 virtual CPUs. That will do and will allow me to run virtual machines without suffering.
Next I’ll have to decide for an operating system. It will not be windows. Not because I don’t like windows. I have at least come to respect it. Windows-Server 2016 is not affordable, so I will not use it unless someone gives me a license. It must be an operating system with features that qualify it to be a server
The platform is a Dell M4800. Actually it’s a workstation in Notebook-format. It comes with 16GB memory. That will do. I know that many contemporary computer systems come with much bigger computing power and more memory, but at this point I like to remember the times, when I started my career with a single CPU 88k UNIX-server from Motorola Computer Systems. It had 25Mhz clock rate and 32MB memory, not to mention the 2 GB disk capacity. 9 people worked on that server simultaneously. Most of them with X-Terminals, some of them with FrameMaker, others with ApplixWare and all of them with the X3270 terminal emulator and with Netscape Navigator,, because from 1994 on we had the Web. And of course all of them worked with our home grown database application for export control and fright logistics. And all that worked! Nothing was slow, while a contemporary web browser of the year 2018 consumes much more resources than we had back in 1992 in our whole department.
Here we go. With this roots I will do databases. Compared to the resources I had when I started, today’s resources are very generous.
My choice for the host operating system is Debian. I would have preferred something different, but I fiddled around for a while and soon I realized, that Debian is the best compromise. What I don’t like about it is systemd. I could have avoided this using Devuan. The only problem was, that the notebook didn’t boot with Devuan. I could have chosen Scientific Linux, but I wasn’t sure, if it supported sound and video in the way I wanted it. Well, I’m not only working on it. Ubuntu wasn’t even among the candidates. Ubuntu’s LTS policy is not acceptable and to say it mildly, it’s pathetic. And so, we are running out of options. And I needed to make sure, that I reach my goals with limited effort.
Next was my choice for a virtual machine infrastructure. Well, one can do a lot with Qemu and KVM if you are a skilled SysAdm with some experience with this tool, which I don’t have. Next would be VMWare, but that one cost’s a few hundert Euro which I didn’t want to spend. Third was Xen, but again I’m lacking the experience and I didn’t want to loose my time with it, so I ended up choosing Oracle’s VirtualBox. I’m not happy with this choice, because Oracle frequently rolls out new versions and once this happens, your current installations refuses to work unless you installed the upgrade. But that’s limited and calculable effort. Only a few days, ,after I installed VirtualBox 5.2.4, Oracle reminded me, why I don’t like it. VirtualBox demanded me to upgrade to version 5.2.6 and you better install these updates, because after a while your installation will stop working until you installed the latest version. I’m really considering to acquire a license for VMware Workstation Pro.
Next come the gust operating systems. I will work with the following:
- Scientific Linux 7.4
- FreeBSD 11.1
- OpenIndiana 2017.10 Hipster
And on these three I will install and try out a few databases starting with
- Oracle 12c on Scientific Linux and maybe aso on OpenIndiana
- Informix IDS 12.10 also on Scientific Linux
- PostgreSQL 10.1 on any of the three
- Ingres 11.0 on Scientific Linux and/or on OpenIndiana
So, that’s a lot of work and I will start it with Oracle.
This is not about developing an application, but about developing a cookbook to installation and configuration of the operating system and the database.
At this point, let’s assume that the underlying infrastructure including the guest operating system are already installed.
First steps to configure the operating system
The operating system comes with a number of disks configured. This is because I will stick with the Oracle Flexible Architecture – OFA. Here in this example, speed will not be our primary concern, but I’ll discuss it in a different blog.
But before I copy/paste the result of df, I’ll have to recognize that sshd is not running. Well, we can start that with the command systemctl start sshd, but that will go away with the next reboot. Since I want it to stay, I issue the command
systemctl enable sshd.service
Now I have accomplished an important configuration, because now I can access that system from the outside (let’s assume, that we don’t want to use rsh respectively remsh or telnet) So now from within an XTerm on my host operating system, I can say
ssh -X 192.168.178.72 (the IP-address of my guest operating system) Next I can start a program that would be displayed on the guest’s graphical user interface and it will be displayed on the host’s graphical user interface, which resembles the real-life situation much better than working within the graphical user interface displayed in the in the VM-manager’s window. We’ll need that later.
The disks come as follows:
Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 972452 168660 803792 18% /boot /dev/sda2 11708416 32944 11675472 1% /opt /dev/sda3 5849088 1998520 3850568 35% /usr /dev/sda5 3895296 72156 3823140 2% / /dev/sda6 3895296 128208 3767088 4% /var /dev/sda7 3135488 33080 3102408 2% /tmp /dev/sda9 972452 36932 935520 4% /home /dev/sda10 972452 33044 939408 4% /usr/local /dev/sdb1 3895296 32944 3862352 1% /db/ora/rdo /dev/sdc1 20960256 32944 20927312 1% /db/ora/data /dev/sdd1 8377344 32944 8344400 1% /db/ora/arch /dev/sdd1 8377344 32944 16733008 1% /data
Of course oracle recommends in their Oracle Flexible Architecture to name the root-directory of the database u01. I opted for meaningful names and put the actual database to a mount-point named /db/ora.
Next I’m going to transfer the database package to the guest system. I saved it to my disk long before. First I change permission to the directory /data on the guest-OS. That directory is big enough for a well over 3GB file. /data is big enough to also store the inflated directory of the oracle-zip-file. We’ll need that.
su chmod 777 /data
Next I go to my storage and transfer the file
scp linuxx64_12201_database.zip firstname.lastname@example.org:/spare
Some may think that now we unpack and install, but we are not there yet, but before we do anything, we make a backup of this piece of work. We shutdown the virtual machine and and create a compressed tar-file on the host operating system:
tar cvJf sl-ora-20170122-1903.txz sl-ora
That will take a while, because xz is not exactly the fastest compression algorithm and particularly the just uploaded compressed file with the oracle database will be a hard piece to chew on, but you’ll also see some of the disk-files to collapse to almost nothing within a very short time. In my case it took 1½ hours to deflate the files of a virtual machine with a total of 83GB to a xz-compressed tar-file with a little less than 4GB. xz takes its time, but it achieves pretty good results.
Here it shines up that would be convenient if we could start up and shut down from the command line without starting the VirtualBox graphical user interface.
VBoxManage startvm "sl-ora" --type headless
This one starts the virtual machine with the name sl-ora. The shutdown will be a bit more complicated, because we need to gracefully shutdown the guests, because they may run services. On some places in the internet ACPI-shutdown is recommended, but this doesn’t necessarily lead to a graceful shutdown of the guest operating system. There have to be better ways.
There are parameters to VBoxManage that are recommended, but yet I’m not happy with any of them:
VBoxManage -+ poweroff - pulls the plug | (probably not a good idea) | + acpipowerbutton - presses the power off button for | a clean shutdown (well, that | requires configuration to the | guest operating system) | + acpisleepbutton - tells the OS to go to sleep (just as bad as poweroff)
So I played a bit with the options and ended up finding the acpipowerbutton functions so far. I don’t like the solution, but it works and I don’t have to care for it any more, at least for the time being:
VBoxManage controlvm "sl-ora" acpipowerbutton
This command will power off the virtual machine. Yet, I’m not sure, if I like the command as it is. But here is the result:
[root@misrad log]# tail -f messages ....... Feb 3 20:10:01 misrad systemd: Started Session 4 of user root. Feb 3 20:10:02 misrad systemd: Starting Session 4 of user root. Feb 3 20:11:41 misrad systemd: Starting Cleanup of Temporary Directories... Feb 3 20:11:41 misrad systemd: Started Cleanup of Temporary Directories. Feb 3 20:11:49 misrad systemd-logind: Power key pressed. Feb 3 20:11:49 misrad systemd-logind: System is powering down. Connection to 192.168.178.76 closed by remote host. Connection to 192.168.178.76 closed.
So, here we see that the guest system recognizes the ACPI interrupt and powers down. Next I’ll build this into my shutdown scripts on the host computer.
Things, you should keep in mind
We are approaching the end of this chapter and continue with “Finger Exercise 2”, but before we get there, I’d like to address a few general issues about databases. When you use a database, you need to consider a plenitude of aspects, which will turn out as very important, if not life-saving for you as a software engineer and/or admin.
In the recent years, in the IT-field we’ve seen the appearance of the Jack in all trades engineer. Today this Jack-in-all-trades is called “Full-Stack-Developer” and of course, this guy doesn’t know everything AND s/he is not good in everything. But it comes worse, as today quality assurance is mainly considered as testing, but it couldn’t be more wrong. In the late 1980s and early 1990s we learned that also in software engineering we had to prevent errors from happening in the first place rather than finding them once they happened and fix them later. What slowed us down at the beginning, assured that we finished in time with a product that did what it was expected todo. Compare that to the software, predominantly web-based software, you get today. It’s full of bugs and often enough when reporting a bug you get the barefaced answer, that it’s not an error, but this is how “we” do things.
Here we don’t want that and hence we try to think ahead. In a professional environment, I would try to get a consultant who sets up that database. Either a proven in-house expert, not a full-stack-jack, but a real DBA with a reasonable number of flying hours with exactly this database, but in many real-live scenarios you don’t get that. You will be the pseuco-expert ending up, implementing these things and you may not want to be shamed for the disaster you you’ve been compiling.
Think about availability!
When you google “oracle ofa” you won’t find a lot of passages directly addressing this issue. It’s assumed that you know!
It is assumed that you do a backup on your database and you do it planfully and you do this for a point of time. Let’s further assume that you run transactions on this database – transactions in the wider sense. The database is changing after you finished your backup. Then your disk, your disk-controller…. or whatever burns down and you need to recover the database from the backup. Then all the transactions performed since your backup has been finished, would be lost.
This is where the redo-log and the archive-log come into play. You restore the database from the backup and then “roll-forward” the database replaying all changes that have been made to the data, from the archive-log respectively the redo-log.
But what if the devices with the redo-log and the archive-log are gone? You better have a plan for this scenario, because I have seen it happening and I worked all night to recover a crucial database from such a disaster.
At this point of your considerations, you better pull in a real database expert to help you with the physical layout of your database server. You better plan a budget for this. It is worth the money!
Now we start the real configuration of the guest operating system.
The oracle database does not ultimately require particular settings, but in a production environment, it will perform much better, if some system configurations are set right at the beginning to support the operation of the Oracle RDBMS.