Running Oracle VM Templates on Oracle Linux guide (Part 4 of 6)
In part 4, we are going to install and configure the database. Now that we have installed and configured most of our two virtual machines, we will create our HCM database and configure the Oracle Linux VM to be our database server. When we are done, we have a complete database up and running. Then we are going to install the Tools in the next part, and we will be (almost) good to go!
Index of my blog series.
- Prerequisites before starting the guide.
- Installing Virtualbox and Converting the OVM Templates.
- Installing Oracle Linux for OVM. (Based on this blog from Hakan Biroglu)
- Installing and configurating the HCM database.
- Installing and configuring PeopleTools. (application server, web server and process scheduler)
- Installing and configuring PeopleTools on your windows client.
First we need to go to the machine settings, storage, and add two drives to our machine. The two .vdi files are in the images\hcmdb folder and called HCMDB.vdi and Oracle11gR2.vdi. To make things easier, first add the HCMDB.vdi file then the Oracle11gR2.vdi file.
Now we need to set up our static ip address on the machines Host-only network card. Go to system -> Administration -> Network.
This opens the network configuration. Select your eth0 adapter, and press the edit button.
Highlight eth0 and click the Edit button in the toolbar. On the general tab, select the Statically set radio button and enter an IP address and subnet mask. For my network configuration, I chose 192.168.56.50 for my IP address and a subnet of 255.255.255.0. Click OK to close the edit dialog, and then choose File | Save from the menu bar.
Using the buttons on the right, deactivate eth0 and then activate eth0. This will mess up resolv.conf. so deactivate and activate eth1 to get internet access back.
To be sure our host can communicate with the Tools Machine, we need to edit the hosts file. Use the vi /etc/hosts command to edit the hosts file.
Add these lines to the bottom of the file.
192.168.56.50 hcmdb91 hcmdb91.example.com 192.168.56.51 hcmpt91 hcmpt91.example.com
Save the file and exit. Now create the following directories.
mkdir /opt/oracle/psft/ptdb mkdir /u01
use the fdisk –l command, to see if we mapped our hard drives the right way. The output should be something like below. Each hard drive should be /dev/sdx where x represents the hard drive letter. So in this case, /dev/sda is our primary hard disk, /dev/sdb is the database disk and /dev/sdc is the Oracle11gR2 disk. The numbers behind the /dev/sdx represents the number of partitions on the hard drive. /dev/sda for example, has two partitions.
Open the /etc/fstab file with vi /etc/fstab command, so we can mount the database and oracle home disk. We will also mount the swap partition we are going to create soon.
/dev/sdb1 /opt/oracle/psft/ptdb ext3 defaults 1 3 /dev/sdc1 /u01 ext3 defaults 1 4 /root/swapfile swap swap defaults 0 0
Add these lines to the bottom of the file.
Now mount the new partitions using:
mount /u01 mount /opt/oracle/psft/ptdb
dd if=/dev/zero of=/root/swapfile bs=1024 count=2097152 mkswap /root/swapfile chown root:root /root/swapfile chmod 0600 /root/swapfile swapon /root/swapfile
Next we need to set the owner of our just created mount point to oracle. Use the following command. If the files are not owned by the user oracle, the Relinking script will fail, and you will receive permission denied errors.
chown -R oracle:oinstall /u01/app/oracle
now we are going to configure the database. Use the following commands to start the database configuration script.
cd /opt/oracle/psft/vm ./oraclevm-template.sh
The script will ask you to relink the binaries. Say yes. The next prompt will be to specify a port for the database listener. Leave this default, so press enter. Next up, say yes to start the oracle database on boot. The script will now start to relink the oracle binaries. This could take a few minutes.
After the relinking is done, we need to set-up the database SID (database name). We will use the name HCM. Be sure to write this in capital letters, or the scripts might go wrong later. If you want to use another name, don’t make it longer then 8 characters. If you see any errors before this, press ctrl+c to abort, and resolve the errors first.
I’ve posted my output below.
Creating ovm_configure_pre CreateVirtualEnvironment /u01/scripts/db-reconfig.sh: line 238: ovm_set_password: command not found /u01/scripts/db-reconfig.sh: line 239: ovm_configure_network: command not found INFO: Starting Oracle database reconfiguration. Oracle Database Configuration ------------------------------------------------- This will configure on-boot properties of Oracle Database. The following questions will determine whether the database should be starting upon system boot, the ports it will use. Press <Enter> to accept the defaults. Do you want to relink binaries? (y/n) [n] y Specify a port that will be used for the database listener [1521]: Do you want Oracle Database to be started on boot (y/n) [y]:y Wrote to /etc/sysconfig/oracle11g Relinking Oracle Binaries... Oracle Relinking Completed Successfully Logs: /home/oracle/relink.log Running orainstRoot.sh and root.sh... set 2GB tmpfs Enabling Oracle Database service Configuration Completed Successfully. Enter the name of the database SID [TESTDB]:HCM ORACLE instance started. Total System Global Area 288104448 bytes Fixed Size 2225832 bytes Variable Size 104859992 bytes Database Buffers 176160768 bytes Redo Buffers 4857856 bytes Control file created. Database altered. Tablespace altered. Tablespace altered. Tablespace altered. 1 row updated. 160 rows updated. Commit complete. DB Current Current [root@hcmdb91 vm]#
When the script is done, we now have our database almost done! We are now going to log in as the user Oracle. Use the following command;
su –l oracle
Make sure you use the –l parameter, or the bash scripts wont load, and we can’t make use of the $ORACLE_HOME link and other thinks. Edit our initXXX.ora script (XXX is the database name). In our case with the command;
vi $ORACLE_HOME/dbs/initHCM.ora
move to the db_domain property, and comment it out using the #.
Next, use the following command to edit our tnsnames.ora file.
vi $ORACLE_HOME /network/admin/tnsnames.ora
when opening the file, we will see something like below, where the fully qualified name is given.
Remove the .example.com and save the file. Do the same for the listener.ora file, get there using the following command;
vi $ORACLE_HOME /network/admin/listener.ora
it will look like this:
Since the database tier contains application specific files that the tools tier will require (PS_APP_HOME). We will use nfs to share this. Edit the /etc/exports file using the following command. (make sure you are logged in as root. If you are still in logged in with the oracle user, use the ‘su –L root’ command to log in as root again)
vi /etc/exports
add the following line to the file and save it.
/opt/oracle/psft/ptdb/apptools HCMPT91(ro)
next, set up nfs to start when we start our machine, using;
chkconfig nfs on
now all configuration is done. Reboot your machine, after rebooting we will test if the database is up and running.
After rebooting, log in with the root user, and open up a terminal. Use su –L oracle to switch to the oracle user.
Next, use this command to see if the database started on OS boot and if database is accessible.
.
sqlplus SYSADM/SYSADM@HCM
if all went correct, we are now logged in as the SYSADM user. With the following command, we can check if all went well.
SELECT COUNT(1) FROM PSRECDEFN;
Output will be something like below.
This concludes the database setup. On to the Tools installation!
Viewed 1333 times by 383 visitors
Small detail… after editing the .ora files, you need to login as root to edit the /exports file otherwise you get a permissions error
[Reply to this comment]
Wijnand Gritter Reply:
September 11th, 2012 at 5:40 am
Thanks for the note. If you find anything else, please let me know so I can update the posts accordingly. This way anybody can use the guides, even if they have small technical knowledge.
[Reply to this comment]