天天看點

oracle 11g在linux下的安裝指引-tina

一、安裝前準備工作 

記憶體 1.5g,至少1g 

#grep  memtotal  /proc/meminfo 

swap交換空間  3g 

#grep swaptotal  /proc/meminfo 

磁盤  至少20g 

#df –ah 

二、安裝所需的依賴包 

1、首先要确認你的作業系統的位數和版本,依賴包必須要是相符的。 

#getconf  long_bit        

#cat  /etc/issue  

本指引以rhel5.7,64位的系統為例。注:不同版本的系統可能需要的包不同。 

2、使用rpm –qa| grep 軟體包名稱   

逐個檢視是否已經安裝下方圖中的所有包。 

3、如果有未安裝的包,可使用下面兩種方式擷取安裝。 

(1)使用yum工具 

#cd /etc/yum.repos.d/ 

#lftp 10.0.15.33  

>get repo1/repos/rehl5.7.repo  擷取ftp上的相應repo檔案,也可以直接挂載iso檔案。 

yum list  安裝包名     查找是否有需要的包,查找的時候最好不要帶上後面的數字。   

yum install  安裝包名     

(2)使用rpm安裝 

最直接的方式是去下載下傳缺失的rpm檔案,然後使用rpm –ivh  xxxxx.rpm 安裝。 

但是由于這些包之間有依賴關系,有些包安裝的時候會提示conflict with另一個包。 

yum install -y 

binutils 

compat-libstdc++ 

elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static 

gcc gcc-c++ 

glibc glibc-common glibc-devel glibc-headers 

kernel-headers ksh libaio libaio-devel 

libgcc libgomp libstdc++ libstdc++-devel 

make sysstat unixodbc unixodbc-devel 

三、建立oracle使用者 

#groupadd oinstall     oracle安裝組oinstall 

#groupadd dba          資料庫管理者組dba 

#makdir  /u01 

#useradd –g oinstall –g dba  -d  /u01/oracle  oracle建立使用者oracle  主組oinstall 其他組dba  主目錄是/u01/oracle  

注意:如果不想用oracle這個使用者名,标黃處需修改。 

#passwd oracle   密碼 oracle   

若想删除使用者: 

userdel –r oracle   會把/u01/oracle這個目錄删掉,/u01保留 

四、修改核心參數 

vi  /etc/sysctl.conf  在下方加如下參數: 

為了使上述配置生效而不重新開機系統,執行如下指令 

#/sbin/sysctl –p 

如果安裝過程中修改了核心參數,就需要再次輸入下面指令,使生效。 

注:後面安裝檢測時,如果設定不達到要求,會有提示。 

fs.aio-max-nr = 1048576 

fs.file-max = 6815744 

kernel.shmall = 2097152 

kernel.shmmax = 2070413312 

kernel.shmmni = 8192 

kernel.sem = 550 32000 10100 1280 

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 

五、修改使用者限制 

#vi /etc/security/limits.conf 在下方加入如下内容: 

注:此處的oracle是前面建立的資料庫使用者名稱。 

資料庫的使用者必須是linux的系統使用者。 

oracle soft nproc 2047 

oracle hard nproc 16384 

oracle soft nofile 1024 

oracle hard nofile 65536 

六、修改使用者驗證選項 

#vi /etc/pam.d/login  在下方加入如下内容: 

session   required    pam_limits.so 

七、修改使用者配置檔案 

#vi /etc/profile  在下方加入如下内容: 

if [ $user = "oracle" ];then 

   if  [ $shell = "/bin/ksh" ];then 

        ulimit -p 16384 

        ulimit -p 65536 

   else 

        ulimit -u 16384 -n 65536 

   fi 

fi 

