instance structure

本文介绍了Oracle数据库实例的结构,包括系统全局区(SGA)的作用和组成,以及单实例和Oracle Real Application Clusters(RAC)配置的区别。此外,还详细阐述了实例恢复的过程,包括缓存恢复和事务回滚两个阶段。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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. 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

 

The SGA is shared by the Oracle processes, which include server processes and background processes, running on a single computer. The way in which Oracle processes are associated with the SGA varies according to operating system.

 

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.

 

Figure 13-1 shows the main components of an Oracle database instance.


 

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.

 

Figure 13-2 shows possible database instance configurations.

 

 

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.

 

Note:

This chapter discusses a single-instance database configuration unless otherwise noted.

 

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.

 

 

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.

 

Importance of Checkpoints for Instance Recovery

 

Instance recovery uses checkpoints to determine which changes must be applied to the data files. The checkpoint position guarantees that every committed change with an SCN lower than the checkpoint SCN is saved to the data files.

 

Figure 13-5 depicts the redo thread in the online redo log.

 

During instance recovery, the database must apply the changes that occur between the checkpoint position and the end of the redo thread. As shown in Figure 13-5, some changes may already have been written to the data files. However, only changes with SCNs lower than the checkpoint position are guaranteed to be on disk.

 

Instance Recovery Phases

 

The first phase of instance recovery is called cache recovery or rolling forward, and involves reapplying all of the changes recorded in the online redo log to the data files. Because rollback data is recorded in the online redo log, rolling forward also regenerates the corresponding undo segments.

 

Rolling forward proceeds through as many online redo log files as necessary to bring the database forward in time. After rolling forward, the data blocks contain all committed changes recorded in the online redo log files. These files could also contain uncommitted changes that were either saved to the data files before the failure, or were recorded in the online redo log and introduced during cache recovery.

 

After the roll forward, any changes that were not committed must be undone. Oracle Database uses the checkpoint position, which guarantees that every committed change with an SCN lower than the checkpoint SCN is saved on disk. Oracle Database applies undo blocks to roll back uncommitted changes in data blocks that were written before the failure or introduced during cache recovery. This phase is called rolling back or transaction recovery.

 

Figure 13-6 illustrates rolling forward and rolling back, the two steps necessary to recover from database instance failure.

 

Description of "Figure 13-6 Basic Instance Recovery Steps: Rolling Forward and Rolling Back"

 

Oracle Database can roll back multiple transactions simultaneously as needed. All transactions that were active at the time of failure are marked as terminated. Instead of waiting for the SMON process to roll back terminated transactions, new transactions can roll back individual blocks themselves to obtain the required data.

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

转载于:http://blog.itpub.net/26844646/viewspace-1066300/

### 关于 PyCharm 的 Structure 插件 PyCharm 是一种强大的 Python 开发环境,提供了多种内置工具来增强用户的开发体验[^2]。其中,Structure 工具窗口是一个非常实用的功能,它能够帮助开发者快速浏览当前文件的结构并导航到特定部分。 #### Structure 插件的功能介绍 Structure 工具窗口主要用于显示当前文件中定义的主要元素列表,例如类、函数、变量等。通过这个窗口,用户可以轻松定位和查看项目中的代码结构。以下是它的主要功能特点: - **代码概览**:展示当前文件内的所有顶级对象及其嵌套层次关系。 - **快速跳转**:点击某个条目即可立即跳转至对应的代码位置。 - **过滤选项**:允许隐藏某些类型的元素(如私有成员),以便更专注于重要部分。 - **实时更新**:随着代码的变化动态调整视图内容。 #### 如何启用与配置 Structure 工具 要访问 Structure 工具窗口,在默认布局下可以通过以下方式实现: 1. 使用菜单栏路径 `View -> Tool Windows -> Structure` 打开面板; 2. 或者利用快捷键组合通常为 `Alt+7` (Windows/Linux) / `Cmd+Option+S` (macOS),具体取决于键盘方案设置。 如果发现此功能不可见或未正常工作,则可能需要重新启动应用程序以应用最新的更改[^3]。另外确认安装的是完整版而非社区简化版本也很关键,因为一些特性仅存在于付费的专业版本之中。 #### 示例操作流程说明 下面给出一段简单的演示代码片段,并描述如何借助 Structure 查看其组成成分。 ```python class Animal: def __init__(self, name): self.name = name def speak(self): raise NotImplementedError("Subclasses must implement this method") class Dog(Animal): def speak(self): return f"{self.name} says woof!" def main(): dog_instance = Dog('Rex') print(dog_instance.speak()) if __name__ == "__main__": main() ``` 当上述脚本被加载入编辑器之后,激活 Structure side panel 将会呈现出清晰易懂的大纲形式表示——包括两个类别定义 (`Animal`, `Dog`) 和三个方法声明(`__init__()`, `speak()`, 及顶层函数 `main()`). ### 结论 综上所述,PyCharm 提供了一个直观高效的手段让用户掌控复杂项目的内部构造详情,即所谓的 'Structure' 边栏组件。熟练运用它可以极大地提升编码效率以及维护便利度。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值