這篇文章是轉載的,講的很全面了
CentOS7安裝Oracle 12C
實驗環境:Oracle VM VirtualBox 4.2.12
作業系統:CentOS 7(LINUX7)64bit
資料庫 :Oracle 12C 64bit
實驗目标:熟悉LINUX7下安裝Oracle12C
操作示範:
(1)、安裝Linux7作業系統
略
(2)、官網下載下傳oracle軟體包
略
(3)、下載下傳oracle12C官方文檔
略
(4)、上傳oracle軟體包至linux作業系統下
略
(5)、安裝oracle
5.1 主機配置
根據經驗,關閉一些無用的服務,否則安裝時可能會出現某些錯誤
#vi serverstop.
編寫關閉服務腳本
chkconfig iptables off
chkconfig ip6tables off
chkconfig cups off
chkconfig firstboot off
chkconfig wpa_supplicant off
chkconfig postfix off
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
sed -i 's/^GSSAPIAuthentication yes$/GSSAPIAuthentication no/' /etc/ssh/sshd_config
sed -i 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
#sh serverstop.sh
執行關閉服務腳本
5.2 安裝包
解壓安裝包
[[email protected] /]# cd /software
[[email protected] software]# ls
linuxamd64_12c_database_1of2.zip linuxamd64_12c_database_2of2.zip
[[email protected] software]# unzip linuxamd64_12c_database_1of2.zip
[[email protected] software]# unzip linuxamd64_12c_database_2of2.zip
檢視官方文檔,沒有找到LINUX7需安裝包的文檔,找到了LINUX6需要安裝的包,以LINUX6作為參考,步驟如下: 官方安裝文檔說明
在系統CD光牒中,按要求找到需要的包,下面是文檔中要求安裝的64位的相關包:
1. The following packages (or later versions) must be installed:
2. binutils-2.20.51.0.2-5.11.el6 (x86_64)
3. compat-libcap1-1.10-1 (x86_64)
4. compat-libstdc++-33-3.2.3-69.el6 (x86_64)
5. gcc-4.4.4-13.el6 (x86_64)
6. gcc-c++-4.4.4-13.el6 (x86_64)
7. glibc-2.12-1.7.el6 (x86_64)
8. glibc-devel-2.12-1.7.el6 (x86_64)
9. ksh
10. libgcc-4.4.4-13.el6 (x86_64)
11. libstdc++-4.4.4-13.el6 (i686)
12. libstdc++-devel-4.4.4-13.el6 (x86_64)
13. libaio-0.3.107-10.el6 (x86_64)
14. libaio-devel-0.3.107-10.el6 (x86_64)
15. libXext-1.1 (x86_64)
16. libXtst-1.0.99.2 (x86_64)
17. libX11-1.3 (x86_64)
18. libXau-1.0.5 (x86_64)
19. libxcb-1.5 (x86_64)
20. libXi-1.3 (x86_64)
21. make-3.81-19.el6
22. sysstat-9.0.4-11.el6 (x86_64)
将找到的包上傳到linux系統下,對其進行安裝^footnote.
[[email protected] package]# vi rpm.sh
1. rpm -ivh binutils-2.23.52.0.1-16.el7.x86_64.rpm
2. rpm -ivh compat-libcap1-1.10-7.el7.x86_64.rpm
3. rpm -ivh gcc-4.8.2-16.el7.x86_64.rpm
4. rpm -ivh gcc-c++-4.8.2-16.el7.x86_64.rpm
5. rpm -ivh glib2-devel-2.36.3-5.el7.x86_64.rpm
6. rpm -ivh glibc-2.17-55.el7.x86_64.rpm
7. rpm -ivh ksh-20120801-19.el7.x86_64.rpm
8. rpm -ivh libaio-0.3.109-12.el7.x86_64.rpm
9. rpm -ivh libaio-devel-0.3.109-12.el7.x86_64.rpm
10. rpm -ivh libgcc-4.8.2-16.el7.x86_64.rpm
11. rpm -ivh libstdc++-4.8.2-16.el7.x86_64.rpm
12. rpm -ivh libstdc++-devel-4.8.2-16.el7.x86_64.rpm
13. rpm -ivh libX11-1.6.0-2.1.el7.x86_64.rpm
14. rpm -ivh libXau-1.0.8-2.1.el7.x86_64.rpm
15. rpm -ivh libxcb-1.9-5.el7.x86_64.rpm
16. rpm -ivh libXext-1.3.2-2.1.el7.x86_64.rpm
17. rpm -ivh libXtst-1.2.2-2.1.el7.x86_64.rpm
18. rpm -ivh make-3.82-21.el7.x86_64.rpm
19. rpm -ivh sysstat-10.1.5-4.el7.x86_64.rpm
[[email protected] package]# sh rpm.sh
安裝調用圖形化需要的包[^footnote2], [^footnote2]:圖像化工具千千萬,我是用的anydesk
[[email protected] yum.repos.d]# yum -y install unixODBC
[[email protected] yum.repos.d]# yum -y install unixODBC-devel
[[email protected] scripts]# yum install -y xterm
xterm這是調用圖形化用的包
5.3 添加使用者及相關目錄
這個步驟是比較重要的,Oracle的安裝不允許在root使用者下安裝
[[email protected] /]# groupadd oinstall
[[email protected] /]# groupadd dba
[[email protected] /]# useradd -g oinstall -G dba oracle
[[email protected] /]# 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.
[[email protected] /]# id oracle
uid=1001(oracle) gid=1001(oinstall) groups=1001(oinstall),1002(dba)
[[email protected] /]# mkdir -p /u01/app/oracle/product/12.1.0/db_1
[[email protected] /]# mkdir -p /u01/app/oraInventory
[[email protected] /]# chown -R oracle:oinstall /u01/app
[[email protected] /]# chmod -R 775 /u01/app
5.4 配置核心參數^footnote3
[[email protected] /]# vi /etc/sysctl.conf
1. # System default settings live in /usr/lib/sysctl.d/00-system.conf.
2. # To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file
3. #
4. # For more information, see sysctl.conf(5) and sysctl.d(5).
5. fs.aio-max-nr = 1048576
6. fs.file-max = 6815744
7. kernel.shmall = 2097152
8. kernel.shmmax = 4294967295
9. kernel.shmmni = 4096
10. kernel.sem = 250 32000 100 128
11. net.ipv4.ip_local_port_range = 9000 65500
12. net.core.rmem_default = 262144
13. net.core.rmem_max = 4194304
14. net.core.wmem_default = 262144
15. net.core.wmem_max = 1048576
16. ~
[[email protected] /]# sysctl -p
1. fs.aio-max-nr = 1048576
2. fs.file-max = 6815744
3. kernel.shmall = 2097152
4. kernel.shmmax = 4294967295
5. kernel.shmmni = 4096
6. kernel.sem = 250 32000 100 128
7. net.ipv4.ip_local_port_range = 9000 65500
8. net.core.rmem_default = 262144
9. net.core.rmem_max = 4194304
10. net.core.wmem_default = 262144
11. net.core.wmem_max = 1048576
修改系統限制
[[email protected] ~]# vi /etc/security/limits.conf
1. # End of file
2. oracle soft nproc 2047
3. oracle hard nproc 16384
4. oracle soft nofile 1024
5. oracle hard nofile 65536
[[email protected] ~]# vi /etc/pam.d/login
1. session required /lib/security/pam_limits.so
2. session required pam_limits.so
[[email protected] ~]# vi /etc/profile
添加以下參數
1. if [ $USER = "oracle" ]; then
2. if [ $SHELL = "/bin/ksh" ]; then
3. ulimit -p 16384
4. ulimit -n 65536
5. else
6. ulimit -u 16384 -n 65536
7. fi
8. fi
5.5 切換到oracle使用者下,配置環境變量
環境變量必須要配置,否則安裝完Oracle資料庫後,好多指令會使用不友善
[[email protected] /]# su - oracle
[[email protected] ~]$ vi .bash_profile
1. # .bash_profile
2. # Get the aliases and functions
3. if [ -f ~/.bashrc ]; then
4. . ~/.bashrc
5. fi
6. # User specific environment and startup programs
7. #PATH=$PATH:$HOME/.local/bin:$HOME/bin
8. #export PATH
9. ORACLE_BASE=/u01/app/oracle
10. ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1
11. ORACLE_SID=shenlan
12. PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
13. LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
14. export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH
15. ~
16. ~
17. ".bash_profile" 18L, 430C written
[[email protected] ~]$ source .bash_profile
5.6 安裝oracle軟體
遠端調用圖形安裝oracle軟體 此處使用的X-manager軟體
以下出現的錯誤忽略即可!!![^footnote4] [^footnote4]:我覺得還是盡量把問題都解決掉比較好,根據提示所有的錯誤和警告都可以完美處理掉
産生這個問題的原因是,12c的第一版本,還不支援linux7,是以需要手工解決這個問題。
[[email protected] stubs]# cd /u01/app/oracle/product/12.1.0/db_1/lib/stubs
[[email protected] stubs]# cp * /bak
[[email protected] bak]# rm -rf /u01/app/oracle/product/12.1.0/db_1/lib/stubs/*
[[email protected] bak]# cp /u01/app/oracle/product/12.1.0/db_1/rdbms/lib/env_rdbms.mk /u01/app/oracle/product/12.1.0/db_1/rdbms/lib/env_rdbms.mk.orig
[[email protected] bak]# vi /u01/app/oracle/product/12.1.0/db_1/rdbms/lib/env_rdbms.mk
176行
修改前:
LINKTTLIBS=$(LLIBCLNTSH) $(ORACLETTLIBS) $(LINKLDLIBS)
修改後:
LINKTTLIBS=$(LLIBCLNTSH) $(ORACLETTLIBS) $(LINKLDLIBS) -lons
279-280行
修改前:
LINK=$(FORT_CMD) $(PURECMDS) $(ORALD) $(LDFLAGS) $(COMPSOBJS)
LINK32=$(FORT_CMD) $(PURECMDS) $(ORALD) $(LDFLAGS32) $(COMPSOBJS)
修改後:
LINK=$(FORT_CMD) $(PURECMDS) $(ORALD) $(LDFLAGS) $(COMPSOBJS) -Wl,--no-as-needed
LINK32=$(FORT_CMD) $(PURECMDS) $(ORALD) $(LDFLAGS32) $(COMPSOBJS) -Wl,--no-as-needed
3041-3042行
修改前:
TG4PWD_LINKLINE= $(LINK) $(OPT) $(TG4PWDMAI) \
$(LLIBTHREAD) $(LLIBCLNTSH) $(LINKLDLIBS)
修改後:
TG4PWD_LINKLINE= $(LINK) $(OPT) $(TG4PWDMAI) \
$(LLIBTHREAD) $(LLIBCLNTSH) $(LINKLDLIBS) -lnnz12
修改後,點選Retry,如下:
手工修正後,繼續安裝。
[[email protected] bak]# /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.
[[email protected] bak]# /u01/app/oracle/product/12.1.0/db_1/root.sh
Performing root user operation for Oracle 12c
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/12.1.0/db_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.
至此,oracle軟體安裝完成。
5.7 dbca建庫
使用X-manager調用圖形化界面。
[[email protected] ~]$ xhost +
access control disabled, clients can connect from any host
[[email protected] ~]$ dbca
5.8 配置監聽
[[email protected] ~]$ netca
驗證監聽狀态,如下:
[[email protected] ~]$ lsnrctl status
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 12-APR-2015 17:12:03
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hyldb)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date 12-APR-2015 17:03:10
Uptime 0 days 0 hr. 8 min. 54 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/hyldb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hyldb)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=hyldb)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/shenlan/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "shenlan" has 1 instance(s).
Instance "shenlan", status READY, has 1 handler(s) for this service...
Service "shenlanXDB" has 1 instance(s).
Instance "shenlan", status READY, has 1 handler(s) for this service...
The command completed successfully
5.9 配置Net Configuration Assistant
[[email protected] ~]$ netca
簡單示範:
[[email protected] ~]$ sqlplus scott/[email protected]
SQL*Plus: Release 12.1.0.1.0 Production on Sun Apr 12 17:14:44 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Last Successful login time: Sun Apr 12 2015 17:10:20 +08:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>
關于Net Configuration Assistant的配置一般是在用戶端進行配置,此處隻作為一種示範。
至此,在LINUX7下安裝Oracle12C完成。
轉載于:https://my.oschina.net/junehappylove/blog/853852