oracle数据库读书报告,Oracle Concepts 11g 读书笔记(五)

++[Oracle Database Instance]

+++[Introduction to the Oracle Database Instance]

A database instance is a set of memory structures that manage database files. A database is a set of physical files on disk created by the CREATE DATABASE statement. The instance manages its associated data and serves the users of the database.

一个数据块实例是管理数据库文件的一组内存结构。一个数据库是被CREATE DATABASE 语句在磁盘上创建的一组物理文件。

++++[Database Instance Structure]

数据库实例结构

When an instance is started, Oracle Database allocates a memory area called the system global area (SGA) and starts one or more background processes.

当一个实例启动时,Oracle 数据库分配一个内存区域叫SGA,启动一个或多个后台进程。

The SGA serves various purposes, including the following:

* Maintaining internal data structures that are accessed by many processes and threads concurrently

* Caching data blocks read from disk

* Buffering redo data before writing it to the online redo log files

* Storing SQL execution plans

SGA服务不同的目的:

* 存储内部数据结构,这些内部数据结构被许多进程和线程同时访问。

* 缓存数据块(从磁盘上读取)

* 缓冲重做数据,在重做数据写入到联机重做日志文件之前

* 存储SQL执行计划

The SGA is shared by the Oracle processes, which include server processes and background processes, running on a single computer.

SGA是被Oracle 进程共享的,Oracle进程包括服务进程和后台进程。

A database instance includes background processes. Server processes, and the process memory allocated in these processes, also exist in the instance. The instance continues to function when server processes terminate.

一个数据块实例包括后台进程。服务进程和分配给这些服务进程的内存也存在实例中 。当服务进程终止后实例继续运行。

Oracle实例的主要组件如下图:

++++[Database Instance Configurations]

数据库实例配置

You can run Oracle Database in either of the following mutually exclusive configurations:

*  Single-instance configuration

A one-to-one relationship exists between the database and an instance.

*  Oracle Real Application Clusters (Oracle RAC) configuration

A one-to-many relationship exists between the database and instances.

你可以运行Oracle 数据库在以下的互斥的配置:

* 单一实例配置

数据库和实例的一对一关系

* Oracle 真正应用集群(Oracle RAC)配置

数据库和实例的一对多关系

Whether in a single-instance or Oracle RAC configuration, a database instance is associated with only one database at a time. You can start a database instance and mount (associate the instance with) one database, but not mount two databases simultaneously with the same instance.

无论是在单实例或者Oracle RAC配置中,一个数据库实例在一个时间只能和一个数据库关联。你可以启动一个数据库实例和挂载一个数据库,但不能为一个实例同时挂载两个数据库。

Multiple instances can run concurrently on the same computer, each accessing its own database. For example, a computer can host two distinct databases: prod1 and prod2. One database instance manages prod1, while a separate instance manages prod2.

一个相同的电脑可以同时运行多个实例,各自管理各自的数据库。

+++++[Duration of an Instance]

实例的持续时间

An instance begins when it is created with the STARTUP command and ends when it is terminated. During this period, an instance can associate itself with one and only one database. Furthermore, the instance can mount a database only once, close it only once, and open it only once. After a database has been closed or shut down, you must start a different instance to mount and open this database.

一个实例当被STARTUP命令创建时开始,终止时结束。在这个期间,一个实例只能与一个数据库关联。 而且,实例只能挂载一个数据库一次,也只能关闭一次和开启它一次。当一个数据库关闭后,你必须开启一个不同地实例来挂载和开启这个数据库。

+++++[Oracle System Identifier (SID)]

Oracle系统标识符(SID)

The system identifier (SID) is a unique name for an Oracle database instance on a specific host. On UNIX and Linux, Oracle Database uses the SID and Oracle home values to create a key to shared memory. Also, the SID is used by default to locate the parameter file, which is used to locate relevant files such as the database control files.

SID是在指定主机上的Oracle 数据库实例的唯一名称。在UNIX和Linux上,Oracle数据库用SID和Oracle home值来创建一个对共享内存的键。同样,SID也被默认用来定位参数文件,参数文件是用来定位相关文件例如数据库控制文件。

