Tuesday, July 18, 2017

Oracle Database 12c Installation and Configuration

Oracle has release Oracle Database 12c and we are covering Oracle Database 12.2.1.0 for the installation and configuration in this post.  Below are software versions that we are using.

Virtualization: Oracle Virtual Box

Operating System: Oracle Enterprise Linux 6.9

Database: Oracle Database 12.2.1.0

We can us this post as initial step to turn into Oracle DBA.

1.       Oracle DBA Tasks: General Oracle DBA Tasks
a.       Install Oracle Database
b.      Create Oracle Database instances
c.       Upgrade Database to newer versions
d.      Start Oracle Database instance
e.       Shutdown Oracle Database instance
f.        Manage storage structures of Oracle Database
g.      Manage users and security
h.      Manage database objects – indexes, tables, views etc.
i.         Backup database
j.         Recover database
k.       Monitor the state of the database instance and performance
l.         Tune database
m.    Diagnose and Report critical errors

2.     Tools for administering oracle database
a.       Oracle universal installer – to install oracle database.
b.      Oracle Database Configuration Assistant (DBCA) – to create database from templates (oracle supplied or own templates)
c.       Database Upgrade Assistant (DBUA) – Upgrade Oracle Database to Newer Versions
d.      Net Configuration Assistant – Configure listeners and naming methods
e.       Oracle Enterprise Manager Database Express (EM Express) – Web based interface for managing the database
f.        SQL Developer – Supports Oracle Database developments

3.     Oracle Database Installation

a.       Pre-requisites: All these pre-requisites need to be done before starting the Oracle Database 12c installation.

                                                               i.      Display Cards resolution – 1024x768

                                                             ii.      RAM – 2 GB RAM
[root@fmwdb12c ~]# grep MemTotal /proc/meminfo
MemTotal:        8512592 kB
[root@fmwdb12c ~]#  grep SwapTotal /proc/meminfo
SwapTotal:       3145724 kB
[root@fmwdb12c ~]#  df -h /tmp
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_ohs12c-lv_root
                       26G  7.1G   18G  29% /
[root@fmwdb12c ~]# free
             total       used       free     shared    buffers     cached
Mem:       8512592    4865736    3646856       4076      29176    4287356
-/+ buffers/cache:     549204    7963388
Swap:      3145724          0    3145724
[root@fmwdb12c ~]# uname -m
x86_64
[root@fmwdb12c ~]# df -h /dev/shm
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           4.1G   84K  4.1G   1% /dev/shm

                                                            iii.      OS – OEL 6.4 to OEL 7.2
[oracle@fmwdb12c ~]$ cat /etc/oracle-release
Oracle Linux Server release 6.9

                                                           iv.      Install Oracle Pre-Installation RPM. This will install the required os libraries for Oracle Database installation.

1.        Login with root user
2.       Execute the below command and make sure that internet connection is available.
#yum install oracle-database-server-12cR2-preinstall

                                                             v.      Check ssh installed

[root@fmwdb12c ~]# rpm -qa | grep ssh
openssh-server-5.3p1-122.el6.x86_64
openssh-clients-5.3p1-122.el6.x86_64
openssh-5.3p1-122.el6.x86_64
openssh-askpass-5.3p1-122.el6.x86_64
libssh2-1.4.2-2.el6_7.1.x86_64
[root@fmwdb12c ~]#

                                                           vi.      Create Operating System Groups, Assign to user and create the installation directory

[root@fmwdb12c ~]# groupadd oper
[root@fmwdb12c ~]# groupadd dba
[root@fmwdb12c ~]# groupadd oinstall
[root@fmwdb12c ~]# usermod -g oinstall -G dba,oper oracle
[root@fmwdb12c ~]# mkdir -p /u01/app/oracle/product/12.2.0.1/db_1
[root@fmwdb12c ~]# chown -R oracle:oinstall /u01
[root@fmwdb12c ~]# chmod -R 775 /u01

                                                          vii.      Set Environment Parameters

[root@fmwdb12c ~]# su - oracle
[oracle@fmwdb12c ~]$ cd /home/oracle/
[oracle@fmwdb12c ~]$ vi .bash_profile

TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_HOSTNAME=fmwdb12c; export ORACLE_HOSTNAME
ORACLE_UNQNAME=FMW12CDB; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.2.0.1/db_1; export ORACLE_HOME
ORACLE_SID=FMW12CDB; export ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH; export PATH



                                                        viii.      Check the resource limits

[oracle@fmwdb12c ~]$ ulimit -Sn
1024
[oracle@fmwdb12c ~]$ ulimit -Hn
65536
[oracle@fmwdb12c ~]$ ulimit -Su
16384
[oracle@fmwdb12c ~]$ ulimit -Hu
16384
[oracle@fmwdb12c ~]$ ulimit -Ss
10240
[oracle@fmwdb12c ~]$ ulimit -Hs
32768
[oracle@fmwdb12c ~]$

b.      Database file location

                                                               i.      File System – Operating system file system. We are following File System for the database installation in this post.

                                                             ii.      Automatic Storage Management – Oracle ASM disk group. Oracle ASM need to be installed and create the disk groups before starting the Oracle Installation.

c.       Installation Steps

[oracle@fmwdb12c tmp]$ cd /u01/sw/
[oracle@fmwdb12c sw]$ unzip linuxx64_12201_database.zip
[oracle@fmwdb12c sw]$ cd database/
[oracle@fmwdb12c sw]$./runInstaller



























Install the scripts using root user in a separate terminal.

[oracle@fmwdb12c database]$ su -
Password:
[root@fmwdb12c ~]# sh /u01/app/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@fmwdb12c ~]# sh /u01/app/oracle/product/12.2.0.1/db_1/root.sh
Performing root user operation.

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

Enter the full pathname of the local bin directory: [/usr/local/bin]: /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 script.
Now product-specific root actions will be performed.
Do you want to setup Oracle Trace File Analyzer (TFA) now ? yes|[no] :
yes
Installing Oracle Trace File Analyzer (TFA).
Log File: /u01/app/oracle/product/12.2.0.1/db_1/install/root_fmwdb12c_2017-07-18_13-19-42-504748751.log
Finished installing Oracle Trace File Analyzer (TFA)
[root@fmwdb12c ~]#



d.      Post Installation Checking

[oracle@fmwdb12c sw]$ sqlplus "/as sysdba"

SQL*Plus: Release 12.2.0.1.0 Production on Tue Jul 18 13:51:09 2017

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
FMW12CDB

SQL> select name,open_mode from v$pdbs;

NAME
--------------------------------------------------------------------------------
OPEN_MODE
----------
PDB$SEED
READ ONLY

FMW12CPDB
READ WRITE


SQL> alter session set container=FMW12CPDB;

Session altered.

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/FMW12CDB/fmw12cpdb/system01.dbf
/u01/app/oracle/oradata/FMW12CDB/fmw12cpdb/sysaux01.dbf
/u01/app/oracle/oradata/FMW12CDB/fmw12cpdb/undotbs01.dbf
/u01/app/oracle/oradata/FMW12CDB/fmw12cpdb/users01.dbf

SQL> shutdown immediate;
Pluggable Database closed.

SQL> startup
Pluggable Database opened.

e.      Restart the Virtual Machine and start the database
[oracle@fmwdb12c ~]$ lsnrctl start

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 18-JUL-2017 14:08:18

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/12.2.0.1/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/12.2.0.1/db_1/network/admin/lis                                                                                        tener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/fmwdb12c/listener/alert/log                                                                                        .xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=fmwdb12c)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=fmwdb12c)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                18-JUL-2017 14:08:19
Uptime                    0 days 0 hr. 0 min. 1 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.2.0.1/db_1/network/admin/li                                                                                        stener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/fmwdb12c/listener/alert/l                                                                                        og.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=fmwdb12c)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
[oracle@fmwdb12c ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 12.2.0.1.0 Production on Tue Jul 18 14:08:31 2017
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> select instance_name from v$instance;
select instance_name from v$instance
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
SQL> startup
ORACLE instance started.

Total System Global Area 2617245696 bytes
Fixed Size                  8796192 bytes
Variable Size             687867872 bytes
Database Buffers         1912602624 bytes
Redo Buffers                7979008 bytes
Database mounted.
Database opened.
SQL>


Oracle Database 12c has been installed and successfully configured to use.