1Z0-031.3 - 3. Startup and Shutdown Database

Startup Database:

Syntax:STARTUP [FORCE] [RESTRICT] [PFILE=filename] [OPEN [RECOVER][database] | MOUNT | NOMOUNT]

[@more@]

where:

--- OPEN : enables users to access the database

--- MOUNT : mounts the database for certain DBA activities but does not provide user access to the database

--- NOMOUNT: creates the SGA and starts up the background processes but does not provide access to the database

--- PFILE=parfile : enables a nondefault parameter file to be used to configure the instance

--- FORCE : aborts the running instance before performing a normal startup

--- RESTRICT : enables only users with RESTRICTED SESSION privilege to access the database

--- RECOVER : begins media recovery when the database starts

Startup Setup:

1. shutdown --&gt nomount : instance started

2. nomount --&gt mount : control file opened for this instance

3. mount --&gt open : all file opened as described by the control file for this instance

Startup Setup Order:

1. startup nomount

2. alter database mount;

3. alter database open; | ALTER DATABASE OPEN [READ WRITE| READ ONLY]

--- READ WRITE : opens the database in read-write mode, so that users can generate redo logs

--- READ ONLY : restricts users to read-only transactions, preventing them from generating redo log information

Opening a Database in Restricted Mode:

1. Use the STARTUP command to restrict access to a database: STARTUP RESTRICT

2. Use the ALTER SYSTEM command to place an instance in restricted mode: ALTER SYSTEM ENABLE RESTRICTED SESSION;

3. The database can also be put in restricted mode by using the ALTER SYSTEM SQL command:

Syntax:ALTER SYSTEM [ {ENABLE|DISABLE} RESTRICTED SESSION ]

where:

--- ENABLE RESTRICTED SESSION: enables future logins only for users who have the RESTRICTED SESSION privilege

--- DISABLE RESTRICTED SESSION: disables RESTRICTED SESSION so that users who do not have the privilege can log on

Terminate Sessions:

Syntax:ALTER SYSTEM KILL SESSION 'integer1,integer2'

where:

--- integer1: is the value of the SID column in the V$SESSION view

--- integer2: is the value of the SERIAL# column in the V$SESSION view

Effects of Terminating a Session:

The ALTER SYSTEM KILL SESSION command causes the background process PMON to perform the following steps upon execution:1. Roll back the user’s current transaction; 2. Release all currently held table or row locks; 3.Free all resources currently reserved by the user

Startup Setup Tasks:

1. Starting an instance includes the following tasks:

--- Reading the initialization file from $ORACLE_HOME/dbs in the following order:

i>. First spfileSID.ora. If not found then

ii>. spfile.ora

iii>. initSID.ora

--- Specifying the PFILE parameter with STARTUP overrides the default behavior

i>. Allocating the SGA

ii>. Starting the background processes

iii>. Opening the alertSID.log file and the trace files

2. Mounting a database includes the following tasks:

--- Associating a database with a previously started instance

--- Locating and opening the control files specified in the parameter file

--- Reading the control files to obtain the names and status of the datafiles and redo logfiles. However, no checks are performed to verify the existence of the data files and online redo log files at this time.

3. Opening the database includes the following tasks:

--- Opening the online data files

--- Opening the online redo log files

Shutdown Database:

To shut down an instance you must connect as SYSOPER or SYSDBA and use the following command:

Syntax: SHUTDOWN [NORMAL | TRANSACTIONAL | IMMEDIATE | ABORT ]

shutdown mode

abort

immediate

transactional

normal

allow new collections

N

N

N

N

wait until current sessions end

N

N

N

Y

wait until current transactions end

N

N

Y

Y

force a checkpoint and close files

Y

N

N

N

shutdown normal | transaction | immediate:

1. Database buffer cache written to the data files

2. Uncommitted changes rolled back

3. Resources released.

- No instance recovery when startup next time

shutdown abort:

1. Modified buffers are not written to the data files

2. Uncommitted changes are not rolled back

- instance recovery when startup next time

-> when startup next time , you should do:

- Redo logs used to reapply changes

- Undo segments used to roll back uncommitted changes

- Resources released

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8633028/viewspace-909783/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/8633028/viewspace-909783/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值