一、進入管理員權限html
[anzerong@localhost ~]# su - root password [root@localhost ~]#
二、建立用戶組oinstallnode
[root@localhost ~]# groupadd oinstall
三、建立用戶組dbapython
[root@localhost ~]# groupadd dba
四、建立oracle用戶,並加入到oinstall和dba用戶組linux
[root@localhost ~]# useradd -g oinstall -g dba -m oracle
五、設置用戶oracle的登錄密碼,不設置密碼,在CentOS的圖形登錄界面無法登錄c++
[root@localhost ~]# passwd oracle Changing password for user oracle. New password: # 密碼 BAD PASSWORD: The password is shorter than 8 characters Retype new password: # 再次輸入密碼 passwd: all authentication tokens updated successfully.
六、查看新建的oracle用戶數據庫
[root@localhost ~]# id oracle uid=1001(oracle) gid=1002(dba) groups=1002(dba)
七、進入根目錄centos
[root@localhost ~]# cd /.
八、建立oracle數據庫安裝目錄bash
[root@localhost /]# mkdir -p /data/oracle
九、建立oracle數據庫配置文件目錄oracle
[root@localhost /]# mkdir -p /data/oraInventory
十、建立oracle數據庫軟件包解壓目錄dom
[root@localhost /]# mkdir -p /data/database
十一、建立完後檢查一下
[root@localhost /]# cd /data [root@localhost data]# ls database oracle oraInventory
十二、設置目錄全部者爲oinstall用戶組的oracle用戶
[root@localhost data]# chown -R oracle:oinstall /data/oracle [root@localhost data]# chown -R oracle:oinstall /data/oraInventory [root@localhost data]# chown -R oracle:oinstall /data/database
1三、修改OS系統標識(oracle默認不支持CentOS系統安裝,可是centos與redhat的關係自行百度)
[root@localhost data]# cat /proc/version Linux version 3.10.0-514.26.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Tue Jul 4 15:04:05 UTC 2017 [root@localhost data]# cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) [root@localhost data]# vi /etc/redhat-release [root@localhost data]# cat /etc/redhat-release redhat-7
1四、安裝oracle數據庫所須要的軟件包
[root@localhost data]# yum install binutils compat-libcap1 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel glibc elfutils-libelf-devel compat*
1五、查看防火牆狀態(運行中)
[root@localhost data]# systemctl status firewalld.service ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2017-09-13 09:23:08 CST; 25min ago Docs: man:firewalld(1) Main PID: 641 (firewalld) CGroup: /system.slice/firewalld.service └─641 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid Sep 13 09:22:58 localhost.localdomain systemd[1]: Starting firewalld - dynami... Sep 13 09:23:08 localhost.localdomain systemd[1]: Started firewalld - dynamic... Hint: Some lines were ellipsized, use -l to show in full.
1六、關閉防火牆
[root@localhost data]# systemctl stop firewalld.service
1七、查看防火牆狀態(已關閉)
[root@localhost data]# systemctl status firewalld.service ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: inactive (dead) since Wed 2017-09-13 09:48:55 CST; 10s ago Docs: man:firewalld(1) Process: 641 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS) Main PID: 641 (code=exited, status=0/SUCCESS) Sep 13 09:22:58 localhost.localdomain systemd[1]: Starting firewalld - dynami... Sep 13 09:23:08 localhost.localdomain systemd[1]: Started firewalld - dynamic... Sep 13 09:48:54 localhost.localdomain systemd[1]: Stopping firewalld - dynami... Sep 13 09:48:55 localhost.localdomain systemd[1]: Stopped firewalld - dynamic... Hint: Some lines were ellipsized, use -l to show in full.
1八、禁止使用防火牆(重啓也是禁止的)
[root@localhost data]# systemctl disable firewalld.service Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
1九、關閉selinux(需重啓生效)
[root@localhost data]# vi /etc/selinux/config [root@localhost data]# cat /etc/selinux/config
/etc/selinux/config 最終文檔爲:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled #此處修改成disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
20、修改內核參數(加入斜體部分)
[root@local++host data]# vi /etc/sysctl.conf [root@localhost data]# cat /etc/sysctl.conf
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.conf.all.rp_filter = 1
fs.file-max = 6815744 #設置最大打開文件數
fs.aio-max-nr = 1048576
kernel.shmall = 2097152 #共享內存的總量,8G內存設置:2097152*4k/1024/1024
kernel.shmmax = 2147483648 #最大共享內存的段大小
kernel.shmmni = 4096 #整個系統共享內存端的最大數
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500 #可以使用的IPv4端口範圍
net.core.rmem_default = 262144
net.core.rmem_max= 4194304
net.core.wmem_default= 262144
net.core.wmem_max= 1048576
2一、使配置修改內核的參數生效
[root@localhost data]# sysctl -p
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.conf.all.rp_filter = 1
sysctl: setting key "fs.file-max": Invalid argument
fs.file-max = 6815744 #設置最大打開文件數
fs.aio-max-nr = 1048576
sysctl: setting key "kernel.shmall": Invalid argument
kernel.shmall = 2097152 #共享內存的總量,8G內存設置:2097152*4k/1024/1024
sysctl: setting key "kernel.shmmax": Invalid argument
kernel.shmmax = 2147483648 #最大共享內存的段大小
sysctl: setting key "kernel.shmmni": Invalid argument
kernel.shmmni = 4096 #整個系統共享內存端的最大數
kernel.sem = 250 32000 100 128
sysctl: setting key "net.ipv4.ip_local_port_range": Invalid argument
net.ipv4.ip_local_port_range = 9000 65500 #可以使用的IPv4端口範圍
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
2二、對oracle用戶設置限制,提升軟件運行性能(斜體爲添加部分)
[root@localhost data]# vi /etc/security/limits.conf [root@localhost data]# cat /etc/security/limits.conf
# /etc/security/limits.conf
#
#This file sets the resource limits for the users logged in via PAM.
#It does not affect resource limits of the system services.
#
#Also note that configuration files in /etc/security/limits.d directory,
#which are read in alphabetical order, override the settings in this
#file in case the domain is the same or more specific.
#That means for example that setting a limit for wildcard domain here
#can be overriden with a wildcard setting in a config file in the
#subdirectory, but a user specific setting here can be overriden only
#with a user specific setting in the subdirectory.
#
#Each line describes a limit for a user in the form:
#
#
#
#Where:
#can be:
# - a user name
# - a group name, with @group syntax
# - the wildcard *, for default entry
# - the wildcard %, can be also used with %group syntax,
# for maxlogin limit
#
#can have the two values:
# - "soft" for enforcing the soft limits
# - "hard" for enforcing hard limits
#
#- can be one of the following:
# - core - limits the core file size (KB)
# - data - max data size (KB)
# - fsize - maximum filesize (KB)
# - memlock - max locked-in-memory address space (KB)
# - nofile - max number of open file descriptors
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit (KB)
# - maxlogins - max number of logins for this user
# - maxsyslogins - max number of logins on the system
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
# - sigpending - max number of pending signals
# - msgqueue - max memory used by POSIX message queues (bytes)
# - nice - max nice priority allowed to raise to values: [-20, 19]
# - rtprio - max realtime priority
#
#
##* soft core 0
#* hard rss 10000
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#@student - maxlogins 4oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536# End of file
2三、配置用戶的環境變量(斜體部分爲添加代碼)
[root@localhost data]# vi /home/oracle/.bash_profile [root@localhost data]# cat /home/oracle/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
export ORACLE_BASE=/data/oracle #oracle數據庫安裝目錄
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 #oracle數據庫路徑
export ORACLE_SID=orcl #oracle啓動數據庫實例名
export ORACLE_TERM=xterm #xterm窗口模式安裝
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH #添加系統環境變量
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib #添加系統環境變量
export LANG=C #防止安裝過程出現亂碼
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK #設置Oracle客戶端字符集,必須與Oracle安裝時設置的字符集保持一致
2四、使用戶的環境變量配置當即生效
[root@localhost data]# source /home/oracle/.bash_profile
2五、將安裝包移動到/usr/local/src路徑下
[root@localhost ~]# cd /. [root@localhost /]# cd /home/anzerong/Desktop/ [root@localhost Desktop]# ls linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip [root@localhost Desktop]# mv linux.x64_11gR2_database_1of2.zip /usr/local/src [root@localhost Desktop]# ls linux.x64_11gR2_database_2of2.zip [root@localhost Desktop]# mv linux.x64_11gR2_database_2of2.zip /usr/local/src
2六、重啓系統,確保全部設置生效
[root@localhost Desktop]# reboot
2七、從oracle用戶進入/usr/local/src目錄
[oracle@localhost /]$ cd /usr/local/src [oracle@localhost src]$ ls linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip
2八、解壓兩個軟件包至/data/database/目錄下
[oracle@localhost src]$ unzip linux.x64_11gR2_database_1of2.zip -d /data/database/ #解壓 (省略...) [oracle@localhost src]$ unzip linux.x64_11gR2_database_2of2.zip -d /data/database/ #解壓 (省略...)
2九、進入管理員權限
[oracle@localhost src]$ su root Password:
30、設置目錄全部者爲oinstall用戶組的oracle用戶
[root@localhost src]# chown -R oracle:oinstall /data/database/database/
3一、執行安裝腳本
[oracle@localhost /]$ cd /data/database/database/ [oracle@localhost database]$ ls doc install response rpm runInstaller sshsetup stage welcome.html [oracle@localhost database]$ ./runInstaller Starting Oracle Universal Installer... (省略...)
3二、==++Configure Security Updates++==
去掉 I wish to receive security updates via My Oracle Support.
點擊 「Nest >」
3三、==++Installation Option++==
選擇第二項 Install database software only
點擊 「Nest >」
3四、==++Grid Options++==
選擇單例模式 Single instance database installation
點擊 「Nest >」
3五、==++Product Languages++==
選擇英語 English(根據系統默認選擇好了)
點擊 「Nest >」
3六、==++Database Edition++==
選擇第一個企業版
3七、==++Installation Location++==
肯定數據軟件的安裝路徑,自動讀取前面Oracle環境變量中配置的值
點擊 「Nest >」
3八、==++Create Inventory++==
選擇默認,不作修改
點擊 「Nest >」
3九、==++Operation System Groups++==
所有使用dba用戶組
點擊 「Nest >」
40、==++Prepequisite Checks++==
按照提示信息一個一個解決
點擊 「Nest >」
PS:pdksh安裝
一、卸載已安裝的ksh
[root@localhost Desktop]# rpm -e pdksh* [root@localhost Desktop]# rpm -e ksh*
二、下載pdksh-5.2.14-21.x86_64.rpm
三、安裝
[root@localhost Desktop]# rpm -ivh pdksh-5.2.14-21.x86_64.rpm --force --nodeps
按提示解決缺乏的依賴包,以後點擊 「Check Again」
能夠忽略缺乏的32bit依賴包
4一、==++Summary++==
點擊 「Finsh」
4二、==++Install Product++==
在此過程當中,安裝界面會變成黑色,有一長條出現(實際上是一個提示框),調整高度與寬度查看,
或者能夠直接右鍵選擇close
4三、==++Finish++==
參考:http://www.linuxidc.com/Linux/2016-04/130559.htm
centos 安裝oracle 11g r2(二)-----監聽配置與建立數據庫實例 http://www.cnblogs.com/anzerong2012/p/7940850.html centos 安裝oracle 11g r2(三)-----表空間建立 http://www.cnblogs.com/anzerong2012/p/7941179.html