1.Oracle超級用戶創(chuàng)建
sudo groupadd oinstall
sudo groupadd dba
sudo mkdir -p /opt/oracle #目錄修改為自己機器的實際目錄
sudo useradd -g oinstall -G dba -s /bin/bash oracle
sudo passwd oracle
sudo chown -R oracle:oinstall /opt/oracle
2.修改/etc/sysctl.conf
增加以下內(nèi)容
kernel.sem = 250 32000 100 128
kernel.shmall = 2097152
kernel.shmmni = 4096
kernel.shmmax=1073741824
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 = 1048576
fs.aio-max-nr = 1048576
fs.file-max = 6815744
vm.hugetlb_shm_group = 1002
生效
??sudo sysctl -p
3.修改/etc/security/limits.conf
增加以下內(nèi)容
oracle soft nproc? 2047
oracle hard nproc? 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack? 10240
4.修改/etc/pam.d/login
增加以下內(nèi)容
session required /lib/security/pam_limits.so
session required pam_limits.so
5.偽裝系統(tǒng)為Oracle Linux
sudo ln -sf /bin/bash /bin/sh
sudo ln -s /usr/bin/awk /bin/awk
sudo ln -s /usr/bin/rpm /bin/rpm
sudo ln -s /usr/bin/basename /bin/basename
for i in 0 1 2 3 4 5 6 ; do sudo ln -s /etc/rc$i.d /etc/rc.d/rc$i.d ; done
sudo ln -s /usr/lib/x86_64-linux-gnu /usr/lib64
cd /lib64
sudo ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 .
6.修改系統(tǒng)變量/etc/profile
# Oracle Settings
TMP=/tmp;
export TMP
TMPDIR=$TMP;
export TMPDIR
生效
source /etc/profile
7.解壓安裝文件聋袋,加權(quán)限
cd /data/downloads/database/install
chmod +x *.sh .oui unzip
sudo chown -R oracle:oinstall /data/downloads/database
8.安裝可能的依賴
mkdir /tmp/libstdc++5
cd /tmp/libstdc++5
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-3.3/libstdc++5_3.3.6-28ubuntu1_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-3.3/libstdc++5_3.3.6-28ubuntu1_i386.deb
sudo dpkg --force-architecture -i libstdc++5_3.3.6-28ubuntu1_i386.deb
sudo mv /usr/lib/libstdc++.so.5* /usr/lib32/
sudo dpkg -i libstdc++5_3.3.6-28ubuntu1_amd64.deb
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install automake
sudo apt-get install autotools-dev
sudo apt-get install binutils
sudo apt-get install bzip2
sudo apt-get install elfutils
sudo apt-get install expat
sudo apt-get install gawk
sudo apt-get install gcc
sudo apt-get install gcc-multilib
sudo apt-get install g++-multilib
sudo apt-get install ia32-libs
sudo apt-get install ksh
sudo apt-get install less
sudo apt-get install lesstif2
sudo apt-get install lesstif2-dev
sudo apt-get install lib32z1
sudo apt-get install libaio1
sudo apt-get install libaio-dev
sudo apt-get install libc6-dev
sudo apt-get install libc6-dev-i386
sudo apt-get install libc6-i386
sudo apt-get install libelf-dev
sudo apt-get install libltdl-dev
sudo apt-get install libmotif4
sudo apt-get install libodbcinstq4-1 libodbcinstq4-1:i386
sudo apt-get install libpth-dev
sudo apt-get install libpthread-stubs0
sudo apt-get install libpthread-stubs0-dev
sudo apt-get install libstdc++5
sudo apt-get install lsb-cxx
sudo apt-get install make
sudo apt-get install openssh-server
sudo apt-get install pdksh
sudo apt-get install rlwrap
sudo apt-get install rpm
sudo apt-get install sysstat
sudo apt-get install unixodbc
sudo apt-get install unixodbc-dev
sudo apt-get install unzip
sudo apt-get install x11-utils
sudo apt-get install zlibc
9.運行runInstaller
./runInstaller -jreloc /opt/jdk1.8.0_65/jre/
遇到后4個異常:
sed -i 's/^\(\s*\$(MK_EMAGENT_NMECTL)\)\s*$/\1 -lnnz11/g' $ORACLE_HOME/sysman/lib/ins_emagent.mk
sed -i 's/^\(\$LD \$LD_RUNTIME\) \(\$LD_OPT\)/\1 -Wl,--no-as-needed \2/g' $ORACLE_HOME/bin/genorasdksh
sed -i 's/^\(\s*\)\(\$(OCRLIBS_DEFAULT)\)/\1 -Wl,--no-as-needed \2/g' $ORACLE_HOME/srvm/lib/ins_srvm.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/^\(ORACLE_LINKLINE.*\$(ORACLE_LINKER)\) \(\$(PL_FLAGS)\)/\1 -Wl,--no-as-needed \2/g' $ORACLE_HOME/rdbms/lib/env_rdbms.mk
圖形化安裝結(jié)束:
/opt/oracle/app/oraInventory/orainstRoot.sh
/opt/oracle/app/oracle/product/11.2.0/dbhome_1/root.sh
10.修改.profile文件
export ORACLE_HOME=/opt/oracle/app/oracle/product/11.2.0/dbhome_1
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=orcl
11.啟動Oracle
dbstart $ORACLE_HOME
sqlplus system/Lywan7758521@orcl
dbshut $ORACLE_HOME
12.創(chuàng)建表空間和用戶
create tablespace TS_DAT_SJCK? DATAFILE '/opt/oracle/app/oracle/oradata/orcl/TPIN.DBF' SIZE 1500m AUTOEXTEND on next 100m maxsize unlimited;
create user myTpin identified by myTpin default tablespace TS_DAT_SJCK;
grant dba to myTpin;
13.完整的啟動TNSListener
可能權(quán)限不足
chmod 777 /var/tmp/.oracle
su - oracle
sqlplus /nolog
conn /as sysdba
startup
exit
lsnrctl start
exit