Category Archives: Linux

Oracle Virtualized ODA Install

I’ve been working with the brand new ODA update on an X5-2 and Oracle has made a number of changes that impact how an install and configuration is done. is the first release that supports a ‘reflash’ of an ODA with Oracle Linux 6. Previously update had Oracle Linux 5 and updated had Oracle Linux 6, but the only way to move to was to first already be at and then patch to is the first release that will support (re-)deployment of an ODA in a virtualized configuration where you load the Oracle VM ISO into each ILOM and then deploy the ODA_BASE virtual machine. Note that if your ODA was at or earlier you will still have to download the patch to ODA_BASE after you deploy ODA_BASE to patch some of the server and storage components. Oracle has changed from the old patch –infra, –grid, –database options and now has a –server (that does some hardware and the grid infrastructure) and –storage (which patches the shared storage hardware).

One very major change which is especially important for those of us who manage virtualized ODA installs remotely is that /etc/xen/xend-config.sxp on ODA_BASE now has the following section:

# The interface for VNC servers to listen on. Defaults
# to  To restore old 'listen everywhere' behaviour
# set this to
#(vnc-listen '')

This means that you when you attempt to create a VM and connect to the console the same way you did in past ODA versions you’re probably going to get something like this:

[root@oda-base-node0 ~]# oakcli show vmconsole OL7U2 
 OAKERR:8006 Error in VNC display configurations : DISPLAY=localhost:10.0

You can either modify the /etc/xen/xend-config.sxp file, or you can update the vm.cfg file for a particular VM that you’ve imported. Since the ODA will be using ACFS it might be a bit hard to find the vm.cfg file since it ends up in the hidden .ACFS directory on the shared repository ACFS file system.

I had created my VMs on a shared repository named sharedrepo so my vm.cfg file ended up here:

[root@oda-base-node0 OL7U2]# pwd 
[root@oda-base-node0 OL7U2]# vim vm.cfg

Update the vm.cfg file and add the following:

vnclisten = ''

Note that vnclisten ‘’ didn’t work and neither did vnclisten = It had to be vnclisten = ‘’ for the VM to start.

Now that you’ve got a ‘listen anywhere’ vnc console running, you can just use a VNC client on your workstation (I used Tiger VNC) and connect to your node0-dom0:590X where X is the number of VMs you’ve started past ODA_BASE.  ODA_BASE is at :5900 and if this is the first additional VM you’ve created you’ll be able to reach the console at :5901. Note that once you’ve done the initial network configuration of your VM you’ll probably want to take the vnclisten parameter out of the vm.cfg file.

I’m also currently working with Oracle support on an issue. We’ve got a RAC One Node multitenant database and won’t run scripts in the ‘root container and all pluggables’. For example:

[oracle@oda-base-node0 ~]$ $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/ -u SYS -d $ORACLE_HOME/rdbms/admin -b utlrp_output utlrp.sql 
 catcon: ALL catcon-related output will be written to utlrp_output_catcon_77673.lst 
 catcon: See utlrp_output*.log files for output generated by scripts 
 catcon: See utlrp_output_*.lst files for spool files, if any 
 Enter Password: 
 catconInit: database is not open on the default instance 
 Unexpected error encountered in catconInit; exiting

This is important because apxremov_con.sql is just a wrapper for so you can’t remove APEX from the root container (CDB$ROOT) and PDB$SEED so that new pluggable databases won’t have APEX in them. We do this so that we’ll be able to potentially have different versions of APEX in different pluggable databases in the same container database.

Oracle has opened a P1 bug on this and has actively been working this for a few days.

Happy ODAing!



yum install tree -y

You need to do this right now!

As root on your Oracle Linux server, type:

[root@sqlfundamentals ~]# yum install tree -y

Then you can do this:

[oracle@sqlfundamentals ~]$ cd labs/
[oracle@sqlfundamentals labs]$ tree
├── sql1
│   ├── code_ex
│   │   ├── cleanup_scripts
│   │   │   ├── cleanup_10.sql
│   │   │   └── cleanup_11.sql
│   │   ├── code_09_retired_emp_tab.sql
│   │   ├── code_10_cretest.sql
│   │   ├── code_ex_02.sql
│   │   ├── code_ex_03.sql
│   │   ├── code_ex_04.sql
│   │   ├── code_ex_05.sql
│   │   ├── code_ex_06.sql
│   │   ├── code_ex_07.sql
│   │   ├── code_ex_08.sql
│   │   ├── code_ex_09.sql
│   │   ├── code_ex_10.sql
│   │   └── code_ex_11.sql
│   ├── demo
│   │   ├── demo_02_alias.sql
│   │   ├── demo_02_null.sql
│   │   ├── demo_03_and.sql
│   │   ├── demo_03_betw.sql
│   │   ├── demo_03_expr.sql
│   │   ├── demo_03_in.sql
│   │   ├── demo_03_ordernull.sql
│   │   ├── demo_03_or.sql
│   │   ├── demo_03_sal1.sql
│   │   ├── demo_03_sal2.sql
│   │   ├── demo_03_varno.sql
│   │   ├── demo_03_varyes.sql
│   │   ├── demo_04_case.sql
│   │   ├── demo_04_nest.sql
│   │   ├── demo_05_day1.sql
│   │   ├── demo_05_day2.sql
│   │   ├── demo_05_hire.sql
│   │   ├── demo_05_mask.sql
│   │   ├── demo_06_count1.sql
│   │   ├── demo_06_count2.sql
│   │   ├── demo_06_error.sql
│   │   ├── demo_06_job1.sql
│   │   ├── demo_06_job2.sql
│   │   ├── demo_06_listagg.sql
│   │   ├── demo_06_order1.sql
│   │   ├── demo_06_order2.sql
│   │   ├── demo_07_cart.sql
│   │   ├── demo_07_loc.sql
│   │   ├── demo_09_inters.sql
│   │   ├── demo_09_minus.sql
│   │   ├── demo_09_orderby.sql
│   │   ├── demo_09_union1.sql
│   │   ├── demo_09_union3.sql
│   │   ├── demo_10_cretabs.sql
│   │   ├── demo_10_grant.sql
│   │   ├── demo_10_revoke.sql
│   │   ├── demo_10_select.sql
│   │   ├── demo_10_update.sql
│   │   ├── demo_11_identity_col.sql
│   │   ├── demo_11_invisible_col.sql
│   │   ├── demo_11_sol_col_default.sql
│   │   └── demo_d_loc.sql
│   ├── labs
│   │   ├── lab_10_01.sql
│   │   ├── Online_Book_Store_Create_Table.sql
│   │   ├── Online_Book_Store_Drop_Tables.sql
│   │   └── Online_Book_Store_Populate.sql
│   └── soln
│       ├── sol_02.sql
│       ├── sol_03.sql
│       ├── sol_04.sql
│       ├── sol_05.sql
│       ├── sol_06.sql
│       ├── sol_07.sql
│       ├── sol_08.sql
│       ├── sol_09.sql
│       ├── sol_10.sql
│       ├── sol_11.sql
│       └── sol_ap.sql
└── sql2
├── code_ex
│   ├── cleanup_scripts
│   │   ├── cleanup_03.sql
│   │   ├── cleanup_05.sql
│   │   ├── cleanup_07.sql
│   │   ├── cleanup_09.sql
│   │   └── cleanup_10.sql
│   ├── code_cre_emp_history.sql
│   ├── code_cre_emp_sales.sql
│   ├── code_cre_mgr_history.sql
│   ├── code_cre_sales_info.sql
│   ├── code_cre_sales_source_data.sql
│   ├── code_cre_sal_high.sql
│   ├── code_cre_sal_history.sql
│   ├── code_cre_sal_low.sql
│   ├── code_cre_sal_mid.sql
│   ├── code_ex_02.sql
│   ├── code_ex_03.sql
│   ├── code_ex_04.sql
│   ├── code_ex_05.sql
│   ├── code_ex_06.sql
│   ├── code_ex_07.sql
│   ├── code_ex_08.sql
│   ├── code_ex_09.sql
│   ├── code_ex_10.sql
│   └── code_ins_sales_source_data.sql
├── demo
│   ├── demo_04_easyvu.sql
│   ├── demo_04_emp.sql
│   ├── demo_06_ex_1a.sql
│   ├── demo_06_ex_1b.sql
│   ├── demo_06_ex_2.sql
│   ├── demo_06_pairwise_a.sql
│   ├── demo_06_pairwise_b.sql
│   ├── demo_06_pairwise.sql
│   ├── demo_06_With.sql
│   ├── demo_07_delete_rows.sql
│   ├── demo_07_update_rows.sql
│   ├── demo_07_update_subquery1.sql
│   ├── demo_07_update_subquery.sql
│   ├── demo_08_revoke.sql
│   ├── demo_09_default_tab.sql
│   ├── demo_10_tz.sql
│   ├── demo_d_loc.sql
│   ├── demo_I_regexp_replace_a.sql
│   └── demo_I_regexp_replace_b.sql
├── emp_dir
│   ├── emp.dat
│   ├── library_items.dat
│   ├── LIBRARY_ITEMS_EXT_23121.log
│   ├── LIBRARY_ITEMS_EXT_5040.log
│   ├── OLDEMP_14719.log
│   └── OLDEMP_26721.log
├── labs
│   ├── confidence.sql
│   ├── lab_02_06_tab.sql
│   ├── lab_04_07.sql
│   ├── lab_05_09.sql
│   ├── lab_05_10.sql
│   ├── lab_05_11_a.sql
│   ├── lab_05_11_b.sql
│   ├── lab_05_11_g.sql
│   ├── lab_06_insert_empdata.sql
│   ├── lab_08_05.sql
│   ├── lab_09_01.sql
│   ├── lab_09_03.sql
│   ├── lab_09_05.sql
│   ├── lab_09_08_a.sql
│   ├── lab_09_08_b.sql
│   ├── lab_09_08_e.sql
│   ├── lab_09_09.sql
│   ├── lab_09_10.sql
│   ├── lab_09_11.sql
│   ├── lab_10_06.sql
│   ├── lab_ap_cre_mgr_history.sql
│   ├── lab_ap_cre_sal_history.sql
│   ├── lab_ap_cre_special_sal.sql
│   ├── Online_Book_Store_Drop_Tables.sql
│   └── Online_Book_Store_Populate.sql
└── soln
├── sol_02.sql
├── sol_03.sql
├── sol_04.sql
├── sol_05.sql
├── sol_06.sql
├── sol_08.sql
├── sol_09.sql
├── sol_10.sql
└── sol_ap.sql

13 directories, 154 files
[oracle@sqlfundamentals labs]$

And this is awesome!


Command line editing with bash

I use Oracle Linux just about every day. I teach Oracle classes using Oracle Linux and work with a whole bunch of Oracle servers which, more often than not, use Oracle Linux (or sometimes Redhat Linux which is basically very similar to Oracle Linux). The vast majority of the time these systems are set up to use bash (From wikipedia: The name itself is an acronym, a pun, and a description. As an acronym, it stands for Bourne-again shell, referring to its objective as a free replacement for the Bourne shell. As a pun, it expressed that objective in a phrase that sounds similar to born again, a term for spiritual rebirth. The name is also descriptive of what it did, bashing together the features of sh, csh, and ksh.) as the default shell for users.

While teaching my classes, I frequently type commands while my students watch and it’s not unusual for me to make typing mistakes. I often bang the BACKSPACE key a bunch of times while removing a single word, or worse yet, I hold it down to erase and entire line and start all over again. Every time I did this I would think “I used to know how to do this better.”

Today I looked it up a book that I have sitting on my bookshelf, (I last read it in 1995), which I would highly recommend if you’re a Unix System Admin: Using csh & tcsh Type Less, Accomplish More. It’s a really great book if you are going to be using a Unix shell all day every day interactively. I read it way back when I was learning Unix and it made a huge difference in my productivity with interactive ‘shelling’. These days I’m mostly only working with Linux to get Oracle systems set up and configured correctly, so I’m usually sticking with the default shell… which is bash.

I tested out some of the things in the book and they work a bit differently in tcsh than they do in bash. Since I’ve become (largely by default) a bash user, here goes:

Remove the entire command line in bash with CTRL-u or CTLR-w

[oracle@multitenant ~]$ This is a command line that I want to erase

Type CTRL-u or CTRL-w (as an aside, CTRL-w in tcsh erases a single word) and voila:

[oracle@multitenant ~]$

Sometime I only mess up the last word…

Remove the last word typed in bash with ESC BACKSPACE

[oracle@multitenant ~]$ env | grep ORALCE

Oops! Messed up that ORACLE. Type ESC BACKSPACE and voila:

[oracle@multitenant ~]$ env | grep

Now I can correctly add ORACLE to the above without having to use backspace six times.

