首頁技術文章正文

CentOS 下安裝oracle數(shù)據(jù)庫圖文教程【超級詳細】

更新時間:2019-12-11 來源:黑馬程序員 瀏覽量:

一、前言

本次實施內(nèi)容是,oracle單實例系統(tǒng)文件安裝,操作系統(tǒng)為CentOS 6.9,數(shù)據(jù)庫版本11.2.0.4。


ip主機名數(shù)據(jù)庫實例ORACLE_SID
10.1.1.1heima.itcast.cnora11gora11g

 

二、oracle軟件安裝

1、以下用root賬號操作

1.1 配置本地yum源

Yum(全稱為 Yellow dog Updater, Modified)是一個在Fedora和RedHat以及SUSE、CentOS中的Shell前端軟件包管理器?;禦PM包管理,能夠從指定的服務器自動下載RPM包并且安裝,可以自動處理依賴性關系,并且一次安裝所有依賴的軟體包,無須繁瑣地一次次下載、安裝。推薦了解黑馬程序員linux云計算+運維開發(fā)課程。

·掛載鏡像到本地空目錄

[root@heima ~]# mkdir /mnt/cdrom

[root@heima ~]# mount -o ro /dev/sr0 /mnt/cdrom

·創(chuàng)建配置文件

[root@heima ~]# cat /etc/yum.repos.d/local.repo

[local]

name=local yum

baseurl=file:///mnt/cdrom

enabled=1

gpgcheck=0

 

說明:如果只配置本地yum源,那可以刪除/etc/yum.repos.d/目錄下Centos自帶的所有文件,然后自己創(chuàng)建以.repo結尾文件即可,內(nèi)容如上。

·創(chuàng)建yum緩存

[root@heima ~]# yum clean all

[root@heima ~]# yum makecache

1.2 安裝所需依賴包

[root@heima ~]# yum -y install compat-libstdc++-33 libaio-devel elfutils-libelf-devel

注意:在后面安裝軟件的時候可以再看需要安裝哪些包,然后裝上就行

1.3 創(chuàng)建用戶組和用戶(具體看要求決定ID號)

[root@heima ~]# groupadd -g 1000 oinstall

[root@heima ~]# groupadd -g 1001 dba

 

[root@heima ~]# useradd -u 1000 -g oinstall -G dba oracle

[root@heima ~]# id oracle

uid=1000(oracle) gid=1000(oinstall) groups=1000(oinstall),1001(dba)

 

[root@heima ~]# echo oracle|passwd --stdin oracle

Changing password for user oracle.

passwd: all authentication tokens updated successfully.

1.4 創(chuàng)建相應數(shù)據(jù)目錄(安裝和數(shù)據(jù)目錄)

[root@heima ~]# mkdir -p /u01/app/{oracle,oradata,oraInventory}

 

[root@heima ~]# chown -R oracle.oinstall /u01/app/

[root@heima ~]# chmod -R 775 /u01/app/*

1.5 修改oracle用戶資源限制

[root@heima ~]# cat >> /etc/security/limits.conf <<EOF

> oracle soft nproc 2047

> oracle hard nproc 16384

> oracle soft nofile 1024

> oracle hard nofile 65536

> EOF

 

[root@heima ~]# grep 'limit' /etc/pam.d/system-auth

session     required      pam_limits.so

1.6 配置系統(tǒng)資源限制(內(nèi)核參數(shù))

[root@heima ~]# cat >> /etc/sysctl.conf  << EOF

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 = 1048586

EOF

說明:以上是參考值,具體值根據(jù)實際情況進行調(diào)整

kernel.shmmax = 4294967295 (4G) (需要設置的比sga內(nèi)存大,sga為物理內(nèi)存內(nèi)存的80%);如果物理內(nèi)存是16G,則sga可以設置為12G,kernel.shmmax = 15032385536(14G)

[root@heima ~]# sysctl -p       讓內(nèi)核改變立即生效

1.7 配置/etc/hosts文件

[root@heima ~]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

10.1.1.1 heima.itcast.cn heima

 

1.8 關閉防火墻和selinux

[root@heima ~]# service iptables stop

[root@heima ~]# chkconfig iptables off

[root@heima ~]# sed -i '/SELINUX=/cSELINUX=disabled' /etc/selinux/config

2、以下用oracle賬號操作

2.1 配置oracle用戶shell環(huán)境

[root@heima ~]# su - oracle

[oracle@heima ~]$ vim .bash_profile

文件下面追加以下內(nèi)容:

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

export ORACLE_SID=ora11g

export PATH=$PATH:$ORACLE_HOME/bin

export LD_LIBRARY_PATH=$ORACLE_HOME/dbhome_1/lib:/lib:/usr/lib


2.2 安裝oracle軟件

·下載oracle軟件并解壓

[oracle@heima ~]$ ls

database

p13390677_112040_Linux-x86-64_1of7.zip

p13390677_112040_Linux-x86-64_2of7.zip


·進入到解壓目錄里進行安裝

[root@heima ~]# xhost +

[oracle@heima ~]$ cd database

[oracle@heima ~]$ ./runInstaller

錯誤提示:

1576056555173_oracle數(shù)據(jù)庫安裝01.jpg

解決辦法:

安裝VNC服務,使用MobaXterm工具或其他客戶端連接VNC服務端

[root@heima ~]# yum -y install tigervnc-server

啟動服務:

[root@heima ~]# vncserver :1

New 'heima.itcast.cn:2 (root)' desktop is heima.itcast.cn:2

Starting applications specified in /root/.vnc/xstartup

Log file is /root/.vnc/heima.itcast.cn:1.log

 

① 跳過更新提示

1576056579134_oracle數(shù)據(jù)庫安裝02.jpg

1576056600512_oracle數(shù)據(jù)庫安裝03.jpg

② 選擇只安裝軟件

1576056625462_oracle數(shù)據(jù)庫安裝04.jpg


③ 安裝類型選項,選擇單實例安裝

1576056642953_oracle數(shù)據(jù)庫安裝05.jpg


④ 選擇安裝軟件的語言

1576056734790_oracle數(shù)據(jù)庫安裝06.jpg

⑤ 選擇安裝版本

1576056777739_oracle數(shù)據(jù)庫安裝07.jpg

⑥ 選擇軟件安裝路徑

1576056799030_oracle數(shù)據(jù)庫安裝08.jpg

⑦ 指定相關文件目錄及組

 

1576056831172_oracle數(shù)據(jù)庫安裝09.jpg

1576056850081_oracle數(shù)據(jù)庫安裝10.jpg

⑧ 環(huán)境檢查,需要依賴包根據(jù)提示安裝即可

1576056891318_oracle數(shù)據(jù)庫安裝11.jpg

以下包可以忽略,繼續(xù)往下

1576056931799_oracle數(shù)據(jù)庫安裝12.jpg

⑨ 開始安裝

 

1576056950023_oracle數(shù)據(jù)庫安裝13.jpg

1576056986641_oracle數(shù)據(jù)庫安裝14.jpg


⑩ 在root用戶下執(zhí)行兩個腳本

1576057014436_oracle數(shù)據(jù)庫安裝15.jpg

 

在root用戶下運行兩個腳本的結果:

1576057078085_oracle數(shù)據(jù)庫安裝15.1.jpg

執(zhí)行完畢腳本后,點擊OK,安裝完畢!

 

三、oracle數(shù)據(jù)庫安裝

1、運行命令:dbca創(chuàng)建數(shù)據(jù)庫

 [oracle@heima ~]$ dbca

1576057105351_oracle數(shù)據(jù)庫安裝16.jpg

1576057114209_oracle數(shù)據(jù)庫安裝17.jpg

2、選擇建庫類型

1576057146485_oracle數(shù)據(jù)庫安裝18.jpg


3、創(chuàng)建庫名與實例名

1576057186217_oracle數(shù)據(jù)庫安裝19.jpg


4、跳過安裝OEM

1576057199564_oracle數(shù)據(jù)庫安裝20.jpg


5、設置密碼

1576057240188_oracle數(shù)據(jù)庫安裝21.jpg

6、指定數(shù)據(jù)庫安裝目錄(數(shù)據(jù)文件等)

1576057259972_oracle數(shù)據(jù)庫安裝22.jpg

7、開啟歸檔

1576057275439_oracle數(shù)據(jù)庫安裝23.jpg

8、默認選項

1576057305555_oracle數(shù)據(jù)庫安裝24.jpg

9、設置Oracle共享內(nèi)存占物理內(nèi)存的70%~80%

1576057326202_oracle數(shù)據(jù)庫安裝25.jpg

10、設置Processes為800

1576057351852_oracle數(shù)據(jù)庫安裝26.jpg

11、選擇字符集需注意

1576057382195_oracle數(shù)據(jù)庫安裝27.jpg


12、選擇連接模式

1576057413482_oracle數(shù)據(jù)庫安裝28.jpg


13、日志大小分配512M

1576057444706_oracle數(shù)據(jù)庫安裝29.jpg


14、記錄建庫腳本(目錄自定義)

1576057467871_oracle數(shù)據(jù)庫安裝30.jpg

15、開始安裝

1576057489123_oracle數(shù)據(jù)庫安裝31.jpg

四、安裝完畢配置監(jiān)聽

[oracle@ esxoradb ~]$ netmgr

1576057513795_oracle數(shù)據(jù)庫安裝32.jpg

1576057525796_oracle數(shù)據(jù)庫安裝33.jpg


五、本地訪問oracle數(shù)據(jù)庫

[oracle@heima admin]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Fri Sep 6 07:03:44 2019

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

 

SQL> conn sys as sysdba     管理員身份連接數(shù)據(jù)庫

Enter password:             輸入密碼,密碼不顯示

Connected.

SQL>

 

SQL> select INSTANCE_NAME,VERSION,DATABASE_STATUS from v$instance;

 

INSTANCE_NAME    VERSION           DATABASE_STATUS

---------------- ----------------- -----------------

ora11g           11.2.0.4.0        ACTIVE

分享到:
在線咨詢 我要報名
和我們在線交談!