행위

"Oracle 19c 설치"의 두 판 사이의 차이

DB CAFE

1번째 줄: 1번째 줄:
Install Oracle 12c R2 on Ubuntu 16.04
+
= ORALCE 리눅스에 ORACLE 19C 설치 =
 +
* 구성 : 오라클리눅스 + Oracle 19c + VirtualBox
  
groupadd -g 54321 oinstall
+
== sw 다운로드 ==
  
groupadd -g 54322 dba
+
=== oracle linux 다운로드 ===
 +
https://yum.oracle.com/oracle-linux-isos.html
  
groupadd -g 54323 oper
+
=== oracle 19.3 다운로드 ===
 +
* 19c  다운로드
  
useradd -u 54321 -g oinstall -G dba,oper -m -s binbash oracle
+
https://www.oracle.com/database/technologies/oracle19c-linux-downloads.html
  
passwd oracle
+
=== virtual box 다운로드 ===
  
mkdir -p apporacleproduct12.2.0.1db_1
+
https://www.virtualbox.org/wiki/Downloads
  
chown -R oracleoinstall app
+
=== virtual box에  오라클 리눅스 설치 ===
chmod -R 775 app
+
# virtual box 실행 -> 머신 -> 새로만들기
 +
## 이름 : dbcafe
 +
## 머신폴더 : d:\VM
 +
## 종류 : LINUX
 +
## 버전 : ORACLE (64 bit)
 +
* 메모리는 최소 1G 를 잡아줘야 에러없이 DB 설치 가능
 +
* 설치 진행 후 아래 환경 설정 진행
  
 +
== 오라클 19c 설치를 위한 환경설정 ==
 +
=== oracle-database-preinstall-19c 설치 ===
 +
<source lang=bash>
 +
yum -y install oracle-database-preinstall-19c
 +
</source>
  
oracle - .bash_profile
+
=== /etc/sysctl.conf 파일에 추가 ===
# Oracle Settings
+
<source lang=bash>
export TMP=tmp
+
# vi /etc/sysctl.conf
export TMPDIR=$TMP
 
 
 
export ORACLE_HOSTNAME=hostname
 
export ORACLE_UNQNAME=sid
 
export ORACLE_BASE=apporacle
 
export ORACLE_HOME=$ORACLE_BASEproduct12.2.0.1db_1
 
export ORACLE_SID=SHAKER12C
 
 
 
export PATH=usrsbin$PATH
 
export PATH=$ORACLE_HOMEbin$PATH
 
 
 
export LD_LIBRARY_PATH=$ORACLE_HOMEliblibusrlib
 
export CLASSPATH=$ORACLE_HOMEjlib$ORACLE_HOMErdbmsjlib
 
 
 
 
 
vi etcsysctl.conf
 
# for oracle 12C
 
 
fs.file-max = 6815744
 
fs.file-max = 6815744
 
kernel.sem = 250 32000 100 128
 
kernel.sem = 250 32000 100 128
51번째 줄: 48번째 줄:
 
fs.aio-max-nr = 1048576
 
fs.aio-max-nr = 1048576
 
net.ipv4.ip_local_port_range = 9000 65500
 
net.ipv4.ip_local_port_range = 9000 65500
 +
</source>
  
 
+
=== oracle-database-preinstall-19c.conf 파일에 추가 ===
 
+
<source lang=bash>
vi etcsecuritylimits.conf
+
# vi /etc/security/limits.d/oracle-database-preinstall-19c.conf
 
oracle  soft  nofile    1024
 
oracle  soft  nofile    1024
 
oracle  hard  nofile    65536
 
oracle  hard  nofile    65536
63번째 줄: 61번째 줄:
 
oracle  hard  memlock    134217728
 
oracle  hard  memlock    134217728
 
oracle  soft  memlock    134217728
 
oracle  soft  memlock    134217728
 +
</source>
  
 +
=== 유저 및 그룹 수정===
 +
<source lang=bash>
 +
# usermod -g dba -G dba oracle
 +
</source>
 +
=== selinux permissive 설정 ===
 +
<source lang=bash>
 +
# vi /etc/selinux/config
 +
</source>
 +
<source lang=bash>
 +
SELINUX=permissive
 +
</source>
  
# 패키지 설치
+
=== 방화벽 해제 ===
apt-get install alien autoconf automake autotools-dev binutils doxygen
+
<source lang=bash>
elfutils expat gawk gcc-4.9 gcc-4.9-multilib  g++-4.9-multilib libstdc++6i386 ksh less libtiff5
+
# systemctl stop firewalld
libtiff5-dev lib32z1 libaio1 libaio-dev libc6-dev libc6-dev-i386 libc6-i386
+
# systemctl disable firewalld
libelf-dev libltdl-dev libodbcinstq4-1 libodbcinstq4-1i386
+
</source>
libpth-dev libstdc++5 make
 
openssh-server rlwrap rpm sysstat unixodbc unixodbc-dev x11-utils
 
zlibc libglapi-mesai386 libglu1-mesai386 libqt4-opengli386
 
libpthread-workqueue0 libpthread-workqueue-dev libzthread-2.3-2 libzthread-dev
 
libpthread-stubs0-dev libaio-dev
 
 
 
 
 
 
 
#gcc
 
update-alternatives --install usrbingcc gcc usrbingcc-4.9 50
 
 
 
update-alternatives --install usrbincpp cpp usrbincpp-4.9 50
 
 
 
#링크 설정
 
 
 
ln -s usrbinawk binawk
 
ln -s usrbinrpm binrpm
 
ln -s usrbinbasename binbasename
 
 
 
  
Linking Libraries
+
=== 설치 경로 생성 ===
 +
<source lang=bash>
 +
mkdir -p /app/oracle/product/19.0.0/db_1/
 +
mkdir -p /app/oradata
 +
chown -R oracle:oinstall /app
 +
chmod -R 775 /app
 +
</source>
 +
* -p 옵션은 하위 폴더까지 생성 
  
ln -s usrlibx86_64-linux-gnu usrlib64
+
=== 서버에 Oracle Database 설치 미디어 업로드 및  권한 부여 ===
cd lib64
+
# 오라클19c파일(LINUX.X64_193000_db_home.zip) 업로드
ln -s libx86_64-linux-gnulibgcc_s.so.1 .
+
# oracle:oinstall 권한 부여
 +
<source lang=bash>
 +
# chown oracle:oinstall LINUX.X64_193000_db_home.zip
 +
# ls -al /app/oracle/product/19.0.0/db_1/
 +
</source>
  
Source: https://drive.google.com/file/d/1a7lL4vhhFZat8F5Z7QuX5tnfBptcooew/view
+
=== 오라클 계정 접속 후 .bash_profile 에 아래 내용 추가 ===
 +
<source lang=bash> 
 +
# su - oracle
 +
</source>
 +
<source lang=bash>
 +
$ vi .bash_profile
 +
</source>
 +
<source lang=bash>
 +
# .bash_profile
  
 
+
# Get the aliases and functions
Preinstall script :
+
if [ -f ~/.bashrc ]; then
 
+
        . ~/.bashrc
 
 
#!/bin/bash
 
 
 
#  ---------------------------------------------------------------------------------
 
#  This script written by Howard Rogers.
 
#
 
#  It's purpose is to install Oracle 12c onto 64-bit Ubuntu 16.04.
 
#
 
#  See http://www.dizwell.com/wordpress/technical-articles/oracle/install-oracle-12c-on-ubuntu-16-04/ for some details.
 
#
 
#  Copyright (c) 2016 Howard Rogers,Dizwell Informatics
 
#  The script is supplied "as-is" with no warranties or guarantees of fitness of
 
#  use or otherwise. Neither Dizwell Informatics nor Howard Rogers accepts any
 
# responsibility whatsoever for any damage caused by the use or misuse of this script.
 
#
 
#  Version 1.0 - Initial Release - 29th May 2016
 
#
 
#  ---------------------------------------------------------------------------------
 
 
 
#  ---------------------------------------------------------------------------------
 
#  Define a little function to draw a progress indicator... Jaws!
 
#  i forever increments; when 1 mod 60 = 0, we start decrementing $pos or
 
#  incrementing it, depending on current direction of travel. Requires that
 
#  the function is called as a background process before some task is performed,
 
#  then killed when complete, which requires that you know the process spawned by the
 
#  background call to the function. For example:
 
#
 
#  jaws &
 
#  jawsp=$!
 
#  apt-get install some_program
 
#  kill $jawsp
 
#  wait $jawsp 2>/dev/null
 
#  ---------------------------------------------------------------------------------
 
jaws() {
 
i=0
 
char=">"
 
pos=4
 
tput sgr0;tput clear;tput setaf $TITLECOL;tput cup 3 5;tput smul;echo "$mytitle";
 
tput rmul;tput cup 5 5;tput rev; echo "$mysubtxt";
 
tput sgr0;tput cup 7 5;tput setaf $TEXTCOL; echo "$mybody1";
 
tput sgr0;tput cup 8 5;tput setaf $TEXTCOL; echo "$mybody2"
 
tput sgr0;tput cup 9 5;tput setaf $TEXTCOL; echo "$mybody3"
 
while true
 
do
 
  i=$((i+1))
 
  if [ $i -gt 36000 ]; then
 
    tput cup 18 5; echo "This is taking too long. Quitting."
 
clear
 
exit 1
 
  fi
 
  if [ $(($i%60)) -eq 0 ]; then 
 
    if [ $char = ">" ]; then
 
      char="<"
 
    else
 
      char=">"
 
    fi
 
  fi
 
  if [ "$char" = ">" ]; then
 
    pos=$((pos+1))
 
    if [ "$pos" -gt 64 ]; then
 
      pos=64
 
    fi
 
  else
 
    pos=$((pos-1))   
 
    if [ "$pos" -lt 5 ]; then
 
      pos=5
 
    fi
 
  fi
 
  tput cup 18 5; echo "............................................................";
 
  tput cup 18 $(($pos)); echo -n $char;tput cup 23 0;
 
  sleep 0.2
 
done
 
}
 
 
 
#  ---------------------------------------------------------------------------------
 
#  Let's initialise  the default values for some of the variables
 
#  we'll be using later on
 
#  ---------------------------------------------------------------------------------
 
ROOT_UID="0";VERGOOD=0;OSGOOD=0;USRGOOD=0;NAMEGOOD=0;SETSMSML=0;SETSEMMNS=0;SETSMOPM=0;SETSMMNI=0;SETSHMAX=0;SETSHMAL=0
 
SETSHMNI=0;SETPRMIN=0;SETPRMAX=0;SETFSMAX=0;SETWMEMD=0;SETWMEMM=0;SETRMEMD=0;SETRMEMM=0;SETAIMAX=0;SETSUDMP=0
 
TITLECOL=2;TEXTCOL=0;WARNCOL=1;
 
ver=16.04
 
 
 
#  ---------------------------------------------------------------------------------
 
#  Check we're running on a 64-bit platform, aborting if not...
 
#  ---------------------------------------------------------------------------------
 
ARCHITECTURE="`/bin/uname -m`"
 
if [ "$ARCHITECTURE" != "x86_64" ]; then
 
  tput sgr0;tput clear;tput setaf $TITLECOL;tput cup 3 5;tput smul
 
  echo "UBUNTU $ver - THE DIZWELL ORACLE PREINSTALLER";tput rmul;tput cup 5 5;tput rev
 
  echo " W R O N G  O/S  A R C H I T E C T U R E ! ";tput sgr0;tput cup 7 5;tput setaf $WARNCOL;tput bold
 
  echo "This script only works on 64-bit platforms, but yours is a 32-bit one.";tput cup 16 5;tput rev
 
  tput cup 17 5; read -p "Press Enter to quit..." RESP
 
  tput sgr0
 
  clear
 
  exit 1
 
fi 
 
 
 
#  ---------------------------------------------------------------------------------
 
#  This script has to run with root privileges, so check you are root now
 
#  and if you're not, re-call the script as root having prompted for the password.
 
#  ---------------------------------------------------------------------------------
 
CMDLN_ARGS="$@"
 
export CMDLN_ARGS
 
chk_root () {
 
  if [ ! $( id -u ) -eq 0 ]; then
 
    tput sgr0;tput clear;tput setaf $TITLECOL;tput cup 3 5;tput smul
 
    echo "UBUNTU $ver - THE DIZWELL ORACLE PREINSTALLER";tput rmul;tput cup 5 5;tput rev
 
    echo " R O O T  P R I V I L E G E S  R E Q U I R E D ";tput sgr0;tput cup 7 5;tput setaf $TEXTCOL
 
    echo "This script requires root privileges to run properly.";tput cup 8 5
 
    echo "Please enter your root password to continue... ";tput cup 17 5;tput bold;tput rev
 
    exec sudo -S su -c "${0} ${CMDLN_ARGS}"
 
    exit ${?}               
 
  fi
 
}
 
chk_root
 
 
 
#  ---------------------------------------------------------------------------------
 
#  The script only runs on Ubuntu 16.04.
 
#  ---------------------------------------------------------------------------------
 
 
 
VERCHECK=`lsb_release -d`
 
if [ "$VERCHECK" != "Description: Ubuntu 16.04 LTS" ]; then
 
  tput sgr0;tput clear;tput setaf $TITLECOL;tput cup 3 5;tput smul
 
  echo "UBUNTU $ver - THE DIZWELL ORACLE PREINSTALLER";tput rmul;tput cup 5 5;tput rev
 
  echo " W R O N G  D I S T R O  D E T E C T E D ! ";tput sgr0;tput cup 7 5;tput setaf $WARNCOL;tput bold
 
  echo "This script is intended to run only on the following distros:";tput sgr0;tput cup 9 5;tput setaf $TEXTCOL
 
  echo "* Ubuntu 16.04";tput cup 10 5;
 
  echo "Your OS is, however, reporting itself to be:";tput cup 12 5
 
  echo `lsb_release -d` | awk '{print substr($0,14,99)}';tput cup 13 5;tput rev
 
  read -p "Press Enter to quit..." RESP
 
  tput sgr0
 
  clear
 
  exit 1 
 
else
 
  DISTRO="Deb"
 
fi 
 
 
 
#  ---------------------------------------------------------------------------------
 
#  With those fundamental tests out of the way, let's display some boiler-plate
 
#  explanation that most people probably won't read anyway...
 
#  ---------------------------------------------------------------------------------
 
tput sgr0;tput clear;tput setaf 2;tput cup 3 5;tput smul
 
echo "UBUNTU $ver - THE DIZWELL ORACLE PREINSTALLER";tput rmul;tput cup 5 5;tput rev
 
echo " P R E L I M I N A R Y  W A R N I N G S!! ";tput sgr0;tput cup 7 5;tput setaf $TEXTCOL
 
echo "This script will make considerable configuration changes";tput cup 8 5
 
echo "to your system so that it can run the Oracle relational";tput cup 9 5
 
echo "database management system. ";tput cup 11 5
 
echo "Once these changes are made, they are only reversible ";tput cup 12 5
 
echo "manually ...and with a lot of effort!";tput cup 17 5;tput rev;tput bold
 
read -p "Are you sure you wish to proceed? [default=n] (y/n): " RESP
 
if [ "$RESP" == "" ]; then
 
  RESP=n
 
 
fi
 
fi
  
if [ "$RESP" = "y" ]; then
+
export TMP=/tmp
  tput setaf 1
+
export TMPDIR=$TMP
  tput clear
 
else
 
  tput sgr0
 
  clear
 
  exit 0 
 
fi
 
 
 
#  ---------------------------------------------------------------------------------
 
#  Next, we need to know which Oracle version is to be installed. There
 
#  are only two choices these days...
 
#  ---------------------------------------------------------------------------------
 
tput sgr0;tput clear;tput setaf 2;tput cup 3 5;tput smul
 
echo "UBUNTU $ver - THE DIZWELL ORACLE PREINSTALLER";tput rmul;tput cup 5 5;tput rev
 
echo " C H O O S E  O R A C L E  V E R S I O N ";tput sgr0;tput cup 7 5;tput setaf $TEXTCOL
 
echo "1. Oracle 12c Release 1";tput cup 9 5
 
echo "2. Quit";tput bold
 
while [ "$VERGOOD" != 1 ]; do
 
  tput cup 17 5
 
  tput rev
 
  read -p "Enter your choice [1-2]: " oraver
 
  case $oraver in
 
    1 ) ORAPATH="12.1.0";
 
        ORACHOICE="12c";
 
VERGOOD=1;;
 
    2 ) tput sgr0;
 
        clear
 
exit 1;;
 
    * ) tput cup 17 5;
 
VERGOOD=0;
 
        echo "Please enter 1 or 2 only.";;
 
  esac
 
done;
 
 
 
#  ---------------------------------------------------------------------------------
 
# The IP address of the machine needs to be recorded in the /etc/hosts
 
# file. So we will first get the IP address of the machine. Then we'll check if that address
 
# is listed in /etc/hosts ...and if it isn't, we'll add it to it. Note the original hosts
 
# file is copied to a uniquely-named file first, so the edit is manually reversible if needed.
 
#  ---------------------------------------------------------------------------------
 
IPADD=$(ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}')
 
IPCHECK=$(awk '/$IPADD/{print $1}' /etc/hosts)
 
 
 
if [ "$IPCHECK" ] ; then
 
tput cup 16 5;tput setaf 4
 
echo 'Hosts file is already configured correctly'
 
else
 
curDate=`date '+%m-%d-%y-%s'`
 
cp /etc/hosts /etc/hosts.$curDate
 
echo "$IPADD `hostname`"|cat - /etc/hosts > /tmp/out && mv -f /tmp/out /etc/hosts
 
tput cup 16 5;tput setaf 4
 
echo "# Next line added for fresh Oracle Installation"|cat - /etc/hosts > /tmp/out && mv -f /tmp/out /etc/hosts
 
tput cup 17 5
 
echo 'Hosts file configuration updated'
 
fi
 
 
 
#  ---------------------------------------------------------------------------------
 
#  A user has to own the Oracle installation. By default, we'll offer to create the user 'oracle'
 
#  to do that. But a user can overtype the default and specify whatever name they like, if they are
 
#  minded to... so long as they don't get smart and try submitting a blank name!
 
#  ---------------------------------------------------------------------------------
 
while [ "$USRGOOD" != 1 ]; do
 
tput clear;tput sgr0;tput setaf 2;tput cup 3 5;tput smul
 
echo "UBUNTU $ver - THE DIZWELL ORACLE PREINSTALLER";tput rmul;tput cup 5 5;tput rev
 
echo " S P E C I F Y  O R A C L E  U S E R ";tput sgr0;tput cup 7 5;tput setaf $TEXTCOL
 
echo "An Oracle software installation has to be 'owned' by";tput cup 8 5
 
echo "a user account. By default, that account is 'oracle',";tput cup 9 5
 
echo "but you can specify any account name now. If you type";tput cup 10 5
 
echo "a username that doesn't already exist, that account";tput cup 11 5
 
echo "will be created for you.";tput cup 17 5;tput setaf 0;tput bold;tput rev
 
read -p "Type in a username [default=oracle]: " ORACLEUSER
 
if [ "$ORACLEUSER" == "" ]; then
 
  ORACLEUSER=oracle
 
fi
 
LENGTHUSRNAME=`echo -n $ORACLEUSER | wc -m | sed -e s/^\s+//`
 
if [[ $LENGTHUSRNAME > 0 ]]; then
 
  USRGOOD=1
 
else
 
  USRGOOD=0
 
fi
 
done
 
 
 
egrep $ORACLEUSER /etc/passwd >/dev/null 2>&1
 
if [ $? -eq 0 ]; then
 
#  ---------------------------------------------------------------------------------
 
# The username specified is one that belongs to an existing user
 
#  ---------------------------------------------------------------------------------
 
  USREXISTS=1
 
else
 
  USREXISTS=0
 
fi
 
 
 
egrep "^dba" /etc/group >/dev/null 2>&1
 
if [ $? -eq 0 ]; then
 
#  ---------------------------------------------------------------------------------
 
# The dba group already exists
 
#  ---------------------------------------------------------------------------------
 
  DBAEXISTS=1
 
else
 
  DBAEXISTS=0
 
fi
 
 
 
egrep "^oinstall" /etc/group >/dev/null 2>&1
 
if [ $? -eq 0 ]; then
 
#  ---------------------------------------------------------------------------------
 
# The oinstall group already exists
 
#  ---------------------------------------------------------------------------------
 
  OINEXISTS=1
 
else
 
  OINEXISTS=0
 
fi
 
 
 
egrep "^nobody" /etc/group >/dev/null 2>&1
 
if [ $? -eq 0 ]; then
 
#  ---------------------------------------------------------------------------------
 
# The nobody group already exists
 
#  ---------------------------------------------------------------------------------
 
  NOBEXISTS=1
 
else
 
  NOBEXISTS=0
 
fi
 
 
 
#  ---------------------------------------------------------------------------------
 
#  We have to prompt for a password for the Oracle User, too, if it's a new user
 
#  ---------------------------------------------------------------------------------
 
if [ "$USREXISTS" -eq 0 ]; then
 
  tput clear;tput sgr0;tput setaf 2;tput cup 3 5;tput smul
 
  echo "UBUNTU $ver - THE DIZWELL ORACLE PREINSTALLER";tput rmul;tput cup 5 5;tput rev
 
  echo " O R A C L E  U S E R  P A S S W O R D ";tput sgr0;tput cup 7 5;tput setaf $TEXTCOL
 
  echo "You've opted to create a new user to own the Oracle";tput cup 8 5
 
  echo "installation. That new user account needs password";tput cup 9 5
 
  echo "protection. The default password is 'oracle', but ";tput cup 10 5
 
  echo "you can supply an alternative now if you like.";tput cup 17 5;tput bold;tput rev
 
  read -p "Type the new user's password [default=oracle]: " ORAPASSWD
 
  if [ "$ORAPASSWD" == "" ]; then
 
    ORAPASSWD=oracle
 
  fi
 
fi
 
 
 
#  ---------------------------------------------------------------------------------
 
#  The users get to choose their database name, if they want to.
 
#  But then we have to check that their proposed name is less than
 
#  nine characters long, not null and doesn't start with a number!
 
#  ---------------------------------------------------------------------------------
 
tput clear;tput sgr0;tput setaf 2;tput cup 3 5;tput smul
 
echo "UBUNTU $ver - THE DIZWELL ORACLE PREINSTALLER";tput rmul;tput cup 5 5;tput rev;
 
echo " S T A R T E R  D A T A B A S E  N A M E ";tput sgr0;tput cup 7 5;tput setaf $TEXTCOL
 
echo "When you perform the Oracle software installation, you'll ";tput cup 8 5
 
echo "be prompted to create a starter database. That database will";tput cup 9 5
 
echo "need a name, which needs to be specified now. By default,";tput cup 10 5
 
echo "this script will assume you'll use a name of 'orc'.";tput cup 17 5
 
while [ "$NAMEGOOD" != 1 ]; do
 
tput setaf 0
 
tput cup 17 5
 
tput bold
 
tput rev
 
read -p "Type in a database name [default=orcl] : " DBNAME
 
if [ "$DBNAME" == "" ]; then
 
  DBNAME=orcl
 
fi
 
 
 
LENGTHDBNAME=`echo -n $DBNAME | wc -m | sed -e s/^\s+//`
 
NUMCHECK=`echo $DBNAME | sed -e s/^[0-9]//`
 
 
 
if [ "$LENGTHDBNAME" -gt 8 ]; then
 
  tput setaf 1;tput cup 17 5;tput bold;tput rev
 
  echo "That name is too long. 8 or fewer characters please!"
 
  NAMEGOOD=0
 
fi
 
 
 
if [ "$LENGTHDBNAME" -gt 0 ]; then
 
  if [ "$DBNAME" != "$NUMCHECK" ]; then   
 
    tput setaf 1;tput cup 17 5;tput bold;tput rev 
 
    echo "That name starts with a number, which isn't allowed!"
 
    NAMEGOOD=0
 
  fi
 
fi
 
 
 
if [ "$LENGTHDBNAME" -gt 0 ]; then
 
  if [ "$LENGTHDBNAME" -lt 9 ]; then
 
    if [ "$DBNAME" = "$NUMCHECK" ]; then
 
    NAMEGOOD=1
 
    fi
 
  fi
 
fi
 
done
 
 
 
#  ---------------------------------------------------------------------------------
 
#  That's the interactive part over with (almost!). So now it's time to
 
#  actually make some changes to the system. Let's begin by creating the
 
#  oracle user and setting his password to whatever was supplied earlier
 
#  ---------------------------------------------------------------------------------
 
if [ "$USREXISTS" -eq 0 ]; then
 
  if [ "$DBAEXISTS" -eq 0 ]; then
 
    /usr/sbin/groupadd dba
 
  fi
 
 
 
  if [ "$OINEXISTS" -eq 0 ]; then
 
    /usr/sbin/groupadd oinstall
 
  fi
 
  /usr/sbin/useradd -m $ORACLEUSER -g oinstall -G dba -s /bin/bash
 
  echo $ORACLEUSER:$ORAPASSWD | chpasswd
 
  history -c
 
fi
 
 
 
if [ "$USREXISTS" -eq 1 ]; then
 
#  ---------------------------------------------------------------------------------
 
# We have to preserve the groups the user already has -which means working
 
# out what those groups are to start with!
 
#  ---------------------------------------------------------------------------------
 
  GROUPLIST=`id -Gn $ORACLEUSER`
 
  for group in $GROUPLIST; do
 
    if [ "$group" != 'dba' ] && [ "$group" != 'oinstall' ] ; then
 
      groupstring=$groupstring,$group
 
    fi
 
  done
 
 
 
  if [ "$DBAEXISTS" -eq 0 ]; then
 
    /usr/sbin/groupadd dba
 
  fi
 
 
 
  if [ "$OINEXISTS" -eq 0 ]; then
 
    /usr/sbin/groupadd oinstall
 
  fi
 
 
 
  /usr/sbin/usermod -g oinstall -G dba$groupstring $ORACLEUSER
 
fi
 
 
 
#  ---------------------------------------------------------------------------------
 
#  We need some symbolic links to make Ubuntu look more Red Hattish
 
#  ---------------------------------------------------------------------------------
 
if [ ! -e "/bin/awk" ]; then
 
ln -s /usr/bin/awk /bin/awk >/dev/null 2>&1
 
fi
 
if [ ! -e "/bin/rpm" ]; then
 
ln -s /usr/bin/rpm /bin/rpm >/dev/null 2>&1
 
fi
 
if [ ! -e "/lib/x86_64-linux-gnu/libgcc_s.so.1" ]; then
 
ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib64/libgcc_s.so.1 >/dev/null 2>&1
 
fi
 
if [ ! -e "/lib/libgcc_s.so" ]; then
 
ln -s /lib/libgcc_s.so.1 /lib/libgcc_s.so >/dev/null 2>&1
 
fi
 
if [ ! -e "/bin/basename" ]; then
 
ln -s /usr/bin/basename /bin/basename >/dev/null 2>&1
 
fi
 
if [ ! -e "/usr/lib64" ]; then
 
ln -s /usr/lib/x86_64-linux-gnu /usr/lib64 >/dev/null 2>&1
 
fi
 
if [ ! -e "/bin/sh" ]; then
 
ln -sf /bin/bash /bin/sh >/dev/null 2>&1
 
fi
 
if [ "$NOBEXISTS" -eq 0 ]; then
 
/usr/sbin/groupadd nobody >/dev/null 2>&1
 
fi
 
 
 
#  ---------------------------------------------------------------------------------
 
#  Now create the directory structure for the final Oracle
 
#  installation. Additionally, we create an /osource directory where the
 
#  Oracle software can be copied to disk, avoiding an off-DVD installation.
 
#  ---------------------------------------------------------------------------------
 
if [ ! -e "/u01/app/oracle/product/$ORAPATH/db_1" ]; then
 
  mkdir -p /u01/app/oracle/product/$ORAPATH/db_1
 
fi
 
if [ ! -e "/osource" ]; then
 
  mkdir /osource
 
fi
 
chown -R $ORACLEUSER:oinstall /u01/app
 
chmod -R 775 /u01/app
 
chown -R $ORACLEUSER:oinstall /osource
 
chmod -R 775 /osource
 
 
 
#  ---------------------------------------------------------------------------------
 
#  Now we check the existing kernel parameters so we can work out if
 
#  they need to be changed...
 
#  ---------------------------------------------------------------------------------
 
SMSML=`cat /proc/sys/kernel/sem | awk '{print $1}'`
 
SMMNS=`cat /proc/sys/kernel/sem | awk '{print $2}'`
 
SMOPM=`cat /proc/sys/kernel/sem | awk '{print $3}'`
 
SMMNI=`cat /proc/sys/kernel/sem | awk '{print $4}'`
 
MEMSZ=`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`
 
let "MEMSZ *= 1024"
 
let "MEMSZ /= 2"
 
let "MEMSZ += 16777216"
 
SHMAX=`cat /proc/sys/kernel/shmmax`
 
SHMAL=`cat /proc/sys/kernel/shmall`
 
SHMNI=`cat /proc/sys/kernel/shmmni`
 
PRMIN=`cat /proc/sys/net/ipv4/ip_local_port_range | awk '{print $1}'`
 
PRMAX=`cat /proc/sys/net/ipv4/ip_local_port_range | awk '{print $2}'`
 
FSMAX=`cat /proc/sys/fs/file-max`
 
RMEMD=`cat /proc/sys/net/core/rmem_default`
 
RMEMM=`cat /proc/sys/net/core/rmem_max`
 
WMEMD=`cat /proc/sys/net/core/wmem_default`
 
WMEMM=`cat /proc/sys/net/core/wmem_max`
 
AIMAX=`cat /proc/sys/fs/aio-max-nr`
 
SUDMP=`cat /proc/sys/fs/suid_dumpable`
 
HSTNM=`hostname`
 
 
 
#  ---------------------------------------------------------------------------------
 
#  Time to set the kernel parameters to recommended values, but only
 
#  if they are NOT already set to usable minima.
 
#  ---------------------------------------------------------------------------------
 
if [ $SMSML -lt 250 ]; then
 
  SMSML=250
 
  SETSMSML=1
 
fi
 
 
 
if [ $SMMNS -lt 32000 ]; then
 
  SMMNS=32000
 
  SETSEMMNS=1
 
fi
 
 
 
if [ $SMOPM -lt 100 ]; then
 
  SMOPM=100
 
  SETSMOPM=1
 
fi
 
 
 
if [ $SMMNI -lt 128 ]; then
 
  SMMNI=128
 
  SETSMMNI=1
 
fi
 
 
 
result=`echo $SHMAX \< $MEMSZ | bc`
 
if [ "$result" -ne 0 ]; then
 
  SHMAX=$MEMSZ
 
  SETSHMAX=1
 
else
 
  SHMAX=8589934592
 
  SETSHMAX=1
 
fi
 
 
 
SHMAL=2097152
 
SETSHMAL=1
 
 
 
SHMNI=4096
 
SETSHMNI=1
 
 
 
if [ $PRMIN -gt 1024 ]; then
 
  PRMIN=1024
 
  SETPRMIN=1
 
fi
 
 
 
 
 
if [ $PRMAX -lt 65000 ]; then
 
  PRMAX=65000
 
  SETPRMAX=1
 
fi
 
 
 
if [ $FSMAX -lt 65536 ]; then
 
  FSMAX=65536
 
  SETFSMAX=1
 
fi
 
 
 
if [ $WMEMD -lt 262144 ]; then
 
  WMEMD=262144
 
  SETWMEMD=1
 
fi
 
 
 
if [ $WMEMM -lt 262144 ]; then
 
  WMEMM=262144
 
  SETWMEMM=1
 
fi
 
 
 
if [ $ORACHOICE = "11gR2" ]; then
 
  if [ $FSMAX -lt 6815744 ]; then
 
    FSMAX=6815744
 
    SETFSMAX=1
 
  fi
 
 
 
  if [ $WMEMM -lt 1048576 ]; then
 
    WMEMM=1048576
 
    SETWMEMM=1
 
  fi
 
 
 
  if [ $RMEMD -lt 4194304 ]; then
 
    RMEMD=4194304
 
    SETRMEMD=1
 
  fi
 
 
 
  if [ $PRMIN -lt 9000 ]; then
 
    PRMIN=9000
 
    SETPRMIN=1
 
  fi
 
 
 
  if [ $PRMAX -lt 65500 ]; then
 
    PRMAX=65500
 
    SETPRMAX=1
 
  fi
 
 
 
  if [ $AIMAX -lt 1048576 ]; then
 
    AIMAX=1048576
 
    SETAIMAX=1
 
  fi
 
 
 
  if [ $RMEMM -lt 4194304 ]; then
 
    RMEMM=4194304
 
    SETRMEMM=1
 
  fi
 
 
 
  if [ $SUDMP -eq 0 ]; then
 
    SUDMP=1
 
    SETSUDMP=1
 
  fi
 
fi
 
 
 
if [ $ORACHOICE = "12c" ]; then
 
  if [ $FSMAX -lt 6815744 ]; then
 
    FSMAX=6815744
 
    SETFSMAX=1
 
  fi
 
 
 
  if [ $WMEMM -lt 1048576 ]; then
 
    WMEMM=1048576
 
    SETWMEMM=1
 
  fi
 
 
 
  if [ $RMEMD -lt 262144 ]; then
 
    RMEMD=262144
 
    SETRMEMD=1
 
  fi
 
 
 
  if [ $PRMIN -lt 9000 ]; then
 
    PRMIN=9000
 
    SETPRMIN=1
 
  fi
 
 
 
  if [ $PRMAX -lt 65535 ]; then
 
    PRMAX=65535
 
    SETPRMAX=1
 
  fi
 
 
 
  if [ $AIMAX -lt 1048576 ]; then
 
    AIMAX=1048576
 
    SETAIMAX=1
 
  fi
 
 
 
  if [ $RMEMM -lt 4194304 ]; then
 
    RMEMM=4194304
 
    SETRMEMM=1
 
  fi
 
 
 
  if [ $SUDMP -eq 0 ]; then
 
    SUDMP=1
 
    SETSUDMP=1
 
  fi
 
fi
 
 
 
#  ---------------------------------------------------------------------------------
 
#  Now actually set those parameters which have been determined to need re-setting
 
#  -----------------------------------------------------------------------------------
 
cat >> /etc/sysctl.conf << EOF
 
#
 
#Added for fresh Oracle $ORACHOICE Installation
 
EOF
 
 
 
if [ $SETSHMAL -eq "1" ]; then
 
cat >> /etc/sysctl.conf << EOF
 
kernel.shmall = $SHMAL
 
EOF
 
fi
 
 
 
if [[ $SETSHMAX -eq "1" ]]; then
 
cat >> /etc/sysctl.conf << EOF
 
kernel.shmmax = $SHMAX
 
EOF
 
fi
 
 
 
if [ $SETSHMNI -eq "1" ]; then
 
cat >> /etc/sysctl.conf << EOF
 
kernel.shmmni = 4096
 
EOF
 
fi
 
 
 
cat >> /etc/sysctl.conf << EOF
 
kernel.semmni = $SHMNI
 
EOF
 
 
 
if [[ $SETSMSML -eq "1" || $SETSMMNS -eq "1" || $SETSMOPM -eq "1" || $SETSMMNI -eq "1" ]]; then
 
cat >> /etc/sysctl.conf << EOF
 
kernel.sem = $SMSML $SMMNS $SMOPM $SMMNI
 
EOF
 
fi
 
 
 
if [ $SETFSMAX -eq "1" ]; then
 
cat >> /etc/sysctl.conf << EOF
 
fs.file-max = $FSMAX
 
EOF
 
fi
 
 
 
if [[ $SETPRMIN -eq "1" || $SETPRMAX -eq "1" ]]; then
 
cat >> /etc/sysctl.conf << EOF
 
net.ipv4.ip_local_port_range = $PRMIN $PRMAX
 
EOF
 
fi
 
 
 
if [ $SETRMEMD -eq "1" ]; then
 
cat >> /etc/sysctl.conf << EOF
 
net.core.rmem_default = $RMEMD
 
EOF
 
fi
 
 
 
if [ $SETWMEMD -eq "1" ]; then
 
cat >> /etc/sysctl.conf << EOF
 
net.core.wmem_default = $WMEMD
 
EOF
 
fi
 
 
 
if [ $SETRMEMM -eq "1" ]; then
 
cat >> /etc/sysctl.conf << EOF
 
net.core.rmem_max = $RMEMM
 
EOF
 
fi
 
 
 
if [ $SETWMEMM -eq "1" ]; then
 
cat >> /etc/sysctl.conf << EOF
 
net.core.wmem_max = $WMEMM
 
EOF
 
fi
 
 
 
if [ $SETAIMAX -eq "1" ]; then
 
cat >> /etc/sysctl.conf << EOF
 
fs.aio-max-nr = $AIMAX
 
EOF
 
fi
 
 
 
if [ $SETSUDMP -eq "1" ]; then
 
cat >> /etc/sysctl.conf << EOF
 
fs.suid_dumpable = $SUDMP
 
EOF
 
fi
 
 
 
#  ---------------------------------------------------------------------------------
 
#  Now we have to set security limits.
 
#  ----------------------------------------------------------------------------------
 
cat /etc/security/limits.conf | sed /'# End of file'/d > /tmp/limits.wrk
 
cat >> /tmp/limits.wrk << EOF
 
$ORACLEUSER        soft    nproc    2047
 
$ORACLEUSER        hard    nproc  16384
 
$ORACLEUSER        soft    nofile  1024
 
$ORACLEUSER        hard    nofile  65536
 
$ORACLEUSER        soft    stack  10240
 
# End of file
 
EOF
 
 
 
rm /etc/security/limits.conf
 
mv /tmp/limits.wrk /etc/security/limits.conf
 
 
 
cat >> /etc/pam.d/login << EOF
 
session    required    pam_limits.so
 
EOF
 
 
 
DISTRIB=5
 
 
 
#  ---------------------------------------------------------------------------------
 
#  Now the Oracle User's environment variables are set
 
#  ---------------------------------------------------------------------------------
 
ENVFILE="/home/$ORACLEUSER/.bashrc"
 
cat >> $ENVFILE << EOF
 
#Added for fresh Oracle $ORACHOICE Installation
 
export ORACLE_HOSTNAME=$HSTNM
 
export ORACLE_BASE=/u01/app/oracle
 
export ORACLE_HOME=/u01/app/oracle/product/$ORAPATH/db_1
 
export ORACLE_SID=$DBNAME
 
export ORACLE_UNQNAME=$DBNAME
 
export PATH=\$ORACLE_HOME/bin:\$PATH:.
 
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
 
export CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
 
DISTRIB_RELEASE=$DISTRIB
 
 
 
alias sqlplus="rlwrap sqlplus"
 
alias sql="sqlplus / as sysdba"
 
alias diag="cd \$ORACLE_BASE/diag/rdbms/\$ORACLE_UNQNAME/\$ORACLE_SID/trace"
 
 
 
EOF
 
 
 
#  ---------------------------------------------------------------------------------
 
#  We need a script to auto-start Oracle databases at server reboot. Note that whilst
 
#  this section will generate such a script, it won't be automatically run unless the
 
#  user manually remembers to alter the contents of the /etc/oratab file.
 
#  ---------------------------------------------------------------------------------
 
 
 
if [ -f /etc/init.d/dboraz ]; then
 
mv /etc/init.d/dboraz /etc/init.d/dboraz.original
 
fi
 
 
 
cat >> /etc/init.d/dboraz << EOF
 
#!/bin/bash
 
### BEGIN INIT INFO
 
# Provides:          dboraz
 
# Required-Start:    $remote_fs $syslog
 
# Required-Stop:    $remote_fs $syslog
 
# Default-Start:    3 4 5
 
# Default-Stop:      0 1 2 6
 
# Short-Description: Startup script for Oracle Databases
 
# Description:      Oracle Database Auto-Start Script
 
### END INIT INFO
 
export ORACLE_HOME=/u01/app/oracle/product/$ORAPATH/db_1
 
export ORACLE_SID=$DBNAME
 
export PATH=\$ORACLE_HOME/bin:\$PATH:.
 
 
 
case "\$1" in
 
start)
 
        echo -n "Starting Oracle: "
 
su $ORACLEUSER -c "\$ORACLE_HOME/bin/dbstart \$ORACLE_HOME"
 
su $ORACLEUSER -c "\$ORACLE_HOME/bin/emctl start dbconsole"
 
touch /var/lock/oracle
 
echo "OK"
 
;;
 
stop)
 
echo -n "Shutting down Oracle: "
 
su $ORACLEUSER -c "\$ORACLE_HOME/bin/emctl stop dbconsole"
 
su $ORACLEUSER -c "\$ORACLE_HOME/bin/dbshut \$ORACLE_HOME"
 
rm -f /var/lock/oracle
 
echo "OK"
 
;;
 
restart)
 
echo -n "Shutting down Oracle: "
 
su $ORACLEUSER -c "\$ORACLE_HOME/bin/emctl stop dbconsole"
 
su $ORACLEUSER -c "\$ORACLE_HOME/bin/dbshut \$ORACLE_HOME"
 
rm -f /var/lock/oracle
 
echo "OK"
 
    su $ORACLEUSER -c "\$ORACLE_HOME/bin/dbstart \$ORACLE_HOME"
 
su $ORACLEUSER -c "\$ORACLE_HOME/bin/emctl start dbconsole"
 
touch /var/lock/oracle
 
echo "OK"
 
;;
 
esac
 
exit 0
 
EOF
 
 
 
chmod 775 /etc/init.d/dboraz
 
(update-rc.d -f dboraz remove) >/dev/null 2>&1 2>&1
 
tput sgr0;tput cup 16 5;tput dim;tput setaf 7
 
(update-rc.d dboraz defaults) >/dev/null 2>&1 2>&1
 
 
 
#  ---------------------------------------------------------------------------------
 
#  Time to get some software prerequisites installed
 
#  ---------------------------------------------------------------------------------
 
tput sgr0;tput clear;tput setaf 2;tput cup 3 5;tput smul
 
echo "UBUNTU $ver - THE DIZWELL ORACLE PREINSTALLER";tput rmul;tput cup 5 5;tput rev
 
echo " S O F T W A R E  D O W N L O A D ";tput sgr0;tput cup 7 5;tput setaf $TEXTCOL
 
echo "This script now wants to update your existing software and";tput cup 8 5
 
echo "download quite a lot of new (and necessary) packages. ";tput cup 17 5;tput bold;tput rev
 
read -p "Do you wish to proceed? [default=n] (y/n): " RESP
 
if [ "$RESP" == "" ]; then
 
  RESP=n
 
fi
 
 
 
if [ "$RESP" = "y" ]; then
 
  tput setaf 1
 
  #  ---------------------------------------------------------------------------------
 
  #  Check if the CD/DVD repository is still enabled. If so, comment it out
 
  #  from /etc/apt/sources.list, ensuring that software is downloaded from
 
  #  the Internet (otherwise you sit there for hours not realising that the O/S
 
  #  is asking you to insert a cd/dvd before it can proceed!)
 
  #  ---------------------------------------------------------------------------------
 
  mytitle="UBUNTU $ver - THE DIZWELL ORACLE PREINSTALLER";
 
  mysubtxt=" S O F T W A R E  D O W N L O A D  ";
 
  mybody1="Repositories are being updated. ";
 
  mybody2="This can take a long time, so please be patient...";
 
  jaws $mytitle $mysubtxt $mybody1 $mybody2 &
 
  jawsp=$!
 
  sed -i 's/deb cdrom:/#deb cdrom:/' /etc/apt/sources.list  
 
  apt-get update >/dev/null 2>&1
 
  kill $jawsp
 
  wait $jawsp 2>/dev/null
 
 
 
  #  ---------------------------------------------------------------------------------
 
  #  Installation loop
 
  #  ---------------------------------------------------------------------------------
 
  tput cup 17 5
 
  mytitle="UBUNTU $ver - THE DIZWELL ORACLE PREINSTALLER";
 
  mysubtxt=" S O F T W A R E  D O W N L O A D  ";
 
  mybody1="Necessary software packages and libraries are being downloaded.";
 
  mybody2="This can take a long time, so please be patient...";
 
  jaws $mytitle $mysubtxt $mybody1 $mybody2 &
 
  jawsp=$!
 
  #  ---------------------------------------------------------------------------------
 
  #  If one package does not exist in a request to install a long list of them, apt
 
  #  will not install ANY of them. So, we have to treat the list of packages as an
 
  #  array and install them one-by-one, by looping.
 
  #  ---------------------------------------------------------------------------------
 
  for pkg in unixodbc unixodbc-dev unzip  lsb-cxx pdksh sysstat gcc g++-multilib \
 
  ia32-libs ksh lesstif2 zlibc rpm libc6 libc6-dev libc6-dev-i386 libc6-i386 \
 
  gcc-multilib less lib32z1 libelf-dev binutils libodbcinstq4-1 libpth-dev zenity \
 
  libpthread-stubs0 libstdc++5 autotools-dev bzip2 elfutils g++ rlwrap libltdl-dev \
 
  libmotif4 libpthread-stubs0-dev build-essential expat gawk alien autoconf automake \
 
  lesstif2-dev make; do
 
apt-get -y install $pkg >/dev/null 2>&1
 
tput cup 17 5
 
echo "                                                    ";tput cup 17 5
 
echo "Installing: "$pkg
 
  done
 
 
 
  tput cup 20 5;ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib64/libgcc_s.so.1 >/dev/null 2>&1
 
 
 
  tput cup 17 5
 
  echo "                                                    ";tput cup 17 5
 
  echo "Installing: older libaio libraries"
 
  wget http://ftp.us.debian.org/debian/pool/main/liba/libaio/libaio1_0.3.109-3_amd64.deb >/dev/null 2>&1
 
  dpkg -i libaio1_0.3.109-3_amd64.deb  >/dev/null 2>&1
 
  aptitude hold libaio1 >/dev/null 2>&1
 
  echo "libaio1 hold" | dpkg --set-selections >/dev/null 2>&1
 
  wget http://ftp.us.debian.org/debian/pool/main/liba/libaio/libaio-dev_0.3.109-3_amd64.deb >/dev/null 2>&1
 
  dpkg -i libaio-dev_0.3.109-3_amd64.deb >/dev/null 2>&1
 
  aptitude hold libaio-dev >/dev/null 2>&1
 
  echo "libaio-dev hold" | dpkg --set-selections >/dev/null 2>&1
 
 
 
  rm -f libaio*.deb >/dev/null 2>&1
 
  kill $jawsp
 
  wait $jawsp 2>/dev/null
 
#  ---------------------------------------------------------------------------------
 
#  Ubuntu will produce a compilation error once the Oracle 11g software
 
#  installation is underway. This part of the script creates a shell script
 
#  in the oracle user's Documents directory which, if run, will add appropriate
 
#  compiler switches to the various makefiles that will fix the problems,
 
#  once a 'Retry' has been selected.
 
#  ---------------------------------------------------------------------------------
 
mkdir -p /home/$ORACLEUSER/Documents/
 
cat >> /home/$ORACLEUSER/Documents/ubuntu-fixup.sh << EOF
 
#!/bin/bash
 
export ORACLE_HOME=/u01/app/oracle/product/$ORAPATH/db_1
 
 
 
sudo ln -s \$ORACLE_HOME/lib/libclntsh.core.so.12.1 /usr/lib
 
sudo ln -s \$ORACLE_HOME/lib/libclntsh.so.12.1 /usr/lib
 
 
 
cp \$ORACLE_HOME/rdbms/lib/ins_rdbms.mk \$ORACLE_HOME/rdbms/lib/ins_rdbms.bkp
 
cp \$ORACLE_HOME/rdbms/lib/env_rdbms.mk \$ORACLE_HOME/rdbms/lib/env_rdbms.bkp
 
 
 
sed -i 's/\$(ORAPWD_LINKLINE)/\$(ORAPWD_LINKLINE) -lnnz12/' \$ORACLE_HOME/rdbms/lib/ins_rdbms.mk
 
sed -i 's/\$(HSOTS_LINKLINE)/\$(HSOTS_LINKLINE) -lagtsh/' \$ORACLE_HOME/rdbms/lib/ins_rdbms.mk
 
sed -i 's/\$(EXTPROC_LINKLINE)/\$(EXTPROC_LINKLINE) -lagtsh/' \$ORACLE_HOME/rdbms/lib/ins_rdbms.mk
 
sed -i 's/\$(OPT) \$(HSOTSMAI)/\$(OPT) -Wl,--no-as-needed \$(HSOTSMAI)/' \$ORACLE_HOME/rdbms/lib/env_rdbms.mk
 
sed -i 's/\$(OPT) \$(HSDEPMAI)/\$(OPT) -Wl,--no-as-needed \$(HSDEPMAI)/' \$ORACLE_HOME/rdbms/lib/env_rdbms.mk
 
sed -i 's/\$(OPT) \$(EXTPMAI)/\$(OPT) -Wl,--no-as-needed \$(EXTPMAI)/' \$ORACLE_HOME/rdbms/lib/env_rdbms.mk
 
sed -i 's/^\(TNSLSNR_LINKLINE.*\$(TNSLSNR_OFILES)\) \(\$(LINKTTLIBS)\)/\1 -Wl,--no-as-needed \2/g' \$ORACLE_HOME/network/lib/env_network.mk
 
sed -i 's/\$(SPOBJS) \$(LLIBSERVER)/\$(SPOBJS) -Wl,--no-as-needed \$(LLIBSERVER)/' \$ORACLE_HOME/rdbms/lib/env_rdbms.mk
 
sed -i 's/\$(S0MAIN) \$(SSKFEDED)/\$(S0MAIN) -Wl,--no-as-needed \$(SSKFEDED)/' \$ORACLE_HOME/rdbms/lib/env_rdbms.mk
 
