SampleApp v406 - Automatic startup of OBIEE
Last week Oracle released v406 of SampleApp. SampleApp is a one-stop-shop for a demonstration of pretty much any conceivable thing that OBIEE is capable of, and then some more on top of it. It is a VirtualBox appliance with everything on the one machine (Database, OBIEE, Endeca, TimesTen, Essbase, etc), and demonstrates basic analysis building techniques through to dashboarding, Mobile App Designer, analysis visualisations with D3, ADF, JavaScript, backend hackery with undocumented NQS calls (hi Christian!), and much, much more.
So, SampleApp is awesome, but … there’s no such thing as absolute perfection ;-) One of the things that is still missing from it is the automatic start/stop of OBIEE when you bootup/shutdown the machine respectively. Setting it up is easy to do, as I demonstrate below. I've also put my cheatsheet for whipping SampleApp into line for my day-to-day use, focussed on the commandline and automation (because respectively that’s where I spend most of my time on a server and because I’m lazy).The OBIEE init.d service script that I demonstrate here is available for use on any Linux installation of OBIEE. For more information, see the Rittman Mead public scripts github repository here: http://ritt.md/init.d
Before we get started I’m assuming here that you’ve:
- downloaded the 28GB worth of zip files
- Unpacked them using 7zip
- Found 70+GB of disc space free and imported the OVF into VirtualBox
- Started up the VM
There’s full instructions in the SampleApp_QuickDeploymentGuide–406.pdf, available in the SampleApp v406 Documentation download from the same page as the SampleApp image itself.
So to make OBIEE start automatically, the first thing we need to do is make sure that the database (where the RCU schemas are) is doing the same, by setting it up as a service (init.d). This is based on this article if you want more details about quite how it works, but for know you just need to copy and paste this whole code block into the command prompt on SampleApp to create the necessary files. If you can't copy & paste between your host and the Virtualbox guest, just go to this blog from Firefox within the SampleApp VM itself.
(Or if you know what you're doing, SSH onto the server and paste the text into an SSH client on your host machine.)
Copy and paste this whole code block into the command prompt:
# Create startup/shutdown script files mkdir -p /home/oracle/scripts chown oracle.oinstall /home/oracle/scripts cat>>/home/oracle/scripts/startup.sh<<EEOF #!/bin/bash # Start Listener lsnrctl start # Start Database sqlplus / as sysdba << EOF STARTUP; ALTER PLUGGABLE DATABASE ALL OPEN; EXIT; EOF EEOF cat>>/home/oracle/scripts/shutdown.sh<<EEOF #!/bin/bash # Stop Database sqlplus / as sysdba << EOF ALTER PLUGGABLE DATABASE ALL CLOSE IMMEDIATE; SHUTDOWN IMMEDIATE; EXIT; EOF # Stop Listener lsnrctl stop EEOF # Make them executable chmod u+x /home/oracle/scripts/startup.sh /home/oracle/scripts/shutdown.sh chown oracle.oinstall /home/oracle/scripts/startup.sh /home/oracle/scripts/shutdown.sh # Create service script cat>/tmp/dbora<<EOF #!/bin/sh # chkconfig: 345 90 25 # description: Oracle auto start-stop script. # # Set ORA_OWNER to the user id of the owner of the # Oracle database software. ORA_OWNER=oracle case "\$1" in 'start') # Start the Oracle databases: # The following command assumes that the oracle login # will not prompt the user for any values su - \$ORA_OWNER -c "/home/oracle/scripts/startup.sh >> /home/oracle/scripts/startup_shutdown.log 2>&1" touch /var/lock/subsys/dbora ;; 'stop') # Stop the Oracle databases: # The following command assumes that the oracle login # will not prompt the user for any values su - \$ORA_OWNER -c "/home/oracle/scripts/shutdown.sh >> /home/oracle/scripts/startup_shutdown.log 2>&1" rm -f /var/lock/subsys/dbora ;; esac EOF sudo mv /tmp/dbora /etc/init.d/dbora sudo chown root. /etc/init.d/dbora # Make the service script executable sudo chmod 750 /etc/init.d/dbora # Associate the dbora service with the appropriate run levels and set it to auto-start using the following command. sudo chkconfig --add dbora
On SampleApp v406 there is an Oracle 12c container database (CDB), with two "pluggable" databases (PDB) within it. Assuming you've not started the database yet, trying to connect to one of the PDBs for the RCU schema will fail:
[oracle@demo ~]$ sqlplus BIEE_BIPLATFORM/Oracle123@localhost:1521/pdborcl SQL*Plus: Release 12.1.0.1.0 Production on Tue Jun 17 03:03:51 2014 Copyright (c) 1982, 2013, Oracle. All rights reserved. ERROR: ORA-12541: TNS:no listener
Now run the service start (which will happen automatically at boot)
sudo service dbora start
And check the status again:
[oracle@demo ~]$ sqlplus BIEE_BIPLATFORM/Oracle123@localhost:1521/pdborcl SQL*Plus: Release 12.1.0.1.0 Production on Tue Jun 17 03:06:12 2014 Copyright (c) 1982, 2013, Oracle. All rights reserved. Last Successful login time: Tue Jun 17 2014 03:02:09 -04:00 Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options SQL>
Now we can set up OBIEE as a service that can start automatically at boot time. This is using a script that I wrote and is shared on the Rittman Mead public scripts github repository here: http://ritt.md/init.d. To install it on SampleApp v406 needs a couple of changes for the environment paths and dependencies etc, which I’ve incorporated in this code block. Again, copy and paste the whole thing into a command prompt on SampleApp.
# lsof is used in the script and isn't installed by default, so let's install it: sudo yum -y install lsof # Now fetch the init.d script itself and configuration file sudo wget --no-check-certificate https://raw.githubusercontent.com/RittmanMead/scripts/master/obi/service/init.d/obiee -O /etc/init.d/obiee sudo wget --no-check-certificate https://raw.githubusercontent.com/RittmanMead/scripts/master/obi/service/sysconfig/obiee -O /etc/sysconfig/obiee # Update the FMW_HOME path in the script # If you're doing this manually, you just neeed to change the line # "FMW_HOME=" and put in the FMW_HOME path for your installation. # In the case of SampleApp v406 it is /app/oracle/biee sudo sed -i -e 's/FMW_HOME=.*$/FMW_HOME=\/app\/oracle\/biee/g' /etc/sysconfig/obiee # Make the script executable sudo chmod 750 /etc/init.d/obiee
You should now be able to run the following status
command to see if OBIEE is running or not:
sudo service obiee status
and if it’s not running, start it up:
sudo service obiee start
To shut it down:
sudo service obiee stop
You can read more about the script here.
There’s one more step to run to make OBIEE start automatically at boot up:
sudo chkconfig --add obiee
Now that the service scripts are in place, restart the machine and check they work:
sudo shutdown -r now
When the VM restarts, it may appear to “hang” on boot - the progress bar will show and “Oracle Linux Server 6.5”, but no desktop. That’s because the services are starting up, and you can switch to the console view to see this. On my Mac I press Shift-Function-Backspace to do this, it may vary on other host operating systems (try ALT + d on Windows):
Once the desktop appears you should be able to launch Firefox and go straight to OBIEE, up and running
There are some additional tweaks I usually make to any new server I work with:
- Install screen (don't know what screen is? Read this!):
Note I’m usingsudo yum -y install screen
sudo
which this version of SampleApp thankfully has configured for theoracle
user - previous versions didn’t IIRC. - Configure screen with a nice statusbar:
cat > ~/.screenrc <<EOF hardstatus alwayslastline "%{= RY}%H %{kG}%{G} Screen(s): %{c}%w %=%{kG}%c %D, %M %d %Y LD:%l" startup_message off msgwait 1 defscrollback 100000 nethack on EOF
I’m using the bash “here document” functionality here to embed the contents of a document in a command statement. It means I can cut and paste it from my clipboard (if you’re on a Mac, you really should check out Alfred, which has a clipboard history manager, so I always have this screenrc and many other snippets available to paste within just a couple of key presses). Cut and paste a single command is easier (and thus less error-prone) than explaining what content to edit into which text file with which text editor. - Set up SSH keys. I wrote about SSH keys previously on this blog (in fact, all of the things on this checklist are covered there). Put simply, it makes logging in much faster and removes the problem of fat-fingering the password:
As with the screen configuration in the previous step, I use a snippet of code from my clipboard, pasted into the shell of any new server I’m working on:
# setup ssh key mkdir ~/.ssh cat >> ~/.ssh/authorized_keys <<EOF ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDMvNjJ8y1a3+NR5OEZHjAd6HhPFdkOI4mDiIIegbRDG+ABhTQmE80DuDe0vp4tex7qefS1u5FG3Xf+hmKDBzKFyegpC+9oEmrtIPkuW7b1Uf/f7Dr6EjXbyA6x1LGEu3THCrGVfw5Mkakqzr43ZfGEFf8k0RiMroHQbp3vOcR+5y0Q132Tbrr0GPd0RPuj4cVOC7QQ6jXSs7TZWepzrcqEpB4M1+N3xS/jEQ5aiCY2FTDOUVj6Y4c0Ogg93bLos6JltPKznq08KXy0ZW/rWDindAmeL0ZAMuU12Qv1ehQZJsxjUwq3jz4yNMgXs5ba3nSvMAr7ZVRzbK5nLl7+eAN3 zaphod@beeblebrox EOF # chmod -R 700 ~/.ssh
As a side node, that’s my public SSH key there. One’s public ssh key is just that - public. If you want to use it, go ahead, it just means I’ll be able to login to your server. That’s because I have the other half of the key-pair; the private key, and that is the one that should not be shared, because with it you can access any server that has been configured with the public key. Private SSH keys should be treated just as your most important passwords (and indeed, you should use a passphase when creating your private SSH key, to add a layer of security to it, so that it can only be used if the passphrase is known).
The next step is Installing obi-metrics-agent, Graphite, and collectl, but that's a matter for another blog post :-)