startup database and shutdown database

启动数据有三种方式,

第一种 是SQLPLUS ,用数据管理员登陆,然后执行startup

第二种 是RMAN ,rman target / 登陆.然后startup

第三种是EM,直接点启动数据库就可以.

启动的时候会从缺省位置搜索以下三种服务器三种文件

  1. spfile$ORACLE_SID.ora
  2. spfile.ora
  3. init$ORACLE_SID.ora

  1. 你也可以指定启动的服务器参数文件startup pfile=''或spfile=''

启动其实可以分为三步:

  • (startup nomount)Start the instance without mounting a database. This does not allow access to the database and usually would be done only for database creation or the re-creation of control files.

在此模式下可以重建控制文件,

  • (startup mount)Start the instance and mount the database, but leave it closed. This state allows for certain DBA activities, but does not allow general access to the database.

修改数据的归档模式,打开闪回数据库,进行数据的RESTORE和RECOVER,都是在此模式下,

  • (startup mount,alter database open)Start the instance, and mount and open the database. This can be done in unrestricted mode, allowing access to all users, or in restricted mode, allowing access for database administrators only.
  • Force (强制重起)the instance to start after a startup or shutdown problem, or start the instance and have complete media recovery begin immediately.

数据库有时候还需要启动到restricted模式,通常以下情况需要:

  • Perform an export or import of data 进行数据导入导出时
  • Perform a data load (with SQL*Loader)  加载数据时
  • Temporarily prevent typical users from using data 临时阻止用户使用数据
    • Perform certain migration or upgrade operations 升级时

    ALTER SYSTEM DISABLE RESTRICTED SESSION; 关闭RESTRICT模式

     假如你知道实例需要介质恢复,则可以使用startup open recover

    you open a database in read-only mode when you alternate a standby database between read-only and recovery mode. Be aware that these are mutually exclusive modes.

    The following statement opens a database in read-only mode:

    ALTER DATABASE OPEN READ ONLY;
    ALTER DATABASE OPEN READ WRITE
    下边在来说说关闭数据库:
    shutdown normal 缺省的关闭方式,执行此语句后将不在有新的连接,数据库会等待所有已经连接的用户关闭连接后,在关闭数据库,
    shutdown immediate 常用的关闭方式
    Use immediate database shutdown only in the following situations:
    
    • To initiate an automated and unattended backup
    • When a power shutdown is going to occur soon
    • When the database or one of its applications is functioning irregularly and you cannot contact users to ask them to log off or they are unable to log off

    shutdown  TRANSACTIONAL

    Transactional database shutdown proceeds with the following conditions:

    • No new connections are allowed, nor are new transactions allowed to be started, after the statement is issued.
    • After all transactions have completed, any client still connected to the instance is disconnected.
    • At this point, the instance shuts down just as it would when a SHUTDOWN IMMEDIATE statement is submitted.

    The next startup of the database will not require any instance recovery procedures.

    A transactional shutdown prevents clients from losing work, and at the same time, does not require all users to log off.

    shutdown abort

    An aborted database shutdown proceeds with the following conditions:

    • No new connections are allowed, nor are new transactions allowed to be started, after the statement is issued. 不允许新的连接,不允许新的事务
    • Current client SQL statements being processed by Oracle Database are immediately terminated.
    • Uncommitted transactions are not rolled back.没提交 的事务将不回滚
    • Oracle Database does not wait for users currently connected to the database to disconnect. The database implicitly disconnects all connected users.(不等待用户断开连接)

    The next startup of the database will require instance recovery procedures.(需要介质恢复)



    评论暂缺

    (Required)
    (Required, will not be published)