Saturday, 30 November 2013

Installation of Oracle-12C database


Create groups, user and directories

#groupadd -g 54321 oinstall
#groupadd -g 54322 dba
#groupadd -g 54323 oper
#useradd -u 54321 -g oinstall -G dba,oper oracle
#passwd xxxxxx

#mkdir -p /u01/app/oracle/product/12.1.0
#chown -R oracle:oinstall /u01
#chmod -R 775 /u01

Pre-Requisite check for 12CR1 installation

Installation of required RPMs:

  1. Automatic  Process
All necessary prerequisites will be performed automatically. It is probably worth doing a full update as well. The simple "yum update" command will set the oracle recommended values to sysctl.conf and limit.conf files.
# yum update

  1. Manual Process
Add the following lines to the "/etc/sysctl.conf" file.

kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.hostname = localhost.localdomain
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500

Add the following lines to the "/etc/security/limits.conf" file.

oracle   soft   nofile    1024
oracle   hard   nofile    65536
oracle   soft   nproc    2047
oracle   hard   nproc    16384
oracle   soft   stack    10240
oracle   hard   stack    32768

Install the following packages if they are not already present.
# From Public Yum or ULN

yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

Installation Of Database Software


ü  Unzipping of above Zip files will create a database directory under the software location folder.
ü  Make sure sufficient Temp size and Swap Memory is available.
ü  Execute the runInstaller file as an ORACLE user.

After executing the runInstaller, It will prompt for continue with the installation. Please proceed with option ‘Y’
continuing with the installation,

Continue? (y/n) [n] Y

Step 1: Configure Security updates

  • Dis-select the security update checkbox and click NEXT.

 Click yes and proceed to next step.

Step 2: Software Updates.
  • Select Skip Software Updates and proceed to next step.

Step 3: Installation Option

  • If you want to create the database along with the installation select the first option.
  • If you want to just install the database software alone, select the second option. 
  •  If you want to upgrade an existing database proceed with third option.

Click Next and proceed Further.

Step 4: System Class

  • Select server class and proceed to next step

Step 5: Grid Installation Options
  • Please select the option depends on your requirement and proceed further.

Step 6: Install Type

  • Select Typical Install and proceed to next step.

Step 7: Typical Installation

  • Fill the details and proceed further

Step 8: Create Inventory

  • Simply Click Next and Proceed


Step 9: Prerequisite Check

  • Please wait until completion of prerequisite check and click next.

Step 10:  Ignore the SWAP related warning and proceed further.

Step 11: Summary

  •  Before Installation of DB software, please go through all the option and click edit if you want to change any settings else click INSTALL button to proceed installation.

Step 12: Install Product

  • Run the files as a root user.

Installation of Database.

  • If you click on Password Management you will manage the default user accounts.  

Step 13 :  Install Product.

  • Installation of DB is complete by clicking the next.

Post Installation Configuration Steps.

Set the values in .bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0
export ORACLE_SID=odb12c

export PATH=/usr/sbin:$PATH

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

Listener Configuration:                 $ORACLE_HOME/network/admin/listener.ora
ODB12C =
      (ADDRESS = (PROTOCOL = TCP)(HOST = = 1521))

    (SID_DESC =
      (ORACLE_HOME= /u01/app/oracle/product/12.1.0)
      (SID_NAME = odb12c)

TNS Configuration:   $ORACLE_HOME/network/admin/tnsnames.ora

Working with 12c:

[oracle@odb12c ~]$ sqlplus / as sysdba
SQL*Plus: Release Production on Sun Jun 30 14:52:50 2013

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> select status from v$instance;


SQL> select name from v$database;


ü  User Creation
SQL> grant connect, resource to TEST identified by TEST;
grant connect, resource to TEST identified by TEST
ERROR at line 1:
ORA-65049: creation of local user or role is not allowed in CDB$ROOT

ü  Here is the syntax for user Creation
SQL> grant connect, resource to C##TEST identified by TEST container=all;

Grant succeeded.

ü  Query to check the DB Details.

 'DB_NAME: ' ||sys_context('userenv', 'db_name')||
 ' / CDB?: ' ||(select cdb from v$database)||
 ' / AUTH_ID: ' ||sys_context('userenv', 'authenticated_identity')||
 ' / USER: ' ||sys_context('userenv', 'current_user')||
 ' / CONTAINER: '||nvl(sys_Context('userenv', 'con_Name'), 'NON-CDB')


ü  Query to check the DB Details from v$PDBS

SQL> select NAME, CON_ID, DBID, OPEN_TIME, OPEN_MODE from v$pdbs;

NAME                     CON_ID       DBID OPEN_TIME                       OPEN_MODE
-------------------- ---------- ---------- ------------------------------- -------------------
PDB$SEED                      2 4062010165 30-JUN-13 AM       READ ONLY
PDB12C                        3  471577855 30-JUN-13 AM       READ WRITE

ü  Query to check the Datafile Details from cdb_data_files

col FILE_NAME for a80
select      con_id,
from  cdb_data_files
order by 1, 2;

---------- -------------------- -----------------------------------------------------------
         1 SYSAUX               /u01/app/oracle/oradata/odb12c/sysaux01.dbf
         1 SYSTEM               /u01/app/oracle/oradata/odb12c/system01.dbf
         1 UNDOTBS1             /u01/app/oracle/oradata/odb12c/undotbs01.dbf
         1 USERS                /u01/app/oracle/oradata/odb12c/users01.dbf
         2 SYSAUX               /u01/app/oracle/oradata/odb12c/pdbseed/sysaux01.dbf
         2 SYSTEM               /u01/app/oracle/oradata/odb12c/pdbseed/system01.dbf
         3 EXAMPLE              /u01/app/oracle/oradata/odb12c/pdb12c/example01.dbf
         3 SYSAUX               /u01/app/oracle/oradata/odb12c/pdb12c/sysaux01.dbf
         3 SYSTEM               /u01/app/oracle/oradata/odb12c/pdb12c/system01.dbf
         3 USERS                /u01/app/oracle/oradata/odb12c/pdb12c/SAMPLE_SCHEMA_users01.dbf

10 rows selected.

CON_ID 1: Normal Database
CON_ID 2: Container Database
CON_ID 3: Pluggable Database

ü  Here are some queries with new Data Dictionary Views.

SQL> SELECT pdb FROM dba_services;
SQL> SELECT sys_context('userenv','con_name') "MY_CONTAINER" FROM dual;
SQL> SHOW con_name
SQL> SELECT NAME, CON_ID FROM v$active_services ORDER BY 1;

No comments: