1. 程式人生 > >Centos 7安裝oracle 數據庫

Centos 7安裝oracle 數據庫

Centos 7安裝oracle 數據庫

1.創建用戶

su - root

groupadd oinstall
groupadd dba
useradd -g oinstall -g dba -m oracle

Centos7
adduser -g oinstall -g dba -m oracle

passwd oracle

2.配置X11

是否安裝X Window System

使用rpm -qa |grep -i x11

沒有安裝則安裝

配置X11

su - root

vi /etc/gdm/custom.conf

[security]

AllowRemoteRoot=true

[xdmcp]
Port=177

Enable=true

xhost +

使得oracle的安裝界面可以顯示在客戶機上
########可以不操作#########################
[oracle@localhost oracle]$ echo $DISPLAY

[oracle@localhost oracle]$ DISPLAY="客戶端IP地址:0.0"

如果是VNC遠程安裝,則需要將地址和屏幕號改為

[oracle@localhost oracle]$ DISPLAY="客戶端IP地址:1.0"

[oracle@localhost oracle]$ export DISPLAY

[oracle@localhost oracle]$ echo $DISPLAY

3.設置編碼語言(中文下要做,英文不需要)

系統默認編碼設置文件,

Centos7以下/etc/sysconfig/i18n

Centos7及以上 /etc/locale.conf

LANG="en_US"(不會出現亂碼)
LANG="zh_cn.UTF-8"

4.拷貝文件
ssh oracle@地址
輸入oracle 密碼
scp 遠程主機:文件路徑 本地文件路徑最好是/home/oracle目錄
或者用存儲介質存放數據庫軟件 xshell登錄上傳
root 下執行掛載iso 作為yum源

mkdir /media/cdrom
mount -o loop xxx.iso /media/cdrom

unzip

如果在執行完 ./runInstaller 如果還沒有安裝界面。重啟一下即可。

註意:如果出現死進程或是yum進程占用 殺死進程 kill -s 9

5.安裝依賴包軟件

pdksh compat-libstdc++ elfutils-libelf-devel libaio-devel libstdc++-devel unixODBC unixODBC-devel
mpfr cpp ppl cloog-ppl gcc gcc-c++ binutils binutils-devel elfutils-libelf expat expat-devel glibc glibc-common glibc-devel glibc-headers libaio libgcc libstdc++ make sysstat

6.安裝數據庫軟件

安裝過程中保存目錄信息默認

在解壓目錄執行(比之前多了個參數設置)

./runInstaller -jreLoc /usr/lib/jvm/jre-1.8.0

1.郵箱勾去掉
2.選擇創建和配置一個數據庫(第一個)
3.選擇Server class
4.選擇單實例 即single
5.高級安裝 Advanced install
6.語言選擇English 及Traditional Chinese
7.選擇標準版 4.22G的
8.安裝位置默認
9.創建恢復默認
10.配置類型選擇 General Purpose/Transaction Processing
另一個是數據倉庫不要選
11.全局數據名:cwall SID:cwall
12.配置選型將字符集設置為AL32UTF8,其他默認
13.管理選項默認
14.數據存儲默認
15.備份和恢復,選擇默認
16.方案和密碼,選擇設置相同密碼 King@20180522
17.默認
18

安裝的時候會卡在68%不會動

7.設置oracle的環境變量

[oracle@localhost]$ vi ~/.bash_profile

export ORACLE_BASE=/home/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=cwall
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib

8.優化(可選)

修改配置文件

修改操作系統核心參數
vi /etc/security/limits.conf
添加以下內容:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

修改/etc/pam.d/login 文件

vi /etc/pam.d/login
session required /lib/security/pam_limits.so
session required pam_limits.so

[root@localhost]# vi /etc/sysctl.conf

添加如下內容

fs.file-max = 6815744

fs.aio-max-nr = 1048576

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 = 4194304

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576

[root@localhost]# sysctl -p # 使文件生效

[root@localhost]# vi /etc/profile

編輯/etc/profile
添加如下內容:

if [ $USER = "oracle" ]; then

if [ $SHELL = "/bin/ksh" ]; then

ulimit -p 16384

ulimit -n 65536

else

ulimit -u 16384 -n 65536

fi

fi

Centos 7安裝oracle 數據庫