Linux系統下Oracle資料庫的安裝和啟動關閉操作教程_oracle

來源:互聯網
上載者:User

1.準備:

df -H

  查看空間剩餘   一般準備最少5G


2.查看swap分區大小

 du -sh /tmp/ 

    最少400M


3. 建組建使用者

groupadd dba -g 111groupadd oinstall -g 110useradd oracle -u -110 -g 110 -G 111passwd oracle --stdin


4. 設定參數

su - oraclevi .bash_profile
export ORACLE_BASE=/u01/oracleexport ORACLE_HOME=$ORACLE_BASE/10gexport ORACLE_SID=orclPATH=$PATH:$HOME/bin:$ORACLE_HOME/bin


5. 許可權

sumkdir /u01/oraclechown oracle:oinstall /u01/oracle/ -R


6. 修改系統參數

sysctl -a|grep sem|sed 's/32/100/2' >> /etc/sysctl.confsysctl -a|grep ip_local|sed -e 's/32768/1024' -e 's/61/65/' >> /etc/sysctl.confsysctl -a|grep rmem_d|sed 's/109568/262144' >> /etc/sysctl.confsysctl -a|grep rmem_ma|sed 's/131071/262144' >> /etc/sysctl.confsysctl -a|grep wmem_ma|sed 's/131071/262144' >> /etc/sysctl.confsysctl -a|grep wmem_de|sed 's/109568/262144' >> /etc/sysctl.confsysctl -a|grep file-m|sed 's/83702/65536' >> /etc/sysctl.confsysctl -p


7. 安裝

xhost +su - oracleruninstall

8.問題解決
安裝介面亂碼問題
orcale使用者:

 [oracle@~]$ export LC_CTYPE="en_US.UTF-8"

版本問題
修改/etc/redhat-release裡的版本為低版本(Redhat 4.X)

xhost +報錯
最簡單的,登出目前使用者,使用oracle使用者登入,進行安裝


9.啟動和關閉
查詢資料庫當前的狀態:


>select OPEN_MODE from v$database;
oracle not available  ------- oracle沒啟動執行個體oracle not mounted   ------- oracle在nomount階段oracle mounted     ------- oracle在mount階段oracle read write   ------- oracle在open階段


9.1.sqlplus


啟動執行個體階段  nomount  -------------- 

>startup [force] [pfile=xxx] nomount;

查參數檔案錯誤 spfilesid.ora---spfile.ora---initsid.ora
查看使用的參數檔案 >show parameter spfile  不為空白即以spfile啟動,否則是pfile
分配記憶體
記錄資訊到alert檔案和追蹤檔案

#tail -f /u01/oracle/admin/orcl/bdump/alert_orcl.log

啟動後台進程
查看資料庫是否啟動  #ps -ef|grep ora_

【本階段設定參數】
[startup restrict 啟動到受限制會話,不允許別人串連的情況下對資料庫進行操作]


裝載資料庫階段 

db mount ------------------ >alter database mount;

關聯資料庫和當前的執行個體

定位並開啟參數檔案中指定的控制檔案
控制檔案

>show parameter control_file;
讀取控制檔案擷取資料檔案和重做記錄檔的名稱和狀態,但不進行是否存在的檢查

【本階段可以操作資料庫物理操作:alter database,建庫刪庫,恢複資料庫;命名資料檔案,啟用禁用日誌】


開啟資料庫階段 ---------------  

 >alter database open;

判斷資料檔案和記錄檔是否存在,是否開啟,檢查資料庫的一致性

開啟聯機資料檔案和記錄檔

【本階段對資料庫資料進行操作】


關閉資料庫階段 ---------------  

>shutdown [normal|transactional|immediate|abort]

將緩衝區告訴緩衝中的更改及重做日誌緩衝區快取中的條目寫入資料檔案和聯機重做記錄檔

關閉資料檔案和重做記錄檔

卸載資料庫

關閉控制檔案

關閉執行個體

alter檔案和追蹤檔案關閉

sga回收、後台進程終止


shutdown [normal|transactional|immediate|abort] 

abort不是一致性關閉


9.2.dbstart & dbshut


vi /etc/oratab 中資料庫最後的欄位是Y,才能通過dbstart和dbshut控制

vi $ORACLE_HOME/bin/dbstart 中ORACLE_HOME_LISTNER的值為$ORACLE_HOME時,啟動監聽

附:oracle開機啟動

head -n 6 /etc/init.d/network >/etc/init.d/oracle10gvi /etc/init.d/oracle10g
ORACLE_HOME=/u01/oracle/10gif [ !-f $ORACLE_HOME/bin/dbstart ]thenecho "oracle cannot start"exitfiif [ ! -f $ORACLE_HOME/bin/lsnrctl ]thenecho "lsnrctl cannot start"exitficase "$1" in'start')echo "starting oracle 10g ...."su - oracle -c "$ORACLE_HOME/bin/dbstart"#su - oracle -c "$ORACLE_HOME/bin/emctl start dbconsole" ------>start oem;;'stop')echo "stopping oracle 10g ...."#su - oracle -c "$ORACLE_HOME/bin/emctl stop dbconsole" ------>stop oemsu - oracle -c "$ORACLE_HOME/bin/dbshut";;*)echo "usage $0: start|stop";;esac
chmod a+x /etc/init.d/oracle10gchkconfig oracle10g on

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.