Wednesday, March 22, 2017

Oracle Database 12C - Installation Database Standalone Server

Hi, everyone.

Today in this article I will show you how to install Oracle Database 12c.

We will use Oracle Automatic Storage Management (Oracle ASM) to store our database, take a look in my previous post about install and configure: Oracle Grid Infrastructure for a Standalone Server 12c.

1. Download Oracle Database 12c (Linux x86_64) installation packages: and
  • Unpack package called: and after that, unpack package called:
It will be created a directory called database with the following content:

1.1 It's time to call the installation utility, execute: ./runInstaller

  •    For purpose of this how to, uncheck the option to receive security updates, let's email field blank and click --> Next
  • It will be presented a warning message, because we are ignoring the email field, just ignore it too and click --> Yes.

1.2 Next screen it will be presented the options to that we want to perform:
  •  Create and configure a database 
  • Install database software only   ---> Choose this one.
  • Upgrade an existing database

We will only install the database software binaries first, because I want to show you more in deep details the command "DBCA - Database Configuration Assistant".

 1.3 Select "Single instance database installation" --> Next --> Next again to choose the language:

We are installing a single database, Oracle Real Application Clusters and Oracle Rac One Node, it will be discussed in a future posts. 

1.4 The only option that as available is "Enterprise Edition" --> Next

1.5 Setup Oracle Base and Oracle Home --> Next

1.6 Setup groups to "oinstall" --> Next:

  • Once again, I will not explain about the "Job Role Separation" or apply it for the purpose of our how to, please take a look at the link.

 1.7 Next step is to check if all prerequisites are satisfied --> Next:

  • As we are good DBA's and take's care about the environment, it will not complain about any failed prerequisite.

 1.8 Last look in the summary screen, to check if everything is where it need's to be --> Install:

 1.9 Installing....

2.0 It will be required to execute as root user the script $ORACLE_HOME/

Just pay attention to the "OK" button, because it is to be pressed only after finish the execution of the script.

2.1 During the script execution it will be prompt to setup the directory path to the: "dbhome", "oraenv" and "coraenv" scripts, that contains the variables of the Oracle  Database environment --> Just "Press Enter":

2.2 Finally the last screen click --> Close.

  • If you have followed step-by-step, it will be presented the following message:
          "The installation of Oracle Database was successful."

                                                                 See you in the next post

Thursday, November 3, 2016

Oracle Grid Infrastructure for a Standalone Server 12C - Installation

Hi, everyone.

Today in this article I will show you how to install and configure Oracle Grid Infrastructure for a Standalone Server 12c.
In my previous post, I showed how to install and prepare the Operating System to install Oracle Database.

If you don't even have your environment yet, please start from here: Oracle Linux 6.7 Installation - VM VirtualBox

1. After install and configure OEL 6.7 (Oracle Enterprise Linux), we need the Oracle Grid Infrastructure for a Standalone Server 12c installation packages, for more details and download: Oracle Database 12c (Linux x86_64) 
When download installation packages finish, we need to upload to the OS (Operating System) all packages, if you are using Windows platform I recommend use WinSCP, it's a free (GPL License) graphic tool that use SSH protocol to transfer through network using TCP/IP. 
But if your are using Linux or Mac, it will be simple, because SSH protocol comes natively in most of OS versions and SCP program it's part of OpenSSH package.
When upload packages has finished, we will unpack using unzip program:
  • Unpack package called: and after that, unpack package called:
  • Execute: unzip and unzip
It will be created a directory called grid with the following content: 

 2. Before start install Oracle Grid Infrastructure for a Standalone Server, we need to be sure about every prerequisites (Preinstallation Tasks), if you are using Windows to follow this "HowTo" you will need a client to access OS using SSH protocol (PuTTY) and it will be needed a program to export the display (Xming) from VM to physical machine (desktop). 
  In the "PuTTY Configuration", expand "Connection" menu, expand "SSH" menu, go to the "X11" option and check box "Enable X11 forwarding" and start Xming program:

Now you will be able to export the display of your VM to your physical machine (desktop).

3. In this step I will guide you how to check prerequisites before start installation setup. It is not uncommon run the installation software and after made every configuration the installation setup perform the prerequisites check with "Failed" status. To prevent it to happen, it's more easy to run first the setup installation with parameter "-executePrereqs", it will "jump" to the prerequisites check and after everything is compliance we can perform installation definitely.

