CentOS6.5下Oracle11G-R2安裝、卸載,linuxoracle11gr2

來源:互聯網
上載者:User

CentOS6.5下Oracle11G-R2安裝、卸載,linuxoracle11gr2

CentOS6.5下Oracle11G-R2安裝、卸載
資源(包括本人所有安裝過程中,系統備份檔案):http://download.csdn.net/detail/attagain/7700437

一、 硬體要求
本部分內容命令,均以root使用者執行。
1、 記憶體
建議記憶體應大於2G以上,1G可以運行,但比較吃力。
記憶體查看命令:
[root@tsp-rls-dbserver /]# cat /proc/meminfo

[root@tsp-rls-dbserver /]# free -m
total       used       free     shared    buffers     cached
Mem:         32062       1301      30760          0         40        552
-/+ buffers/cache:        708      31354
Swap:        16095          0      16095
2、 交換分區
交換分區大小,通常設為記憶體的1.5倍以上,也可以根據實際情況進行調整。
交換分區查看命令:
[root@tsp-rls-dbserver /]# grep SwapTotal /proc/meminfo
SwapTotal:      67682296 kB
3、 硬碟空間
建議資料使用獨立的掛載分區,本文中採用/data作為資料分區。要求/tmp目錄空間不小於400M。
磁碟空間查看命令:
[root@tsp-rls-dbserver /]# df -h
Filesystem                             Size  Used Avail Use% Mounted on
/dev/mapper/vg_tsprlsdbserver-lv_root   50G  4.3G   43G  10% /
tmpfs                                   16G  348K   16G   1% /dev/shm
/dev/sda1                              485M   39M  421M   9% /boot
/dev/mapper/vg_tsprlsdbserver-lv_home  210G  190M  199G   1% /home
/dev/sdb1                              1.1T  4.5G  1.1T   1% /data

  目錄空間大小查看命令:
[root@tsp-rls-dbserver tmp]# du -ch /tmp

