你的Oracle沒(méi)有開(kāi)機(jī)自啟?那是你沒(méi)有這樣操作??!
作者個(gè)人研發(fā)的在高并發(fā)場(chǎng)景下,提供的簡(jiǎn)單、穩(wěn)定、可擴(kuò)展的延遲消息隊(duì)列框架,具有精準(zhǔn)的定時(shí)任務(wù)和延遲隊(duì)列處理功能。自開(kāi)源半年多以來(lái),已成功為十幾家中小型企業(yè)提供了精準(zhǔn)定時(shí)調(diào)度方案,經(jīng)受住了生產(chǎn)環(huán)境的考驗(yàn)。為使更多童鞋受益,現(xiàn)給出開(kāi)源框架地址:https://github.com/sunshinelyz/mykit-delay
重啟Oracle數(shù)據(jù)庫(kù)
重啟Oracle數(shù)據(jù)庫(kù)包括啟動(dòng)Oracle數(shù)據(jù)庫(kù)服務(wù)進(jìn)程和啟動(dòng)Oracle數(shù)據(jù)庫(kù)兩步,大家繼續(xù)往下看。
按照《【Oracle】什么?作為DBA,你竟然不會(huì)安裝Oracle??》安裝Oracle數(shù)據(jù)庫(kù)之后,當(dāng)我們重啟系統(tǒng)之后,使用Navicat連接Oracle數(shù)據(jù)庫(kù)時(shí),會(huì)出現(xiàn)如下的提示信息。
這是因?yàn)橹貑⑾到y(tǒng)之后,Oracle數(shù)據(jù)庫(kù)服務(wù)并沒(méi)有自動(dòng)重啟。我們也可以使用netstat命令來(lái)查看是否有進(jìn)程監(jiān)聽(tīng)1521端口,如下所示。
- [root@binghe121 ~]# netstat -nlp | grep 1521
- [root@binghe121 ~]#
可以看到,并沒(méi)有進(jìn)程監(jiān)聽(tīng)1521端口,說(shuō)明Oracle數(shù)據(jù)庫(kù)進(jìn)程并沒(méi)有啟動(dòng),
接下來(lái),我們首先需要啟動(dòng)Oracle數(shù)據(jù)庫(kù)進(jìn)程。以oracle用戶(hù)登錄系統(tǒng),輸入如下命令啟動(dòng)Oracle服務(wù)進(jìn)程。
- lsnrctl start
具體命令執(zhí)行過(guò)程如下所示。
- [oracle@binghe121 ~]$ lsnrctl start
- LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 24-MAY-2020 16:14:09
- Copyright (c) 1991, 2009, Oracle. All rights reserved.
- Starting /home/oracle/tools/oracle11g/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
- TNSLSNR for Linux: Version 11.2.0.1.0 - Production
- System parameter file is /home/oracle/tools/oracle11g/product/11.2.0/dbhome_1/network/admin/listener.ora
- Log messages written to /home/oracle/tools/oracle11g/diag/tnslsnr/binghe121/listener/alert/log.xml
- Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
- Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=binghe121)(PORT=1521)))
- Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
- STATUS of the LISTENER
- ------------------------
- Alias LISTENER
- Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
- Start Date 24-MAY-2020 16:14:10
- Uptime 0 days 0 hr. 0 min. 0 sec
- Trace Level off
- Security ON: Local OS Authentication
- SNMP OFF
- Listener Parameter File /home/oracle/tools/oracle11g/product/11.2.0/dbhome_1/network/admin/listener.ora
- Listener Log File /home/oracle/tools/oracle11g/diag/tnslsnr/binghe121/listener/alert/log.xml
- Listening Endpoints Summary...
- (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=binghe121)(PORT=1521)))
- The listener supports no services
- The command completed successfully
此時(shí),再次使用netstat命令查看1521端口的占用情況,如下所示。
- [root@binghe121 ~]# netstat -nlp | grep 1521
- tcp6 0 0 :::1521 :::* LISTEN 2075/tnslsnr
- unix 2 [ ACC ] STREAM LISTENING 21089 2075/tnslsnr /var/tmp/.oracle/sEXTPROC1521
可以看到,Oracle數(shù)據(jù)庫(kù)服務(wù)進(jìn)程已經(jīng)開(kāi)啟。
再次使用Navicat連接Oracle數(shù)據(jù)庫(kù),如下所示。
可以看到,并沒(méi)有成功連接Oracle數(shù)據(jù)庫(kù),這是因?yàn)閱?dòng)Oracle服務(wù)進(jìn)程后,需要我們啟動(dòng)數(shù)據(jù)庫(kù)。
使用oracle用戶(hù)登錄系統(tǒng),并依次執(zhí)行如下命令啟動(dòng)Oracle數(shù)據(jù)庫(kù)。
- sqlplus /nolog
- conn / as sysdba
- startup
命令執(zhí)行效果如下所示。
- [oracle@binghe121 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Sun May 24 16:23:57 2020
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn / as sysdba
- Connected to an idle instance.
- SQL> startup
- ORACLE instance started.
- Total System Global Area 1068937216 bytes
- Fixed Size 2220200 bytes
- Variable Size 641732440 bytes
- Database Buffers 419430400 bytes
- Redo Buffers 5554176 bytes
- Database mounted.
- Database opened.
此時(shí),再次使用Navicat連接Oracle數(shù)據(jù)庫(kù),如下所示。
此時(shí)Oracle數(shù)據(jù)庫(kù)重啟成功
關(guān)閉Oracle數(shù)據(jù)庫(kù)
使用oracle用戶(hù)登錄系統(tǒng),依次執(zhí)行如下命令關(guān)閉Oracle數(shù)據(jù)庫(kù)。
- sqlplus /nolog
- conn /as sysdba
- shutdown immediate
- exit
- lsnrctl stop
具體執(zhí)行情況如下所示。
- [oracle@binghe121 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Sun May 24 16:31:21 2020
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn /as sysdba
- Connected.
- SQL> shutdown immediate
- Database closed.
- Database dismounted.
- ORACLE instance shut down.
- SQL> exit
- Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
- With the Partitioning, OLAP, Data Mining and Real Application Testing options
- [oracle@binghe121 ~]$ lsnrctl stop
- LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 24-MAY-2020 16:31:52
- Copyright (c) 1991, 2009, Oracle. All rights reserved.
- Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
- The command completed successfully
本文轉(zhuǎn)載自微信公眾號(hào)「 冰河技術(shù)」,可以通過(guò)以下二維碼關(guān)注。轉(zhuǎn)載本文請(qǐng)聯(lián)系 冰河技術(shù)公眾號(hào)。