本文 基本參考了下面這篇文章
http://blog.csdn.net/gq5251/article/details/42004035
和http://www.linuxidc.com/Linux/2017-08/146528.htm
但是改正了一些錯誤
操作系統:CentOS Linux release 7.2.1511 (Core)?
oracle: oarcle (12.1.0.2.0) - Standard Edition (SE2)
幾點要注意的
關于虛擬機配置
我會告訴你,為了安裝oracle12,我失敗了3次,第四次的時候才安好把虛擬機都重新安裝了一回?
關于swap
它是硬盤中的一塊區域,當內存不夠的時候,操作系統就把它作為內存看。(大概就是這么個意思,大家就粗淺的按這個理解吧)
oracle安裝的時候,需要很大的內存和swap。具體需要多大呢?
我這么說我的第一個虛擬機內存2g,swap似乎也是2g
安裝到后面報這樣的錯誤
- INFO:?INFO:?Verification?Result?for?Node:localhost??
- ????INFO:?INFO:?Expected?Value:2.6845GB?(2814906.0KB)??
- ????INFO:?INFO:?Actual?Value:2GB?(2097148.0KB)??
- ????INFO:?INFO:?Error?Message:PRVF-7573?:?Sufficient?swap?size?is?not?available?on?node?"localhost"?[Required?=?2.6845GB?(2814906.0KB)?;?Found?=?2GB?(2097148.0KB)]??
- ????INFO:?INFO:?Cause:?The?swap?size?found?does?not?meet?the?minimum?requirement.??
- ????INFO:?INFO:?Action:?Increase?swap?size?to?at?least?meet?the?minimum?swap?space?requirement.??
然后我就在現有的虛擬機上增加swap,后面又說磁盤不夠。
硬盤一共20g
然后我就重裝了虛擬機
我會告訴你的物理機是16g內存,2t硬盤
nnd做人果然不能太寒酸,第二次給虛擬機分了8個g內存,swap20個g,硬盤100個g。后面一切都OK。nnd,有資源,就是這么任性。
顯示器的問題
所有的操作,最好在本機完成。
這個意思就是說,不要使用putty等工具。你就直接在虛擬機上做。
否則會報什么顯示器256色的問題
虛擬機崩潰
還是因為虛擬機配置太低了,會顯示
打不開磁盤“H:\centos-6.0-710\CentOS 64 位.vmdk”或它所依賴的某個快照磁盤類似的信息。
去
http://zyp88.blog.51cto.com/1481591/1566504看看,就知道怎么辦了。
下載oracle12c文件
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
? 去官網下就OK。不過,說一個小技巧。直接從官網下載很慢。怎么辦?
? 用迅雷!
? 地址呢?
? ?
? 下面的你要是還不知道,那我就沒法了。
? 下載完成后我們可以得到下面兩個文件
配置oracle環境
- yum?-y?install?binutils?compat-libcap1?compat-libstdc++-33?compat-libstdc++-33*.i686?elfutilslibelf-devel?gcc?gcc-c++?glibc*.i686?glibc?glibc-devel?glibc-devel*.i686?ksh?libgcc*.i686?libgcc?libstdc++?libstdc++*.i686?libstdc++-devel?libstdc++-devel*.i686?libaio?libaio*.i686?libaio-devel?libaio-devel*.i686?make?sysstat?unixODBC?unixODBC*.i686?unixODBC-devel?unixODBCdevel*.i686?libXp??
?建立用戶,組,安裝目錄
建立用戶和組
- ???????groupadd?oinstall??
- groupadd?dba??
- groupadd?oper??
- useradd?-g?oinstall?-G?dba,oper?oracle??
- echo?"123456"?|?passwd?--stdin?oracle??
注釋:最后那個就是給oracle這個用戶,設置密碼123456
安裝目錄
- mkdir?-p?/orcl/app/oracle/product/12.1.0/db_1??
- chown?-R?oracle:oinstall?/orcl/app??
- chmod?-R?775?/orcl/app??
修改參數
內核參數
vi /etc/sysctl.conf
- ???????fs.aio-max-nr?=?1048576??
- fs.file-max?=?6815744??
- kernel.shmall?=?2097152??
- kernel.shmmax?=?1200000000????
- 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??
改好后,使之生效
sysctl -p
另外 上面的kernel.shmmax = 1200000000可能會有問題,后面咱們再說。
或者你直接現在就寫成4098955264?
改文件限制
vi /etc/security/limits.conf
- ???????oracle?soft?nproc?2047??
- oracle?hard?nproc?16384??
- oracle?soft?nofile?1024??
- oracle?hard?nofile?65536??
- oracle?soft?stack?10240??
注意:修改此文件是即時生效的,但可能要重登錄后再看
vi /etc/pam.d/login
- #session?required?/lib/security/pam_limits.so??
- ?required?pam_limits.so??
注意:如果在login文件里就沒有
session required /lib/security/pam_limits.so
這一項,那也就不用注釋掉它了。直接把
session required pam_limits.so
復制進去就OK
修改 ulimit
vi /etc/profile
- if?[?$USER?=?"oracle"?];?then??
- if?[?$SHELL?=?"/bin/ksh"?];?then??
- ulimit?-p?16384??
- ulimit?-n?65536a??
- else??
- ulimit?-u?16384?-n?65536??
- fi??
- fi??
進到/etc/profile里 里面本身就有內容,把上面的內容加入進去。
修改 oracle 用戶環境變量
vi ~oracle/.bash_profile
- ???????ORACLE_BASE=/orcl/app/oracle??
- ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1??
- ORACLE_SID=orcl??
- export?ORACLE_BASE?ORACLE_HOME?ORACLE_SID??
- PATH=$ORACLE_HOME/bin:$PATH??
- export?PATH??
注釋:
(這個地方 ORACLE_SID 需要和之后安裝界面的 Global database name 保持一致,也是orcl)
另外我多說幾句。
咱們都知道在linux里,~代表home目錄
對root用戶來說 ~就是/root
對其他用戶,例如testuser來說或,~就是/home/testuser
那 ~oracle是什么鬼?
此時我的用戶還是root
按照我的理解 ~oracle應該就是/root/oracle
但實際情況是 上面的命令開啟的目錄是 /home/oracle
見下圖:
安裝? ??
- ???????#?su?-?oracle??
- $?cd?/orcl/app/oracle??
- $?unzip?linuxamd64_12102_database_se2_1of2.zip??
- $?unzip?linuxamd64_12102_database_se2_2of2.zip??
- $?export?LANG="en_US"??
- $?cd?/orcl/app/oracle/database??
- $?./runInstaller??
? ? ? ? ? ?安裝的時候,不能是root用戶,所以得su - oracle
? ? ? ? ? ? 在運行./runInstaller的時候,可能會報錯誤說顯示器256色的問題(大概就是這么個意思)如果切換到oracle了還不行,那就重新以oracle用戶登陸
圖形界面
上面的步驟都走完了之后,就會出現圖形界面
? ? ? ? 關于這個 大家參考
http://ycrsjxy.blog.51cto.com/618627/1598712
從這里開始看:

在這期間報了一個錯誤,下面是解決思路,一開始以為不上網不讓安裝,其實隨便
| While I was installing Oracle 12c database on Fedora 20 I encountered this error which wasted my 2 days.  "[INS-30131] Initial setup required for the execution of installer validations failed." In the details it says this: Cause?-?Failed to access the temporary location. Action?-?Ensure that the current user has required permissions to access the temporary location. Additional Information:?-?Framework setup check failed on all the nodes ?-?Cause:?Cause Of Problem Not Available ?-?Action:?User Action Not Available Summary of the failed nodes fedora ?-?Version of exectask could not be retrieved from node "fedora" ?-?Cause:?Cause Of Problem Not Available ?-?Action:?User Action Not Available I have tried a lot of things like restarting the computer and changing the permissions of the tmp folder etc. But none of these methods worked. Plz help me out from this. Any help will be appreciated. |
o see the real reason of this error in console output, use:
./runInstaller -debug -logLevel finest
In my case the reason was no execute permission for the file: '/tmp/CVU_12.1.0.2.0_oracle/exectask.sh'
So you simply need to add execute permission to all scripts and executable files in this directory, without exiting the installer.Open the second console and use:
cd /tmp/CVU_12.1.0.2.0_oracle
chmod +x *.sh
chmod +x exectask
chmod +x cvuhelper
Then resume installation. It should install without further problems!
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
在第四步,oraclebase就選/orcl/app/oracle
software loaction 就選/orcl/app/oracle/product/12.1.0/db_1
后面的database file location是自動生成的 是/orcl/app/oracle/oradata
在后面的characterset 如果沒有圖示的webmswin1252 就選哪個ntf8
global data name就是前面的orcl
一般情況下software loaction不會出問題,如果說找不到文件什么的
就返回到system class然后再回第四步 一般就OK
還有Administrative password 比較麻煩死規矩特別多。
我最后設置的密碼包含了大寫英文小寫英文還有數字,并且以字母開頭
總之我到這一步的時候,碰到了很多問題
到安裝的第6步,prerequisity check的時候
可能會說kernel.shmmax = 1200000000 ?不夠
那么你點擊fix&checkagain,然后會彈出一個框,里面指定了腳本,下面有提示,自己看看步驟,然后執行就能修復shmmax的問題
然后再繼續
如下圖,已經說得很清楚了,執行第二個sh的時候,會有提示,但是你不用管,直接回車

到后面設置用戶口令的時候,點擊password management按鈕,出來一個表格,可忽視,直接OK。
啟動
1.#su - oracle 切換到 oracle 用戶且切換到它的環境
2.$lsnrctl status 查看監聽及數據庫狀態
3.$lsnrctl start 啟動監聽
4.$sqlplus / as sysdba 以 DBA 身份進入 sqlplus
5.SQL>startup 啟動 db
?停止
1.#su - oracle 切換到 oracle 用戶且切換到它的環境
2.$lsnrctl stop 停止監聽
3.$sqlplus / as sysdba 以 DBA 身份進入 sqlplus
4.SQL>SHUTDOWN IMMEDIATE 關閉 db