sed -i 's/\$(S0MAIN) \$(SSKFODED)/\$(S0MAIN) -Wl,--no-as-needed \$(SSKFODED)/' \$ORACLE_HOME/rdbms/lib/env_rdbms.mk
 
sed -i 's/\$(S0MAIN) \$(SSKFNDGED)/\$(S0MAIN) -Wl,--no-as-needed \$(SSKFNDGED)/' \$ORACLE_HOME/rdbms/lib/env_rdbms.mk
 
sed -i 's/\$(S0MAIN) \$(SSKFMUED)/\$(S0MAIN) -Wl,--no-as-needed \$(SSKFMUED)/' \$ORACLE_HOME/rdbms/lib/env_rdbms.mk
 
sed -i 's/^\(ORACLE_LINKLINE.*\$(ORACLE_LINKER)\) \($(PL_FLAGS)\)/\1 -Wl,--no-as-needed \2/g' \$ORACLE_HOME/rdbms/lib/env_rdbms.mk
 
sed -i 's/\$LD \$LD_RUNTIME/$LD -Wl,--no-as-needed \$LD_RUNTIME/' \$ORACLE_HOME/bin/genorasdksh
 
sed -i 's/\$(GETCRSHOME_OBJ1) \$(OCRLIBS_DEFAULT)/\$(GETCRSHOME_OBJ1) -Wl,--no-as-needed \$(OCRLIBS_DEFAULT)/' \$ORACLE_HOME/srvm/lib/env_srvm.mk
 
 
 
zenity --info --title "Fix-up Script Applied" --text="Click OK to return to the Oracle Installer, \nthen click the [Retry] option."
 
 
 
exit 0
 
EOF
 
 
 
chmod 775 /home/$ORACLEUSER/Documents/ubuntu-fixup.sh
 
fi
 
 
 
tput clear;tput sgr0;tput setaf 2;tput cup 3 5;tput smul
 
echo "UBUNTU $ver - THE DIZWELL ORACLE PREINSTALLER";tput rmul;tput cup 5 5;tput rev
 
echo " R E B O O T  R E Q U I R E D ";tput sgr0;tput cup 7 5;tput setaf $TEXTCOL
 
echo "To ensure the configuration changes made by this script take full";tput cup 8 5
 
echo "effect, this PC will be rebooted as soon as you press Enter.";tput cup 10 5
 
echo "When your PC comes back up, log on as '$ORACLEUSER' and launch the";tput cup 11 5
 
echo "runInstaller.sh script from the Oracle software source of your choice.";tput cup 17 5;tput setaf 1;tput bold;tput rev
 
read -p "Press Enter to reboot..." RESP
 
reboot
 
exit 0
 
 
 
  
Source: https://www.dizwell.com/wordpress/technical-articles/oracle/install-oracle-12c-on-ubuntu-16-04/3/
+
export LANG=C
 +
export LC_ALL=C
 +
export CV_ASSUME_DISTID=RHEL7.6
  
https://onedrive.live.com/?authkey=%21AL1G4tLE8F3dgsQ&cid=8C51C47ADD8D1B71&id=8C51C47ADD8D1B71%2122250&parId=8C51C47ADD8D1B71%2122249&o=OneUp
+
export ORACLE_HOSTNAME=oel.ora19
 +
export ORACLE_UNQNAME=ora19
 +
export ORACLE_BASE=/app/oracle
 +
export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/db_1
 +
export ORA_INVENTORY=/oraInventory
 +
export ORACLE_SID=ora19
 +
export DATA_DIR=/app/oradata
 +
export PATH=/usr/sbin:/usr/local/bin:$PATH
 +
export PATH=$ORACLE_HOME/bin:$PATH
 +
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
 +
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
 +
</source>
  
[[Category:oracle]]
+
== 오라클 설치 ==
[[Category:설치]]
+
# runInstaller 실행
 +
#:* DB 생성중에 실패했다면 나중에 디비만 다시 생성
 +
# dbca 실행

2024년 3월 16일 (토) 16:58 판

thumb_up 추천메뉴 바로가기


1 ORALCE 리눅스에 ORACLE 19C 설치[편집]

  • 구성 : 오라클리눅스 + Oracle 19c + VirtualBox

1.1 sw 다운로드[편집]

1.1.1 oracle linux 다운로드[편집]

https://yum.oracle.com/oracle-linux-isos.html

1.1.3 virtual box 다운로드[편집]

https://www.virtualbox.org/wiki/Downloads

1.1.4 virtual box에 오라클 리눅스 설치[편집]

  1. virtual box 실행 -> 머신 -> 새로만들기
    1. 이름 : dbcafe
    2. 머신폴더 : d:\VM
    3. 종류 : LINUX
    4. 버전 : ORACLE (64 bit)
  • 메모리는 최소 1G 를 잡아줘야 에러없이 DB 설치 가능
  • 설치 진행 후 아래 환경 설정 진행

1.2 오라클 19c 설치를 위한 환경설정[편집]

1.2.1 oracle-database-preinstall-19c 설치[편집]

yum -y install oracle-database-preinstall-19c

1.2.2 /etc/sysctl.conf 파일에 추가[편집]

# vi /etc/sysctl.conf
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500

1.2.3 oracle-database-preinstall-19c.conf 파일에 추가[편집]

# vi /etc/security/limits.d/oracle-database-preinstall-19c.conf
oracle   soft   nofile    1024
oracle   hard   nofile    65536
oracle   soft   nproc    16384
oracle   hard   nproc    16384
oracle   soft   stack    10240
oracle   hard   stack    32768
oracle   hard   memlock    134217728
oracle   soft   memlock    134217728

1.2.4 유저 및 그룹 수정[편집]

# usermod -g dba -G dba oracle

1.2.5 selinux permissive 설정[편집]

# vi /etc/selinux/config
SELINUX=permissive

1.2.6 방화벽 해제[편집]

# systemctl stop firewalld
# systemctl disable firewalld

1.2.7 설치 경로 생성[편집]

mkdir -p /app/oracle/product/19.0.0/db_1/
mkdir -p /app/oradata
chown -R oracle:oinstall /app 
chmod -R 775 /app
  • -p 옵션은 하위 폴더까지 생성

1.2.8 서버에 Oracle Database 설치 미디어 업로드 및 권한 부여[편집]

  1. 오라클19c파일(LINUX.X64_193000_db_home.zip) 업로드
  2. oracle:oinstall 권한 부여
# chown oracle:oinstall LINUX.X64_193000_db_home.zip
# ls -al /app/oracle/product/19.0.0/db_1/

1.2.9 오라클 계정 접속 후 .bash_profile 에 아래 내용 추가[편집]

# su - oracle
$ vi .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

export TMP=/tmp
export TMPDIR=$TMP

export LANG=C
export LC_ALL=C
export CV_ASSUME_DISTID=RHEL7.6

export ORACLE_HOSTNAME=oel.ora19
export ORACLE_UNQNAME=ora19
export ORACLE_BASE=/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/db_1
export ORA_INVENTORY=/oraInventory
export ORACLE_SID=ora19
export DATA_DIR=/app/oradata
export PATH=/usr/sbin:/usr/local/bin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

1.3 오라클 설치[편집]

  1. runInstaller 실행
    • DB 생성중에 실패했다면 나중에 디비만 다시 생성
  2. dbca 실행