On most platforms, the ORACLE_SID environment variable sets the SID, whereas the ORACLE_HOME variable sets the Oracle home. When connecting to an instance, clients can specify the SID in an Oracle Net connection or use a net service name. Oracle Database converts a service name into an ORACLE_HOME and ORACLE_SID.

在很多平台上,ORACLE_SID环境变量设置SID,ORACLE_HOME 设置Oracle home。当连接到一个实例时,客户可以在Oracle Net 连接指定SID或者用一个网络服务名称。Oracle 数据库把一个服务名称转换为一个ORACLE_HOME 和ORACLE_SID。

+++[Overview of Instance Startup and Shutdown]

A database instance provides user access to a database. This section explains the possible states of the instance and the database.

一个数据库实例为用户提供对数据库的访问。这一节解释实例和数据库的可能的状态。

++++[Overview of Instance and Database Startup]

In a typical use case, you manually start an instance and then mount and open the database, making it available for users. You can use the SQL*Plus STARTUP command, Oracle Enterprise Manager (Enterprise Manager), or the SRVCTL utility to perform these steps. Figure13–3 shows how a database progresses from a shutdown state to an open state.

在一个典型的使用情况,你可以手动启动然后装载和打开一个数据库,使它对用户可用。你可以使用SQL*Plus STARTUP命令,Oracle Enterprise Manager,或者SRVCTL组件来执行这些步骤。图13-3 显示了一个数据库从关闭到开启状态的过程。

A database goes through the following phases when it proceeds from a shutdown state to an open database state:

1. Instance started without mounting database  The instance is started, but is not yet associated with a database.实例启动没有和数据库关联。

2. Database mounted The instance is started and is associated with a database by reading its control file . The database is closed to users.实例启动并且通过读取控制文件和数据库关联。数据库对用户是关闭的。

3. Database open The instance is started and is associated with an open database. The data contained in the data files is accessible to authorized users. 实例启动并且和开启的数据库关联。授权的用户可以访问在数据文件中的数据。

+++++[Connection with Administrator Privileges]

管理员权限的连接

+++++[How an Instance Is Started]

实例如何启动

When Oracle Database starts an instance, it performs the following basic steps:

当Oracle 数据库启动一个实例,履行下列基本步骤:

1. Searches for a server parameter file in a platform-specific default location and, if not found, for a text initialization parameter file (specifying STARTUP with the SPFILE or PFILE parameters overrides the default behavior) 寻找一个服务器参数文件在一个平台相关的默认位置,如果没有找到,就寻找一个文本的初始化参数文件

2. Reads the parameter file to determine the values of initialization parameters 读参数文件确定初始化参数的值

3. Allocates the SGA based on the initialization parameter settings 基于初始化参数的设置配备SGA

4. Starts the Oracle background processes 启动Oracle 后台进程

5. Opens the alert log and trace files and writes all explicit parameter settings to the alert log in valid parameter syntax 打开警告日志和跟踪文件,用有效参数语法将显式的参数设置写入警告日志中。

At this stage, no database is associated with the instance. Scenarios that require a NOMOUNT state include database creation and certain backup and recovery operations.

这一阶段,实例没有关联数据库。 要求NOMOUNT状态的场景包括数据库创建和某些备份和恢复操作。

+++++[How a Database Is Mounted]

数据库如何装载

The instance mounts a database to associate the database with this instance. To mount the database, the instance obtains the names of the database control files specified in the CONTROL_FILES initialization parameter and opens the files. Oracle Database reads the control files to find the names of the data files and the online redo log files that it will attempt to access when opening the database.

实例装载数据库来将数据库关联到这个实例。实例获得在CONTROL_FILES初始化参数指定的数据库控制文件名称并且打开它来装载数据库。Oracle 数据库读取控制文件来获得数据文件和联机重做日志文件的名称,这些文件是开启数据库时要读取的文件。

In a mounted database, the database is closed and accessible only to database administrators. Administrators can keep the database closed while completing specific maintenance operations. However, the database is not available for normal operations.

在一个装载的数据库,数据库是关闭的只能被数据库管理员访问。管理员在完成特定的维护操作时可以保持数据库关闭。然而数据库对一般操作不可用。

If Oracle Database allows multiple instances to mount the same database concurrently, then the CLUSTER_DATABASE initialization parameter setting can make the database available to multiple instances. Database behavior depends on the setting:

Oracle 数据库允许多个实例同时挂载相同的数据库,CLUSTER_DATABASE初始化参数设置可以使数据库对多个实例可用。数据库行为取决于以下设置:

* If CLUSTER_DATABASE is false (default) for the first instance that mounts a database, then only this instance can mount the database.

* If CLUSTER_DATABASE is true for the first instance, then other instances can mount the database if their CLUSTER_DATABASE parameter settings are set to true. The number of instances that can mount the database is subject to a predetermined maximum specified when creating the database.

+++++[How a Database Is Opened]

数据库如何开启

Opening a mounted database makes it available for normal database operations. Any valid user can connect to an open database and access its information. Usually, a database administrator opens the database to make it available for general use.

When you open the database, Oracle Database performs the following actions:

当你打开一个数据库,Oracle数据库履行下列行动:

* Opens the online data files in tablespaces other than undo tablespaces 开启表空间而非撤销表空间的联机数据文件

If a tablespace was offline when the database was previously shut down, then the tablespace and its corresponding data files will be offline when the database reopens.

如果当数据库之前关闭的时候表空间是脱机的,那么当数据库重新开始时表空间和相应的数据文件也会是脱机的。

*  Acquires an undo tablespace 获得撤销表空间

If multiple undo tablespaces exists, then the UNDO_TABLESPACE initialization parameter designates the undo tablespace to use. If this parameter is not set, then the first available undo tablespace is chosen.

如果多个撤销表空间存在,那么UNDO_TABLESPACE出事换参数指定要用的撤销表空间。

* Opens the online redo log files 开启联机重做日志文件

+++++[Read-Only Mode]

只读模式

By default, the database opens in read/write mode. In this mode, users can make changes to the data, generating redo in the online redo log. Alternatively, you can open in read-only mode to prevent data modification by user transactions.

Read-only mode restricts database access to read-only transactions, which cannot write to data files or to online redo log files. However, the database can perform recovery or operations that change the database state without generating redo. For example, in read-only mode:

只读模式限制数据库只能访问只读事务,不能写入数据文件和联机重做日志文件。然而,数据库可以执行恢复或者改变数据库状态的操作而不产生重做。例如,在只读模式下:

* Data files can be taken offline and online. However, you cannot take permanent tablespaces offline.数据文件可以被联机和脱机。然而,你不能使持久表空间脱机。

* Offline data files and tablespaces can be recovered.脱机数据文件和表空间可以被恢复

* The control file remains available for updates about the state of the database.控制文件可用对数据库状态的更新操作.

* Temporary tablespaces created with the CREATE TEMPORARY TABLESPACE statement are read/write.用CREATE TEMPORARY TABLESPACE 语句创建的临时表空间是可读可写的。

* Writes to operating system audit trails, trace files, and alert logs can continue. 对操作系统审计轨迹和跟踪文件还有警告日志的写入可以继续。

+++++[Database File Checks]

数据库文件检查

If any of the data files or redo log files are not present when the instance attempts to open the database, or if the files are present but fail consistency tests, then the database returns an error. Media recovery may be required.

++++[Overview of Database and Instance Shutdown]

关闭数据库和启动数据库是逆过程。

+++++[Shutdown Modes]

关闭模式

A database administrator with SYSDBA or SYSOPER privileges can shut down the database using the SQL*Plus SHUTDOWN command or Enterprise Manager. The SHUTDOWN command has options that determine shutdown behavior. Table13–2 summarizes the behavior of the different shutdown modes.

拥有SYSDBA或者SYSOPER权限的数据库管理者可以关闭数据库。 SHUTDOWN 命令的选项可以决定shutdown行为。表13-2总结了不同关闭模式的行为。

The possible SHUTDOWN statements are:

可能的SHUTDOWN语句是:

* SHUTDOWN ABORT This mode is intended for emergency situations, such as when no other form of shutdown is successful. This mode of shutdown is the fastest. However, a subsequent open of this database may take substantially longer because instance recovery must be performed to make the data files consistent.Note: Because SHUTDOWN ABORT does not checkpoint the open data files, instance recovery is necessary before the database can reopen. The other shutdown modes do not require instance recovery before the database can reopen.

