精华内容
下载资源
问答
  • 脚本启停数据库1修改启动脚本BUG#Vim $ORACLE_HOME/bin/dbstart(line78)ORACLE_HOME_LISTNER=$ORACLE_HOME修改变量为指定值2修改允许脚本启动调用启的参数#vim /etc/oratabOra10:/u01/app/oracle/product/10.2.0/...

    操作系统自动启停数据库及脚本启停数据库

    >脚本启停数据库

    1修改启动脚本BUG

    #Vim $ORACLE_HOME/bin/dbstart(line78)

    ORACLE_HOME_LISTNER=$ORACLE_HOME修改变量为指定值

    2修改允许脚本启动调用启停的参数

    #vim /etc/oratab

    Ora10:/u01/app/oracle/product/10.2.0/db_1:Y将参数改为Y

    3测试数据库启停脚本

    $dbstart

    $dbshut

    >定制脚本,使系统启动时自动启动oracle,关机时自动关闭oracle数据库。

    Vim /etc/init.d/dbora

    #!/bin/bash

    #chkconfig: 35 99 01*启动级别在3,5;最后一个启动的服务;第一个关闭的服务

    #description: oracle

    ORA_HOME=/u01/app/oracle/product/10.2.0/db_1*定义oracle主目录

    LOG=$ORA_HOME/startup.log*记录oracle的启停操作

    Chmod a+r$LOG*给这个变量增加读的权限

    If [! –f $ORA_HOME/bin/dbstart ]*对脚本作出判断,如果不是一个文件

    Then

    Echo

    “oracle startup:can not start”*输出这个数据库不能启动

    Fi否则:

    Case $1 in*情况一

    ‘start’)*启动

    Echo

    “$0:starting up” >>$LOG*将启动信息追加到$LOG文件中记录

    Date >>$LOG*将时间也追加进去

    If [ -f $ORA_HOME/bin/tnslsnr]*如果这个服务端监听文件是一个文件

    Then*则

    Echo

    “starting oracle net listener”*输出打开网络监听程序

    Su –

    oracle –c “$ORA_HOME/bin/lsnrctl start” >>$LOG 2 >&1 *切换到oracle用户启动监听

    Fi

    Echo “starting oracle databases”*输出启动数据库的信息

    Su -oracle –c “$ORA_HOME/bin/dbstart” >>$LOG >&1 *切到oracle用户执行db启动脚本

    Touch /var/lock/subsys/dbora*创建一个标记文件,表明这个服务已经开启了

    ;;

    ‘stop’)*关闭数据库的操作

    Echo

    “$0:shutting down “>>$LOG

    Date

    >>$LOG*将关闭数据库的信息和日期写入$LOG文件中

    If

    [ -f $ORACLE_HOME/bin/tnslsnr ]

    Then

    echo “stopping oracle net listener”

    su – oracle –c “$ORA_HOME/bin/lsnrctl stop” >>$LOG 2>&1*关闭监听

    fi

    echo “stopping oracle databases”

    su – oracle –c “$ORA_HOME/bin/dbshut” >>$LOG 2>&1*关闭数据库

    rm /var/lock/subsys/dbora*删除标记服务的文件

    ;;

    *)

    Echo “usage :$0 {start|stop}”*输出脚本的使用方法

    Exit

    ;;

    Esac

    #Touch /u01/app/oracle/product/10.2.0/db_1/startup.log创建标记文件

    #chown oracle:oinstall

    /u01/app/oracle/product/10.2.0/db_1/startup.log修改文件的所属为oracle用户和oinstall用户组

    #chmod a+x /etc/init.d/dbora给脚本赋予可执行权限

    #/etc/rc.d/init.d/dbora start测试脚本的启动

    #/etc/rc.d/init.d/dbora stop测试脚本的停止

    #chkconfig –add dbora将dbora服务添加到开机启动服务中去。下次开机就自动启动oracle数据库了

    *注意:脚本头部的chkconfig:后面空一格加启动级别;description:空一格加描述;否则该脚本服务奖不能被chkconfig命令所使用。另外:[ ]内不能有字母与[]挨着,要空一格,否则会报语法错误。

    展开全文
  • 1、启动oracle # su - oracle $sqlplus sys/oracle as sysdba >select * from v$version; //查看版本 >startup open //启动oracle服务器 >exit $lsnrctl start //启动监听   2、停止oracle # su - ...

    1、启动oracle

    # su - oracle

    $sqlplus sys/oracle as sysdba

    >select  *   from   v$version;  //查看版本

    >startup open     //启动oracle服务器

    >exit

    $lsnrctl start      //启动监听

     

    2、停止oracle

    # su - oracle

    $sqlplus sys/oracle as sysdba

    >shutdown immediate

     

    3、windows下启停

    services.msc  查看到服务名称

    启动:net start OracleServiceORCL
    停止:net stop OracleServiceORCL

    展开全文
  • 满足如下条件即可远程启库1.创建sysdba用户,赋予connect和sysdba权限 2.remote_login_passwordfile为 EXCLUSIVE 3.加入静态监听 Last login: Tue Nov 3 11:01:16 2020 from 192.168.52.1 [root@saperp ~]# su - ...

    满足如下条件即可远程启停库
    1.创建sysdba用户,赋予connect和sysdba权限
    2.remote_login_passwordfile为 EXCLUSIVE
    3.加入静态监听

    Last login: Tue Nov  3 11:01:16 2020 from 192.168.52.1
    [root@saperp ~]# su - oracle
    Last login: Fri Oct 30 14:44:06 CST 2020 on pts/0
    [oracle@saperp ~]$ sqlplus / as sysdba

    SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 24 09:34:02 2020

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

    Connected to an idle instance.

    SQL> startup
    ORACLE instance started.

    Total System Global Area 1252663296 bytes
    Fixed Size                  2252824 bytes
    Variable Size             436211688 bytes
    Database Buffers          805306368 bytes
    Redo Buffers                8892416 bytes
    Database mounted.
    Database opened.
    SQL> select * from v$pwfile_users;

    USERNAME                       SYSDB SYSOP SYSAS
    ------------------------------ ----- ----- -----
    SYS                            TRUE  TRUE  FALSE

    SQL> create user sysdba identified by sys;

    User created.

    SQL> grant sysdba to sysdba;

    Grant succeeded.

    SQL> select * from v$pwfile_users;

    USERNAME                       SYSDB SYSOP SYSAS
    ------------------------------ ----- ----- -----
    SYS                            TRUE  TRUE  FALSE
    SYSDBA                         TRUE  FALSE FALSE

    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@saperp ~]$ ps -ef|grep ora_smon
    oracle     1939      1  0 09:34 ?        00:00:00 ora_smon_erp
    oracle     2073   1883  0 09:35 pts/0    00:00:00 grep --color=auto ora_smon

    [oracle@saperp admin]$ more sqlnet.ora
    # sqlnet.ora Network Configuration File: /home/db/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora
    # Generated by Oracle configuration tools.

    NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

    ADR_BASE = /home/db/oracle
     

    [oracle@saperp admin]$ cat tnsnames.ora 
    erp =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.52.155)(PORT = 1521))
        )
        (CONNECT_DATA =
          (SERVICE_NAME = erp)
        )
      )
    [oracle@saperp ~]$ tnsping erp

    TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 24-NOV-2020 09:35:19

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

    Used parameter files:
    /home/db/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora


    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.52.155)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = erp)))
    TNS-12541: TNS:no listener
    [oracle@saperp ~]$ lsnrctl start

    LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 24-NOV-2020 09:35:22

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

    Starting /home/db/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 /home/db/oracle/product/11.2.0/db_1/network/admin/listener.ora
    Log messages written to /home/db/oracle/diag/tnslsnr/saperp/listener/alert/log.xml
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=saperp)(PORT=1521)))

    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
    STATUS of the LISTENER
    ------------------------
    Alias                     LISTENER
    Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
    Start Date                24-NOV-2020 09:35:22
    Uptime                    0 days 0 hr. 0 min. 0 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /home/db/oracle/product/11.2.0/db_1/network/admin/listener.ora
    Listener Log File         /home/db/oracle/diag/tnslsnr/saperp/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=saperp)(PORT=1521)))
    The listener supports no services
    The command completed successfully
    [oracle@saperp ~]$ tnsping erp

    TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 24-NOV-2020 09:35:24

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

    Used parameter files:
    /home/db/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora


    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.52.155)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = erp)))
    OK (0 msec)
    [oracle@saperp ~]$ sqlplus sysdba/sys@erp as sysdba

    SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 24 09:35:41 2020

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

    ERROR:
    ORA-12514: TNS:listener does not currently know of service requested in connect descriptor


    Enter user-name: 
    [oracle@saperp ~]$ tnsping erp

    TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 24-NOV-2020 09:36:03

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

    Used parameter files:
    /home/db/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora


    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.52.155)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = erp)))
    OK (0 msec)
    [oracle@saperp ~]$ sqlplus / as sysdba

    SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 24 09:36:09 2020

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


    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options

    SQL> show parameter name;

    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    cell_offloadgroup_name               string
    db_file_name_convert                 string
    db_name                              string      erp
    db_unique_name                       string      erp
    global_names                         boolean     FALSE
    instance_name                        string      erp
    lock_name_space                      string
    log_file_name_convert                string
    processor_group_name                 string
    service_names                        string      erp
    SQL> grant connect to sysdba;

    Grant succeeded.

    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@saperp ~]$ sqlplus sysdba/sys@erp as sysdba

    SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 24 09:37:11 2020

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


    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options

    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> startup
    ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
    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@saperp ~]$ sqlplus sysdba/sys@erp as sysdba

    SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 24 09:37:53 2020

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

    ERROR:
    ORA-12514: TNS:listener does not currently know of service requested in connect
    descriptor


    Enter user-name: 
    ERROR:
    ORA-01017: invalid username/password; logon denied


    Enter user-name: 
    [oracle@saperp ~]$ sqlplus /@erp as sysdba

    SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 24 09:38:21 2020

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

    ERROR:
    ORA-12514: TNS:listener does not currently know of service requested in connect
    descriptor


    Enter user-name: 
    [oracle@saperp ~]$ sqlplus / as sysdba

    SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 24 09:38:31 2020

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

    Connected to an idle instance.

    SQL> startup
    ORACLE instance started.

    Total System Global Area 1252663296 bytes
    Fixed Size                  2252824 bytes
    Variable Size             436211688 bytes
    Database Buffers          805306368 bytes
    Redo Buffers                8892416 bytes
    Database mounted.
    Database opened.
    SQL> show parameter pass;

    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    remote_login_passwordfile            string      EXCLUSIVE
    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@saperp ~]$ sqlplus sysdba/sys@erp as sysdba

    SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 24 09:41:01 2020

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


    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options

    SQL> startup force
    ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
    SQL> !ps -ef|grep ora_smon
    oracle     2491   2474  0 09:41 pts/1    00:00:00 /bin/bash -c ps -ef|grep ora_smon
    oracle     2493   2491  0 09:41 pts/1    00:00:00 grep ora_smon

    SQL> !oerr ora 12514
    12514, 00000, "TNS:listener does not currently know of service requested in connect descriptor"
    // *Cause:  The listener received a request to establish a connection to a
    // database or other service. The connect descriptor received by the listener
    // specified a service name for a service (usually a database service)
    // that either has not yet dynamically registered with the listener or has
    // not been statically configured for the listener.  This may be a temporary
    // condition such as after the listener has started, but before the database
    // instance has registered with the listener.
    // *Action: 
    //  - Wait a moment and try to connect a second time.
    //  - Check which services are currently known by the listener by executing:
    //    lsnrctl services <listener name>
    //  - Check that the SERVICE_NAME parameter in the connect descriptor of the
    //    net service name used specifies a service known by the listener.
    //  - If an easy connect naming connect identifier was used, check that
    //    the service name specified is a service known by the listener.
    //  - Check for an event in the listener.log file.

    SQL> show parameter name;
    ERROR:
    ORA-03114: not connected to ORACLE


    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@saperp ~]$ sqlplus sys/sys@erp as sysdba

    SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 24 09:47:30 2020

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

    ERROR:
    ORA-12514: TNS:listener does not currently know of service requested in connect
    descriptor


    Enter user-name: 
    [oracle@saperp ~]$ sqlplus sys/sys^Crp as sysdba
    [oracle@saperp ~]$ lsnrctl status

    LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 24-NOV-2020 09:47:41

    Copyright (c) 1991, 2013, 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.4.0 - Production
    Start Date                24-NOV-2020 09:35:22
    Uptime                    0 days 0 hr. 12 min. 18 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /home/db/oracle/product/11.2.0/db_1/network/admin/listener.ora
    Listener Log File         /home/db/oracle/diag/tnslsnr/saperp/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=saperp)(PORT=1521)))
    The listener supports no services
    The command completed successfully
    [oracle@saperp ~]$ cd $ORACLE_HOME/network/admin
    [oracle@saperp admin]$ ll
    total 20
    -rw-r-----  1 oracle oinstall 110 Jun  4 14:12 GLOBALS
    -rw-r--r--. 1 oracle oinstall 367 Jan 15  2020 listener.ora
    drwxr-xr-x. 2 oracle oinstall  64 Jan 15  2020 samples
    -rw-r--r--. 1 oracle oinstall 835 Sep 13  2019 shrept.lst
    -rw-r--r--. 1 oracle oinstall 219 Jan 15  2020 sqlnet.ora
    -rw-r--r--  1 oracle oinstall 177 May  2  2020 tnsnames.ora
    [oracle@saperp admin]$ more listener.ora 
    # listener.ora Network Configuration File: /home/db/oracle/product/11.2.0/db_1/network/admin/listener.ora
    # Generated by Oracle configuration tools.

    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
          (ADDRESS = (PROTOCOL = TCP)(HOST = saperp)(PORT = 1521))
        )
      )

    ADR_BASE_LISTENER = /home/db/oracle

    [oracle@saperp admin]$ tnsping erp

    TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 24-NOV-2020 09:48:10

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

    Used parameter files:
    /home/db/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora


    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.52.155)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = erp)))
    OK (0 msec)
    [oracle@saperp admin]$ vi listener.ora 
    # listener.ora Network Configuration File: /home/db/oracle/product/11.2.0/db_1/network/admin/listener.ora
    # Generated by Oracle configuration tools.

    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
          (ADDRESS = (PROTOCOL = TCP)(HOST = saperp)(PORT = 1521))
        )
      )
    SID_LIST_LISTENER=
      (SID_LIST =
         (SID_DESC =
          ( GLOBAL_DBNAME = erp)
          ( ORACLE_HOME =/home/db/oracle/product/11.2.0/db_1)
          ( SID_NAME = erp)
        )
      )

    ADR_BASE_LISTENER = /home/db/oracle

    ~
    ~
    ~
    "listener.ora" 21L, 545C written                                                          
    [oracle@saperp admin]$ cat listener.ora 
    # listener.ora Network Configuration File: /home/db/oracle/product/11.2.0/db_1/network/admin/listener.ora
    # Generated by Oracle configuration tools.

    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
          (ADDRESS = (PROTOCOL = TCP)(HOST = saperp)(PORT = 1521))
        )
      )
    SID_LIST_LISTENER= 
      (SID_LIST = 
         (SID_DESC = 
          ( GLOBAL_DBNAME = erp) 
          ( ORACLE_HOME =/home/db/oracle/product/11.2.0/db_1) 
          ( SID_NAME = erp) 
        ) 
      )

    ADR_BASE_LISTENER = /home/db/oracle

    [oracle@saperp admin]$ lsnrctl stop

    LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 24-NOV-2020 09:49:53

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

    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
    The command completed successfully
    [oracle@saperp admin]$ lsnrctl start

    LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 24-NOV-2020 09:49:55

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

    Starting /home/db/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 /home/db/oracle/product/11.2.0/db_1/network/admin/listener.ora
    Log messages written to /home/db/oracle/diag/tnslsnr/saperp/listener/alert/log.xml
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=saperp)(PORT=1521)))

    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
    STATUS of the LISTENER
    ------------------------
    Alias                     LISTENER
    Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
    Start Date                24-NOV-2020 09:49:55
    Uptime                    0 days 0 hr. 0 min. 0 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /home/db/oracle/product/11.2.0/db_1/network/admin/listener.ora
    Listener Log File         /home/db/oracle/diag/tnslsnr/saperp/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=saperp)(PORT=1521)))
    Services Summary...
    Service "erp" has 1 instance(s).
      Instance "erp", status UNKNOWN, has 1 handler(s) for this service...
    The command completed successfully
    [oracle@saperp admin]$ sqlplus sysdba/sys@erp as sysdba

    SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 24 09:50:02 2020

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

    Connected to an idle instance.

    SQL> startup
    ORACLE instance started.

    Total System Global Area 1252663296 bytes
    Fixed Size                  2252824 bytes
    Variable Size             436211688 bytes
    Database Buffers          805306368 bytes
    Redo Buffers                8892416 bytes
    Database mounted.
    Database opened.
    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> startup
    ORACLE instance started.

    Total System Global Area 1252663296 bytes
    Fixed Size                  2252824 bytes
    Variable Size             436211688 bytes
    Database Buffers          805306368 bytes
    Redo Buffers                8892416 bytes
    Database mounted.
    Database opened.
    SQL> 

    展开全文
  • 用命令shutdown/startup对ORACLE数据库的关闭和启动对DBA来讲是很正常的事,当系统运行到某个时候,有些用户进程可能已死(比如非法退出、非法关闭程序等),这样ORACLE的资源就不能释放,影响到了ORACLE的性能;...

    用命令shutdown/startup对ORACLE数据库的关闭和启动对DBA来讲是很正常的事,当系统运行到某个时候,有些用户进程可能已死(比如非法退出、非法关闭程序等),这样ORACLE的资源就不能释放,影响到了ORACLE的性能;再有,在DBA优化了系统设置参数后,也必须启动数据库等等,这些就牵涉到了ORACLE数据库的启动和关闭,[@more@]

    用命令shutdown/startup对ORACLE数据库的关闭和启动对DBA来讲是很正常的事,当系统运行到某个时候,有些用户进程可能已死(比如非法退出、非法关闭程序等),这样ORACLE的资源就不能释放,影响到了ORACLE的性能;再有,在DBA优化了系统设置参数后,也必须启动数据库等等,这些就牵涉到了ORACLE数据库的启动和关闭,在讲这两个操作之前,我想先明确几个概念:

    一、关闭数据库

    1、 SQL*NET:是分布式ORACLE数据库的组成部分,负责用户或应用程序和数据库的对话;

    2、 trace files 和 logs:trace files文件是在ORACLE启动INSTANCE时自动创建该文件的,该文件存在于由INIT.ORA 或CONFIG.ORA文件中的BACKGROUND_DUMP_DEST参数指定的路径中,对不同的操作系统,trace files有不同的名称,我们都知道,当启动ORACLE时必须先启动监听,也就在这个时候产生了LISTENER.LOG,当ORACLE启动和关闭时,trace files和LISTENER.LOG文件并不删除

    现在我们明确了以上两点,应该知道下步我要做什么了:

    1、 在关闭数据库之前不要先关SQL*NET

    2、 将trace files 和 logs妥善管理,比如删除或改名

    3、 关闭数据库shutdown

    二、启动数据库

    1、 对于被破坏的数据库我们可以先增加一个控制文件,可用这个控制文件覆盖掉原控制文件,我们可以在SQLPLUS的环境下输入:alter database backup controlfile to trace;创建

    2、 启动数据库后,我们要把系统和应用程序经常用到的包放到SGA区中,当ORACLE从SGA区读数据时,我们会觉得速度明显加快,我们可以通过如下语句将包放到SGQ区:

    alter package APPOWNER.ADD_CLIENT compile;

    execute DBMS_SHARED_POOL.KEEP('APPOWNER.ADD_CLIENT','P');

    三、其他

    同时启动两个监听:在当一台机器同时装了两个数据库时(这样的情况很少见),我们可能要同时启动两个监听,当我们在启动第二个监听时,这是ORACLE可能报TNS-01106的错误,其实引起这个错误的是LISTENER.ORA中IPC协议的KEY不同,我们只要将它修改成一致就可以了。

    四、下面推荐一个比较好的停止和启动ORACLE的好方法(包含C/S和B/S结构):

    1、 停止所有应用程序;

    2、 对于B/S结构(这里的中间件用的是WebLogic)应该停掉服务,C/S结构可以省略这一步;

    3、 对trace files 和 logs进行改名处理,建议用时间作为文件名,比如20040801.trc;

    4、 将ORACLE的监听停止:$lsnrctl stop;

    5、 为了防止我们在下次启动ORACLE时出现以外,建议备份控制文件:SQL>alter database backup controlfile to trace;

    6、 为了确保数据已保存到数据库,有必要切换日志文件:SQL>alter system switch logfile;对于B/S结构,我们应该先操作这步,再停掉监听;

    7、 关闭数据库:SVRMGRL>shutdown immediate;

    8、 启动数据库的监听:$lsnrctl start

    9、 启动ORACLE数据库:$svrmgrl ;SVRMGRL>connect internal;SVRMGRL>startup;

    10、启动中间件(B/S结构,所用中间件为WebLogic);

    11、启动应用程序。

    展开全文
  • 技术创新变革未来 Oracle数据库整体架构及启介绍 1 数据库创建过程 2 数据库物理结构 3 数据库逻辑结构 4 数据库启动与关闭 概念性知识--数据库upgrade Critical Patch Update (CPU) now refers to the overall ...
  • oracle 数据库

    2019-05-12 17:35:00
    oracle 数据库三个阶段 1.1 startup nomount : 启动实例 (1) 读取参数文件 (2)分配内存 (3)启动后台进程 SQL> startup nomountORACLE instance started. Total System Global Area 849530880 ...
  • Oracle 数据库模拟数据文件损坏恢复数据文件有时候因为某种原因会导致损坏而导致无法启动数据库,那如何恢复呢?下面是一次模拟实验,如下1. 首先创建一个表空间TEST,在创建一个表test在表空间test上SQL> create...
  • Linux操作oracle——关闭、停止、重启 ... 1)oracle数据库操作首先要切换到oracle用户 1.启动监听 lsnrctl start 2.启动数据库(启动数据库的所有功能) sqlplus /nolog connect /as sysdba star...
  • ORACLE数据库概述

    2019-05-28 09:15:02
    只要使用过oracle database,那么肯定执行过很多次的startup和shutdown的操作,但是你是否关心过这个过程发生了什么?这篇文章主要讲讲oracle启动与停止过程oracle后台发生的事情。 实例与数据库  首先需要弄清楚...
  • Oracle数据库的启

    千次阅读 2018-05-03 23:30:10
    1. Oracle数据库启动的4个状态 首先要知道,Oracle数据库的启动过程存在4个状态 shutdown(关闭) –&gt; nomount(启动已实例)–&gt;mount(加载数据库)–&gt;open(打开数据库) 1.1 SHUTDOWN...
  • 利用dbstart和dbshut脚本自动启动和停止数据库的问题客户的两台IBM Power 740小型机使用HACMP软件创建互备关系的数据库服务器,每台小型机运行一个数据库,任何一台服务器出现故障宕机,另一台小型机应该立即接管,...
  • oracle数据库实战

    2014-03-03 17:54:43
    oracle数据库体系结构,安装配置,起备份
  • 今天忽然 想到一个问题,将oracle的监听ebtl服务的作用是...oracle监听服务是不是就是监听某一个端口(1521) 如果有外来访问1521就会转到oracle数据库那里; 如果监听关掉,新来的链接就不知道去哪 但是之前已经...
  • oracle数据库包含了实例,默认安装数据库时会创建sid为orcl的实例。 当创建新的数据库(实例)时,此时数据 库里就有两个库(实例)。 在这种情况下在注册表里有一个参数 oracle_sid,默认的数据库实例 这个设置...
  • 只要使用过oracle database,那么肯定执行过很多次的startup和shutdown的操作,但是你是否关心过这个过程发生了什么?这篇文章主要讲讲oracle启动与停止过程oracle后台发生的事情。实例与数据库首先需要弄清楚一些...
  • Oracle 数据库服务重启步骤

    千次阅读 2020-03-03 19:36:34
    Linux 环境下搭建的Oracle 数据库,有时会因为数据...今天我们只介绍一下有关Oracle 数据库的相关操作。 首先以 oracle 用户登录 关闭服务 停止 Oracle 监听服务 $ lsnrctl stop 停止 Oracle 服务 $ sql...
  • 车辆管理系统oracle数据库 struts+hibernate
  • 在重启数据库的时候,忘记把一个应用关停了,想起来的时候,就ctrl+c,把数据库shutdown immediate 给强制下了,把该应用再停止,然后shutdown immdiate,这时候数据报错了。oracle@NMSSERVER1:~> sqlplus '/as ...
  • oracle数据库错误

    2017-12-05 10:30:29
    oracle遇到启动和停止错误为: ORA-24324: service handle not initialized ORA-01041: internal error. hostdef extension doesn't exist linux: export ORACLE_SID=orcl2 sqlplus /nolog   windows: set...
  • oracle数据库必备技能

    2011-05-20 17:58:54
    oracle数据库必备技能 ODBC数据源配置 数据库别名设置 数据库启
  • Oracle数据库重启

    千次阅读 2018-05-11 10:29:44
    Oracle数据库重新启动应该如何实现呢?这是很多人都提到过的问题,下面就为您详细介绍Oracle数据库重新启动的方法,供您参考。 1. 应用层的各种程序。 2. oralce的监听进程: $lsnrctl stop 3. 在独占的系统...
  • oracle数据库管理基础

    2019-08-13 13:43:16
    此文档是笔者在多年实际工作中,对经常用到的oracle技术内容做了一下整理,文档...涵盖了表空间及用户的管理,数据库的常用启命令,常见的系统视图功能查询,awr报告的生成,性能分析诊断,数据泵的导入导出操作等。
  • 准备安装文件: 一、oracle数据库安装 1.打补丁 (.net framework2.0/3.0) 二、oracle数据库卸载
  • Oracle管理Oracle数据库维护手册 数据库维护手册 目录 TOC \o "1-3" \h \z \u 1前言4 2ORACLE维护方法4 2.1数据库启动4 2.2数据库停止5 2.3监听器的启5 2.4用户管理6 2.5数据库参数文件6 2.6数据库概况的查询7 2.7...
  • oracle数据库操作

    2012-07-29 19:06:36
    [root@localhost ~]#[color=green] su - oracle[/color] //用oracle用户登录 [oracle@localhost ~]$[color=green] lsnrctl start[/color] //启动监听 [oracle@localhost ~]$[color=green]...
  • 输入 su - oracle第二步:连接在oracle用户下,输入 sqlplus /nolog第三步:使用管理员权限输入 connect /as sysdba第四步:启动/关闭服务输入startupstartup参数不带参数,启动数据库实例并打开数据库,以便用户...
  • 修改oracle数据库的名称 修改oracle数据库的名称需要同时在控制文件和参数文件中进行修改。修改控制文件中数据库的名称使用操作系统命令nid,修改参数文件中数据库的名称使用alter system命令。 step 1:查看数据库...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 20,497
精华内容 8,198
关键字:

停oracle数据库