Skip to content

Commit

Permalink
Add Oracle 12c
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiomt committed Feb 3, 2019
1 parent 8657b0f commit a20fcf8
Show file tree
Hide file tree
Showing 9 changed files with 1,294 additions and 3 deletions.
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -947,11 +947,27 @@ After increasing the swap space you can start installation by running the Bash s

## Install

[Installation Script](vagrant-setup/oracle12c2.sh)
The setup runs in silent mode. The install, database and listener parameters are specified in [response files](vagrant-setup/oracle/database/12.2.0.1).

## Post installation configuration
The pre-configured database name is **ORCL** the pre-configured instance name is **SE2**

As part of the installation process, the script will automatically initiate oracle-xe configure which will interactively ask you questions about which ports must be used and whether Oracle must start on boot or not.
The password for **SYS** and SYSTEM users is **manager**

Start and stop databse with

`su oracle -c "/u01/app/oracle/product/12.2.0.1/bin/dbstart $ORACLE_HOME"`

`su oracle -c "/u01/app/oracle/product/12.2.0.1/bin/dbshut $ORACLE_HOME"`

LISTENER is pre-configured on 192.168.101.110:1521

Start and stop listener with:

`su oracle -c "/u01/app/oracle/product/12.2.0.1/bin/lsnrctl [start|stop]"`

[Installation Script](vagrant-setup/oracle12c.sh)

## Post installation configuration

If you are using a GUI like Cinnamon then you can also install **SQL Developer**.
As for the database, you need an OTN account to download SQL Developer from
Expand Down
3 changes: 3 additions & 0 deletions vagrant-setup/oracle/bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export ORACLE_HOME=/u01/app/oracle/product/12.2.0.1
export ORACLE_SID=SE2
export ORACLE_BASE=/var/lib/oracle/12.2.0.1
436 changes: 436 additions & 0 deletions vagrant-setup/oracle/database/12.2.0.1/db_install.rsp

Large diffs are not rendered by default.

605 changes: 605 additions & 0 deletions vagrant-setup/oracle/database/12.2.0.1/dbca.rsp

Large diffs are not rendered by default.

126 changes: 126 additions & 0 deletions vagrant-setup/oracle/database/12.2.0.1/listener.ora
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# copyright (c) 1997 by the Oracle Corporation
#
# NAME
# listener.ora
# FUNCTION
# Network Listener startup parameter file example
# NOTES
# This file contains all the parameters for listener.ora,
# and could be used to configure the listener by uncommenting
# and changing values. Multiple listeners can be configured
# in one listener.ora, so listener.ora parameters take the form
# of SID_LIST_<lsnr>, where <lsnr> is the name of the listener
# this parameter refers to. All parameters and values are
# case-insensitive.

# <lsnr>
# This parameter specifies both the name of the listener, and
# it listening address(es). Other parameters for this listener
# us this name in place of <lsnr>. When not specified,
# the name for <lsnr> defaults to "LISTENER", with the default
# address value as shown below.
#
LISTENER =
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=centorion)(PORT=1521))
(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY))
)
)

# SID_LIST_<lsnr>
# List of services the listener knows about and can connect
# clients to. There is no default. See the Net8 Administrator's
# Guide for more information.
#
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
#BEQUEATH CONFIG
(GLOBAL_DBNAME=ORCL)
(SID_NAME=SE2)
(ORACLE_HOME=/u01/app/oracle/product/12.2.0.1)
#PRESPAWN CONFIG
(PRESPAWN_MAX=20)
(PRESPAWN_LIST=
(PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=2)(TIMEOUT=1))
)
)
)

# PASSWORDS_<lsnr>
# Specifies a password to authenticate stopping the listener.
# Both encrypted and plain-text values can be set. Encrypted passwords
# can be set and stored using lsnrctl.
# LSNRCTL> change_password
# Will prompt for old and new passwords, and use encryption both
# to match the old password and to set the new one.
# LSNRCTL> set password
# Will prompt for the new password, for authentication with
# the listener. The password must be set before running the next
# command.
# LSNRCTL> save_config
# Will save the changed password to listener.ora. These last two
# steps are not necessary if SAVE_CONFIG_ON_STOP_<lsnr> is ON.
# See below.
#
# Default: NONE
#
# PASSWORDS_LISTENER = 20A22647832FB454 # "foobar"

# SAVE_CONFIG_ON_STOP_<lsnr>
# Tells the listener to save configuration changes to listener.ora when
# it shuts down. Changed parameter values will be written to the file,
# while preserving formatting and comments.
# Default: OFF
# Values: ON/OFF
#
# SAVE_CONFIG_ON_STOP_LISTENER = ON

# USE_PLUG_AND_PLAY_<lsnr>
# Tells the listener to contact an Onames server and register itself
# and its services with Onames.
# Values: ON/OFF
# Default: OFF
#
# USE_PLUG_AND_PLAY_LISTENER = ON

# LOG_FILE_<lsnr>
# Sets the name of the listener's log file. The .log extension
# is added automatically.
# Default=<lsnr>
#
# LOG_FILE_LISTENER = lsnr

# LOG_DIRECTORY_<lsnr>
# Sets the directory for the listener's log file.
# Default: <oracle_home>/network/log
#
# LOG_DIRECTORY_LISTENER = /private/app/oracle/product/8.0.3/network/log

# TRACE_LEVEL_<lsnr>
# Specifies desired tracing level.
# Default: OFF
# Values: OFF/USER/ADMIN/SUPPORT/0-16
#
# TRACE_LEVEL_LISTENER = SUPPORT

# TRACE_FILE_<lsnr>
# Sets the name of the listener's trace file. The .trc extension
# is added automatically.
# Default: <lsnr>
#
# TRACE_FILE_LISTENER = lsnr

# TRACE_DIRECTORY_<lsnr>
# Sets the directory for the listener's trace file.
# Default: <oracle_home>/network/trace
#
# TRACE_DIRECTORY_LISTENER=/private/app/oracle/product/8.0.3/network/trace
# CONNECT_TIMEOUT_<lsnr>
# Sets the number of seconds that the listener waits to get a
# valid database query after it has been started.
# Default: 10
#
# CONNECT_TIMEOUT_LISTENER=10

4 changes: 4 additions & 0 deletions vagrant-setup/oracle/etc/security/limits.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
12 changes: 12 additions & 0 deletions vagrant-setup/oracle/etc/sysctl.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 2147483648
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 = 1048586
2 changes: 2 additions & 0 deletions vagrant-setup/oracle/oraInst.loc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
inventory_loc=/u01/app/oraInventory
inst_group=oinstall
87 changes: 87 additions & 0 deletions vagrant-setup/oracle12c.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/bash

if [[ $EUID -eq 0 ]]
then

SETUP="/vagrant/vagrant-setup"
PPWD=$PWD
source $SETUP/include.sh

PHYMX=$(free|awk '/^Mem:/{print $2}')
SWAPS=`swapon -s`
SWAPV=$(sed -n 2p <<< "$SWAPS")
DEV1=$(echo $SWAPV | cut -d ' ' -f 1)
SWAPX=$(echo $SWAPV | cut -d ' ' -f 3)
echo "Swap Size is ${SWAPX}Kb"
echo "Physical Memory is ${PHYMX}Kb"

if [ -f "$SETUP/cache/linuxx64_12201_database.zip" ]
then
yum install -y binutils.x86_64 compat-libcap1.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc.i686 glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64 ksh compat-libstdc++-33 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libXi.i686 libXi.x86_64 libXtst.i686 libXtst.x86_64 make.x86_64 sysstat.x86_64

if getent passwd oracle > /dev/null 2>&1; then
echo "oracle user already exists"
else
echo "Creating user oracle"
groupadd oinstall
groupadd dba
groupadd oper
useradd -d /u01 -K MAIL_DIR=/dev/null -g oinstall oracle
usermod -a -G dba oracle
usermod -a -G oper oracle
echo -e "0rclPasswd\n0rclPasswd\n" | passwd oracle
cat $SETUP/oracle/bashrc >> /u01/.bashrc
fi

mkdir -p /u01/app/oracle/middleware
mkdir -p /u01/app/oracle/config/domains
mkdir -p /u01/app/oracle/config/applications
mkdir -p /u01/app/oracle/product/12.2.0.1/network/log/
mkdir -p /var/lib/oracle/12.2.0.1/data
mkdir -p /var/lib/oracle/12.2.0.1/recovery

chown -R oracle:oinstall /var/lib/oracle
chmod -R 775 /var/lib/oracle

cd /u01/app/oracle/
unzip $SETUP/cache/linuxx64_12201_database.zip

chown -R oracle:oinstall /u01
chmod -R 775 /u01/

cd database
su oracle -c "./runInstaller -ignorePrereq -silent -responseFile $SETUP/oracle/12.2.0.1/database/db_install.rsp"

export ORACLE_HOME=/u01/app/oracle/product/12.2.0.1
export ORACLE_SID=SE2
export ORACLE_BASE=/var/lib/oracle/12.2.0.1

cd /u01/app/inventory/
./orainstRoot.sh
cd /u01/app/oracle/product/12.2.0.1
./root.sh

cd bin
su oracle -c "./dbca -silent -createDatabase -responseFile $SETUP/oracle/12.2.0.1/database/dbca.rsp"

if [[ ! $(iptables -nL | grep "dpt:1521") ]]
then
iptables -A INPUT -p tcp --dport 1521 -j ACCEPT
service iptables save
systemctl restart iptables
fi

cp $SETUP/oracle/12.2.0.1/database/listener.ora $ORACLE_HOME/network/admin
su oracle -c "./lsnrctl start"

else

echo "You must download linuxx64_12201_database.zip and save it at /vagrant/vagrant-setup/cache before begining Oracle 12c set up."

fi

else

echo "Oracle must be installed as root. Type sudo ./oracle11g2.sh for executing the script."

fi

0 comments on commit a20fcf8

Please sign in to comment.