Monday, February 22, 2016

Create Database using DBCA in 11gr2


CREATE DATABASE USING DBCA
===========================================================
==============================
=================


Login as oracle user

[oracle@test ~]$ dbca
or
[oracle@test ~]$ cd /u01/app/oracle/product/11.2.0/db_1/bin
[oracle@test ~]$ ./dbca



















Add Harddisk in linux as mount point /u01 using Virtual Box

ADD HARD DISK IN LINUX USING VIRTUAL BOX
====================================================================
=======================================================
=============================== 











Login as ROOT user
===================================

[root@test ~]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/vg_test-lv_root  8.3G  5.1G  2.8G  65% /
tmpfs                        2.0G   76K  2.0G   1% /dev/shm
/dev/sda1                    477M   55M  397M  13% /boot
/dev/sdb1                    9.8G  3.7G  5.6G  40% /repo
[root@test ~]#
[root@test ~]#
[root@test ~]# fdisk -l

Disk /dev/sda: 12.9 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 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: 0x00095f55

   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        1567    12069888   8e  Linux LVM

Disk /dev/sdb: 10.8 GB, 10766991360 bytes
255 heads, 63 sectors/track, 1309 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: 0xc71cec29

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1309    10514511   83  Linux

Disk /dev/sdc: 12.9 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 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: 0x00000000


Disk /dev/mapper/vg_test-lv_root: 9122 MB, 9122611200 bytes
255 heads, 63 sectors/track, 1109 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: 0x00000000


Disk /dev/mapper/vg_test-lv_swap: 3145 MB, 3145728000 bytes
255 heads, 63 sectors/track, 382 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: 0x00000000

[root@test ~]#
[root@test ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x9595adae.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/sdc: 12.9 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 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: 0x9595adae

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1566, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1566, default 1566):
Using default value 1566

Command (m for help): p

Disk /dev/sdc: 12.9 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 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: 0x9595adae

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1        1566    12578863+  83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@test ~]#
[root@test ~]#
[root@test ~]# mkfs.ext4 /dev/sdc1
mke2fs 1.43-WIP (20-Jun-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
786432 inodes, 3144715 blocks
157235 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=3221225472
96 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

[root@test ~]#
[root@test ~]# cd /
[root@test /]# mkdir /u01
[root@test /]#
[root@test /]# mount -t ext4 /dev/sdc1 /u01
[root@test /]#
[root@test /]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/vg_test-lv_root  8.3G  5.1G  2.8G  65% /
tmpfs                        2.0G   76K  2.0G   1% /dev/shm
/dev/sda1                    477M   55M  397M  13% /boot
/dev/sdb1                    9.8G  3.7G  5.6G  40% /repo
/dev/sdc1                     12G   30M   12G   1% /u01
[root@test /]#
[root@test /]# vi /etc/fstab
[root@test /]#
[root@test /]# cat etc/fstab

#
# /etc/fstab
# Created by anaconda on Sun Feb 21 22:08:33 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_test-lv_root /                       ext4    defaults        1 1
UUID=2f39e521-c679-45a8-899b-3e4facdb6fd7 /boot                   ext4    defaults        1 2
/dev/mapper/vg_test-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/sdb1               /repo                   ext4    defaults        1 2
/dev/sdc1               /u01                    ext4    defaults        1 2
[root@test /]#





Oracle 11g Database Installation on Oracle Linux 6.5 64 bit

During Linux installation
=========================================================

Base System > Base
Base System > Client management tools
Base System > Compatibility libraries
Base System > Hardware monitoring utilities
Base System > Large Systems Performance
Base System > Network file system client
Base System > Performance Tools
Base System > Perl Support
Servers > Server Platform
Servers > System administration tools
Desktops > Desktop
Desktops > Desktop Platform
Desktops > Fonts
Desktops > General Purpose Desktop
Desktops > Graphical Administration Tools
Desktops > Input Methods
Desktops > X Window System
Applications > Internet Browser
Development > Additional Development
Development > Development Tools


=====================Check RAM =======================

[root@test ~]# grep MemTotal /proc/meminfo
MemTotal:        4048820 kB
[root@test ~]#
/*
 We need at least 1GB of physical RAM.
 In my case I have more than 1GB.
*/


=============Check SWAP space===============================

[root@test ~]#
[root@test ~]#  grep SwapTotal /proc/meminfo
SwapTotal:       3071996 kB
[root@test ~]#

/*
 RAM between 1GB and 2GB then Swap = 1.5 times the size of RAM
 RAM between 2GB and 16GB then Swap = equal to the size of RAM
 RAM more than 16GB then Swap Size = 16GB
 Since my RAM is near by 3GB, so I have 3GB of Swap Size.

*/


===================================Check resolution ======================
/*
 To install Oracle 11g Release 2 your system should be running
 on at least 1024x768 screen resolution.
*/

# xdpyinfo | grep 'dimensions:'
dimensions:    1024x760 pixels (271x203 millimeters)

====================Cehck TMP space=================================


[root@test ~]#
[root@test ~]# df -h /dev/shm/
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           2.0G   76K  2.0G   1% /dev/shm
[root@test ~]#

Resize tmp

 #mount -t tmpfs tmpfs -o size=1500m /dev/shm

exp

[root@test ~]# df -h /dev/shm/
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           2.0G   76K  2.0G   1% /dev/shm
[root@test ~]# mount -t tmpfs tmpfs -o size=2100m /dev/shm
[root@test ~]#
[root@test ~]# df -h /dev/shm/
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           2.1G     0  2.1G   0% /dev/shm
[root@test ~]#
[root@test ~]#

/*
  You need to have at least 1GB of space in the /tmp directory.
  Make sure you have 1GB in the column "Avail" in the above output.
  In my case I have 2.1G space available in /tmp.
*/


=================================Check package ==================================


cd /media/OL6.5 x86_64 Disc 1 20131125/Packages


rpm -Uvh binutils-2*x86_64*
rpm -Uvh compat-libcap1*x86_64*
rpm -Uvh compat-libcap1*i686*
rpm -Uvh compat-libstdc++-33*x86_64*
rpm -Uvh compat-libstdc++-33*i686*
rpm -Uvh elfutils-libelf-0*x86_64*
rpm -Uvh elfutils-libelf-devel-0*x86_64*
rpm -Uvh gcc-4*x86_64*
rpm -Uvh gcc-c++-4*x86_64*
rpm -Uvh glibc-2*x86_64* nss-softokn-freebl-3*x86_64*
rpm -Uvh glibc-2*i686* nss-softokn-freebl-3*i686*
rpm -Uvh glibc-common-2*x86_64*
rpm -Uvh glibc-devel-2*x86_64*
rpm -Uvh glibc-devel-2*i686*
rpm -Uvh glibc-headers-2*x86_64*
rpm -Uvh ksh-*x86_64*
rpm -Uvh libaio-0*x86_64*
rpm -Uvh libaio-0*i686*
rpm -Uvh libaio-devel-0*x86_64*
rpm -Uvh libaio-devel-0*i686*
rpm -Uvh libgcc-4*x86_64*
rpm -Uvh libgcc-4*i686*
rpm -Uvh libstdc++-4*x86_64*
rpm -Uvh libstdc++-4*i686*
rpm -Uvh libstdc++-devel-4*x86_64*
rpm -Uvh libstdc++-devel-4*i686*
rpm -Uvh make-3*x86_64*
rpm -Uvh numactl-devel-2*x86_64*
rpm -Uvh sysstat-9*x86_64*
rpm -Uvh unixODBC-2*x86_64*
rpm -Uvh unixODBC-2*i686*
rpm -Uvh unixODBC-devel-2*x86_64*
rpm -Uvh elfutils-libelf-0*i686* elfutils-libelf-devel-0*i686*
rpm -Uvh libtool-ltdl*i686*
rpm -Uvh ncurses*i686*
rpm -Uvh readline*i686*


/* check all the rpm from os disk*/



=======================Make entry Kernal parameter to Support Oracle======================


Open /etc/sysctl.conf and add the following lines:

net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 2147483648
kernel.shmall = 2097152
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 1048576
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

Note: You may find the parameters mentioned above already present in the /etc/sysctl.conf file.
If they have a value lower then mentioned above then make sure you change it,
but if they have a larger value then perhaps its safe to leave it as is.

============================To make effect kernal parameters======================


-- Make the kernel parameters changes effective immediately:


[root@test ~]# /sbin/sysctl -p



========================= Set the shell limits for the user Oracle=========================

Open /etc/security/limits.conf and add these lines.

vi /etc/security/limits.conf

oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  4096
oracle              hard    nofile  65536
oracle              soft    stack   10240

save with
:wq!

Where "nproc" is the maximum number of processes available to the user and "nofiles" is the number of open file descriptors.





=======================Setup User and groups that we will use as Oracle owner and the groups that it will need for installing and managing Oracle=======================


/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/groupadd oper
/usr/sbin/useradd -g oinstall -G dba,oper oracle
/usr/bin/passwd oracle

====================Create directories where the Oracle Software and database will be installed.========================

[root@test mail]# mkdir -p /u01/app/oracle/product/11.2.0/db_1
[root@test mail]# chown -R oracle:oinstall /u01
[root@test mail]# chmod -R 0775 /u01
[root@test mail]#

/*
 The above directory structure is designed to comply with OFA
 (Oracle Flexible Architecture) i.e. a directory structure to
 support multiple oracle software installations.

 ORACLE_BASE=/u01/app/oracle
 -- Base directory for all oracle installations.
*/

===================================

Disable secure linux by editing the /etc/selinux/config file, making sure the SELINUX flag is set as follows:

SELINUX=disabled

/*
If you leave SELINUX=enforcing then you may get an error later while starting sqlplus:
sqlplus: error while loading shared libraries:
/usr/lib/oracle/default/client64/lib/libclntsh.so.11.1: cannot restore segment
prot after reloc: Permission denied

*/

============================================================

Open /etc/pam.d/login and add the following line if it is already not there.

session    required     pam_limits.so

/*
How does ulimit work?

When you login to the Linux machine, the "login" program reads the file /etc/pam.d/login. The following line has been included in this file:    
   
session required pam_limits.so

This line tells the "login" program to load the pam_limits.so module during login. In turn, the pam_limits.so module is configured to read the file /etc/security/limits.conf. Only the root user can edit this file. This file lists those users who can set the ulimit values.

For example, the following lines in /etc/security/limits.conf file


oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

*/

=================================================================


======================Set ENV=================

Now Login with oracle user (switch user)

ls -la
[oracle@test ~]$ ls -la
total 32
drwx------. 4 oracle oinstall 4096 Feb 22 02:06 .
drwxr-xr-x. 3 root   root     4096 Feb 22 02:06 ..
-rw-r--r--. 1 oracle oinstall   18 Jul 18  2013 .bash_logout
-rw-r--r--. 1 oracle oinstall  176 Jul 18  2013 .bash_profile
-rw-r--r--. 1 oracle oinstall  124 Jul 18  2013 .bashrc
drwxr-xr-x. 2 oracle oinstall 4096 Nov 20  2010 .gnome2
-rw-r--r--. 1 oracle oinstall  171 Nov 22  2013 .kshrc
drwxr-xr-x. 4 oracle oinstall 4096 Feb 21 22:09 .mozilla
[oracle@test ~]$
[oracle@test ~]$ vi .bash_profile
[oracle@test ~]$



ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
ORACLE_SID=TEST; export ORACLE_SID
PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
export CLASSPATH




================================================================================================================


The environment is ready for oracle installation. Its time to prepare the oracle installation media now.
Download or Copy the oracle media to the oracle user home directory i.e. /home/oracle.
Once Download/Copy is done unzip the media as follows:

[oracle@test software]$ pwd
/u01/software

[oracle@test database]$
[oracle@test database]$ ls -lrt
-rw-r--r--. 1 oracle oinstall 1111416131 Oct  1  2014 linux.x64_11gR2_database_2of2.zip
-rw-r--r--. 1 oracle oinstall 1239269270 Oct  1  2014 linux.x64_11gR2_database_1of2.zip
[oracle@test software]$

[oracle@test software]$ unzip  linux.x64_11gR2_database_1of2.zip
[oracle@test software]$ unzip  linux.x64_11gR2_database_2of2.zip
[oracle@test database]$
[oracle@test database]$ pwd
/u01/software/database

[oracle@test database]$
[oracle@test database]$ ls -lrt
total 36
-rwxr-xr-x.  1 oracle oinstall 3226 Aug 15  2009 runInstaller
drwxr-xr-x.  2 oracle oinstall 4096 Aug 15  2009 rpm
drwxr-xr-x.  4 oracle oinstall 4096 Aug 15  2009 install
drwxr-xr-x. 14 oracle oinstall 4096 Aug 15  2009 stage
drwxrwxr-x.  2 oracle oinstall 4096 Aug 15  2009 sshsetup
drwxrwxr-x.  2 oracle oinstall 4096 Aug 15  2009 response
drwxr-xr-x. 12 oracle oinstall 4096 Aug 17  2009 doc
-rw-r--r--.  1 oracle oinstall 5402 Aug 18  2009 welcome.html
[oracle@test database]$
[oracle@test database]$./runInstaller




[oracle@test admin]$
[oracle@test admin]$ pwd
/u01/software/database/stage/cvu/cv/admin
[oracle@test admin]$

CV_ASSUME_DISTID=OEL4
to
CV_ASSUME_DISTID=OEL6

======================================================
#if enabled, cvuqdisk rpm is required on all nodes
CV_RAW_CHECK_ENABLED=TRUE

# Fallback to this distribution id
CV_ASSUME_DISTID=OEL6




========================================Missing pdksh-5.2.14===============================

Missing pdksh-5.2.14 package during Oracle database 11.2.0.4 install on Oracle Linux 6 (Doc ID 1962046.1)

its Bug 19947777

Install ksh package then ignore the warring and proceed with installation

[root@test ~]# yum install ksh




===========================================Run from root user=============================================




[root@test ~]#
[root@test ~]# cd /u01/app/oraInventory/
[root@test oraInventory]# ls
ContentsXML  install.platform  logs  oraInstaller.properties  oraInst.loc  orainstRoot.sh  oui
[root@test oraInventory]#
[root@test oraInventory]#
[root@test oraInventory]# ./orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@test oraInventory]#
[root@test oraInventory]#
[root@test oraInventory]#



[root@test oraInventory]#
[root@test oraInventory]# cd /u01/app/oracle/product/11.2.0/db_1/
[root@test db_1]#
[root@test db_1]# pwd
/u01/app/oracle/product/11.2.0/db_1
[root@test db_1]#
[root@test db_1]# ls
apex         clone   cv           dv                   install           jdbc  log      oc4j    oracore      perl      root.sh       srvm             utl
assistants   config  dbs          emcli                install.platform  jdev  md       odbc    oraInst.loc  plsql     scheduler     sysman           wwg
bin          crs     dc_ocm       EMStagePatches_TEST  instantclient     jdk   mesg     olap    ord          precomp   slax          test_TEST        xdk
ccr          csmig   deinstall    has                  inventory         jlib  mgw      ons     oui          racg      sqldeveloper  timingframework
cdata        css     demo         hs                   j2ee              ldap  network  OPatch  owb          rdbms     sqlj          ucp
cfgtoollogs  ctx     diagnostics  ide                  javavm            lib   nls      opmn    owm          relnotes  sqlplus       uix
[root@test db_1]#
[root@test db_1]# ./root.sh
Running Oracle 11g root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/11.2.0/db_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...


Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
[root@test db_1]#
[root@test db_1]#


=============================================================

When configuration scripts are executed successfully by root press OK in the installer and you will see this "Finish" page.
Note down the management URL and press "Close".
































Missing pdksh-5.2.14 package during Oracle database installation prerequisite

=====================Missing pdksh-5.2.14===============================

Missing pdksh-5.2.14 package during Oracle database 11.2.0.4 install on Oracle Linux 6.5 (Doc ID 1962046.1)

its Bug 19947777

Install ksh package then ignore the waring and proceed with installation

[root@test ~]# yum install ksh



Missing pdksh-5.2.14 package during Oracle database install (Doc ID 1962046.1)