If you followed my previous post or if you are installing own your own and followed the best practices reading the official documentation, you will have the same result as me "No results" for "Show Failed" option. 
But if there is some prerequisites with failed status you need to fix and run "Check Again" to be sure that there is no more complaints.
To call the installation setup utility, execute: ./runInstaller -executePrereqs

3.1 After match every prerequisites, call again the installation setup utility but without "-executePrereqs" parameter, select "Install and Configure Oracle Grid Infrastructure for a Standalone Server"

3.2 Select your preferred language --> Next.

3.3 In the step 3, we need to fill the field "Disk group name", choose the type of "Redundancy", configure "Allocation Unit Size" (Keep it default 1 MB), let's selected "Candidate Disks", in the option "Change Discovery Path" type "/dev/*", then OK --> Next.

  • The first disk group "DG_BLOG_DATA" it will be used to store data, datafiles and etc: /dev/sdb1
  •  Selecting "External" redundancy we assume that disks are redundant by Storage Server or anything else.
  • "Disk Discovery Path" is the same value of "ASM_DISKSTRING" parameter and points to the directory that "ASM" uses to discover candidates disks or disks that is already in use by some disk group.
  • When "Candidate Disks" option is selected only disks that are not in use and has the right permissions are presented to use, preventing us to make any mistake.

3.4 Set SYS and ASMSMP users password: 

3.5 If in your environment you already have an "Oracle Enterprise Manager Cloud Control 12c", you can set up your grid/database to be managed and monitored:

But if you are not using, just click --> Next.

3.6 In the step 6, we are prompted to choose some OS groups. If we intend to use "Job Role Separation", now is the time to determine each job role responsibility:

To this purpose we are not gonna configure separated user roles, this is more used in a big and huge companies, that has a good division of teams: OS, backup, storage, database, middleware, network team and etc. Inside of each team each one has separated duties. 

3.7 In the field "Oracle base" type "/opt/oracle" and "Software location" field type "/opt/oracle/product/12.1.0/grid": 

3.8 On step 8 the "Inventory Directory" field, type: "/opt/oracle/oraInventory"

3.9 I really prefer to take control about every action in the installation process, but you can just check box "Automatically run configuration scripts" and give one of the two alternatives:
  • Use "root" user credential, for that you need to type root user password in this field
  • Use "sudo", you will need to configure /etc/sudoers and add sudo permissions
I will not check or type any information now, just let unchecked and click: Next:

3.10 Now you can see that the installation will execute "Perform Prerequisite Checks", imagine that after make all configuration this step complain about something...

But we are "lucky" and everything is fine. 
3.11 It will be presented an installation summary and an option to "Save Response File" to install Oracle software in other environments using silent mode installation, click "Install":

3.12 Finally the installation has started and in some moment we will be prompted to execute two script files as "root" user:

After complete the execution of these two scripts, click "OK" and the installation will proceed and finish:

Now we have an ASM instance up running and one new disk group: "DG_BLOG_DATA".

4. I will show how to create the other two disk groups in two different ways:
  • Using sqlplus utility to create: DG_BLOG_REDO (/dev/sdc1)

Set ORACLE_SID and  ORACLE_HOME environment variable:
export ORACLE_HOME=/opt/oracle/product/12.1.0/grid 
Connect to the ASM instance using sqlplus: sqlplus '/ as sysasm' 

4.1 The another way to create disk group is using "Oracle ASM Configuration Assistant (ASMCA)":
 Execute: asmca: select "Create" --> Type "Disk Group Name" --> Rundancy "External" --> Select "Show Eligible" --> Check box "Disk Path" - "/dev/sdd1" --> OK.

4.2 Now you can see all the three disk groups created:

We are done here, the next step is just install and configure our database environment.

See you in the next post

Friday, October 28, 2016

Oracle Linux 6.7 Installation - VM VirtualBox

Hi, everyone.

Today in this article we will install and configure Oracle Linux 6.7 for Oracle Database.

For this purpose I recommend use Oracle VM VirtualBox, it's a free virtual machine tool and is totally compatible with almost all platforms of Operating Systems (Windows, Linux and Mac).

Let's go:
1. Open your VM VirtualBox Manager, click "New" --> Type --> Linux, Version --> (Oracle 64-bit):

