zoukankan      html  css  js  c++  java
  • ORACLE数据库关闭与启动

    1、查看监听状态

    [oracle@oracledb ~]# lsnrctl status
    
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 20-DEC-2020 20:46:53
    
    Copyright (c) 1991, 2009, Oracle.  All rights reserved.
    
    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                20-SEP-2020 21:42:43
    Uptime                    90 days 23 hr. 4 min. 10 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /data/app/oracle/product/11.2.0/network/admin/listener.ora
    Listener Log File         /data/app/oracle/diag/tnslsnr/oracledb/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb)(PORT=1521)))
    Services Summary...
    Service "ORCL" has 1 instance(s).
      Instance "ORCL", status READY, has 1 handler(s) for this service...
    Service "orclXDB" has 1 instance(s).
      Instance "ORCL", status READY, has 1 handler(s) for this service...
    The command completed successfully
    [oracle@oracledb ~]# 
    

    2、关闭监听器

    [oracle@oracledb ~]# lsnrctl stop
    
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 20-DEC-2020 20:48:43
    
    Copyright (c) 1991, 2009, Oracle.  All rights reserved.
    
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
    The command completed successfully
    [oracle@oracledb ~]#
    

    3、关闭数据库

    [oracle@oracledb root]$ 
    [oracle@oracledb root]$ sqlplus / as sysdba
    
    SQL*Plus: Release 11.2.0.1.0 Production on Sun Dec 20 20:50:25 2020
    
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    
    
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, Oracle Label Security, OLAP, Data Mining,
    Oracle Database Vault and Real Application Testing options
    
    SQL> 
    SQL> 
    SQL> 
    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> 
    SQL> 
    SQL> 
    SQL> exit
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, Oracle Label Security, OLAP, Data Mining,
    Oracle Database Vault and Real Application Testing options
    [oracle@oracledb root]$
    

    4、启动监听器

    [oracle@oracledb ~]$ lsnrctl start
    
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 20-DEC-2020 20:54:43
    
    Copyright (c) 1991, 2009, Oracle.  All rights reserved.
    
    Starting /data/app/oracle/product/11.2.0/bin/tnslsnr: please wait...
    
    TNSLSNR for Linux: Version 11.2.0.1.0 - Production
    System parameter file is /data/app/oracle/product/11.2.0/network/admin/listener.ora
    Log messages written to /data/app/oracle/diag/tnslsnr/oracledb/listener/alert/log.xml
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb)(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                20-DEC-2020 20:54:43
    Uptime                    0 days 0 hr. 0 min. 0 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /data/app/oracle/product/11.2.0/network/admin/listener.ora
    Listener Log File         /data/app/oracle/diag/tnslsnr/oracledb/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb)(PORT=1521)))
    The listener supports no services
    The command completed successfully
    [oracle@oracledb ~]$ 
    [oracle@oracledb ~]$ 
    [oracle@oracledb ~]$ 
    [oracle@oracledb ~]$ 
    [oracle@oracledb ~]$ lsnrctl status     
    
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 20-DEC-2020 20:55:53
    
    Copyright (c) 1991, 2009, Oracle.  All rights reserved.
    
    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                20-DEC-2020 20:54:43
    Uptime                    0 days 0 hr. 1 min. 10 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /data/app/oracle/product/11.2.0/network/admin/listener.ora
    Listener Log File         /data/app/oracle/diag/tnslsnr/oracledb/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb)(PORT=1521)))
    The listener supports no services
    The command completed successfully
    [oracle@oracledb ~]$
    

    5、启动数据库

    [oracle@oracledb ~]$ sqlplus / as sysdba
    
    SQL*Plus: Release 11.2.0.1.0 Production on Sun Dec 20 20:56:34 2020
    
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    
    Connected to an idle instance.
    
    SQL> CL (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
    SP2-0735: unknown CLEAR option beginning "(DESCRIPTI..."
    SQL> oracle   32753 20146  0 20:56 pts/1    00:00:00 ps -ef^C^C^C
    
    SQL> 
    SQL> startup
    ORACLE instance started.
    
    Total System Global Area 1286066176 bytes
    Fixed Size                  2213016 bytes
    Variable Size             352324456 bytes
    Database Buffers          922746880 bytes
    Redo Buffers                8781824 bytes
    Database mounted.
    Database opened.
    SQL> 
    SQL> 
    SQL> 
    SQL> 
    SQL> 
    SQL> select status from v$instance;
    
    STATUS
    ------------------------
    OPEN
    
    SQL>  exit
    

    详细解读可参考:https://blog.csdn.net/lling_shan/article/details/106085875

  • 相关阅读:
    350 Intersection of Two Arrays II 两个数组的交集 II
    349 Intersection of Two Arrays 两个数组的交集
    347 Top K Frequent Elements 前K个高频元素
    345 Reverse Vowels of a String 反转字符串中的元音字母
    344 Reverse String 反转字符串
    343 Integer Break 整数拆分
    342 Power of Four 4的幂
    338 Counting Bits Bit位计数
    Java常见面试题之Forward和Redirect的区别
    字节、字、bit、byte的关系
  • 原文地址:https://www.cnblogs.com/iwangzhengchao/p/14165567.html
Copyright © 2011-2022 走看看