Reuse part of the previous commands arguments with !$, !^, !*

Often we’ll look at the contents of a file and then decide we want to edit it.

[oracle@multitenant ~]# cat /etc/oratab

Hmmm…. I see something I want to change, so rather than typing vi /etc/oratab I can just do the following:

[oracle@multitenant ~]# vi !$

!$ uses the last argument from the previous command, !^ uses the first argument from the previous command, and !* uses all arguments from the last command, so actually any of those would have worked in the example above. Remember that above I have two parts in the line I’m typing; The first is the actual command (cat) and then the second is the argument (/etc/oratab).

Hopefully this (along with the CTRL-r post from earlier) will help a few folks become just a bit more efficient in their day to day operations!

CTRL-r is your friend!

You already knew that the up and down arrows in a Linux terminal window allow you to navigate through previously typed commands, but did you know that you can also search through your command history?

CTRL-r is great for finding those commands that are a bit tedious to type.

When you type CTRL-R in a terminal window your whole prompt turns into this strange looking text:


As you type characters the first command in your history, starting from the most recent and working back towards the top will be displayed.

Let’s say you’ve typed the following list of commands:

sqlplus / as sysdba
rman target "'/ as sysbackup'"
ls -als

At a command prompt you type CTRL-r and then type s. Your prompt will now look like this:

(reverse-i-search)`s': ls -als

And the s in the als will be highlighted. What you’ve done here is found the first s in your command history.

If you type Enter right now, you’ll rerun that command.

Things get more interesting when you start typing more letters. Instead of typing just s, type sq and you’ll get the following:

(reverse-i-search)`sq': sqlplus / as sysdba

Hitting Enter will rerun that sqlplus command.

What if you want to find something that you typed earlier than the last command that matched? Just type CTRL-r again. Each time you press CTRL-r you’ll find older and older strings that match. If you have a short search string (just s for example), then it’s not unusual to find that string in a single command multiple times. Once you’ve exhausted all the matches in one command, you’ll reach back into your history to find another that matches.

What if you want to find the last thing that you found with CTRL-r?

Start a new search (or just use backspace to remove any characters you’ve started typing) and press CTRL-r again. Let’s say that you used rm as your last successful search and retrieved the rman command from the above list of commands. You then ran a few more commands and decided to run rman again… Just type CTRL-r twice. The first CRTL-r says “I want to search through my history”, the second CTRL-r says “Remember the last successful search I used? I want that one again.”

What if you don’t want to run the command you found, but instead you just put the command at your prompt so you can edit it? Instead of hitting Enter after you find a command, just press Esc. This dumps the text of the command into your terminal at a command prompt.

Here’s where things get really cool… If you use rlwrap for various Oracle commands like sqlplus, rman, etc. (See this post to install rlwrap, and this post to configure the aliases to use with rlwrap) then CTRL-r will also work in those commands too!

Want to find the last alter user command that you ran? In sqlplus just type your good friend CTLR-r and start typing alter. You probably won’t have to actually type all the letters in alter and soon you’ll have the following:

(reverse-i-search)`al': alter user dbsnmp identified by oracle_4U account unlock;

Technically CTRL-r finds the spot in your history where the command you found lives, so once you’ve found a command, you can use the up and down arrows to cycle through the commands that are near that command. What was that command that I typed right after I did that alter user command? Just press the down arrow key and you’ve found it!

There are a few idiosyncrasies with CTRL-r. First it is case sensitive so you’ll have to remember if you used SELECT or select. Second it can be kind of easy to get it into a strange place with the characters you are searching for if you start typing characters that are not actually in your command history CTLR-r will beep at you a bunch and you may or may not be able to use the backspace key to get back to where you want to be… Just use Esc to get out of the CTRL-r search and try again.

Also you may want to give CTRL-r more history to work with. If you’d like to do this you’ll need export two different environment variables, HISTSIZE and HISTFILESIZE.

I added the following to my .bash_profile file in my home directory:

# Let's give the history command and CTRL-r more to work with!
export HISTSIZE=10000
export HISTFILESIZE=10000

CTRL-r has saved me much typing over the years, I hope it helps you too!

Thoughts on the Oracle users bashrc and bash_profile

For many, many years we’ve been clouding up the oracle user’s .bashrc and .bash_profile scripts with ‘lots of things’. Some of these things will be set automatically when we run the . oraenv command (that’s dot space oraenv). Our good old friend LD_LIBRARY_PATH gets set automatically, ORACLE_HOME gets set automatically, and the PATH is extended to search in your ORACLE_HOME/bin directory.

The below screenshot comes from a ‘new’ Oracle Linux 6 system where I’ve done a software only install of Oracle Database and have yet to create any databases. Because I don’t have a database yet, I have to type in the path to the ORACLE_HOME when I give some random SID. Once I have a database created, that database will get added to the /etc/oratab file and the SID will be recognized and automatically set the ORACLE_HOME for me.

bashrc and bash_profile

Click the image above to get a full size picture of what’s happening.

Based on the above, I might change things a bit in this post from my 12c Install Series.

Oracle Database 12c on Oracle Linux 6 – Step 30: Install the VirtualBox guest additions in the VM

Part of this series of posts: Oracle Database 12c on Oracle Linux 6


Select Devices -> Install Guest Additions… from the VirtualBox menu. You’ll have to use the right Ctrl key to release the mouse to do so.


Click Cancel.


Right-click the desktop and select Open in Terminal.


Type the following commands, pressing Enter after each.

su - 
root (at the Password: prompt)
export KERN_DIR=/usr/src/kernels/`uname –r`
cd /media/V [TAB]


Those are back ticks which are probably next to the 1 key on your keyboard, not forward ticks in the export command. The Tab key will autocomplete commands for you. When we type cd /media/V the shell will complete the name of the Virtualbox Guest Additions CD for you. It’s much easier than typing it. If you’d like to use the Tab key to autocomplete the second command, you’ll have to type up to the L in Linux before it will work because there are other commands in that directory that start with VBox. You can always hit the Tab key twice to see what the shell will be able to autocomplete based on your search path.


You should see output with all green OKs.


If you get a failed message it’s most probably because your kernel doesn’t match the kernel sources which usually means that your yum update kernel-uek-devel command from earlier didn’t work correctly. Recheck your commands from Step 9 to make sure you did everything correctly.


Select System -> Log out oracle… from the menu.


Click Log Out.


Press Enter and type oracle in the Password field.


Right click the Guest Additions CD and select Eject.


Your window should now resize to fill the whole screen!


We could actually do this step a lot earlier and get the nice widescreen if we want. It was just a bit harder to do screen captures for me so I stuck this at the end. This must be done AFTER the reboot in step 18 though…

Oracle Database 12c on Oracle Linux 6 – Step 29: Create a Link to SQL Developer and Database Connections < Previous Post – Next Post > Oracle Database 12c on Oracle Linux 6 – Step 31: Enjoy a frosty beverage!

Oracle Database 12c on Oracle Linux 6 – Step 29: Create a Link to SQL Developer and Database Connections

Part of this series of posts: Oracle Database 12c on Oracle Linux 6


Enter the following commands pressing Enter after each one.

cd sqldeveloper/


Click the small x in the top right hand corner of the Tip of the Day dialog.


Click the New Connection button.


Enter orcl – sys for Connection Name.

Enter sys for Username.

Enter oracle_4U for Password.

Check Save Password.

Select SYSDBA in the Role dropdown.

Change the SID to orcl.

Click Test.

Click Save.


Change Connection Name to pdborcl – system.

Change Username to system.

Change the Role dropdown to default.

Choose Service name and enter pdborcl.localdomain.

Click Test.

Click Save.

Click Cancel. (The connection dialog will go away.)


Select File -> Exit.


Right-click the banner at the top of the window and select Add to Panel…


Select Custom Application Launcher and click Add.


Enter SQL Developer for Name.

Enter The best tool for developing SQL for Comment.

Click Browse…


Click the left arrow next to the oracle folder.


Click the disk icon to get to the root directory.


Keep clicking folders until you have navigated to /u01/app/oracle/product/12.1.0/dbhome_1/sqldeveloper.

Select and click Open.


Click the Launch icon.


Navigate to /u01/app/oracle/product/12.1.0/dbhome_1/sqldeveloper again.

Select icon.png.

Click Open.


Click OK.


Click Close.

Oracle Database 12c on Oracle Linux 6 – Step 27: Configure the Pluggable Database to Autostart on Reboot < Previous Post – Next Post > Oracle Database 12c on Oracle Linux 6 – Step 30: Install the VirtualBox guest additions in the VM