SHUTDOWN ABORT 这种模式是专为紧急情况,如没有其它形式的关闭是成功的。关闭的这种模式是最快的。然而,随后打开这个数据库的可能需要更长的时间,因为本质上必须进行实例恢复数据文件一致。

* SHUTDOWN IMMEDIATE This mode is typically the fastest next to SHUTDOWN ABORT. Oracle Database terminates any executing SQL statements and disconnects users. Active transactions are terminated and uncommitted changes are rolled back.

SHUTDOWN IMMEDIATE 这个模式通常是SHUTDOWN ABORT后最快的。Oracle  数据库终止任何正在执行的SQL语句和断开用户连接。活跃的事务也被终止未提交的变化回退。

* SHUTDOWN TRANSACTIONAL This mode prevents users from starting new transactions, but waits for all current transactions to complete before shutting down. This mode can take a significant amount of time depending on the nature of the current transactions.

SHUTDOWN TRANSACTIONAL。这个模式防止用户开启新的事务,而是等待当前的事务完成在关闭之前。该模式可以需要花费大量的时间取决于当前的事务的性质。

* SHUTDOWN NORMAL This is the default mode of shutdown. The database waits for all connected users to disconnect before shutting down.

SHUTDOWN NORMALL 这个事shutdown的默认模式。数据库等待所有连接的用户断开在关闭之前。

+++++[How a Database Is Closed]

The database close operation is implicit in a database shutdown. The nature of the operation depends on whether the database shutdown is normal or abnormal.

数据库关闭是隐式的在数据库shutdown中 。操作的性质取决于数据库shutdown是正常还是异常的。

++++++[How a Database Is Closed During Normal Shutdown]

When a database is closed as part of a SHUTDOWN with any option other than ABORT, Oracle Database writes data in the SGA to the data files and online redo log files. Next, the database closes online data files and online redo log files. Any offline data files of offline tablespaces have been closed already. When the database reopens, any tablespace that was offline remains offline.

正常shutdown而非ABORT,Oracle数据库在SGA中写数据到数据文件和联机重做日志文件。接下来,数据库关闭联机数据文件和联机重做日志文件。任何脱机表空间的脱机数据文件已经被关闭了。

At this stage, the database is closed and inaccessible for normal operations. The control files remain open after a database is closed.

这个阶段,数据库关闭掉,一般的操作不可访问。控制文件依旧是开启的。

++++++[How a Database Is Closed During Abnormal Shutdown]

If a SHUTDOWN ABORT or abnormal termination occurs, then the instance of an open database closes and shuts down the database instantaneously. Oracle Database does not write data in the buffers of the SGA to the data files and redo log files. The subsequent reopening of the database requires instance recovery, which Oracle Database performs automatically.

不会写数据在文件中。重新开启时需要实例恢复。

+++++[How a Database Is Unmounted]

After the database is closed, Oracle Database unmounts the database to disassociate it from the instance. After a database is unmounted, Oracle Database closes the control files of the database. At this point, the instance remains in memory.

实例不再和数据库关联,控制文件关闭。

+++++[How an Instance Is Shut Down]

The final step in database shutdown is shutting down the instance. When the database instance is shut down, the SGA is removed from memory and the background processes are terminated.

实例关闭。SGA会去除后台进程会终止。

+++[Overview of Checkpoints]

A checkpoint is a crucial mechanism in consistent database shutdowns, instance recovery, and Oracle Database operation generally. The term checkpoint has the following related meanings:

检查点是一个重要的机制在一致的数据库shutdown,实例恢复和Oracle数据库一般的操作。术语检查点有以下相关的意思:

* A data structure that indicates the checkpoint position, which is the SCN in the redo stream where instance recovery must begin

一种数据结构,表明检查点的位置,当实例恢复必须开始于重做流中的SCN。

The checkpoint position is determined by the oldest dirty buffer in the database buffer cache. The checkpoint position acts as a pointer to the redo stream and is stored in the control file and in each data file header.

检查点是由在数据库缓冲区中的最老的脏缓存决定的。检查点作为一个指向重做流的指针,被存储在控制文件和每一个数据文件头。

* The writing of modified database buffers in the database buffer cache to disk

