ITPub博客

首页 > 数据库 > Oracle > 1Z0-031.3 - 3. Startup and Shutdown Database

1Z0-031.3 - 3. Startup and Shutdown Database

原创 Oracle 作者:superman-chenzs 时间:2007-04-10 19:45:14 0 删除 编辑

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 --> nomount : instance started

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

3. mount --> 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博客 ” ,链接:https://blog.itpub.net/8633028/viewspace-909783/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 刚进公司两天
请登录后发表评论 登录
全部评论
  • 博文量
    55
  • 访问量
    424546