zoukankan      html  css  js  c++  java
  • linux下oracle11g R2的启动与关闭监听、数据库

    一、启动监听与数据库

    1、启动监听:

    1. [root@JTWF oracle]# su - oracle  
    2. bash-4.1$ lsnrctl start  

    说明:

    su后面追加 -,-l,--login,表示切换用户时,使环境变量(home,shell,user,logname,path等)和欲切换的用户相同、

    结果如下,则启动成功:

    1. LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 04-APR-2014 16:15:25  
    2.   
    3. Copyright (c) 1991, 2009, Oracle.  All rights reserved.  
    4.   
    5. Starting /home/oracle/product/11.2/db_1/bin/tnslsnr: please wait...  
    6.   
    7. TNSLSNR for Linux: Version 11.2.0.1.0 - Production  
    8. System parameter file is /home/oracle/product/11.2/db_1/network/admin/listener.ora  
    9. Log messages written to /home/oracle/diag/tnslsnr/JTWF/listener/alert/log.xml  
    10. Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=JTWF)(PORT=1521)))  
    11.   
    12. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=JTWF)(PORT=1521)))  
    13. STATUS of the LISTENER  
    14. ------------------------  
    15. Alias                     LISTENER  
    16. Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production  
    17. Start Date                04-APR-2014 16:15:25  
    18. Uptime                    0 days 0 hr. 0 min. 0 sec  
    19. Trace Level               off  
    20. Security                  ON: Local OS Authentication  
    21. SNMP                      OFF  
    22. Listener Parameter File   /home/oracle/product/11.2/db_1/network/admin/listener.ora  
    23. Listener Log File         /home/oracle/diag/tnslsnr/JTWF/listener/alert/log.xml  
    24. Listening Endpoints Summary...  
    25.   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=JTWF)(PORT=1521)))  
    26. The listener supports no services  
    27. The command completed successfully  


    2、启动数据库:

    连接到sqlplus

    1. su oracle  
    2. bash-4.1$ sqlplus /nolog  


    结果如下:


    1. SQL*Plus: Release 11.2.0.1.0 Production on Fri Apr 4 16:15:52 2014  
    2.   
    3. Copyright (c) 1982, 2009, Oracle.  All rights reserved.  
    4.   
    5. SQL>  

    以sysdba登陆,并执行命令startup

    1. SQL> conn /as sysdba  
    2. Connected to an idle instance.  
    3. SQL> startup      

    结果如下:

    1. ORACLE instance started.  
    2. Total System Global Area  839282688 bytes  
    3. Fixed Size            2217992 bytes  
    4. Variable Size          578815992 bytes  
    5. Database Buffers      251658240 bytes  
    6. Redo Buffers            6590464 bytes  
    7. Database mounted.  
    8. Database opened.  
    9. SQL>  


    二、关闭数据库、监听

    1、关闭数据库

    1. su - oracle  
    2. [root@JTWF oracle]# su oracle  
    3. bash-4.1$ sqlplus /nolog  

    登陆sqlplus,结果如下:

    1. SQL*Plus: Release 11.2.0.1.0 Production on Fri Apr 4 15:10:59 2014  
    2.   
    3. Copyright (c) 1982, 2009, Oracle.  All rights reserved.  
    4.   
    5. SQL>  


    sysdba登陆:

    1. SQL>conn /as sysdba  
    2. Connected.   


    关闭数据库:

    1. SQL> shutdown immediate  
    2. Database closed.  
    3. Database dismounted.  
    4. ORACLE instance shut down.  


    关闭数据库后,若执行查询命令, 则会报如下错误:

    1. SQL> select * from vio_business_request;  
    2. select * from vio_business_request  
    3. *  
    4. ERROR at line 1:  
    5. ORA-01034: ORACLE not available  
    6. Process ID: 14138  
    7. Session ID: 75 Serial number: 503  
    8. SQL>  



    退出sqlplus:

    1. SQL> exit     
    2. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production  
    3. With the Partitioning, OLAP, Data Mining and Real Application Testing options  


    2、关闭监听:


      1. bash-4.1$ lsnrctl stop   // oracle用户下执行  
      2.   
      3. LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 04-APR-2014 15:17:00  
      4.   
      5. Copyright (c) 1991, 2009, Oracle.  All rights reserved.  
      6.   
      7. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=JTWF)(PORT=1521)))  
      8. The command completed successfullybash-4.1$ lsnrctl stop  
      9.   
      10. LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 04-APR-2014 15:17:00  
      11.   
      12. Copyright (c) 1991, 2009, Oracle.  All rights reserved.  
      13.   
      14. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=JTWF)(PORT=1521)))  
      15. The command completed successfully 
  • 相关阅读:
    python(打印九九乘法表,三角形)
    Python (内置函数)
    python (生成器,生成推导式)
    python (函数名,闭包和迭代器)
    python (函数命名空间和作用域)
    python (函数)
    python (文件)
    python (集合和深浅拷贝)
    jquery 学习(四)
    JavaScript练习
  • 原文地址:https://www.cnblogs.com/jycjy/p/6941440.html
Copyright © 2011-2022 走看看