CentOS7安裝Oracle12c

準備

  • 安裝好CentOS7
  • 下載好linuxx64_12201_database.zip(Oracle12c安裝文件)

安裝步驟

  1. 更新yum
[root@centos7 ~]# yum update -y
  1. 添加操做系統核心參數
  • 添加修改Shell限制
vi /etc/security/limits.conf

添加以下參數:html

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
  • 添加Linux內核參數
vi /etc/sysctl.conf

添加以下參數:linux

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
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
  • 檢查參數是否生效
[root@centos7 ~]# sysctl -p
[root@centos7 ~]# sysctl -a
  1. 建立相關用戶和用戶組
/usr/sbin/groupadd -g 54321 oinstall
/usr/sbin/groupadd -g 54322 dba
/usr/sbin/groupadd -g 54323 oper
/usr/sbin/groupadd -g 54324 backupdba
/usr/sbin/groupadd -g 54325 dgdba
/usr/sbin/groupadd -g 54326 kmdba
/usr/sbin/groupadd -g 54327 asmdba
/usr/sbin/groupadd -g 54328 asmoper
/usr/sbin/groupadd -g 54329 asmadmin
/usr/sbin/groupadd -g 54330 racdba
/usr/sbin/useradd -u 54321 -g oinstall -G dba,asmdba,oper oracle
/usr/sbin/useradd -u 54322 -g oinstall -G asmdba,asmadmin grid

設置oracle和grid用戶密碼:c++

[root@centos7 ~]# passwd oracle
[root@centos7 ~]# passwd grid
  1. (關鍵步驟)更新CentOS7依賴包
[root@centos7 ~]# yum install -y binutils.x86_64 compat-libcap1.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc.i686 glibc.x86_64 \
glibc-devel.i686 glibc-devel.x86_64 ksh compat-libstdc++-33 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 \
libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libXi.i686 libXi.x86_64 \
libXtst.i686 libXtst.x86_64 make.x86_64 sysstat.x86_64

若是CentOS7沒有安裝X Window,還要安裝一X Window的相關軟件:git

[root@centos7 ~]# yum groupinstall -y "X Window System"
[root@centos7 ~]# yum install cjkuni-uming-fonts
  1. 經過oracle用戶上傳linuxx64_12201_database.zip文件github

  2. 在使用oracle用戶進行安裝sql

  • 登陸oracle用戶
ssh -X oracle@192.168.1.100

這樣就能夠將服務器端的界面輸出到客戶端。數據庫

  • 啓動oracle 12c安裝界面
[oracle@centos7 ~]$ unzip linuxx64_12201_database.zip
[oracle@centos7 ~]$ cd database
[oracle@centos7 database]$ ./runInstaller
  1. Oracle12c軟件安裝過程

去掉接收安全更新

選擇僅安裝數據庫軟件

選擇單實例數據庫安裝

選擇企業版7.5G真大

注意一下這兩個目錄

# /home/oracle/:是oracle用戶的home目錄
# 因此Oracle基目錄默認是操做系統用戶的home目錄下面的app/oracle
# /home/oracle/app/oracle/product/12.2.0/dbhome_1
# 這裏意味着其餘oracle數據庫軟件目錄都放在Oracle基目錄的product目錄下面,這裏能夠看出我安裝的oracle軟件版本爲12.2.0

oralce安裝目錄清單

# /home/oracle/app/oraInventory: 與Oracle基目錄並列在同一個app父目錄下面

繼續保持默認

檢查OS是否符合安裝Oracle最低安裝條件,這個步驟很重要

點擊進入Oracle的安裝進度界面

**Note:**值得注意的是最後須要root用戶執行2次腳本。centos

root腳本位置

[root@centos7 ~]# /home/oracle/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 /home/oracle/app/oraInventory to oinstall.
The execution of the script is complete.
# 把/home/oracle/app/oraInventory目錄的讀寫權限給oinstall用戶組
[root@centos7 ~]# /home/oracle/app/oracle/product/12.1.0/dbhome_1/root.sh
Performing root user operation.
The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /home/oracle/app/oracle/product/12.1.0/dbhome_1
Enter the full pathname of the local bin directory: [/usr/local/bin]: <PRESS ENTER>
   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.
Do you want to setup Oracle Trace File Analyzer (TFA) now ? yes|[no] :
yes
Installing Oracle Trace File Analyzer (TFA).
Log File: /home/oracle/app/oracle/product/12.2.0/dbhome_1/install/root_localhost.localdomain_2017-05-22_14-31-35-542560085.log
Finished installing Oracle Trace File Analyzer (TFA)
# 告訴你一些oracle的基本安裝信息,最後問你是否安裝TFA,我選擇了yes,等一段時間就能夠了

執行完成點擊肯定,就安裝完成了 到這裏就安裝完成了Oracle數據庫軟件。安全

8.配置oracle環境變量

[oracle@centos7 ~]$ vi /home/oracle/.bash_profile
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/home/oracle/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID # 注意這裏到oracle sid
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

使配置生效:bash

[oracle@centos7 ~]$ . .bash_profile

9.dbca建立數據庫

dbca建立數據庫

高級配置

通常用途或事務處理

注意這裏的SID和PDB名稱

勾選OMF

快速恢復區大小,暫時使用最小要求的8190MB **NOTE:**必定要啓用歸檔,歸檔很重要的。

監聽程序名稱

保持默認

記住字符集

![去掉EM配置(http://upload-images.jianshu.io/upload_images/650171-aaec1b727514dc36.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

簡單配置口令

準備建立數據庫

須要從新設置快速恢復區大小

從新設置快速恢復區大小爲10713MB

準備建立

建立中

![這樣就建庫完成了(http://upload-images.jianshu.io/upload_images/650171-e2ee72a531107e7b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) **Note:**這裏建議仍是去口令管理,修改一下SYS和SYSTEM賬戶。

10.檢查建立是否成功

[oracle@oracle ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Mon May 22 16:34:08 2017

Copyright (c) 1982, 2016, Oracle.  All rights reserved.


???:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL>

兩個小問題

中文亂碼解決——配置NLS_LANG環境變量

這裏出現亂碼了。

SQL> select userenv('language') from dual;

USERENV('LANGUAGE')
----------------------------------------------------
SIMPLIFIED CHINESE_CHINA.AL32UTF8

SQL> quit
# 添加環境便利NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
[oracle@oracle ~]$ vi .bash_profile
NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"; export NLS_LANG
[oracle@oracle ~]$ . .bash_profile

再次sqlplus登陸就沒有亂碼了。

sqlplus上下鍵亂碼問題——安裝rlwrap包

https://github.com/hanslub42/rlwrap 到這裏下載源代碼進行安裝,由於yum沒有rlwrap,下載後上傳到root的home目錄,進行源碼安裝。

[root@oracle ~]# tar xvf rlwrap-0.43.tar.gz
[root@oracle ~]# cd rlwrap-0.43/
...
checking for readline in -lreadline... no
configure: error:
You need the GNU readline library(ftp://ftp.gnu.org/gnu/readline/ ) to build
this program!

這裏表示rlwrap須要readline依賴。

[root@oracle rlwrap-0.43]# yum install readline-static.x86_64

繼續編譯安裝rlwrap:

make
make check
make install

安裝rlwrap成功後,配置環境變量:

[root@oracle ~]# vi .bash_profile
alias rlsqlplus='rlwrap sqlplus'
alias rlrman='rlwrap rman'
[oracle@oracle ~]$ source .bash_profile

再次使用rlsqlplus登陸oralce,就能夠正常調用上下鍵了,不會出現亂碼了:

[oracle@oracle ~]$ rlsqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on 星期一 5月 22 17:15:44 2017

Copyright (c) 1982, 2016, Oracle.  All rights reserved.


鏈接到:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> select userenv('language') from dual;

USERENV('LANGUAGE')
----------------------------------------------------
SIMPLIFIED CHINESE_CHINA.AL32UTF8

SQL> select userenv('language') from dual;

USERENV('LANGUAGE')
----------------------------------------------------
SIMPLIFIED CHINESE_CHINA.AL32UTF8

SQL> quit
從 Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production 斷開

參考:
Linux下SQLPlus中文亂碼處理
rlwrap for Command Line History and Editing in SQL*Plus and RMAN on Linux
oracle單實例12.2.0.1安裝
Oracle Database 12c Installation on CentOS 7

相關文章
相關標籤/搜索