PS: You can choose Oracle-63bit or Oracle-64bit, it will depend if your processor has the option: Intel VT or AMD-V (Virtualization Hardware). Check it on BIOS, if isn't enabled you will only be able to select 32bit OS versions.

2. Select the total amount of memory that you want to use in your VM (Virtual Machine):

3. Choose option "Create a virtual hard drive now":

4. Select  "VDI (VirtualBox Disk Image):

5. Create a "Dynamically allocated" disk:

6. We will use this first disk to install and configure the Operating System, set the size to 100G:

Creating a "Dynamically allocated" disk, give us flexibility to set a huge size of disk. But doesn't mean that it will allocate this space on your physical hard drive. As you can see, after create the disk the space of the hard drive on your physical machine is the same. The space it will be allocated just when you really use.

7. Let's edit some configurations: Settings --> Network --> enable adpater 1 as NAT, and enable adapter 2 as Host-only:

Enabling NAT (Network Address Translation) it will translate every request to the internet from your physical network. In other words, you will be able to use internet connection inside of your virtual machine. 

Enabling Host-only adapter, you will be able to connect from your physical machine to your virtual machine through TCP/IP protocol, using for example some SSH client (putty, bash, ksh...).  

8. We will need add more disks to install the Oracle Database, in the next steps I will guide you how to add these disks (DATA, REDO and ARCHIVE).
 In the settings of your VM (Virtual Machine), select the option: Storage --> Controller: SATA --> Add Hard Disk --> Create new disk:

 Create this new disk as "Dynamic allocated" with 50GB of size, it will be the disk to use in the "DATA" diskgroup when we install and configure "Oracle Grid Infrastructure for a Standalone Server".
Repeat the same step to add REDO (10GB) and ARCHIVE (20GB) disk, at the end you will have 4 hard disk in your VM:

9. Now it's time to choose our image (.iso) to install our Operating System: OEL 6.7

You can download Oracle Linux from "Oracle Software Delivery Cloud", for purpose of studies you don't need to pay. But you need to use a previous created account (It's free to create if you don't have one).

10. Starting VM select the first option "Install or upgrade an existing system":

10.1 In the next step you will be prompt to select if you want to scan the media that was inserted on media player of VM "OK" or "Skip", you don't need to scan (It take a very long time to complete), because scan it will try to find some physical problem on media and we are using a disc image (.iso):

10.2 Welcome to Oracle Linux installation steps: Next -->

10.3 Select the language that you want to use during the installation process, then: Next -->

10.4 Select your keyboard layout:

10.5 We will not use SAN (Storage Area Network), it will be a simple hard disk (SATA), select "Basic Storage Devices": 

10.6 It will appear a warning message about clear your device and loose some data if there is some: "Yes, discard any data":

10.7 Set a Hostname --> Configure Network --> Edit eth0 device --> "Check box" --> Connect automatically --> Set "Automatic DHCP":

10.8 Edit settings of eth1 device, Configure Network --> Select eth1 device --> Edit --> Check box "Connect automatically" --> Set "Manual" IP --> Next:

10.9 Select your territory/Time Zone, check box "Sytem clock uses UTC" if you are gonna use "Coordinated Universal Time", Next:

10.10 Set up a root password:

10.11 In the next step select "Create Custom Layout", this option will enable us to create the file systems and edit the partitions of disks:

10.12 Select the first disk (/dev/sda), we will create and configure some partitions:
  • /boot (200MB) -----> Non LVM
  • Swap (7GB) -----> LVM
  • /opt/oracle (30GB) -----> LVM
  • /backup (30GB) -----> LVM
  • / (10GB) -----> LVM
  • We will leave some free space to resize some file system in the volume group if need it in the future. 
Select /dev/sda, Create --> Standard Partition, "Allowable Drives" keep just sda selected, ext4 partition type, size 200MB, Fixed size --> check "Force to be a primary partition": 

The /boot partition it will be the unique partition to resides out of LVM, because contains the kernel image to start the operation system and other processes like LVM software.

10.13 Select the "Free" space of /dev/sda disk, now create "LVM Physical Volume", again keep just sda disk selected, select "Fill to maximum allowable size". 
We will use the entire disk to create this volume group and create each partition: 

10.14 Click "Add", select "swap" on "File System Type" menu list to create a Swap partition, 6GB size, I prefer to give a custom name to identify easily each lvm partition (lv_swap, lv_ora_bin, lv_root, lv_backup...), repeat this process to every partition that you wish create, but in the next partitions the "File System Type" it will be ext4 format:

