Monday, July 22, 2013

Oracle Database Preinstallation – Part 1

Dear Readers,

My name is Franz Devantier, creator of this blog.  I am an Oracle Certified Professional (OCP DBA 11g) Security DBA.  I will be sharing with you the basic duties of an Oracle DBA, and also some of the undocumented, and not so well known tasks. 


I will make a deal with you:  If you refer me to a company that needs database support, from a few hours per week to full time, and I am able to sign a contract with them.
Then I will give you 10% of the monthly contract or deal price every month.  When the contract ends, and we re-sign the contract, I will again give you 10% of the monthly contract price.  This will go on until the company no longer employs or contracts me or my agents to look after their databases.
I can do this, because that 10% is my marketing budget.  When we re-sign the contract, in the future, it may depend on you giving the thumbs up again, and that is worth 10% of the monthly contract price, to be given to you as commission.
Contact: Franz

Oracle Database Preinstallation – Part 1
These are the tasks that you must complete, before you run Oracle Universal Installer (OUI).
Generally speaking there are two things that you should do before installing the Oracle software.  Firstly you should download the installation manual for your specific manual, and perform the pre-installation tasks.  Secondly if you are going to use Oracle Automatic Storage Management (ASM), or Oracle restart, then you should start off by installing Oracle Grid Infrastructure.

My notes are relevant to Linux and Unix, because with windows, most of these pre-installation tasks are transparent, and you can usually just get away with, putting the installation disk in and running it.  Actually I will be focussing on Linux, because Oracle has invested a lot into Linux, and secondly it is very convenient to load the Linux operating system onto your laptop or workstation, or virtual OS.  Oracle Linux has a free version, which you can download and install.  So we are looking at Oracle linux really, which is essentially Red Hat.   

Logging in to the System as root
Firstly you need to complete several tasks as the root user.  If the organization has a problem with giving the DBA the root password, then you will need to work very closely with the Sys Admin.  In windows you really just need an administrator login, and you are good to go.

You must install the software using a X Windows utility, or a X terminal, or any other system that can use or invoke X Server software.  If you are using silent mode installation, the you don’t need X Windows.

Installing from X Windows workstation or X Terminal:
=> Firstly you need to start your local terminal session, which could be something like “xterm”.

=> If you are not going to install the software on the local system, then you need to enable the remote host to display X applications on your local X Server or workstation.
You can achieve this something like:
$ xhost <fully qualified host name>

=> If you are going to install the software on the remote system, then use ssh, rlogin or telnet to connect to the system on which you want to install the software.  If you can use telnet on your site, then you have inherent issues, and I would suggest that you get an Oracle security expert to advice you.

=> If you are not logged in as root, then you must first do something like:
$sudo su root
Otherwise you must work closely with the companies sys admin.

=> To install the Oracle software on Linux, you may have to read through the specific X server documentation or request support from the specific vendors.  However the process should run something like this:
1.) Start your X server software
2.) Configure your X server to allow remote hosts to display X application on your workstation or local system.
3.) Connect to the remote server or where you want to install the Oracle software, and start your terminal or X windows session on that server.  For example an xterm session.  You may need to first logon to root, or do a “sudo” or “sudo su” to root, before you can proceed.

Now that you are logged onto the server where you will install the software, and have some sort of X Windows facilities, you are ready to verify the Hardware Requirements for the installation.

Verifying the Hardware Requirements for 11.2
We will check that we meet the minimal requirements.  If there has been time for planning, then you may have a set of hardware requirements that exceed the minimal requirements.  The areas that we will check include the Memory requirements, System architecture, Disk space requirements, and Display requirements.

Memory Requirements:
Minimum 1GB of RAM, recommended at least 2GB of RAM.

One way to determine the size of the RAM on a linux box is:
$ grep MemTotal /proc/meminfo
If the size of the RAM is less than the minimal required size, then you must first install more RAM before continuing.  The installation will abend if you try to install without enough RAM.

You also need to take into account the relationship between installed RAM, and the configured swap space.  There are specific recommendations by Oracle, and it is good to try to stay within those parameters.
RAM
Swap Space
Between 1GB and 2GB
1.5 times the size of the RAM, 1.5GB to 3GB
Between 2GB and 16GB
Swap space should be equal to the size of the RAM
More than 16GB
Swap space should not be larger than 16GB

If Oracle does start using too much swap space, during operations, you could have a drastically reduced performance throughput.  On Linux you can enable the HugePages feature.  HugePages are basically used for memory-mapped files.  If you are using HugePages, then you should deduct the memory allocated to HugePages from your RAM, before calculating the relationship between RAM and swap space.  You also need to verify that after deducting your HugePages from RAM, you still have at least 1GB of RAM left.

On linux you can use a command like this to verify the available RAM and swap space.
$ free

Remember that as the interactions with the server change, from busy to quite, your available RAM and swap space readings are going to keep changing; so you will need to perform this step under various stress conditions, to arrive at meaningful values.  It may also be useful to get recommendations from you OS vendor for specific guidelines on the RAM Swap space settings.

Using Automatic Memory Management (AMM)
From 11g onwards, AMM requires more shared memory than before, which on linux is defined in “/dev/shm”, as well as using more file descriptors.  Two parameters in the database must be smaller than the size of the defined shared memory.  MEMORY_MAX_TARGET or MEMORY_TARGET, typically MEMORY_MAX_TARGET would have the larger value, or would be equal to MEMORY_TARGET.  You would need to add values from all the Oracle instances on the computer, to properly determine the size to assign to the shared memory.

On Linux especially if the operating system mount size that has been defined is too small for the instance being started, defined in “/dev/shm”, then you will get the ORA-00845 error, when you try to start the instance.  The above mentioned Oracle memory variables, define the total size of the combined System Global Area (SGA), and Program Global Area (PGA).

The other variable that can bite is the file descriptors.  There should be at least 512 times the Oracle variable PROCESSES defined.  If the file descriptors is not sized correctly then you will get an Oracle error: ORA-27123.  Potentially you may also get the Linux error “EMFILE (Too many open files)”, especially with regards to non-Oracle related processes.

It is quite easy to determine the amount of shared memory available.
$ df –h /dev/shm/

Keep in mind that if you use the parameter LOCK_SGA, then you can’t use MEMORY_MAX_TARGET or MEMORY_TARGET.  Also if you have defined HugePages on the Linux level, then you can’t use MEMORY_MAX_TARGET or MEMORY_TARGET.

For example, if the shared memory file system allocation on your server is 1GB, and you have set MEMORY_MAX_TARGET = to 2GB, then you will get the following errors, when you try to start the database up.
ORA-00845    MEMORY_MAX_TARGET not supported on this system
ORA-01078   Failure in processing system parameters

To address the ORA-00845 error, you can increase the “/dev/shm” mountpoint size.
For example:
$ mount –t tmpfs shmfs -0 size=7g /dev/shm

Then you will need to make this change persistent across system restarts, by adding an entry in the “/etc/fstab”
For example:
$ smfs /dev/shm tmpfs size=7g 0


The database name is typically limited to 8 characters, however sometimes a user will have a requirement for the database to be named to something that is longer than 8 characters.  What happens in this situation is:
Let’s say the Global Database Name is longer than 8 characters.
DB_NAME parameter is truncated to 8 characters.
DB_UNIQUE_NAME parameter is set to the global name.
The end result is that this is fairly transparent to the end user, but remember the internal representation, for just in case you start to experience issues.

Franz Devantier,
Need a database health check?
devantierf@gmail.com

Classifieds

No comments:

Post a Comment