二、 軟體要求
1、 安裝依賴包
建議安裝系統時,選擇開發庫。CentOS6.5(x64)安裝開發庫後,主要依賴包有:
compat-libstdc++-33-3.2.3-61.i386.rpm(url: http://download.csdn.net/detail/attagain/7699569 )
compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm(url: http://download.csdn.net/detail/attagain/7699573 )
libaio-0.3.105-2.i386.rpm(url: http://download.csdn.net/detail/attagain/7700213 )
libaio-0.3.107-10.el6.x86_64.rpm(url: http://download.csdn.net/detail/attagain/7699585 )
libaio-devel-0.3.105-2.i386.rpm(url: http://download.csdn.net/detail/attagain/7700217 )
libaio-devel-0.3.105-2.x86_64.rpm(url: http://download.csdn.net/detail/attagain/7700247 )
libgcc-3.4.6-3.i386.zip(url: http://download.csdn.net/detail/attagain/7699599  含有:libgcc-3.4.6-3.i386.rpm、libgcc_s-4.4.7-20120601.so.1、libgcc_s.so.1,安裝本檔案,首先要卸載libgcc-4.4.7-4.el6.x86_64.rpm ,so檔案即為卸載前從/lib64中備份下來的,以備誤刪使用)
libgcc-4.4.7-4.el6.x86_64.rpm(url: http://download.csdn.net/detail/attagain/7700201 )
libstdc++-3.4.6-11.i386.rpm(url: http://download.csdn.net/detail/attagain/7700169 )
libstdc++-devel-3.4.6-3.1.i386.rpm(url: http://download.csdn.net/detail/attagain/7699847 )
libstdc++-4.4.7-4.el6.x86_64.rpm(url: http://download.csdn.net/detail/attagain/7699837 )
pdksh-5.2.14-37.el5_8.1.x86_64.rpm(url: http://download.csdn.net/detail/attagain/7700147 )
unixODBC-2.2.11-7.1.i386.rpm(url: http://download.csdn.net/detail/attagain/7700007 )
unixODBC-2.2.11-7.1.x86_64.rpm(url: http://download.csdn.net/detail/attagain/7700021 )
unixODBC-devel-2.2.11-7.1.i386.rpm(url: http://download.csdn.net/detail/attagain/7699903 )
unixODBC-devel-2.2.11-7.1.x86_64.rpm(url: http://download.csdn.net/detail/attagain/7699907 )

 註:上述安裝包,我搜尋了好久才整理搜集完全。已經上傳至csdn,不需要資源分。在64位CentOS6.5上安裝上述資源套件時,需要先卸載原64位安裝包,安裝成功後,再安裝被卸載的64位安裝包(上述的64位安裝包,亦可以在安裝光碟片中找到)。卸載原64位依賴包時,建議使用參--nodeps,如:rpm –e libaio-0.3.107-10.el6.x86_64 –nodeps。另外,需要特別注意的,卸載libgcc-4.4.7-4.el6.x86_64時,同時會將/lib64目錄中的libgcc_s.so.1卸載,卸載成功後,還要恢複該檔案。上述依賴包libgcc-3.4.6-3.i386.zip中,包含有我的系統備份包。
 如果缺少依賴包,可以使用rpm命令查看、離線安裝、線上安裝相應的安裝包。以gcc包為例:
查看安裝包,是否安裝命令:
[root@tsp-rls-dbserver tmp]# rpm -qa|grep gcc
 離線安裝命令:
[root@tsp-rls-dbserver tmp]# rpm –ivh gcc-***.rpm
 線上安裝命令:
[root@tsp-rls-dbserver tmp]# yum install gcc
 註:根據系統檢查結果,確定自己的系統需要安裝什麼安裝包。

三、 環境配置
1、 建立oracle安裝使用者
A、 建立oinstall組
[root@tsp-rls-dbserver tmp]# groupadd oinstall
B、 建立dba組
[root@tsp-rls-dbserver tmp]# groupadd dba
C、 建立使用者oracle,設定其主組為oinstall,副組為dba
[root@tsp-rls-dbserver tmp]# useradd -g oinstall -G dba oracle
D、 查看建立使用者ID資訊
[root@tsp-rls-dbserver tmp]# id oracle
E、 設定oracle使用者密碼
[root@tsp-rls-dbserver tmp]# passwd oracle

2、 設定使用者環境變數
將使用oracle使用者安裝Oracle軟體,主目錄為/home/oracle;如果安裝在自訂路徑,需要建立路徑,並設定其運行許可權。
修改使用者環境變數檔案/home/oracle/.bash_profile,執行命令:
[root@tsp-rls-dbserver oracle]# vi /home/oracle/.bash_profile
檔案尾部添加如下資訊:
export ORACLE_SID=ORATSP
export ORACLE_BASE=/home/oracle/app
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
 執行source命令,使得環境變數參數生效
[root@tsp-rls-dbserver oracle]# source /home/oracle/.bash_profile
 查看環境變數參數命令:
[root@tsp-rls-dbserver oracle]# env | more

3、  修改系統核心及環境參數
A、 修改核心參數
執行如下命令,修改設定檔/etc/sysctl.conf
[root@tsp-rls-dbserver oracle]# vi /etc/sysctl.conf
  在檔案尾部添加如下資訊:
fs.file-max= 6815744
fs.aio-max-nr=1048576
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
kernel.sem= 250 32000 100 128

 說明:kernel.shmmax和kernel.shmmax參數,應保持系統不變,必要時,可以適當調大。
  執行命令sysctl,使核心參數生效:
[root@tsp-rls-dbserver oracle]# sysctl –p

B、 修改進程數和最大會話數
執行如下命令,修改設定檔/etc/security/limits.conf
[root@tsp-rls-dbserver oracle]# vi /etc/security/limits.conf
在檔案尾部添加如下資訊:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

C、 設定關聯資訊
  執行如下命令,修改關聯檔案/etc/pam.d/login
[root@tsp-rls-dbserver oracle]# vi /etc/pam.d/login
  在檔案尾部添加如下資訊:
session required pam_limits.so

D、 修改系統啟動環境參數
執行如下命令,修改系統啟動環境參數檔案/etc/ profile
[root@tsp-rls-dbserver oracle]# vi /etc/profile
  在檔案尾部添加如下資訊:
if [ $USER = "oracle" ]; then
 if [ $SHELL = "/bin/ksh" ]; then
 ulimit -p 16384
 ulimit -n 65536
 else
 ulimit -u 16384 -n 65536
 fi
fi
E、 修改主機解析資訊
執行命令,修改/etc/hosts檔案
[root@tsp-rls-dbserver ~]# vi /etc/hosts
   在檔案尾部添加如下資訊:
192.168.30.203   tsp-rls-dbserver

F、 資料分區掛載
本文中,介紹的資料庫安裝,資料檔案系統採用獨立的資料分區。因此,需要執行mount命令,添加分區掛載資訊。
人工方式掛載,需要執行如下命令:
 查看磁碟分割資訊命令:
[root@tsp-rls-dbserver oracle]# fdisk –l
 執行mount命令,掛在sdb1分區,到/data(需要預先建立該目錄):
[root@tsp-rls-dbserver oracle]# mount /dev/sdb1 /data
 執行umount命令,取消掛載分區:
[root@tsp-rls-dbserver oracle]# umount /data
 查看掛載分區結果命令:
[root@tsp-rls-dbserver oracle]# df -h
Filesystem                             Size  Used Avail Use% Mounted on
/dev/mapper/vg_tsprlsdbserver-lv_root   50G  4.3G   43G  10% /
tmpfs                                   16G  348K   16G   1% /dev/shm
/dev/sda1                              485M   39M  421M   9% /boot
/dev/mapper/vg_tsprlsdbserver-lv_home  210G  190M  199G   1% /home
/dev/sdb1                              1.1T  4.5G  1.1T   1% /data

 查看系統磁碟分割UUID方法:
[root@tsp-rls-dbserver oracle]# blkid

[root@tsp-rls-dbserver oracle]# ls -l /dev/disk/by-uuid
總用量 0
lrwxrwxrwx. 1 root root 10 7月  30 12:18 0a99941d-8caa-4e3a-9645-a0239dd385f1 -> ../../dm-0
lrwxrwxrwx. 1 root root 10 7月  30 12:20 3d9b7f12-0690-48d2-ae9a-004956dc5072 -> ../../sdb1
lrwxrwxrwx. 1 root root 10 7月  30 12:18 a292586a-9cfb-45c5-88f3-5c9530e65dae -> ../../dm-1
lrwxrwxrwx. 1 root root 10 7月  30 12:18 a486566b-272d-4de7-a852-72fcfc6e7a1a -> ../../dm-2
lrwxrwxrwx. 1 root root 10 7月  30 12:18 f4ab21a5-f068-428c-85ae-b9f2ec1ac640 -> ../../sda1

 執行如下命令,修改系統磁碟分割檔案/etc/ fstab,使得系統啟動時,自動掛載分區:
[root@tsp-rls-dbserver oracle]# vi /etc/fstab
 在檔案中添加如下資訊(使用sdb1的UUID):
UUID=3d9b7f12-0690-48d2-ae9a-004956dc5072 /data      ext4    defaults        1 2

四、 Oracle安裝過程
在執行資料庫安裝前,最好重啟系統,確保所設定參數全部生效。
以oracle使用者登入系統,需要圖形介面支援,可以使用xhost、NoManchine等遠端桌面工具,本文中使用NoMachine工具。(有需要,請自行下載安裝)
1、 官網下載Oracle11GR2安裝檔案,上傳至伺服器
執行命令,解壓檔案,設定可執行許可權:
[oracle@tsp-rls-dbserver soft]$ unzip linux.x64_11gR2.zip
[oracle@tsp-rls-dbserver soft]$ chmod 755 -R ./linux.x64_11gR2
2、 以oracle使用者登入
 

3、 設定語言環境資訊,運行Oracle安裝嚮導
由於,oracle安裝嚮導無法識別中文字型,終端臨時設定語言環境變數,並運行runInstaller。
[oracle@tsp-rls-dbserver linux.x64_11gR2]$ export LANG=en_US
[oracle@tsp-rls-dbserver linux.x64_11gR2]$ export LC_ALL=en_US
[oracle@tsp-rls-dbserver linux.x64_11gR2]$ ./runInstaller
 

下述4-26的步驟省略,如有需要,請到資源中下載word版:

http://download.csdn.net/detail/attagain/7700437


4、 選擇安裝類型(建立資料庫執行個體)
 
5、 安裝程式類型(伺服器類)
 
6、 安裝執行個體選擇(單資料庫執行個體)
 
7、 安裝類型(自訂安裝)
 
8、 選擇支援語言(支援中文)
 
9、 資料庫類型(企業級資料庫)
 
10、 資料庫安裝路徑(環境變數設定資訊)
 
11、 安裝詳細路徑(預設)
 
12、 資料庫執行個體類型(資料倉儲)
 
13、 資料庫執行個體服務名
 
14、 記憶體配置(預設40%)
 
15、 字元集設定(AL32UTF8)
 
16、 安全設定(預設)
 
17、 樣本資料結構(預設)
 
18、 資料庫控制管理(預設)
 
19、 資料庫檔案系統(獨立資料分區:/data/oracle)
 
20、 資料庫自動備份(預設)
 
21、 資料庫系統管理使用者密碼(統一密碼設定)
 
22、 管理、操作賬戶分組設定(預設)
 
23、 安裝預檢資訊收集(需要全部通過,忽略選項,可能導致運行異常)
 
24、 安裝裝過程
 
25、 資料庫配置匯總資訊
管理URL:https://tsp-rls-dbserver:1158/em
 
26、 以root使用者登入,回合組態指令碼
 
27、 執行指令碼orainstRoot過程(/home/oracle/oraInventory/orainstRoot.sh)
[root@tsp-rls-dbserver deps]# /home/oracle/oraInventory/orainstRoot.sh
Changing permissions of /home/oracle/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /home/oracle/oraInventory to oinstall.
The execution of the script is complete.

28、 執行指令碼root過程(/home/oracle/app/product/11.2.0/dbhome_1/root.sh)
[root@tsp-rls-dbserver deps]# /home/oracle/app/product/11.2.0/dbhome_1/root.sh
Running Oracle 11g root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /home/oracle/app/product/11.2.0/dbhome_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.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.

29、 安裝完成
管理URL:https://tsp-rls-dbserver:1158/em

 

30、 開放防火牆連接埠(1521、1158)
執行命令:
[root@tsp-rls-dbserver deps]# /sbin/iptables -I INPUT -p tcp --dport 1521 -j ACCEPT
[root@tsp-rls-dbserver deps]# /sbin/iptables -I INPUT -p tcp --dport 1158 -j ACCEPT
儲存設定命令:
[root@tsp-rls-dbserver deps]# /etc/rc.d/init.d/iptables save
查看連接埠開啟情況命令:
[root@tsp-rls-dbserver deps]# /etc/init.d/iptables status
重啟防火牆服務
[root@tsp-rls-dbserver deps]# /etc/rc.d/init.d/iptables restart

31、 開機自動啟動Oracle服務配置
A、 修改dbstart和dbshut指令碼
[oracle@tsp-rls-dbserver ~]$ vi $ORACLE_HOME/bin/dbstart
[oracle@tsp-rls-dbserver ~]$ vi $ORACLE_HOME/bin/dbshut
  找到檔案中的ORACLE_HOME_LISTNER=$1,修改為:ORACLE_HOME_LISTNER=$ORACLE_HOME
B、 修改oratab檔案
[oracle@tsp-rls-dbserver ~]$ vi /etc/oratab

將ORATSP:/home/oracle/app/product/11.2.0/dbhome_1:N
修改為:ORATSP:/home/oracle/app/product/11.2.0/dbhome_1:Y

C、 修改rc.local檔案(root使用者)
[root@tsp-rls-dbserver deps]# vi /etc/rc.d/rc.local
  檔案尾部添加如下資訊:
su oracle -lc "/home/oracle/app/product/11.2.0/dbhome_1/bin/emctl start dbconsole"
su oracle -lc "/home/oracle/app/product/11.2.0/dbhome_1/bin/lsnrctl start"
su oracle -lc "/home/oracle/app/product/11.2.0/dbhome_1/bin/dbstart"

五、 Oracle卸載
1、 停止監聽服務(oracle使用者登入)
[oracle@tsp-rls-dbserver ~]$ lsnrctl stop
2、 停止資料庫

3、 刪除oracle安裝路徑(root使用者登入)
[root@tsp-rls-dbserver deps]# rm -rf /home/oracle/app
[root@tsp-rls-dbserver deps]# rm -rf /home/oracle/oraInventory

4、 刪除系統路徑檔案(root使用者登入)
[root@tsp-rls-dbserver deps]# rm -rf /usr/local/bin/dbhome
[root@tsp-rls-dbserver deps]# rm -rf /usr/local/bin/oraenv
[root@tsp-rls-dbserver deps]# rm -rf /usr/local/bin/coraenv

5、 刪除資料庫執行個體表(root使用者登入)
[root@tsp-rls-dbserver deps]# rm -rf /etc/oratab

6、 刪除資料庫執行個體lock檔案(root使用者登入)
[root@tsp-rls-dbserver deps]# rm -rf /etc/oraInst.loc

7、 刪除oracle使用者及使用者組(root使用者登入)
[root@tsp-rls-dbserver deps]# userdel -r oracle
[root@tsp-rls-dbserver deps]# groupdel oinstall
[root@tsp-rls-dbserver deps]# groupdel dba


centos62下安裝oracle10g沒有成功,想重新安裝,怎卸載,大俠幫幫忙

在LINUX系統下安裝Oracle需要使用Oracle賬戶。你先進入Oracle使用者的家目錄,查看其中的.bash_profile檔案。進入export ORACLE_BASE=右側所指示的目錄,刪flash_recovery_area、oradata、oraInventory這3個目錄

進/usr/local/bin目錄刪coraenv、dbhome、oraenv 這3個檔案

最後刪/etc/oratab檔案
此時就能重裝Oracle了
 
centos55中卸載oracle

先用oracle oui進入安裝介面,在介面中有一個已安裝的軟體,開啟後點選要刪除的目錄,在選刪除,完成後刪除oracle安裝目錄,刪除oracle使用者和組就可以了。
 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.