Centos7.5 安裝oracle11g
主機名:slave.com
OS: centos7.5
軟件版本:Oracle 11.2.0.4
CPU: 1個
內存: 8G
swap: 16G
/u01 : 20G
/data: 50G
/backup: 50G
安裝方式:CentOS 7為Gnome
二、安裝rpm包
binutils-2.20.51.0.2-5.11.el6 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (x86_64)
gcc-4.4.4-13.el6 (x86_64)
gcc-c++-4.4.4-13.el6 (x86_64)
glibc-2.12-1.7.el6 (i686)
glibc-devel-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6.i686
libgcc-4.4.4-13.el6 (i686)
libgcc-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6.i686
libstdc++-devel-4.4.4-13.el6 (x86_64)
libstdc++-devel-4.4.4-13.el6.i686
libaio-0.3.107-10.el6 (x86_64)
libaio-0.3.107-10.el6.i686
libaio-devel-0.3.107-10.el6.i686
elfutils-libelf-devel-0.164-2.el6 (x86_64)
pdksh-5.2.14-37.el5_8.1 (x86_64)
三、數據庫安裝
-
編輯文件/etc/hosts添加主機名及IP地址
[root@slave ~]# vim /etc/hosts
193.192.168.4.185 slave.com
2.創建用戶和組
[root@slave ~]# groupadd -g 500 oinstall
[root@slave ~]# groupadd -g 501 dba
[root@slave ~]# passwd oracle
Changing password for user oracle.
New password:
Retype new password:
passwd: all authentication tokens updated successfully. -
創建目錄
[root@slave ~]# mkdir -p /u01/app/oracle
[root@slave ~]# mkdir -p /data/oradata
[root@slave ~]# mkdir -p /backup/{expdbbackup,rmanbackup,onlinelog,archivelog,backupsh}
[root@slave ~]# chown -R oracle:oinstall /u01
[root@slave ~]# chown -R oracle:oinstall /data
[root@slave ~]# chown -R oracle:oinstall /backup - 擴大tmpfs
oracle 11g引入了memory_target參數,memory_target 和 /dev/shm(即tmpfs)有緊密聯系,tmpfs的大小制約了memory_target的使用範圍
1) 查看tmpfs大小(tmpfs默認的大小是物理內存的一半)
[root@slave ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 50G 1.2G 49G 3% /
devtmpfs 5.8G 0 5.8G 0% /dev
tmpfs 18G 0 18G 0% /dev/shm
tmpfs 5.8G 8.7M 5.8G 1% /run
tmpfs 5.8G 0 5.8G 0% /sys/fs/cgroup
/dev/sda1 1014M 143M 872M 15% /boot
tmpfs 1.2G 0 1.2G 0% /run/user/0
/dev/mapper/centos-u01 20G 45M 19G 1% /u01
/dev/mapper/centos-data 50G 53M 47G 1% /data
/dev/mapper/centos-backup 50G 53M 47G 1% /backup
2) 編輯/etc/fstab
[root@slave ~]# vim /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=18432M 0 0
3) 重新掛載
[root@slave ~]# mount -o remount /dev/shm
5.修改內核參數
1) 編輯/etc/sysctl.conf添加以下內容
[root@slave ~]# vim /etc/sysctl.conf
#oracle
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 8388608
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=1048576
#end
2) 執行sysctl -p命令使文件生效
[root@slave ~]# sysctl -p
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 8388608
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
- 修改系統資源限制
1) 編輯/etc/security/limits.conf添加以下內容
[root@slave ~]# vim /etc/security/limits.conf
#oracle
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
#end
2) 編輯文件/etc/pam.d/login添加以下內容
[root@slave ~]# vim /etc/pam.d/login
#Oracle
session required pam_limits.so
#end
3) 編輯/etc/profile文件添加以下內容
[root@slave ~]# vim /etc/profile
#oracle
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
#end - 設置環境變量
1) 在oracle用戶下編輯文件.bash_profile添加以下內容
[root@slave ~]# su - oracle
[oracle@slave ~]$ vim .bash_profile
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
ORACLE_SID=oa
PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
2) 執行source .bash_profile命令使環境變量生效
[oracle@slave ~]$ source .bash_profile
- 關閉Linux安全增強
1) 編輯/etc/selinux/config修改SELINUX=disabled
2)執行setenforce 0不重啟操作系統臨時關閉selinux模式
[oracle@slave ~]$ setenforce 0
9.安裝oracle
1) 上傳安裝文件
[root@slave ~]# cd /home/oracle/
[root@slave oracle]# ls
p13390677_112040_Linux-x86-64_1of7.zip p13390677_112040_Linux-x86-64_2of7.zip
2) 解壓
[root@slave oracle]# unzip p13390677_112040_Linux-x86-64_1of7.zip
[root@slave oracle]# unzip p13390677_112040_Linux-x86-64_2of7.zip
[root@slave oracle]# ls
database p13390677_112040_Linux-x86-64_1of7.zip p13390677_112040_Linux-x86-64_2of7.zip
3) 使用Xshell遠程登錄執行runInstaller開始安裝
[root@slave ~]# export DISPLAY=192.168.4.56:0.0
[root@slave ~]# su - oracle
Last login: Fri Jan 18 19:24:18 CST 2019 on pts/1
[oracle@slave ~]$ export DISPLAY=192.168.4.56:0.0
4)測試結果
[root@slave ~]# xhost +
access control disabled, clients can connect from any host
Last login: Fri Jan 18 19:30:13 CST 2019 on pts/0
[oracle@slave ~]$ cd database/
[oracle@slave database]$ ./runInstaller
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 44343 MB Passed
Checking swap space: must be greater than 150 MB. Actual 16383 MB Passed
Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-01-18_07-43-51PM. Please wait ...[oracle@slave da
tabase]$
4) 啟動安裝界面
5) 取消 I wish to receive security updates via my Oracle Support.勾選,點擊下一步
6) 此報錯可以忽略,點擊Yes,並點擊下一步
7) 選擇Skip software updates,點擊下一步
8) 選擇Create and configure a database,點擊下一步
9) 選擇Server Class,點擊下一步
10) 選擇Single instance database installation,點擊下一步
11) 選擇Advanced install,點擊下一步
12) 選擇語言English,點擊下一步
13) 選擇Enterprise Edition,點擊下一步
14) 選擇Oracle Base、Software Location路徑,點擊下一步
15) 選擇Inventory Directory,點擊下一步
16) 選擇General Purpose/Transaction Processing,點擊下一步
17) 設置Global database name、Oracle Service Identifier,Global database name和Oracle Service Identifier保持一致,點擊下一步
18) 設置Memory,選擇Enable Automatic Memory Management
19) 設置Character sets,選擇Use Unicode(AL32UTF8)
20) 設置Security,保持默認選項
21) 設置Sample Schemas,保持默認選項,點擊下一步
22) 保持默認選項,點擊下一步
23) 保持默認選項,點擊下一步
24) 保持默認選項,點擊下一步
25) 選擇Use the same password for all accounts,設置密碼(密碼需參考密碼管理規範),點擊下一步
26) Database Operator(OSOPER) Group(Optional)選擇oinstall,點擊下一步
27) 安裝程序進行配置檢查
28) 配置檢查通過,點擊Install
39) 開始安裝
30) 報錯
解決辦法:
[oracle@slave database]$ vi $ORACLE_HOME/sysman/lib/ins_emagent.mk
Search for the line
$(MK_EMAGENT_NMECTL)
Change it to:
$(MK_EMAGENT_NMECTL) -lnnz11
31) 創建數據庫
32) 創建數據庫完成,點擊Password Management修改sys,system用戶密碼,並確定OK。
33)提示使用root用戶執行兩個shell腳本
34) 執行shell腳本
[root@slave ~]# /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@slave ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.2.0/dbhome_1
Enter the full pathname of the local bin directory: [/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.
Finished product-specific roo
35) 單擊OK,安裝完成。
Centos7.5 安裝oracle11g