• Linux环境 Oracle 监听和服务 日常操作



    文章目录

                        一、Oracle监听
                        1.1. 查看Oracle监听运行状态
                        1.2. 启动Oracle监听
                        1.3. 关闭监听器
                        二、Oracle 服务
                            2.1. 以SYS用户身份登录Oracle
                            2.2. 切换用户至sys
                            2.3. 启动Oracle实例
                            2.4. 停止Oeacle实例运行

    一、Oracle监听

    操作声明:登录服务器,切换到oracle用户,或者以oracle用户登录
    #切换oracle用户
    [root@localhost ~]$ su - oracle
    密码:
    [oracle@localhost ~]$
    1.1. 查看Oracle监听运行状态

    [oracle@localhost ~]$ lsnrctl status

        1

    从图中可以看到oracle监听没有运行
    在这里插入图片描述
    1.2. 启动Oracle监听

    [oracle@localhost ~]$ lsnrctl start

        1

    在这里插入图片描述
    在这里插入图片描述

    在这里插入图片描述
    再次查看Oracle监听运行状态

    [oracle@localhost ~]$ lsnrctl status

        1

    从图中可以看到oracle监听已经运行
    在这里插入图片描述
    1.3. 关闭监听器
    二、Oracle 服务
    2.1. 以SYS用户身份登录Oracle

    [oracle@localhost ~]$ sqlplus /nolog

    SQL*Plus: Release 11.2.0.4.0 Production on Sat May 16 15:43:46 2020

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

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

        1
        2
        3
        4
        5
        6
        7
        8

    2.2. 切换用户至sys

    切换用户:
    CONN 用户名/密码 [AS SYSDBA],如果是sys用户一定要写上AS SYSDBA

    sqlplus /nolog
    conn /as sysdba

        1
        2

    在这里插入图片描述
    2.3. 启动Oracle实例

    SQL> startup
    ORACLE instance started.

    Total System Global Area 8551575552 bytes
    Fixed Size                  2270360 bytes
    Variable Size            4244638568 bytes
    Database Buffers         4294967296 bytes
    Redo Buffers                9699328 bytes
    Database mounted.
    Database opened.

        1
        2
        3
        4
        5
        6
        7
        8
        9
        10

    在这里插入图片描述
    2.4. 停止Oeacle实例运行

    SQL> shutdown
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> quit
    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

        1
        2
        3
        4
        5
        6
        7

    操作日志如下;


    Last login: Sat Jun 20 18:03:14 2020 from 192.168.6.188
    [root@sonar ~]#  su - oracle
    ORACLE_BASE=/u01/oracle
    ORACLE_HOME=/u01/oracle/product/11.2.0/db_1
    ORACLE_SID=sonar
    [oracle@sonar ~]$ lsnrctl status

    LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 20-JUN-2020 18:31:19

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

    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=sonar)(PORT=1521)))
    TNS-12541: TNS:no listener
     TNS-12560: TNS:protocol adapter error
      TNS-00511: No listener
       Linux Error: 111: Connection refused
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
    TNS-12541: TNS:no listener
     TNS-12560: TNS:protocol adapter error
      TNS-00511: No listener
       Linux Error: 111: Connection refused
    [oracle@sonar ~]$ lsnrctl start

    LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 20-JUN-2020 18:31:32

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

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

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

    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=sonar)(PORT=1521)))
    STATUS of the LISTENER
    ------------------------
    Alias                     LISTENER
    Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
    Start Date                20-JUN-2020 18:31:34
    Uptime                    0 days 0 hr. 0 min. 0 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /u01/oracle/product/11.2.0/db_1/network/admin/listener.ora
    Listener Log File         /u01/oracle/diag/tnslsnr/sonar/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sonar)(PORT=1521)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
    The listener supports no services
    The command completed successfully
    [oracle@sonar ~]$ lsnrctl status

    LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 20-JUN-2020 18:31:47

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

    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=sonar)(PORT=1521)))
    STATUS of the LISTENER
    ------------------------
    Alias                     LISTENER
    Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
    Start Date                20-JUN-2020 18:31:34
    Uptime                    0 days 0 hr. 0 min. 13 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /u01/oracle/product/11.2.0/db_1/network/admin/listener.ora
    Listener Log File         /u01/oracle/diag/tnslsnr/sonar/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sonar)(PORT=1521)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
    The listener supports no services
    The command completed successfully
    [oracle@sonar ~]$ sqlplus /nolog

    SQL*Plus: Release 11.2.0.4.0 Production on Sat Jun 20 18:32:56 2020

    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 8551575552 bytes
    Fixed Size                  2270360 bytes
    Variable Size            4244638568 bytes
    Database Buffers         4294967296 bytes
    Redo Buffers                9699328 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@sonar ~]$
    ————————————————
    版权声明:本文为CSDN博主「gblfy」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/weixin_40816738/article/details/106160298

  • 相关阅读:
    SMTP 服务器要求安全连接或客户端未通过身份验证的各个解决方案(C#)
    远程数据同步的三种方法
    粗俗易懂的SQL存储过程在.NET中的实例运用之二
    SSIS脚本组件的代码
    浅谈C# StackTrace 类的实例说明
    解决了:无法加载文件或程序集'stdole, Version=7.0.3300.0'
    收藏: .NET中类型的转换
    WCF 实例 —— Android 短信助手 (WCF + Android)
    粗俗易懂的SQL存储过程在.NET中的实例运用
    此发送邮件的代码对吗?
  • 原文地址:https://www.cnblogs.com/lcword/p/14484566.html
Copyright © 2020-2023  润新知