注:[ ]這個符号中間的内容一定不能挨着符号,要空格  如果沒有空格,那麼切換使用者的時候可能會報錯,-bash[oracle:command cannot find.  

user的名字必須與前面建立的oracle一緻。 

[root@oratest u01]# su - oracle 

[oracle@oratest ~]$ pwd 

/u01/oracle 

八、安裝目錄配置 

#mkdir -p  /u01/orainventory    -p是指如果父目錄不存在,就建立。 

#chown -r  oracle:oinstall  /u01/    這裡是将/u01/目錄及其所有子目錄的屬主改為組oinstall下的oracle使用者,後續添加進來的文檔,會保持原有的屬主,是以若有新增内容,可重新修改屬主。 

#chmod -r 755 /u01/    将/u01的權限修改rwxr-xr-x 

九、修改使用者bash shell 

#su – oracle 切換到oracle使用者,在他的家目錄下/u01/oracle下有一個.bash_profile 

注:如果前面沒有指定,那麼預設就是/home/使用者名目錄下。 

#vi .bash_profile,在下方加如下内容: 

path=$path:$home/bin 

export path 

export oracle_base=/u01 

export oracle_home=$oracle_base/oracle 

export oracle_sid=tinadb 

export path=$oracle_home/bin:$path:$home/bin 

export ld_library_path=$oralce_home/lib:/usr/lib 

#env |grep ora 可以檢視環境變量是否完成。 

[oracle@oratest ~]$ env |grep ora 

oracle_sid=tinadb 

oracle_base=/u01 

oracle_home=/u01/oracle 

注:也可以使用root使用者vi /etc/profile,添加相同内容。 

十、開始安裝 

1、安裝工具 

由于使用secure.crt使用協定ssh2,隻能使用指令行,不能圖形化。是以我們可以使用一個xmanager工具進行圖形化安裝。在所有程式打開xmanager-passive,此時不會彈出視窗,但右下角有一個圖示。 

切換到oracle使用者 

$export display=10.0.11.89:0.0   此ip位址是你本地的ip位址。 

$xhost + 

可能會報錯: 

-bash: xhost: command not found 

http://archive.download.redhat.com/pub/redhat/linux/ 可以下載下傳需要的包  我直接忽略了 

補充說明: 

xhost + 是使所有使用者都能通路xserver. 

xhost + ip使ip上的使用者能夠通路xserver. 

xhost + nis:user@domain使domain上的nis使用者user能夠通路 

xhost + inet:user@domain使domain上的inet使用者能夠通路。 

2、解壓安裝包 

unzip xxx.zip  将oracle的安裝包直接解壓,解壓成一個database的目錄。 

[root@oratest tmp]# yum install -y unzip 

[oracle@oratest tmp]$ unzip p10404530_112030_linux-x86-64_1of7.zip 

[oracle@oratest tmp]$ unzip p10404530_112030_linux-x86-64_2of7.zip 

3、運作安裝腳本,這個腳本在database目錄裡面 

./runinstaller 

[oracle@oratest database]$ ./runinstaller 

starting oracle universal installer... 

checking temp space: must be greater than 120 mb.   actual 41787 mb    passed 

checking swap space: must be greater than 150 mb.   actual 3967 mb    passed 

checking monitor: must be configured to display at least 256 colors 

    >>> could not execute auto check for display colors using command /usr/bin/xdpyinfo. check if the display variable is set.    failed <<<< 

some requirement checks failed. you must fulfill these requirements before 

continuing with the installation, 

continue? (y/n) [n] 

pdksh有的時候跟ksh不相容,要先解除安裝ksh 

6.4版本的必須安裝pdksh,不能安裝ksh。 

先使用rpm -e 解除安裝已經安裝的ksh,再安裝pdksh 

[root@oratest tmp]# rpm -qa |grep ksh 

ksh-20120801-28.el6_7.3.x86_64 

[root@oratest tmp]# rpm -e ksh-20120801-28.el6_7.3.x86_64 

[root@oratest tmp]# rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm 

warning: pdksh-5.2.14-37.el5_8.1.x86_64.rpm: header v3 dsa/sha1 signature, key id e8562897: nokey 

preparing...                ########################################### [100%] 

   1:pdksh                  ########################################### [100%] 

>>> ignoring required pre-requisite failures. continuing... 

preparing to launch oracle universal installer from /tmp/orainstall2015-12-09_05-11-38pm. please wait ...[oracle@oratest database]$ exception in thread "main" jaa.lang.unsatisfiedlinkerror: /tmp/orainstall2015-12-09_05-11-38pm/jdk/jre/lib/amd64/xawt/libmawt.so: libxext.so.6: cannot open shared object file: no such file o directory 

這裡安裝 

yum install -y libxp  libxp-devel  libxpm  libxpm-devel 

4、彈出安裝界面 

第1步:配置安全更新 

此處都可以不填,不勾選。 

第2步:下載下傳軟體更新 

一般不用更新,勾選跳過 

skip software updates 

第3步:安裝選項 

根據需要,選擇建立和配置一個資料庫 

create and configure a database 

第4步:系統類 

桌面類 

伺服器類 

根據需要,選擇伺服器類。 

server class 

第5步:網絡安裝選項 

根據需要,選擇單執行個體資料庫安裝 

single instance database installation you want to perform 

第6步:安裝類型 

典型安裝 

進階安裝 

一般情況下,我們可以選擇典型安裝,但如果要設定一些參數,最好選擇進階安裝。 

進階安裝步驟相對多一些,此處不一一截圖,根據需要選擇即可,沒有特别要求的情況下預設既可。 

注:我們的測試和開發環境,字元集設定為al32utf8,如下圖所示。 

安裝完成後再設定,一般都很難成功,是以要特别注意。 

advanced install 

第7步:資料庫版本:enterprise edition(4.5gb) 

第8步:安裝位置:選擇剛剛定義好的oracle_base目錄和oracle_home目錄 

/u01  和 /u01/oracle 

第9步:create inventory 

/u02/orainventory 

第10步:configuration type 

general purpose/transaction processing 

第11步:database identifiers 

global database name :tinadb 

oracle service identifier(sid):tinadb 

第12步:configuration options 

memory:拖動進度條  調整合适的記憶體大小 

character sets :use unicode(al32utf8) 

第13步:management options:預設即可 

第14步:database storage 

file system:  一般選這個 

specify database file location :/u01/oradata  一般都是oracle_base/oradata 

oracle automatic storage management  自動存儲管理asm,安裝了此軟體的話就選這個 

第15步: 

backup and recovery 

do not enable automated backups 

第16步:schema passwords: 

use the same password for all accounts 

根據需要設定 

第17步:operating system groups 

選擇osdba和osoper的使用者組 

第18步:prerequisite checks 先決條件檢查 

根據報錯提示解決問題,然後點選check again 

此處會自動檢測,是否符合安裝要求,檢測若是出錯,請根據提示進行相應修改。 

常見錯誤有 

1、該機器的名稱為cnsz03v10132 

報如下錯誤時,隻需要vi /etc/hosts 

添加機器的ip位址 和該名稱即可。 

2、核心參數的設定不達期望值,或者某一個依賴包未安裝。 

根據提示修改或者安裝,再重新檢測。 

注:此檢測過程雖失敗,但并不需要退出安裝,待修改後重新檢測通過既可。 

第19步:install 

安裝過程中,會提示用root執行兩個腳本。提示如下: 

(1)執行第一個腳本: 

/u01/orainventory/orainstroot.sh 

[root@oratest orainventory]# ./orainstroot.sh 

changing permissions of /u01/orainventory. 

adding read,write permissions for group. 

removing read,write,execute permissions for world. 

changing groupname of /u01/orainventory to oinstall. 

the execution of the script is complete. 

(2)執行第二個腳本,需要填寫bin的路徑/usr/bin 

/u01/oracle/root.sh 

[root@oratest oracle]# ./root.sh 

performing root user operation for oracle 11g 

the following environment variables are set as: 

    oracle_owner= oracle 

    oracle_home=  /u01/oracle 

enter the full pathname of the local bin directory: [/usr/local/bin]: /usr/bin 

安裝完成 

安裝完成後,在oracle使用者下進行連接配接測試。 

$sqlplus /nolog 

sql>conn / as sysdba 

connected  連接配接成功! 

1、使用dbca在已有的資料庫上建立執行個體 

#su – oracle 

$cd $oracle_home/bin 

同樣可以使用圖形化界面進行安裝 

$export display=10.0.11.89:0.0   

執行指令 

./dbca 

建立過程與前面類似,根據實際需要選擇即可。 

2、配置網絡服務 

./netmgr 

以上為全部指引内容。