詳解Linux系統(tǒng)中Oracle數(shù)據(jù)庫程序的啟動和關(guān)閉方式
在單機(jī)環(huán)境下,要想啟動或關(guān)閉ORACLE系統(tǒng)必須首先切換到ORACLE用戶,如下
su - oracle
Oracle數(shù)據(jù)庫有以下幾種啟動方式:
1、
startup nomount
非安裝啟動,這種方式啟動下可執(zhí)行:重建控制文件、重建數(shù)據(jù)庫
讀取init.ora文件,啟動instance,即啟動SGA和后臺進(jìn)程,這種啟動只需要init.ora文件。
2、
startup mount dbname
安裝啟動,這種方式啟動下可執(zhí)行:
數(shù)據(jù)庫日志歸檔、
數(shù)據(jù)庫介質(zhì)恢復(fù)、
使數(shù)據(jù)文件聯(lián)機(jī)或脫機(jī),
重新定位數(shù)據(jù)文件、重做日志文件。
執(zhí)行“nomount”,然后打開控制文件,確認(rèn)數(shù)據(jù)文件和聯(lián)機(jī)日志文件的位置,
但此時不對數(shù)據(jù)文件和日志文件進(jìn)行校驗檢查。
3、
startup open dbname
先執(zhí)行“nomount”,然后執(zhí)行“mount”,再打開包括Redo log文件在內(nèi)的所有數(shù)據(jù)庫文件,
這種方式下可訪問數(shù)據(jù)庫中的數(shù)據(jù)。
4、startup,等于以下三個命令
startup nomount alter database mount alter database open
5、
startup restrict
約束方式啟動
這種方式能夠啟動數(shù)據(jù)庫,但只允許具有一定特權(quán)的用戶訪問
非特權(quán)用戶訪問時,會出現(xiàn)以下提示:
ERROR:
ORA-01035: ORACLE 只允許具有 RESTRICTED SESSION 權(quán)限的用戶使用
6、
startup force
強(qiáng)制啟動方式
當(dāng)不能關(guān)閉數(shù)據(jù)庫時,可以用startup force來完成數(shù)據(jù)庫的關(guān)閉
先關(guān)閉數(shù)據(jù)庫,再執(zhí)行正常啟動數(shù)據(jù)庫命令
7、startup pfile=參數(shù)文件名
帶初始化參數(shù)文件的啟動方式
先讀取參數(shù)文件,再按參數(shù)文件中的設(shè)置啟動數(shù)據(jù)庫
例:
startup pfile=E:Oracleadminoradbpfileinit.ora
oracle數(shù)據(jù)庫幾種關(guān)閉方式:
1、
shutdown normal
正常方式關(guān)閉數(shù)據(jù)庫。
2、
shutdown immediate
立即方式關(guān)閉數(shù)據(jù)庫。
在SVRMGRL中執(zhí)行shutdown immediate,數(shù)據(jù)庫并不立即關(guān)閉,
而是在Oracle執(zhí)行某些清除工作后才關(guān)閉(終止會話、釋放會話資源),
當(dāng)使用shutdown不能關(guān)閉數(shù)據(jù)庫時,shutdown immediate可以完成數(shù)據(jù)庫關(guān)閉的操作。
3、
shutdown abort
直接關(guān)閉數(shù)據(jù)庫,正在訪問數(shù)據(jù)庫的會話會被突然終止,
如果數(shù)據(jù)庫中有大量操作正在執(zhí)行,這時執(zhí)行shutdown abort后,重新啟動數(shù)據(jù)庫需要很長時間。
啟動錯誤問題解決
問題描述:
[oracle@node1 dbs]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Sun Mar 17 16:38:03 2013 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to an idle instance SQL> startup nomount ORA-00845: MEMORY_TARGET not supported on this system
啟動數(shù)據(jù)庫時,報MEMORY_TARGET 不支持,上網(wǎng)搜索了一下,具體原因是Linux 系統(tǒng)的共享內(nèi)存比SGA 配置的小。而/dev/shm 是根據(jù)tmpfs 的配置來定義的。
[root@node1 ~]# df -h /dev/shm Filesystem Size Used Avail Use% Mounted on tmpfs 1000M 0 1000M 0% /dev/shm SQL> show parameter memory_target NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ memory_target big integer 1G
查了一下tmpfs 的配置,只有1000M,而SGA 配置了1G(換算系1024M),不夠大。解決問題的辦法就是改小SGA 或者改大tmpfs(這里SGA 1G 已經(jīng)小了,不建議在改?。?。
解決方法1、 修改tmpfs(修改/etc/fstab 配置):
[root@node1 ~]# vim /etc/fstab # tmpfs /dev/shm tmpfs defaults 0 0 tmpfs /dev/shm tmpfs defaults,size=2048M 0 0 [root@node1 ~]# umount /dev/shm [root@node1 ~]# mount /dev/shm [root@node1 ~]# df -h /dev/shm Filesystem Size Used Avail Use% Mounted on tmpfs 2.0G 0 2.0G 0% /dev/shm
解決方法2、修改SGA:
SQL> show parameter sga NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ lock_sga boolean FALSE pre_page_sga boolean FALSE sga_max_size big integer 1G sga_target big integer 0 SQL> alter system set sga_max_size=768M scope=spfile; System altered. SQL> shutdown immediate ORA-01507: database not mounted ORACLE instance shut down. SQL> startup nomount ORACLE instance started. Total System Global Area 801701888 bytes Fixed Size 2217632 bytes Variable Size 348129632 bytes Database Buffers 444596224 bytes Redo Buffers 6758400 bytes SQL> show parameter sga NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ lock_sga boolean FALSE pre_page_sga boolean FALSE sga_max_size big integer 768M sga_target big integer 0
這里建議直接修改memory_target,讓Oracle 自己去管理SGA 的大?。╩emory_target=SGA+PGA)
SQL> show parameter memory_target NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ memory_target big integer 1G SQL> alter system set memory_target=768M scope=spfile; System altered. SQL> shutdown immediate ORA-01507: database not mounted ORACLE instance shut down. SQL> startup nomount; ORACLE instance started. Total System Global Area 801701888 bytes Fixed Size 2217632 bytes Variable Size 469764448 bytes Database Buffers 322961408 bytes Redo Buffers 6758400 bytes SQL> SQL> SQL> show parameter memory_target NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ memory_target big integer 768M
擴(kuò)展:
這里需要注意,memory_target 不能小于SGA 或PGA,不然startup 數(shù)據(jù)庫的時候會報錯,數(shù)據(jù)庫不能啟動。
SQL> startup nomount ORA-00844: Parameter not taking MEMORY_TARGET into account ORA-00851: SGA_MAX_SIZE 1073741824 cannot be set to more than MEMORY_TARGET 805306368.
解決辦法:
[oracle@node1 dbs]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Sun Mar 17 17:14:38 2013 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to an idle instance. SQL> create pfile from spfile; File created. SQL> exit
修改init.ora 文件參數(shù)
[oracle@node1 dbs]$ vim initoranode1.ora oranode1.__db_cache_size=444596224 oranode1.__large_pool_size=4194304 oranode1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment *.audit_file_dest='/u01/app/oracle/admin/oranode1/adump' *.audit_trail='db' *.compatible='11.2.0' *.control_files='/u01/oradata/ora_control1','/u01/fast_recovery_area/ora_control 2' *.db_block_size=8192 *.db_domain='node1.example.com' *.db_name='oranode1' *.db_recovery_file_dest='/u01/fast_recovery_area' *.db_recovery_file_dest_size=2G *.diagnostic_dest='/u01/app/oracle' *.dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)' *.memory_target=805306368 *.open_cursors=300 *.processes=150 *.remote_login_passwordfile='EXCLUSIVE' *.sga_max_size=805306368 *.undo_tablespace='UNDOTBS1'
重新生成spfile
[oracle@node1 dbs]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Sun Mar 17 17:15:28 2013 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to an idle instance. SQL> create spfile from pfile; File created. SQL> startup nomount; ORACLE instance started. Total System Global Area 801701888 bytes Fixed Size 2217632 bytes Variable Size 469764448 bytes Database Buffers 322961408 bytes Redo Buffers 6758400 bytes SQL> SQL> SQL> show parameter memory_target NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ memory_target big integer 768M
- linux下oracle設(shè)置開機(jī)自啟動實現(xiàn)方法
- Linux下的Oracle啟動腳本及其開機(jī)自啟動
- Linux系統(tǒng)下Oracle數(shù)據(jù)庫的安裝和啟動關(guān)閉操作教程
- Linux下啟動Oracle服務(wù)和監(jiān)聽程序步驟
- linux服務(wù)器開機(jī)啟動oracle的設(shè)置方法
- Linux環(huán)境下重啟Oracle數(shù)據(jù)庫詳細(xì)圖文教程
- Linux系統(tǒng)下Oracle數(shù)據(jù)庫監(jiān)聽啟動關(guān)閉命令詳解
- Linux下如何啟動Oracle命令
- Linux系統(tǒng)下啟動/關(guān)閉Oracle數(shù)據(jù)庫
相關(guān)文章
Oracle中實現(xiàn)一次插入多條數(shù)據(jù)詳細(xì)代碼舉例
公司的項目,有個功能每次使用需要向數(shù)據(jù)庫插入很多數(shù)據(jù),這里給大家總結(jié)下,這篇文章主要給大家介紹了Oracle中實現(xiàn)一次插入多條數(shù)據(jù)的相關(guān)資料,文中通過圖文及代碼介紹的非常詳細(xì),需要的朋友可以參考下2024-06-06Oracle 解決ORA-00257 Archiver error 報錯問題解決
訂單投資交易環(huán)境進(jìn)行 impdb 數(shù)據(jù)泵恢復(fù)數(shù)據(jù),執(zhí)行到一半,報錯終止,歸檔策略保留時間較長,或歸檔頻率過高,導(dǎo)致數(shù)據(jù)庫掛載盤符空間不足,本文給大家分享Oracle 解決ORA-00257 Archiver error 報錯問題解決,感興趣的朋友一起看看吧2023-12-12Oracle數(shù)據(jù)庫中如何按天、周、月、季、年統(tǒng)計數(shù)據(jù)
我們經(jīng)常遇到一些需求,需要我們在sql語句中對日期進(jìn)行分類統(tǒng)計,下面這篇文章主要給大家介紹了關(guān)于Oracle數(shù)據(jù)庫中如何按天、周、月、季、年統(tǒng)計數(shù)據(jù)的相關(guān)資料,需要的朋友可以參考下2024-03-03Oracle查詢當(dāng)前的crs/has自啟動狀態(tài)實例教程
當(dāng)我們開啟或者關(guān)閉自啟動后,我們?nèi)绾尾榭串?dāng)前CRS 是處于enable還是處于disable中呢?下面這篇文章主要給大家介紹了關(guān)于Oracle如何查詢當(dāng)前的crs/has自啟動狀態(tài)的相關(guān)資料,需要的朋友可以參考下2018-11-11Oracle使用pivot和unpivot函數(shù)實現(xiàn)行列轉(zhuǎn)換
項目開發(fā)過程中常常會涉及到oracle數(shù)據(jù)庫的一個數(shù)據(jù)操作,那就是行列的互轉(zhuǎn),本文為大家介紹了兩個可以實現(xiàn)這一操作的函數(shù)pivot和unpivot,感興趣的可以了解一下2023-06-06oracle截取字符(substr)檢索字符位置(instr)示例介紹
本節(jié)主要介紹了oracle截取字符(substr)檢索字符位置(instr)的使用,需要的朋友可以參考下2014-07-07使用oracle發(fā)生標(biāo)識符無效問題及解決
這篇文章主要介紹了使用oracle發(fā)生標(biāo)識符無效問題及解決方案,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2023-07-07oracle復(fù)制表結(jié)構(gòu)和復(fù)制表數(shù)據(jù)語句分享
這篇文章主要介紹了oracle復(fù)制表結(jié)構(gòu)和復(fù)制表數(shù)據(jù)的語句,大家直接使用就可以了2014-03-03