在数据库缓冲区中更改的数据库缓存写入到磁盘

++++[Purpose of Checkpoints]

检查点的目的:

Oracle Database uses checkpoints to achieve the following goals:

* Reduce the time required for recovery in case of an instance or media failure减少实例或者介质失败恢复的时间

* Ensure that dirty buffers in the buffer cache are written to disk regularly保证缓冲区中的脏缓存定期写入到磁盘中

* Ensure that all committed data is written to disk during a consistent shutdown保证在一致的shutdown中所有提交的数据都被写入到磁盘中

++++[When Oracle Database Initiates Checkpoints]

The checkpoint process (CKPT) is responsible for writing checkpoints to the data file headers and control file. Checkpoints occur in a variety of situations. For example, Oracle Database uses the following types of checkpoints:

检查点的类型:

* Thread checkpoints 线程检查点

The database writes to disk all buffers modified by redo in a specific thread before a certain target. The set of thread checkpoints on all instances in a database is a database checkpoint. Thread checkpoints occur in the following situations:

在某个目标之前数据库在一个特定的线程中将所有重做修改的缓冲写入到磁盘中。数据库的所有实例的线程检查点集合称作数据库检查点。线程检查点发生在以下情况:

– Consistent database shutdown 一致性的数据库shutdown

– ALTER SYSTEM CHECKPOINT statement ALTER SYSTEM CHECKPOINT语句

– Online redo log switch 联机重做日志切换

– ALTER DATABASE BEGIN BACKUP statement ALTER DATABASE BEGIN BACKUP 语句

* Tablespace and data file checkpoints 表空间和数据文件检查点

The database writes to disk all buffers modified by redo before a specific target. A tablespace checkpoint is a set of data file checkpoints, one for each data file in the tablespace. These checkpoints occur in a variety of situations, including making a tablespace read-only or taking it offline normal, shrinking a data file, or executing ALTER TABLESPACE BEGIN BACKUP.

数据库在一个特定目标之前将所有缓存中被重做修改的数据写入到磁盘中。表空间检查点是数据文件检查点的集合,每个数据文件对应一个数据文件检查点。这些检查点出现在很多情况,包括使表空间只读或者使表空间脱机,收缩数据文件,或者执行ALTER TABLESPACE BEGIN BACKUP。

* Incremental checkpoints 增量的检查点

An incremental checkpoint is a type of thread checkpoint partly intended to avoid writing large numbers of blocks at online redo log switches. DBWn checks at least every three seconds to determine whether it has work to do. When DBWn writes dirty buffers, it advances the checkpoint position, causing CKPT to write the checkpoint position to the control file, but not to the data file headers.

增量检查点是一种线程检查点为了避免在联机重做日志切换中写入大量的数据块。DBWn至少每3秒检查已决定它是否要工作。当DBWn写入脏缓存,会使检查点位置向前,引起CKPT写入检查点位置到控制文件,而不写入数据文件头。

Other types of checkpoints include instance and media recovery checkpoints and checkpoints when schema objects are dropped or truncated.

其他类型的检查点包括实例和介质恢复检查点和当模式对象dropped和truncated时的检查点。

+++[Overview of Instance Recovery]

Instance recovery is the process of applying records in the online redo log to data files to reconstruct changes made after the most recent checkpoint. Instance recovery occurs automatically when an administrator attempts to open a database that was previously shut down inconsistently.

实例恢复是将在联机重做日志中的记录写入到数据文件来重建最近检查点后的改变的过程。实例恢复在一个管理员试图在数据库非一致性的shut down后重启数据库时自动发生。

------------------------------------------------后面的只是看了看,没有翻译,要完全理解需要实践,先有个概念上的认识--------------------------------------------------------------------

++++[Purpose of Instance Recovery]

++++[When Oracle Database Performs Instance Recovery]

++++[Importance of Checkpoints for Instance Recovery]

++++[Instance Recovery Phases]

+++[Overview of Parameter Files]

++++[Initialization Parameters]

++++[Server Parameter Files]

++++[Text Initialization Parameter Files]

++++[Modification of Initialization Parameter Values]

+++[Overview of Diagnostic Files]

++++[Automatic Diagnostic Repository]

++++[Alert Log]

++++[Trace Files]

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值