zoukankan      html  css  js  c++  java
  • CentOS6.3 下启动Oracle service和listener

    一、启动Oracle数据库和监听器

      首先切换到Oracle专有用户:

    [root@NJZYY06 ~]# su - oracle
    [oracle@NJZYY06 ~]$ 

      1.启动数据库:

    [oracle@NJZYY06 ~]$ sqlplus /nolog
    
    SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 3 08:48:19 2014
    
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    
    SQL> connect /as sysdba
    Connected to an idle instance.
    SQL> startup
    ORACLE instance started.
    
    Total System Global Area 6680915968 bytes
    Fixed Size                  2213936 bytes
    Variable Size            4429187024 bytes
    Database Buffers         2214592512 bytes
    Redo Buffers               34922496 bytes
    Database mounted.
    Database opened.
    SQL> 

      2.启动监听器

    [oracle@NJZYY06 ~]$ lsnrctl start
    
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 03-SEP-2014 08:50:09
    
    Copyright (c) 1991, 2009, Oracle.  All rights reserved.
    
    Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
    
    TNSLSNR for Linux: Version 11.2.0.1.0 - Production
    System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
    Log messages written to /u01/app/oracle/diag/tnslsnr/NJZYY06/listener/alert/log.xml
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=NJZYY06)(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                03-SEP-2014 08:50:11
    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/db_1/network/admin/listener.ora
    Listener Log File         /u01/app/oracle/diag/tnslsnr/NJZYY06/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=NJZYY06)(PORT=1521)))
    The listener supports no services
    The command completed successfully
    [oracle@NJZYY06 ~]$ 

    二、关闭服务于监听器

      1.关闭数据库:

        <1>.正常关闭:正常关闭数据库所用的选项是normal,数据库在关闭前将检查所有的连接,并且发出命令后不允许再有新的用户连接,在等待所有连接都断开后再关闭数据库,再次启动数据库不需要任何恢复过程。

    SQL> shutdown normal;
    Database closed.
    Database dismounted.
    ORACLE instance shut down.

        <2>.紧急关闭:该方式用在某些紧急的情况下,比如通知马上停电,此时需要紧急关闭数据库以应付这些情况。这种方式用的选项是immediate,在这种方式下并不等待所有的用户断开连接再关闭,而是由系统断开连接,然后关闭数据库。

    SQL> shutdown immediate;

        一旦执行上述命令,则将当前正在处理的sql语句马上停止,然后将所有未提交的事务回滚,并且不等待当前联入数据库的用户断开连接,而是由系统强行将各个联接断开。在下次启动数据库时要执行恢复动作,不过是由系统自动执行的,用户不必去了解它。

        <3>.异常关闭:异常关闭选项是abort,此种方式下系统并不做任何检查和断开用户操作以及回退操作,而是直接将数据库现场撤销,这样现场中的数据库数据当然就无效了,数据库自然也就被关掉了。以abort方式关闭数据库时只有一行关闭信息表示关闭了数据库现场。以abort方式关闭的数据库再次启动时必须要进行恢复动作,这些恢复操作同样是系统自动来完成的,需要的时间较长。

    [oracle@NJZYY06 ~]$ sqlplus /nolog
    
    SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 3 08:53:43 2014
    
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    
    SQL> connect /as sysdba
    Connected.
    SQL> shutdown abort;
    ORACLE instance shut down.

      2.关闭监听器

    [oracle@NJZYY06 ~]$ lsnrctl stop

      3.查看监听器状态

    [oracle@NJZYY06 ~]$ lsnrctl 
    或者
    [oracle@NJZYY06 ~]$ lsnrctl status
  • 相关阅读:
    C#---将数据库数据转换为json格式
    ASP.NET ---根据值让树中某一节点选中
    SQL---查询树中某个节点及其所有子节点
    CSS---相对定位笔记
    CSS---绝对定位笔记
    滑雪
    Self Numbers
    Lotto
    Parencodings
    Robot Motion
  • 原文地址:https://www.cnblogs.com/Richard-xie/p/3952872.html
Copyright © 2011-2022 走看看