Sunday 3 May 2015

Concurrent Managers Questions

Concurrent Managers

A concurrent manager is itself a concurrent program that starts other concurrent programs running. When an application user submits a request to run a program, the request is entered into a database table that lists all of the requests. Concurrent managers read requests from the table and start programs running. 

The Internal Concurrent Manager, which functions as the “boss" of all the other managers. The Internal Concurrent Manager starts up, verifies the status of, resets, and shuts down the individual managers.

The Standard manager accepts any and all requests; it has no specialization. The Standard manager is active all the time; it works 365 days a year, 24 hours a day.

Transaction Managers
While conventional concurrent managers let you execute long-running, data-intensive application programs asynchronously, transaction managers support synchronous processing of the particular requests from client machines. A request from a client program to run a server-side program synchronously causes a transaction manager to run it immediately, and then to return a status to the client program.

Where do concurrent request or manager log files and output files go?
The concurrent manager first looks for the environment variable $APPLCSF. If this is set, it creates a path using two other environment variables: $APPLLOG and $APPLOUT It places the log files in $APPLCSF/$APPLLOG, output files go in $APPLCSF/$APPLOUT
So for example, if you have this environment set:
$APPLCSF = /u01/appl/common
$APPLLOG = log
$APPLOUT = out

Can I delete a concurrent manager?
You can disable the manager by checking the 'Enabled' checkbox, or you can simply Terminate the manager and it will not run again unless you reactivate it. If it is really necessary, you can query the manager in the
'Define Manager' form, and delete the row. (It is recommended that you DO NOT do this)

What is the function of the 'Conflict Resolution Manager'?
Concurrent managers read requests to start concurrent programs running. The Conflict Resolution Manager checks concurrent program definitions for incompatibility rules.

If a program is identified as Run Alone, then the Conflict Resolution Manager prevents the concurrent managers from starting other programs in the same conflict domain.

When a program lists other programs as being incompatible with it, the Conflict Resolution Manager prevents the program from starting until any incompatible programs in the same domain have completed running.

How do I clean out the Concurrent Manager tables?
Cleaning out the tables is a useful method of making sure that there are no invalid statuses that can prevent the managers from starting. Previously, this has been done by truncating fnd_concurrent_processes and/or fnd_concurrent_requests. Truncation of the tables is a little drastic, and can cause problems later when trying to purge requests, not to mention losing all of the request information.

Run the script, cmclean.sql, article Note 134007.1 CMCLEAN.SQL - Non Destructive Script to Clean Concurrent Manager Tables It will make sure the relevant status codes are valid without deleting any information.

I hit the Restart button to start the Standard manager, but it still did not start?
Telling a manager to restart just sets the status to Restart. The ICM will start it the next process monitor session or the next time the ICM starts. Use Activate to start a manager immediately. When a manager is deactivated manually, the ICM will not restart it, you will need to set it to Restart, or activate it manually.

How many rows are in FND_CONCURRENT_REQUESTS and FND_CONCURRENT_PROCESSES tables?
When tables reach above 3000-4000 rows, the performance begins to diminish. You may want to run Purge Concurrent Request on a regular basis, dependant on the amount of requests being run.

The Purge Concurrent Requests job can be used to purge: Requests, Mgr logs, and All requests depending on what is chosen.

Use the following options: Enter = All, Mode = AGE, Mode Value = 15

The std.mgr log continuously grows where it may good to archive it regularly.

Monday 30 March 2015

format mount new Disk in linux

List Partitions

The fdisk -l commands lists the partitions on your system.
# fdisk -l /dev/sda

Disk /dev/sdb: 536.9 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x93e0e5c0

   Device Boot      Start         End      Blocks   Id  System


Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00063dc9

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        6528    51915776   8e  Linux LVM

Disk /dev/dm-1 doesn't contain a valid partition table

Entering Command Mode

To work on a disk’s partitions, you have to enter command mode. You’ll need the device name of a disk from the fdisk -l command. The following command enters command mode for the first disk device:
a. fdisk /dev/sdb

Using Command Mode

In command mode, you use single-letter commands to specify actions you want to take. Type and press Enter to see a list of the commands you can use.

Viewing the Partition Table

Use p to print the current partition table to the terminal from within command mode.

Deleting a Partition

Use the d command to delete a partition. You’ll be asked for the number of the partition you want to delete, which you can get from the p command. For example, if I wanted to delete the partition at /dev/sda5, I’d type 5.
After deleting the partition, you can type p again to view the current partition table. The partition appears deleted, but fdisk doesn’t write these changes to disk until you use the w command.

 Creating a Partition

Use the n command to create a new partition. You can create a logical or primary partition (l for logical or p for primary). A disk can only have four primary partitions.
Next, specify the sector of the disk you want the partition to start at. Press Enter to accept the default sector, which is the first free sector on the disk.
Last, specify the last sector of the partition on the disk. If you want to use up all available space after the initial sector, just press Enter. You can also specify a specific size, such as +5G for a five gigabyte partition or +512M for a 512 megabyte partition. If you don’t specify a unit after the + sign, fdisk uses sectors as the unit. For example, +10000 results in the end of the partition being 10000 sectors after its beginning.

Writing Changes

Use w to write the changes you’ve made to disk.
Use q if you want to quit without saving changes.

Formatting a Partition

You must format new partitions with a file system before you can use them. You can do this with the appropriate mkfs command. For example, this command formats the fifth partition on the first disk with the ext4 file system.
mkfs.ext4 /dev/sdb1

To Mount 

create new directory 

# mkdir /u01

mount /dev/sdb /u01


To Auto mount everytime system reboots

# vi /etc/fstab

add below lines just change the values with your machine values


/dev/sdb1           /u01                 ext3    defaults        1 2
/dev/sdb2           /u02                 ext3    defaults        1 2

To check which format 


 file -sL /dev/sdb1




for Swap https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/3/html/System_Administration_Guide/s1-swap-adding.html
http://computernetworkingnotes.com/file-system-administration/how-to-create-swap-partition.html

Thursday 26 March 2015

Create new User with same responsibilities as an existing user

Find responsibilities attached to a user


SELECT frt.RESPONSIBILITY_NAME, furg.end_date
FROM
fnd_user_resp_groups furg,
FND_RESPONSIBILITY fr,fnd_responsibility_tl frt,fnd_user fu
WHERE fu.user_name = '&&username'
AND   fu.user_id = furg.user_id
AND   furg.responsibility_id = fr.RESPONSIBILITY_ID
AND   frt.responsibility_id = fr.RESPONSIBILITY_ID
ORDER BY 1;

SIMPLEST WAY TO Create application users with same responsibilties  across instances

Downloading Application User Responsibilities

FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afscursp.lct XX_FND_USER_PASSI.ldt FND_USER USER_NAME='DC128877'

Uploading Application user Responsibilites in another instance

FNDLOAD apps/torpedor12 0 Y UPLOAD $FND_TOP/patch/115/import/afscursp.lct XX_FND_USER_PASSI.ldt

Create another Application user with same Responsibilities as the existing application user.

FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afscursp.lct XX_FND_USER_PASSI.ldt FND_USER USER_NAME='DC128877'

Uploading Application user Responsibilites to another Applicatioon user in same instance

do vi *.ldt file
Change username to new username
vi XX_FND_USER_PASSI.ldt

In this ldt file change USER_NAME to new user - then upload the ldt file

FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/afscursp.lct XX_FND_USER_PASSI.ldt

Note : If Application user does not exists it will create it and if it exists it will add the responsibilities its missing.

Tuesday 24 March 2015

Displays a list of tablespaces and their used/full status.

SET PAGESIZE 140
COLUMN used_pct FORMAT A11
SELECT tablespace_name,
       size_mb,
       free_mb,
       max_size_mb,
       max_free_mb,
       TRUNC((max_free_mb/max_size_mb) * 100) AS free_pct,
       RPAD(' '|| RPAD('X',ROUND((max_size_mb-max_free_mb)/max_size_mb*10,0), 'X'),11,'-') AS used_pct
FROM   (
        SELECT a.tablespace_name,
               b.size_mb,
               a.free_mb,
               b.max_size_mb,
               a.free_mb + (b.max_size_mb - b.size_mb) AS max_free_mb
        FROM   (SELECT tablespace_name,
                       TRUNC(SUM(bytes)/1024/1024) AS free_mb
                FROM   dba_free_space
                GROUP BY tablespace_name) a,
               (SELECT tablespace_name,
                       TRUNC(SUM(bytes)/1024/1024) AS size_mb,
                       TRUNC(SUM(GREATEST(bytes,maxbytes))/1024/1024) AS max_size_mb
                FROM   dba_data_files
                GROUP BY tablespace_name) b
        WHERE  a.tablespace_name = b.tablespace_name
       )
ORDER BY tablespace_name;

SET PAGESIZE 14

Monday 23 March 2015

find all the users with Sysadmin Responsibility

SELECT fu.*
FROM fnd_user_resp_groups_direct furgd, fnd_responsibility_vl frvl, fnd_user fu
WHERE furgd.responsibility_id = frvl.responsibility_id
AND fu.user_id = furgd.user_id
AND(to_char(furgd.end_date) is null
OR furgd.end_date > sysdate)
AND frvl.end_date is null
AND frvl.responsibility_name = 'System Administrator'; 

Wednesday 18 March 2015

Oracle apps R12 Resposibilities Undefined error

This short post is about how to fix the undefined issues in Oracle Application . Many times when we install the Java for Oracle EBS , name of all of the responsibilities change to undefined.

As shown below to fix this issue just click on Compatibility View . System will prompt you to login again and once you login  you can see correct responsibility Name.



Can not login to Applications : oracle.apps.fnd.framework.OAException: Could not load application module 'oracle.apps.fnd.sso.login.server.MainLoginPageAM'.

No user able to connect: 


oracle.apps.fnd.framework.OAException: Could not load application module
'oracle.apps.fnd.sso.login.server.MainLoginPageAM'.


## Detail 0 ##

oracle.apps.fnd.framework.OAException: Application: FND, Message Name:
FND_NO_TRANSACTION_ID.


===========CAUSE =============


One of the Tablespace is full 

=======SOLUTION =================

Increase the tablespace and retry ....

Ref: 737960.1
        

Monday 16 March 2015

View the Text of the triggers

SQL> set long 100000

SQL> select DESCRIPTION, TRIGGER_BODY from user_triggers where trigger_name = '<YOUR TRIGGER>';

<YOUR TRIGGER> must be uppercase.

Saturday 14 March 2015

OTM 6.3 Linux Installation Guide

Introduction

This page will guide you step by step in creating an OTM test environment, from creating a virtual machine to having database, application server, web server and OTM up and running. The process is largely the same for OEL, CentOS and (presumably) RedHat. I've succesfully installed OTM on CentOS and OEL, but not on RedHat. In theory it should work just fine.
This do not apply for production instances, it is solely for a single server test environment, for experimenting and studying purposes.
Just so you have an idea of what kind of hardware you will need to run an OTM virtual machine, this guide was made using a Dell Inspiron 15R SE laptop, which has 8GB of RAM, a Core i5 CPU and Windows 8 64 bit operating system, and the VM runs quite well with as little as 4GB of RAM and 4 CPU cores assigned to it.
The entire process has been captured and is available on Youtube. There will be links to video at the end of each section, and you can see all of them here:
Note: I try to be as economic as possible with resources, specially RAM. If you have more RAM available to you, feel free to increase or use default values when installing everything.


Recommended hardware on your host machine:

At least 6GB of RAM
Core 2 Duo x64 or better
At least 80 GB of free disk space (the virtual machine will be approximately 50 GB in side after OTM is fully installed, but 80 is recommended in the manuals)


Software required:

1. Virtualization software VirtualBox or VMware Player (this guide will use VirtualBox, but both are free and function very similarly). Get it from: https://www.virtualbox.org/wiki/Downloads orhttp://www.vmware.com/go/downloadplayer/
2. Oracle Linux 6.4 (https://edelivery.oracle.com/linux), Red Hat Enterprise Linux 6.4 (http://www.redhat.com/) or CentOS 6.4 (http://www.centos.org/).
3. Oracle Database 11g Release 2 (11.2.0.1.0) for Microsoft Windows x64 (64-bit) from: https://edelivery.oracle.com
4. Jrockit for Windows x64 (Java JDK and JRE installer) from: http://www.oracle.com/technetwork/middleware/jrockit/downloads/index.html
5. Oracle WebLogic Server 11gR1 (10.3.6) Generic and Coherence from https://edelivery.oracle.com
6. Oracle HTTP Server (Oracle WebTier Utilities 11g Installations 11.1.1.7 64bit for Windows) from: http://www.oracle.com/technetwork/java/webtier/downloads/index2-303202.html
7. Oracle Transportation Management 6.3.1 for Microsoft Windows x64 (64-bit) from https://edelivery.oracle.com

I also recommend installing a text editor to open log files and edit configuration files. Notepad++ is free and performs very well, available here: http://notepad-plus-plus.org/download/

Image 1 - Downloading from eDelivery: [1]

Useful Linux ccommands

Here are some useful commands you may need to use during this installation:
   ls -a                                      ### list hidden files
   rm -rf /example/dir                        ### remove directory without confirmation
   rpm -qa | grep '<<PART OF PACKAGE NAME>>'  ### verify if you have a package installed
   yum list example\*                         ### search for packages whose name starts with example
   yum install <<PACKAGE NAME>>               ### install package
   sudo sh                                    ### runs sh, which is a program that elevates you to root level (user needs to be on sudoers file first)
   find / -type f -iname "*example*"          ### Search the entire file system for a file that contains example in its name


Installing VirtualBox on your host machine

1. Run the installer you downloaded, and when prompted to select which features you want to install, remove VirtualBox USB Support, VirtualBox Networking and VirtualBox Python 2.x Support. Other than that, you can just click next or finish.

Image 2 - VirtualBox installation [2]


Creating a Virtual Machine


1. Start VirtualBox.
2. Click the "New" button.
3. Enter the name of your VM. Fill name with OTM-Server-OEL64 or something else you'd like and VirtualBox wil detect that its type is Linux and version is Oracle/Red Hat (64 bit). If it doesn't, make sure you do it yourself and click Next.
4. Assign 4096 MB to your VM and click Next.
5. Choose Create a virtual drive now and click Create.
6. Choose VDI as your hard drive type and click Next.
7. Choose Dynamically allocated and click Next.
8. Leave the name of the disk as suggested, change the size to 80,00 GB and click Create. You can change the location of the virtual hard drive if you want to.
9. Right click on your newly created VM and choose Settings....
10. On the General panel, click on the Advanced tab and change Shared Clipboard to Bidirectional.
11. On the System panel, click on the Processor tab and increase the number of Processor(s). In my case I use 4 (half of my CPU cores). Adjust according to your machine.
11. On the Display panel, mark the checkbox Enable 3D acceleration. You can also increase Video Memory depending on what you have available.
12. On the Storage panel, click on Empy under Controller IDE, then click the disk icon next to CD/DVD Drive, then click Choose a virtual CD/DVD disk... and navigate to the location of your CentOS/OEL/Red Hat installation disk image, then click Open.
13. On the Shared Folders panel, click the + icon, and fill "Folder Path" with the drive or directory in your machine that you want to be accessible inside the VM (you'll get the installation files from here later on). Name it "HOST_SHARE".
14. Click OK to finish the configuration of your virtual machine.


Installing CentOS/OEL/RHEL


1. Double click your newly created VM to start it.
2. Select Install or updrage an existing system and hit Enter.
3. Choose Skip and hit Enter.
4. Click Next on the welcome screen.
5. Select English and click Next.
6. Select the keyboard layout that matches your system and click Next.
7. Select Basic Storage and click Next.
8. Click the Yes, discard any data button.
9. Enter OTM-SERVER as hostname and click Next.
10. Select the closest city to you to define the correct time zone, and click Next.
11. Enter otm63! twice to confirm root user password, and click Next (then click Use Anyway).
12. Select Use all space and click Next, then Write changes to disk to confirm.
13. Select Desktop as your choice of software set and click Next.
14. When CentOS/OEL/Red Hat finishes installation, click Reboot.
15. After the reboot, click Forward.
16. Select Yes, I agree... and click Forward.
17. Now it's time to select a username. I use student for username, full name and password, but It doesn't really matter. You could use your name if you want, but please notice that some commands later on will have to be adjusted if you choose differently (because of directory names). Click Forward and Yes to confirm that you want to use a weak password.
18. On date and time screen, click Forward.
19. Uncheck Enable kdump? and click Finish, then Yes and OK to reboot (kdump is selected by default on CentOS, but not on OEL).


Configuring Linux - Adding "student" user to sudoers


1. Now this might be weird for someone who has never used Linux or Unix, because we'll have to edit a text file using vi (visudo to be precise), so I'll try to be as descriptive as possible. Open a terminal window ( Applications --> System tools --> Terminal) and run the following commands:
   su
   <enter root password, which is otm63!>
   visudo  
2. Now, using the arrow keys navigate the document until you find a line that looks like this:
   root   ALL=(ALL)       ALL
3. Use your mouse to select this line and press CTRL+SHIFT+C to copy it.
4. Using arrow keys, position the cursor on the empty line just below the one we copied.
5. Press "i" to enable insert mode, and then CTRL+SHIFT+V to paste the text, and then press ESC to disable insert mode.
6. Using arrow keys, position the cursor on the first character of the line we just pasted, press "i" and write "student", then press ESC.
7. Now the line begins with "studentroot". Using arrow keys, position the cursor on the "r" immediately after "student" and type x four times. This will delete root and you'll end up with "student ALL=(ALL) ALL".
8. Type ":wq" and hit enter to save file and exit visudo.
9. Enter the command bellow to show the contents of the sudoers file on screen and confirm the changes have been applied:
   cat /etc/sudoers

Configuring Linux - Disabling firewall


1. Disable firewall by clicking on System --> Administration --> Firewall and then the "Disable" button.
2. Then open a terminal and run the following commands:
   sudo sh
   <enter student password, if required (it is student)>
   chkconfig iptables off
   chkconfig ip6tables off

Configuring Linux - Installing VirtualBox's Guest Additions


1. On the VirtualBox menu of your running VM, click Devices and "Install guest additions...". This will cause a CD to be mounted inside your VM. When autorun asks if you want to execute it, click Cancel.
2. If you haven't done it already, enable internet connection by clicking the network icon on the top right (select eth0 to enable your VM to user your host machine internet).
3. Open a terminal and execute the following commands to install the packages needed by guest additions. If you get a lock error, you can use kill <PROCESS NUMBER> to release the lock on yum.
   sudo sh 
   yum install kernel-uek-devel-2.6.39-400.17.1.el6uek.x86_64
   yum install gcc.x86_64
5. Execute the following commands to create an environment variable needed by guest additions installer:
   KERN_DIR=/usr/src/kernels/`uname -r`
   export KERN_DIR
6. And finally, execute guest additions installer, and then reboot the virtual machine with the following commands:
   cd /media/VBOXADDITIONS*    
   ./VBoxLinuxAdditions.run
   reboot

Configuring Linux - Loopback adapter


1. This is actually quite easy. Open a command terminal and type:
   sudo sh
   gedit
2. This will open Gedit as root user, so we'll have write permission to the file we need to edit. Click the open button on Gedit and browse the file /etc/hosts
3. Include the following line at the bottom of the document:
   127.0.0.1 OTM-SERVER
4. Click the save button and close Gedit.


Copying setup files


1. Create a folder in your (student's) desktop called HOST_SHARE
2. Open a terminal and run the command below to mount the shared folder we configured earlier when creating the VM:
   sudo mount -t vboxsf HOST_SHARE /home/student/Desktop/HOST_SHARE
3. Double click the HOST_SHARE folder in your VM's desktop, and you should be able to see the contents on the folder you made available on your host machine. Browse it and find the setup files listed below, and copy them to your VM's desktop. Here's a list of the versions I have, it might be slightly different depending on when you downloaded them.
   V17530-01_1of2.zip (Database)
   V17530-01_2of2.zip (Database)
   jrockit-jdk1.6.0_45-R28.2.7-4.1.0-linux-x64.bin
   V29856-01.zip (Weblogic)
   ofm_webtier_linux_11.1.1.7.0_64_disk1_1of1.zip (OHS)
   V35724-01.zip (OTM)
4. Now, let's move them to a place where they can be more easily accessible to other users. Open a terminal and execute the following commands (they may need some adjustments if you have newer versions of the installers):
   sudo sh
   mkdir /setup-files
   mkdir /setup-files/1-DB
   mv /home/student/Desktop/V17530-01_1of2.zip /setup-files/1-DB
   mkdir /setup-files/2-JAVA
   mv /home/student/Desktop/jrockit-jdk1.6.0_45-R28.2.7-4.1.0-linux-x64.bin /setup-files/2-JAVA
   mkdir /setup-files/3-WL
   mv /home/student/Desktop/V29856-01.zip /setup-files/3-WL
   mkdir /setup-files/4-OHS
   mv /home/student/Desktop/ofm_webtier_linux_11.1.1.7.0_64_disk1_1of1.zip /setup-files/4-OHS
   mkdir /setup-files/5-OTM
   mv /home/student/Desktop/V35724-01.zip /setup-files/5-OTM


Oracle Database pre-installation tasks


1. First, install the necessary packages by running the commands below (note: I listed everything that's on the manual for the sake of completion and future-proofing this guide in case something changes, so lines commented are things we already have on our OEL/CentOS/RHEL 6.4 but may not be there on later versions):
   sudo sh #to login as root
   ### We already have: binutils-2.15.92.0.2
   yum install compat-libstdc++-33.x86_64    ###compat-libstdc++-33-3.2.3
   yum install compat-libstdc++-33.i686      ###compat-libstdc++-33-3.2.3 (32 bit)
   ### We already have: elfutils-libelf-0.97
   yum install elfutils-libelf-devel.x86_64  ###elfutils-libelf-devel-0.97
   ### We already have: expat-1.95.7
   ### We already have: gcc-3.4.6
   yum install gcc-c++.x86_64                ###gcc-c++-3.4.6
   ### We already have: glibc-2.3.4-2.41
   ### We already have: glibc-2.3.4-2.41 (32 bit)
   ### We already have: glibc-common-2.3.4
   ### We already have: glibc-devel-2.3.4
   ### We already have: glibc-headers-2.3.4
   ### We already have: libaio-0.3.105
   yum install libaio.i686                   ###libaio-0.3.105 (32 bit)
   yum install libaio-devel.x86_64           ###libaio-devel-0.3.105
   yum install libaio-devel.i686             ###libaio-devel-0.3.105 (32 bit)
   ### We already have: libgcc-3.4.6
   ### We already have: libgcc-3.4.6 (32-bit)
   ### We already have: libstdc++-3.4.6
   yum install libstdc++.i686                ###libstdc++-3.4.6 (32 bit)
   ### We already have: libstdc++-devel 3.4.6
   ### We already have: make-3.80
   ### We already have: numactl-0.6.4.x86_64
   ### We don't need: pdksh-5.2.14
   ### We already have: sysstat-5.0.5
2. Now, let's adjust /etc/sysctl.conf file, as per instructions on Oracle DB manuals. First login as root and open Gedit by running this commands on a terminal:
   sudo sh
   gedit
3. Click the open button and browse for the file /etc/sysctl.conf, then add a # character at the start of lines 37 (kernel.shmmax) and 40 (kernel.shmall). It will end up looking like this:
   # Controls the maximum shared segment size, in bytes
   #kernel.shmmax = 68719476736
   # Controls the maximum number of shared memory segments, in pages
   #kernel.shmall = 4294967296
4. Now copy the lines below and paste at the end of sysctl.conf, then save and close it.
   # Oracle DB 11g parameters
   fs.aio-max-nr = 1048576
   fs.file-max = 6815744
   kernel.shmall = 2097152
   kernel.shmmax = 536870912
   kernel.shmmni = 4096
   kernel.sem = 250 32000 100 128
   net.ipv4.ip_local_port_range = 9000 65500
   net.core.rmem_default = 262144
   net.core.rmem_max = 4194304
   net.core.wmem_default = 262144
   net.core.wmem_max = 1048576
5. As root at a terminal, run the commands below:
   /sbin/sysctl -p
   /sbin/sysctl -a
6. Open gedit as root, the same process as before, and open /etc/security/limits.conf then add the lines
   # Oracle DB 11g parameters
   oracle           soft    nproc   2047
   oracle           hard    nproc   16384
   oracle           soft    nofile  1024
   oracle           hard    nofile  65536
   oracle           soft    stack   10240
   oracle           hard    stack   32768
7. Run the commands below as root to create oinstall and dba groups, oracle user, and also set oracle's password (use oracle as password):
   /usr/sbin/groupadd oinstall
   /usr/sbin/groupadd dba
   /usr/sbin/useradd -g oinstall -G dba oracle
   passwd oracle
8. Now let's create the database installation directory and give ownership to oracle user. Also let's give the setup files to oracle. Run those as root:
   mkdir -p /u01/app/
   chown -R oracle:oinstall /u01/app/
   chmod -R 775 /u01/app/
   chown -R oracle:oinstall /setup-files/
   chmod -R 775 /setup-files/
9. Unzip the database installation media by running:
   cd /setup-files/1-DB/
   unzip V17530-01_1of2.zip 
   unzip V17530-01_2of2.zip
10. Last thing before we run the installer is to fix an installation file (Oracle article [ID 1454982.1]). First make a backup of this file:
   cd /setup-files/1-DB/database/stage/cvu/cv/admin/
   cp cvu_config backup_cvu_config
11. Now, open /setup-files/1-DB/database/stage/cvu/cv/admin/cvu_config on gedit as root and change on the line where it says CV_ASSUME_DISTID=OEL4 change to CV_ASSUME_DISTID=OEL6. Save and close it.


Installing Oracle Database


1. Run the following to start the installer
   sudo sh                    ### to login as root
   xhost +SI:localuser:oracle ### to enable oracle to open windows from terminal
   su oracle                  ### to login as oracle
   cd /setup-files/1-DB/database/
   ./runInstaller

4. Uncheck I wish to receive security updates... and click Next then Yes.
5. Select Install database software only and click Next.
6. Select Single instance database installation and click Next.
7. Leave the default language settings (English) and click Next.
8. Select Enterprise Edition and click Next.
9. Accept the default values for Oracle Base (/u01/app/oracle) and Software Location (/u01/app/oracle/product/11.2.0/dbhome_1) and click Next.
10. Accept the default values for Inventory Directory (/u01/app/oraInventory) and oraInventory Group Name (oinstall) and click Next.
11. Accept the default values for OSDBA (dba)and OSPER (oinstall) groups and click Next.
12. On CentOS, after prerequisite checks are done, you should see a few packages reported missing (we have them, but newer versions), check "Ignore All" and click Next, then Finish. This will not happen on OEL.
13. When installer is nearly done, it will ask you to run some scripts as root. Do so by opening a terminal an running:
   sudo sh
   cd /u01/app/oraInventory/
   ./orainstRoot.sh 
   cd /u01/app/oracle/product/11.2.0/dbhome_1/
   ./root.sh    ### this script will ask for a directory, type in /usr/local/bin
14. Now, go back to installer and click OK then Close to finish database installation.
15. Open gedit as root then open /home/oracle/.bashrc and /home/oracle/.bash_profile, and add the lines below to both of them, then save and close
   # Oracle setup
   umask 022
   export ORACLE_SID=OTMDB
   export ORACLE_BASE=/u01/app/oracle
   export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
   export PATH=$ORACLE_HOME/bin:$PATH
   export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PA

Creating Database Listener


1. Open a terminal and login as root (sudo sh)
2. Run the xhost command below
   xhost +SI:localuser:oracle
3. Login as oracle then change directory to $ORACLE_HOME/bin, and execute NetCA
   su oracle
   cd $ORACLE_HOME/bin
   ./netca
4. On NetCA welcome screen, choose Listener Configuration and click Next.
5. Select Add and click Next.
6. Accept the suggested listener name LISTENER and click Next.
7. Leave protocols as default and click Next.
8. Select Use the standard port number of 1521 and click Next.
9. Select No when asked if you want to configure another listener, and click Next.
10. Click Next and Finish to exit NetCA.


Creating database instance


1. Open a terminal and login as root (sudo sh)
2. Run the xhost command below:
   xhost +SI:localuser:oracle
3. Login as oracle then change directory to $ORACLE_HOME/bin, and execute DBCA:
   su oracle
   cd $ORACLE_HOME/bin
   ./dbca
4. Click Next on DBCA welcome screen.
5. Select Create a Database and click Next.
6. Select Custom Database and click Next.
7. Fill Global Database Name with OTMDB (SID should get the same value automatically) and click Next.
8. On the next screen (Step 4 of 12: Management Options), leave everything as it is and click Next.
9. Click Use the Same Administrative Password for All Accounts, then enter twice the password otm63 , click Next and Yes.
10. On the next screen (Step 6 of 12: Database File Locations), leave everything as it is and click Next.
11. Again (Step 7 of 12: Recovery Configuration), leave everything as it is and click Next.
12. On the Database Components screen, uncheck Oracle Warehouse Builder and click Next.
13. Change Memory Size (SGA and PGA) from the default value to 1536 (if you have plenty of RAM you can increase this value).
14. Click on the Sizing tab, and change Processes to 300.
15. Click on the Character Sets tab, then click on Use Unicode (AL32UTF8).
16. Click on the All Initialization Parameters button on the bottom of the screen, then click Show Advanced Parameters.
17. Change the value of the following parameters:
  DB_16K_CACHE_SIZE: 104857600
  JOB_QUEUE_PROCESS: 4
  OPEN_CURSORS: 3000   
  OPTIMIZER_INDEX_CACHING: 50
  OPTIMIZER_INDEX_COST_ADJ: 50
  OPTIMIZER_MODE: CHOOSE
  PGA_AGGREGATE_TARGET: 193273528 (please note that this value is related to memory assigned to DB instance, adjust accordingly if you use more or less RAM)
  PROCESSES 300
  QUERY_REWRITE_INTEGRITY: TRUSTED
  SESSION_CACHED_CURSORS: 100
  STATISTICS_LEVEL: ALL
16. Click Close, Then Next, and on the next screen click Next again, then mark the checkbox Generate Database Creation Scripts and click Finish.
17. On the confirmation screen, you can review all your configurations and click OK. Click OK again after DB generation script has been created.
18. After database is created (this could take a while!) click the Exit button.
19. Test your instance by opening Firefox and accessing https://localhost:1158/em. If you can't access Enterprise Manager due to a security error, update Firefox (run "yum update firefox" as root). After the update, Firefox will allow you to click on I understand the risks and then add a security exception that will make EM accessible. Login using user system and password otm63. Please note that EM is not started automatically upon reboot. From now on, after a restart you'll need to run emctl start dbconsole to start EM, when needed.


Installing JRockit


1. Open a terminal and login as root (sudo sh)
2. Run the xhost command below
   xhost +SI:localuser:oracle
3. Login as oracle then change directory to /setup-files/2-JAVA, and execute JRockit installer:
   su oracle
   cd /setup-files/2-JAVA
   ./jrockit-jdk1.6.0_45-R28.2.7-4.1.0-linux-x64.bin
4. Click Next to accept the default installation directory, /home/oracle/jrockit-jdk1.6.0_45-R28.2.7-4.1.0.
5. At the Optional Components screen, leave everything unchecked and click Next.
6. After install finishes, click Done to exit the installer.
7. Open Gedit as root or oracle and add the following line to both .bashrc and .bash_profile:
#Java setup
   export JAVA_HOME=/home/oracle/jrockit-jdk1.6.0_45-R28.2.7-4.1.0


Installing Weblogic


1. Open a terminal and login as root (sudo sh)
2. Run the xhost command below
   xhost +SI:localuser:oracle
3. Login as oracle then change directory to /setup-files/3-WL, unzip and start Weblogic installer:
   su oracle
   cd /setup-files/3-WL
unzip V29856-01.zip java -jar wls1036_generic.jar
4. On the welcome screen, click Next.
5. Change the Middleware Home Directory to /home/oracle/Middleware and click Next.
6. Uncheck I wish to receive security updates... and click Next, then Yes, Yes, then check I wish to remain uninformed... and click Continue.
7. Select Custom and click Next.
8. Review products and components (don't need to change anything here) and click Next.
9. On JDK selection screen, click browse then select your JDK directory (/home/oracle/jrockit-jdk1.6.0_45-R28.2.7-4.1.0) and click Select, deselect the default Open JDK, and then hit Next button.
10. Accept the default installation directories and click Next.
11. At installation summary screen, click next.
12. After Weblogic installer is done, uncheck Run Quickstart and click Done.


Installing Oracle HTTP Server


1. Open a terminal and login as root (sudo sh)
2. Run the xhost command below
   xhost +SI:localuser:oracle
3. Login as oracle then change directory to /setup-files/4-OHS, and execute OHS installer:
   su oracle
   cd /setup-files/4-OHS
   unzip ofm_webtier_linux_11.1.1.7.0_64_disk1_1of1.zip
   cd Disk1
   ./runInstaller
4. On the welcome screen, click Next.
5. Select Skip Software Updates and click Next.
6. Select Install and Configure and click Next.
7. Now the prerequisite check will run, and if you are running the same versions I am it will fail the OS packages check because of compat-libcap1.x86_64. Check the log on the bottom of the installer's screen to confirm, and, if you need to, open a new terminal window, login as root and execute yum install compat-libcap1.x86_64. After this, click back and next to force the check to run again, and if it is successful, click Next.
8. Accept the default values for Oracle Middleware Home (/home/oracle/Middleware) and Oracle Home Directory (Oracle_WT1) and click Next.
9. Uncheck I wish to receive security updates... and click Next then Yes.
10. On the Configure Components screen, uncheck Oracle Web Cache and Associate Selected Components with Weblogic Domain and, with only Oracle HTTP Server checked, click Next.
11. Accept the default values for instance home, instance location and OSH component name and click Next.
12. Select Auto Port Configuration and click Next.
13. On the installation summary screen, click Install.
14. After configuration tools are 100% done, click Next, then Finish.


Installing OTM


1. Log in as root using sudo sh.
2. Enable oracle user to open window from command line by running xhoxt +SI:localuser:oracle.
3. Log in as oracle by running su oracle.
4. Cahnge directories, unzip OTM installation media and start OTM installer:
   cd /setup-files/5-OTM
   unzip V35724-01.zip
   ./otmv630_linux.bin
5. Enter /home/oracle/otm for install folder and click Next.
6. Select Next again.
7. On the next screen, enter the following information and click Next:
  Web Server External FQDN: OTM-SERVER
  Web Server External Port: 7777
  Web Server FQDN: OTM-SERVER
  Web Server Port: 7777
  App Server FQDN: OTM-SERVER
  
8. On the next screen, enter the following information and click Next:
  App Server Port: 7001
  DB Server FQDN: 127.0.0.1
  DB Port: 1521
  DB Connect String: otmdb
  DB Service Name: otmdb
  
7. On the next screen, enter the following information and click Next:
  ORACLE_HOME for DB client: /u01/app/oracle/product/11.2.0/dbhome_1
  URL Prefix: /
  SMTP Server FQDN: mail.company.com
  Default Reply-To Email Address: OtmAdvisor@company.com
  
8. On the next screen, enter the following information and click Next:
  WebLogic BEA Home Path: /home/oracle/Middleware
  
9. On the next screen, enter the following information and click Next:
  App Server IP Address: 127.0.0.1
  App Server Path: /home/oracle/Middleware/wlserver_10.3
  App Server Memory: 1536
  App SSL Port: 7002
  App Launcher Port: 32001
  
10. On the next screen, enter the following information and click Next:
  Web Server IP Address: 127.0.0.1
  Web Server SSL Port: 443
  Tomcat Port: 8009
  Tomcat Shutdown Port: 8007
  OHS WebLogic Home Path: .../Oracle_WT1
  
11. On the next screen, enter the following information and click Next:
  Tomcat Memory (MB): 1536
  OHS Server Path: /home/oracle/Middleware/wlserver_10.3
  OHS Instance Home: ./home/oracle/Middleware/Oracle_WT1/instances/instance1
  OHS Component Name: ohs1
  Web Launcher Port: 32000
12. Enter CHANGEME as the WebLogic System Password and click Next.
13. Enter CHANGEME as the App-to-Web Authentication Password and click Next.
14. Enter GLOGDBA as the GLOGDBA Password and click Next.
15. Enter GLOGLOAD as the GLOGLOAD Password and click Next.
16. Leave OTM User Name as is (oracle), but change OTM Group Name to oinstall, and click Next.
17. Leave OTM User Home as is (/home/oracle) and click Next.
18. Leave Would you like to migrate as No and click Next.
19. Don't select anything on Optional Components', just click Next.
20. Click Install to begin installation, and after it's done click Next, and after a while Next again, and Next one more time at the installation readme screen, then click done.
21. Unzip docs.zip and move its contents to /home/oracle/otm/docs folder by running the following commands as oracle:
   mkdir /home/oracle/otm/docs
   cp /setup-files/5-OTM/docs.zip /home/oracle/otm/docs
   cd /home/oracle/otm/docs
   unzip docs.zip
   rm docs.zip
22. We don't need any of the installers anymore, so delete them by running rm -rf /setup-files/ as root. This will free up a sizeable amount of disk space. Then reboot your virtual machine.


Post Installation OTM


1. Log in as oracle and start the database listener and the database instance by running the following commands:
   su oracle
   lsnrctl start
   sqlplus / as sysdba
   SQL> startup
2. Disconnect from the database and exit SQL*Plus (commands disconn and exit) then change directory to /home/oracle/otm/glog/oracle/script8 directory.
3. Run the SQL script to create tablespaces by running the following command and providing the answers below:
   sqlplus / as sysdba
   @create_gc3_tablespaces.sql
   Y
   <ENTER>
   <ENTER>
   y
   /u01/app/oracle/oradata/OTMDB/
   y
4. When tablespaces script is done, run the SQL script to create users by running the following command and providing the answers below:
   @create_glog_users.sql
   <ENTER>
   OTMDB
   <ENTER>
   otm63
   otm63
   ARCHIVE
   GLOGDBA
   GLOGOWNER
   GLOGLOAD
   REPORTOWNER
   GLOBALREPORTUSER
5. Before we continue, we need to install ksh to be be able to run the next script. So, disconnect from the database, log in as root and run yum install ksh
6. Log in as oracle and run the create_all.sh script by running the command below and providing the following answers
   ./create_all.sh
   <ENTER>
   OTMDB
   otm63
   <ENTER>
   otm63
   <ENTER>
   ARCHIVE
   GLOGOWNER
   REPORTOWNER
  
7. After create_all is done, connect to the database again, as GLOGOWNER this time, and run the reset_sequence procedure by running the following commands on the prompt:
  sqlplus GLOGLOWNER/GLOGOWNER@OTMDB
  set serverout on size 1000000
  EXECUTE domainman.reset_sequence;
8. Now we need to run one last script before using OTM. Run it as oracle user and provide the answers below:
   ./dbpatch_60.sh
   OTMDB
   GLOGOWNER
   REPORTOWNER
   ARCHIVE
   OTMDB
   GLOGOWNER
   <ENTER>
   otm63
   <ENTER>
   otm63


OTM Startup and first use


1. Assuming you restarted your virtual machine after the previous step, we need to do the following to start OTM
   ### Start DB Listener ###
   lsnrctl start
   ### Start DB instance ###
   sqlplus / as sysdba
   SQL> startup 
   ### Start Web ###
   cd /home/oracle/otm/install/ohs
   ./glogweb-wl start
   ### Start App ###
   cd /home/oracle/otm/install/weblogic
   ./glogapp-wl start
2. Next, make sure OTM server is ready. You can do this by checking Weblogic logs for OTM Event: ServerReady (use tail /home/oracle/otm/logs/weblogic/console.log.0 on a terminal), by monitoring memory and CPU usage, or you can simply keep trying until you stop getting servlet errors in the browser. Open Firefox and enter the following address: http://OTM-SERVER:7777
3. Use the following credentials to login:
  User: DBA.ADMIN
  Password: CHANGEME
4. Hopefully, it all worked well and now you have your OTM server ready for use. Congratulations!


Log and configuration files

Here are some of the most noteworthy log and configuration files locations inside your VM, in case you need them:
  /u01/app/oracle/admin/OTMDB/scripts/CreateDB.sql
  /home/oracle/otm/Oracle_OTM_v6.3_GA_InstallLog.log   /home/oracle/otm/glog/oracle/script8/create_all_OTMDB_<YYYYMMDDHHMM>.log
  /home/oracle/otm/glog/oracle/script8/create_gc3_tablespaces.log
  
  /home/oracle/otm/weblogic/weblogic.conf
  /home/oracle/otm/tomcat/bin/tomcat.conf   /home/oracle/Middleware/Oracle_WT1/instances/instance1/config/OHS/ohs1/httpd.conf
  
  /home/oracle/otm/logs/glog.exception.log
  /home/oracle/otm/logs/weblogic/console.log.0
  /home/oracle/otm/logs/tomcat/console.log.0