詳解Linux系統(tǒng)中Oracle數(shù)據(jù)庫程序的啟動和關(guān)閉方式
在單機環(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)機或脫機,
重新定位數(shù)據(jù)文件、重做日志文件。
執(zhí)行“nomount”,然后打開控制文件,確認(rèn)數(shù)據(jù)文件和聯(lián)機日志文件的位置,
但此時不對數(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
強制啟動方式
當(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 的大小(memory_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
擴展:
這里需要注意,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è)置開機自啟動實現(xiàn)方法
- Linux下的Oracle啟動腳本及其開機自啟動
- Linux系統(tǒng)下Oracle數(shù)據(jù)庫的安裝和啟動關(guān)閉操作教程
- Linux下啟動Oracle服務(wù)和監(jiān)聽程序步驟
- linux服務(wù)器開機啟動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中ROW_NUMBER()OVER()函數(shù)用法實例講解
Oracle中的row_number()函數(shù)用于在查詢結(jié)果中為每一行生成一個唯一的行號,下面這篇文章主要給大家介紹了關(guān)于Oracle中ROW_NUMBER()OVER()函數(shù)用法的相關(guān)資料,文中通過實例代碼介紹的非常詳細(xì),需要的朋友可以參考下2023-04-04
Oracle數(shù)據(jù)庫創(chuàng)建dblink的過程及其用法實例詳解
這篇文章主要給大家介紹了Oracle數(shù)據(jù)庫創(chuàng)建dblink的過程及其用法的相關(guān)資料,dblink是Oracle數(shù)據(jù)庫中用于連接不同數(shù)據(jù)庫實例的機制,允許用戶在一個數(shù)據(jù)庫實例中直接查詢或操作另一個數(shù)據(jù)庫實例中的數(shù)據(jù),需要的朋友可以參考下2024-12-12
oracle—SQL技巧之(一)連續(xù)記錄查詢sql案例測試
有這樣一個需求:需要查詢出某個客戶某一年那些天是有連續(xù)辦理過業(yè)務(wù),本文給予sql實現(xiàn)語句并測試,感興趣的朋友可以了解下2013-01-01
Oracle SQL Developer腳本輸出中文顯示亂碼的解決方法
我們在測試Oracle Select AI(自然語言查詢數(shù)據(jù)庫)時,發(fā)現(xiàn)Run Statement中文顯示正常,而Run Script中文顯示亂碼,所以本文給大家介紹了Oracle SQL Developer腳本輸出中文顯示亂碼的解決方法,需要的朋友可以參考下2024-05-05
Oracle數(shù)據(jù)庫concat()函數(shù)用法及使用簡化的‘||’進(jìn)行拼接
CONCAT()函數(shù)在Oracle中可以用于將兩個字符串連接在一起,那么CONCAT()函數(shù)的語法及使用方法是什么呢,這篇文章主要給大家介紹了關(guān)于Oracle數(shù)據(jù)庫concat()函數(shù)用法及使用簡化的‘||’進(jìn)行拼接的相關(guān)資料,需要的朋友可以參考下2024-03-03
ORACLE數(shù)據(jù)庫事務(wù)隔離級別介紹
事務(wù)隔離級別:一個事務(wù)對數(shù)據(jù)庫的修改與并行的另一個事務(wù)的隔離程度2012-07-07
Oracle 數(shù)據(jù)倉庫ETL技術(shù)之多表插入語句的示例詳解
Oracle 數(shù)據(jù)庫為 ETL 流程提供了豐富的功能,今天我們就給大家介紹一下 Oracle 多表插入語句,也就是 INSERT ALL 語句,今天通過示例代碼給大家介紹Oracle 數(shù)據(jù)倉庫 ETL 技術(shù)之多表插入語句的相關(guān)知識,感興趣的朋友一起看看吧2021-04-04
Oracle中XML插入數(shù)據(jù)時的空格問題解決方案
在使用 foreach 或其他循環(huán)結(jié)構(gòu)時,插入數(shù)據(jù)庫的數(shù)據(jù)前后可能會出現(xiàn)不必要的空格,這種額外的空格可能會導(dǎo)致數(shù)據(jù)不一致,影響查詢結(jié)果,甚至導(dǎo)致應(yīng)用程序的錯誤,本文將為您提供一些常見的解決方法和建議,需要的朋友參考下吧2023-08-08
oracle常用分析函數(shù)與聚合函數(shù)的用法
今天小編就為大家分享一篇關(guān)于oracle常用分析函數(shù)與聚合函數(shù)的用法,小編覺得內(nèi)容挺不錯的,現(xiàn)在分享給大家,具有很好的參考價值,需要的朋友一起跟隨小編來看看吧2019-01-01