As you can see each LVM partition it's in ext4 format and I indicates each "Mount Point": /opt/oracle (Install Oracle binaries), /backup (Perform disk backups, / (It will be used to install our Operating System). 

I am using /opt/oracle to install Oracle binaries, because /opt directory in the Filesystem Hierarchy Standard (FHS) it's was designed to install/store applications on Linux.

You can choose another directory to install your Oracle binaries, like /u01 that it's used a lot in the "Oracle Documentation".

10.15 At the end you will have the follow "Custom Partitions": Next -->

We won't use the other disks now, I will show you how to format these disks and create an Udev rules for "Oracle ASM (Automatic Storage Management)": "About Udev Rules".

11. Now it's time to perform the last configurations, selecting "Basic Server" --> "Customize now" --> Next --> "Servers" --> check "System administration tools" --> "Optional packages" --> Select "oracle-rdbms-server-12cR1-preinstall-1.0- 14.el6.x86_64" and "oracleasm-support-2.1.8-1.el6.x86-64" --> Close --> Next:

Selecting these two packages we will not need setup any kernel parameters, limits and create oracle user and groups. It's a "preinstall" packages that perform almost everything with at least the minimum values of these parameters and perform dependencies packages installation.

11.1 Initializing the Operating System, you can choose one of two options of the kernel to startup your system. Select the first one "Oracle Linux Server Unbreakable Enterprise kernel", to understand a little bit of unbreakable kernel check this link: "Unbreakable Enterprise Kernel Release 3".

12. We will start prepare our system to receive an Oracle Database installation, access the system using root user.
Let's perform some basic configuration on the Operating System:
  • Edit file /etc/ssh/sshd_config --> uncomment line "#UseDNS yes" and change to "UseDNS no"
  •  In the same file search for "GSSAPIAuthentication yes", comment this line and uncomment "#GSSAPIAuthentication no"
  • Restart SSH service: service sshd restart
  • Disable Iptables firewall: service iptables stop and chkconfig iptables off 
  • Edit file /etc/selinux/config --> change "SELINUX=enforcing" to "SELINUX=disabled"
  • Change oracle user password in the Operating System: passwd oracle 
  • Change owner of the /opt/oracle and /backup mount points: chown -R oracle:oinstall /opt/oracle, chown -R oracle:oinstall /backup 
  • Edit file /etc/fstab, change "tmpfs" entry line as below:
tmpfs                   /dev/shm                tmpfs   defaults                       0 0 
tmpfs                   /dev/shm                tmpfs   defaults,size=6G        0 0 
  • After editing /etc/fstab, execute: mount -o remount tmpfs 

The image below illustrates how your initial file systems and mount points should look like:

Disabling "UseDNS" and "GSSAPIAuthentication"it will allow SSH connection requests to respond more fast.

To learn a little bit more about SELinux, check this link: (Security Enhanced Linux).

Altering "tmpfs " entry on /etc/fstab it will increase the size of "Shared Memory".

12.1 We need to add our "Host-only" IP in the file /etc/hosts, but in a production environment this step isn't necessary because we should use DNS (Domain Name System) to name resolution.
Check below how it should look like:

13. Now we will create the Udev rules to configure owner and permissions on each disk to use in the next post to configure Oracle ASM: /dev/sdb1, /dev/sdc1 and /dev/sdd1:

13.1 Create a new file: vi /etc/udev/rules.d/99-oracle.rules with the following contents:
  •  KERNEL=="sdb1", OWNER=="oracle", GROUP=="oinstall", MODE=="0660"
  •  KERNEL=="sdc1", OWNER=="oracle", GROUP=="oinstall", MODE=="0660"
  •  KERNEL=="sdd1", OWNER=="oracle", GROUP=="oinstall", MODE=="0660"
The "KERNEL" parameter indicates which device you want to set up the rules, "OWNER" parameter indicates who it will be the owner of this device and "MODE" parameter indicates which permissions this device it will have.
Now we will create a new table partition, repeat this process on each disk:

13.2 To check if our rules were successfully applied: ls -l /dev | grep -i ora
You should see each new table partition with the right owner, group and permissions, this permissions are persistent. Even if the Operating System reboot, after startup the system, these rules it will be right:

14. We are almost done, now reboot the Operating System to take effect in the SELinux configuration that we made and finish!

See you in the next post!