Linux 安裝oracle

來源:互聯網
上載者:User

標籤:

具體過程如下:
1 - 確認如下安裝包,若沒有安裝,則從光碟片中找到相應的包進行安裝
#rpm -qa | grep binutils

binutils-2.17.50.0.6-2.el5
compat-libstdc++-33-3.2.3-61
elfutils-libelf-0.125-3.el5
elfutils-libelf-devel-0.125
glibc-2.5-12
glibc-common-2.5-12
glibc-devel-2.5-12
gcc-4.1.1-52
gcc-c++-4.1.1-52
libaio-0.3.106
libaio-devel-0.3.106
libgcc-4.1.1-52
libstdc++-4.1.1
libstdc++-devel-4.1.1-52.e15
make-3.81-1.1
sysstat-7.0.0
unixODBC-2.2.11
unixODBC-devel-2.2.11

libXp-1.0.0-8.1.el5.i386.rpm
libXp-devel-1.0.0-8.1.el5.i386.rpm

安裝rpm包
#rpm -ivh example.rpm

2 - 修改核心參數

在/etc/sysctl.conf檔案中加入下列行:

#fs.file-max = 512 * PROCESSES
fs.file-max = 65536 
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
#net.core.rmem_default=8388608
#net.core.rmem_max=8388608
net.core.wmem_default = 262144
net.core.wmem_max = 262144

運行下列命令改變核心參數,使記憶體參數生效
# sysctl -p

3 - 設定Shell Limits(系統資源限制),提高軟體的運行效率//這一步,不做也可以。之前我都沒有添加過。

Add the following lines to the /etc/security/limits.conf file:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

Add or edit the following line in the /etc/pam.d/login file, if it does not already exist:
session required /lib/security/pam_limits.so
session required pam_limits.so

4 - 建立使用者、使用者組

#/usr/sbin/groupadd oinstall
#/usr/sbin/groupadd dba

#/usr/sbin/useradd -g oinstall -G dba oracle
#passwd oracle

5 - 解壓安裝包,運行runInstaller,進入oracle的圖形介面安裝程式

如果是在root使用者的圖形介面中,可能需要執行xhost+,然後su - oracle,進入解壓的oracle安裝包,執行./runInstaller

遠程可使用vnc開啟圖形介面安裝

有時會遇到oracle安裝圖形介面啟動不了的情況,此時查看系統是不是提示缺乏libXp-1.0.0-8.1.el5.i386.rpm、libXp-devel-1.0.0-8.1.el5.i386.rpm包,這兩個包在安裝作業系統時不是預設的,需要手動選擇,才會安裝。

有時會遇到安裝介面亂碼的問題,解決方案如下:
安裝之前執行如下命令: 
unset LANG 
unset LC_ALL 
unset LC_MESSAGE 
然後 
./runInstaller

6 - 修改root和oracle使用者的.bashrc,設定環境變數,例如:
export ORACLE_BASE=/home/oracle/app/oracle  (具體看個人系統裡的所在位置,這個是到product目錄的上一級)
export ORACLE_SID=orcl    (預設不需要修改)
export ORACLE_HOME=/home/oracle/app/oracle/product/11.1.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin
export NLS_LANG=american_america.zhs16gbk

7 - 添加完成環境變數後,需要切換到root使用者,用root許可權,運行2個.sh檔案。

一個在/home/oracle/app/oracle/product/11.2.0/dbhome_1/root.sh

另一個是/home/oracle/app/oraInventory/orainstRoot.sh

如下操作:

cd /home/oracle/app/oracle/product/11.2.0/dbhome_1 

sh root.sh 

cd /home/oracle/app/oraInventory 

sh orainstRoot.sh

  

8 - 以oracle使用者開啟監聽lsnrctl start,看到顯示監聽開啟,然後sqlplus / as sysdba;訪問oracle資料庫

9 - 修改/etc/oratab檔案
orcl:/home/oracle/app/oracle/product/11.1.0/db_1:N--->改為Y

10 - 設定oracle為開機自啟動,在/etc/rc.local檔案中添加如下2行:
su - oracle -c ‘lsnrctl start‘
su - oracle -c ‘dbstart‘

11 - 更改字元集
[[email protected] ~]$sqlplus / as sysdba
SQL>SHUTDOWN IMMEDIATE;
SQL>STARTUP MOUNT;
SQL>ALTER SYSTEM ENABLE RESTRICTED SESSION;
SQL>ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
SQL>ALTER DATABASE OPEN;
SQL>alter database character set INTERNAL_USE ZHS16GBK;
SQL>SHUTDOWN IMMEDIATE;
SQL>STARTUP;

12 - 建立使用者、設定密碼並授權
SQL> create user db_user identified by <passwd>;
User created.
SQL> grant sysdba to db_user;
Grant succeeded.
SQL> grant dba to db_user;
Grant succeeded.

13 - 重啟系統,查看oracle資料庫能否自啟動

14 - 資料庫匯入、匯出
14-1 匯入
imp db_user/[email protected] file=/home/example.dmp full=y
14-2 匯出
exp db_user/[email protected] log=/home/oracle/example.log file=/home/oracle/example.dmp owner=db_user

 

 

參考博文:http://www.cnblogs.com/zhrq/p/4148801.html

 

Linux 安裝oracle

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.