启动数据库实例,分为两步:第一步,启动监听;第二步,启动数据库实例。

进入到sqlplus启动实例

  1. 切换到oracle用户

    [oracle@aiezfs bin]$ su - oracle

  2. 打开监听

    [oracle@aiezfs bin]$ ./lsnrctl start

    LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 07-OCT-2014 15:41:02

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

    Starting /home/oracle/app/oracle/product/12.1.0/dbhome_1/bin/tnslsnr: please wait...

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

    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
    STATUS of the LISTENER
    ------------------------
    Alias LISTENER
    Version TNSLSNR for Linux: Version 12.1.0.1.0 - Production
    Start Date 07-OCT-2014 15:41:04
    Uptime 0 days 0 hr. 0 min. 0 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File /home/oracle/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
    Listener Log File /home/oracle/app/oracle/diag/tnslsnr/aiezfs/listener/alert/log.xml
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
    The listener supports no services
    The command completed successfully

  3. 进入到sqlplus

    [oracle@aiezfs bin]$ ./sqlplus /nolog

    SQL*Plus: Release 12.1.0.1.0 Production on Tue Oct 7 15:41:30 2014

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

  4. 通过sysdba连接

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

  5. 启动数据库实例

    SQL> startup
    ORACLE instance started.
    Total System Global Area 4.0486E+10 bytes
    Fixed Size 4658128 bytes
    Variable Size 5368712240 bytes
    Database Buffers 3.5031E+10 bytes
    Redo Buffers 82210816 bytes
    Database mounted.
    Database opened.

  6. 关闭数据库实例

    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.

  7. 退出sql

    SQL> exit
    Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

  8. 关闭监听

    [oracle@aiezfs bin]$ ./lsnrctl stop

    LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 07-OCT-2014 16:39:54

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

    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
    The command completed successfully

通过dbstart和dbshut启动和关闭数据库

  1. 启动监听 lsnrctl start,同上

  2. 启动实例

    [oracle@aiezfs bin]$ ./dbstart
    ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
    Usage: ./dbstart ORACLE_HOME

    使用dbstart命令,需要指定变量ORACLE_HOME_LISTNER,此处等于ORACLE_HOME,可以在dbstart和dbshut脚本文件中,修改变量ORACLE_HOME_LISTNER的值。
    ORACLE_HOME_LISTNER=$1,修改为
    ORACLE_HOME_LISTNER=$ORACLE_HOME。

    修改后再执行./dbstart