linux下啟停oracle


1.打開ssh工具,連接到數據庫所在的linux機器。若用戶為root,請輸入命令“su - oracle”並回車,若要密碼,輸入密碼后並回車,就切換到了oracle用戶下。(下為已切換到oracle用戶下了)

[root@tqxs tqxs]# su - oracle
上一次登錄:一 10月 15 09:56:08 CST 2018pts/0 上
[oracle@tqxs ~]$

2.關掉oracle的監聽進程:命令為“lsnrctl stop”並回車,這時外部沒法連接到數據庫了。如下有提示關閉成功信息。

[oracle@tqxs ~]$ lsnrctl stop

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-OCT-2018 10:32:29

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully
[oracle@tqxs ~]$

3.先殺掉所有session,小編用的是命令:“ps -ef|grep $ORACLE_SID|grep -v ora_|grep LOCAL=NO|awk '{print $2}'|xargs kill”也可以用其他辦法。然后用sqlplus登錄到數據庫。命令依次為:“sqlplus /nolog”-“connect / as sysdba” ,最后用命令關閉oracle數據庫"shutdown immediate",強制關閉"shutdown abort" 會忽略事務造成數據丟失 。關閉命令的時候需要等待點時間,成功后會有如下的提示。

[oracle@tqxs ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Fri Oct 19 10:34:21 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

SQL> conn / as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>

4.用命令"exit"退出sqlplus。然后用命令“lsnrctl start”啟動數據庫的監聽進程。如下提示語句表明啟動成功。

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@tqxs ~]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-OCT-2018 10:42:05

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/tqxs/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.23.1.127)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                19-OCT-2018 10:42:05
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/tqxs/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.23.1.127)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@tqxs ~]$

5.和第三步一樣,先用sqlplus登錄到數據庫。命令依次為:“sqlplus /nolog”-“connect / as sysdba”。然后輸入命令“startup”並回車。等待幾分鍾會出現如下提示信息。最后用命令“exit”退出sqlplus。

[oracle@tqxs ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Fri Oct 19 10:43:17 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area 4.0086E+10 bytes
Fixed Size            2261848 bytes
Variable Size         4160752808 bytes
Database Buffers     3.5836E+10 bytes
Redo Buffers           86405120 bytes
Database mounted.
Database opened.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@tqxs ~]$

 

注意事項 

  • 注意命令不要輸入錯誤。

  •  在關閉數據庫的時候要耐心等待一下。

  •  一定要先殺掉所有session哦。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM