데이터 베이스 MySQL 튜토리얼 Oracle学习.数据文件、控制文件、重做日志文件的理解

Oracle学习.数据文件、控制文件、重做日志文件的理解

Jun 07, 2016 pm 03:24 PM
oracle 무엇 공부하다 제어 데이터 문서 통나무 이해하다

什么是数据文件、控制文件、重做日志文件? 首先从Oracle的官方文档里摘录下面内容: The following divs explain the physical database structures of an Oracle database, including datafiles, redo log files, and control files 下面几段内容将解释一

什么是数据文件、控制文件、重做日志文件?


首先从Oracle的官方文档里摘录下面内容:

The following divs explain the physical database structures of an Oracle database, including datafiles, redo log files, and control files

下面几段内容将解释一下,Oracle数据库的物理结构是什么?包括数据文件、控制文件和重做日志文件。

Datafiles


Every Oracle database has one or more physical datafiles. The datafiles contain all the database data. The data of logical database structures, such as tables and indexes, is physically stored in the datafiles allocated for a database.

The characteristics of datafiles are:

  • A datafile can be associated with only one database.

  • Datafiles can have certain characteristics set to let them automatically extend when the database runs out of space.

  • One or more datafiles form a logical unit of database storage called a tablespace.

Data in a datafile is read, as needed, during normal database operation and stored in the memory cache of Oracle. For example, assume that a user wants to access some data in a table of a database. If the requested information is not already in the memory cache for the database, then it is read from the appropriate datafiles and stored in memory.

Modified or new data is not necessarily written to a datafile immediately. To reduce the amount of disk access and to increase performance, data is pooled in memory and written to the appropriate datafiles all at once, as determined by the database writer process (DBWn) background process.

 数据文件:

每一个Oracle数据库都要有一个或者多个物理的数据文件,这些数据文件里存储的就是Oracle数据库里的数据。就好比你有一个文件夹,里面有几个txt的文本文件,文本文件里记录的你这个月的每一笔花销。如果把文件夹看做是数据库,那么txt文件就是数据文件,而txt文件里面记录的每一笔花销就是数据了。

然而表、索引等等其实都是数据库的逻辑结构,这些表、索引都被物理的存储在了数据文件里面。

数据文件有三个特性:

1、一个数据文件只能属于一个数据库。

2、数据库中的数据文件可以被设置成自动的增长。(当数据库的空间用完的时候,数据库中的数据文件就会自动增长,比如原来1G的数据文件自动变成了2G的数据文件)

3、一个或者多个数据文件就组成了数据库的一个逻辑单元叫做---表空间。

(就比如记录流水账,那这个月的账目就组成了一个表空间,下个月的就是另外一个表空间。)

数据文件里的数据,在需要的时候就会被读取到内容Oracle的缓冲区中,比如当我们想查看一天数据时,而这条数据恰好又不在Oracle的缓冲区中,那么Oracle就会把这条数据从数据文件中读取到Oracle的缓冲区中来。

当更改或者新增一天数据时,也不是马上就写到数据文件里面,这么做是为了减少对磁盘的访问,提高效率,数据先存储在缓冲区,然后在一次都写入数据文件,这个过程有一个dbwn后台进程来控制。


Control Files
 
 Every Oracle database has a control file. A control file contains entries that specify the physical structure of the database. For example, it contains the following information:

Database name

Names and locations of datafiles and redo log files

Time stamp of database creation

 Oracle can multiplex the control file, that is, simultaneously maintain a number of identical control file copies, to protect against a failure involving the control file.

 Every time an instance of an Oracle database is started, its control file identifies the database and redo log files that must be opened for database operation to proceed. If the physical makeup of the database is altered (for example, if a new datafile or redo log file is created), then the control file is automatically modified by Oracle to reflect the change. A control file is also used in database recovery.

控制文件:

每一个数据库都拥有控制文件(它和数据文件一样重要),控制文件里记录的是对数据库物理结构的详细信息,例如它包括如下三个信息:
1、数据库的名称
2、数据文件的名字和存在位置,重做日志文件的名字和存储位置
3、数据库创建的时间标识

Oracle可以使用多重的控制文件,也就是说它可以同时维护多个完全一样的控制文件,这么做就是为了防止数据文件损坏而造成的数据库故障。比如Oracle同时维护3个控制文件,当其中有1个控制文件出问题了,就比较好解决,把出问题的删了,在复制一份没有问题的就可以了。

每当Oracle数据库的实例启动的时候,它就会通过控制文件来识别,要想执行数据库的一些操作,必须需要哪些数据文件和重做日志文件,以及这些数据文件和重做日志文件都存在在什么位置。当数据库的物理构成发生改变的时候,比如新增加了一个数据文件或者重做日志文件,那么控制文件就会自动的更新来记录这些变化。另外在数据库恢复的时候也会用到控制文件。


Redo Log Files
 
 Every Oracle database has a set of two or more redo log files. The set of redo log files is collectively known as the redo log for the database. A redo log is made up of redo entries (also called redo records).

 The primary function of the redo log is to record all changes made to data. If a failure prevents modified data from being permanently written to the datafiles, then the changes can be obtained from the redo log, so work is never lost.
 
 To protect against a failure involving the redo log itself, Oracle allows a multiplexed redo log so that two or more copies of the redo log can be maintained on different disks.

 The information in a redo log file is used only to recover the database from a system or media failure that prevents database data from being written to the datafiles. For example, if an unexpected power outage terminates database operation, then data in memory cannot be written to the datafiles, and the data is lost. However, lost data can be recovered when the database is opened, after power is restored. By applying the information in the most recent redo log files to the database datafiles, Oracle restores the database to the time at which the power failure occurred.

 The process of applying the redo log during a recovery operation is called rolling forward.

重做日志文件:
每个Oracle数据库都拥有一组文件,其中包括2个或者多个重做日志文件(其实也可以拥有多组,用途跟多个控制文件一样)。这组文件整体被称为数据库的重做日志,而重做日志又是由一条一条的重做记录组成的,所有也被称为重做记录。
重做日志的主要作用就是记录所有的数据变化,当一个故障导致被修改过的数据没有从内存中永久的写到数据文件里,那么数据的变化是可以从重做日志中获得的,从而保证了对数据修改的不丢失。
为了防止重做日志自身的问题导致故障,所以Oracle拥有多重重做日志功能,也就是可以同时保存多组完全相同的重做日志在不同的磁盘上。
重做日志里的信息只是用于恢复由于系统或者介质故障所引起的数据没法写入数据文件的数据。比如突然断电导致数据库的关闭,那么内存中的数据就不能写入到数据文件中,内存中的数据就会丢失。但当数据库重新启动时丢失的数据是可以被恢复的,可以从最近的重做日志中读取丢失信息然后应用到数据文件中,这样就把数据库恢复到断电前的状态。
在恢复操作中恢复重做日志信息的过程叫做回滚。

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
1 몇 달 전 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
1 몇 달 전 By 尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. 크로스 플레이가 있습니까?
1 몇 달 전 By 尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

Oracle의 테이블 스페이스 크기를 확인하는 방법 Oracle의 테이블 스페이스 크기를 확인하는 방법 Apr 11, 2025 pm 08:15 PM

Oracle 테이블 스페이스 크기를 쿼리하려면 다음 단계를 따르십시오. 쿼리를 실행하여 테이블 스페이스 이름을 결정하십시오. 쿼리를 실행하여 테이블 스페이스 크기를 쿼리하십시오. sum (bytes)을 total_size, sum (bytes_free)으로 sum (bytes_free), sum (bytes) - sum (bytes_free)으로 dba_data_fices where tablespace_.

오라클에서 시간을 얻는 방법 오라클에서 시간을 얻는 방법 Apr 11, 2025 pm 08:09 PM

Oracle에는 시간을 얻는 방법이 있습니다. current_timestamp : 현재 시스템 시간을 반환합니다. Systimestamp : current_timestamp보다 나노 초보다 더 정확합니다. sysdate : 시간 부분을 제외하고 현재 시스템 날짜를 반환합니다. to_char (sysdate, 'yyy-mm-dd hh24 : mi : ss') : 현재 시스템 날짜와 시간을 특정 형식으로 변환합니다. 추출 : 1 년, 월 또는 시간과 같은 시간 값에서 특정 부분을 추출합니다.

Oracle의 인스턴스 이름을 보는 방법 Oracle의 인스턴스 이름을 보는 방법 Apr 11, 2025 pm 08:18 PM

Oracle에서 인스턴스 이름을 보는 세 가지 방법이 있습니다. 명령 줄에 명령. "show instance_name"을 사용하십시오. sql*plus의 명령. 운영 체제의 작업 관리자, Oracle Enterprise Manager 또는 운영 체제를 통해 환경 변수 (Linux의 Oracle_Sid)를 확인하십시오.

Oracle View를 암호화하는 방법 Oracle View를 암호화하는 방법 Apr 11, 2025 pm 08:30 PM

Oracle View 암호화를 사용하면보기에서 데이터를 암호화 할 수 있으므로 민감한 정보의 보안을 향상시킬 수 있습니다. 단계에는 다음이 포함됩니다. 1) 마스터 암호화 키 생성 (MEK); 2) 암호화 된 뷰 생성, 암호화 할보기 및 MEK를 지정하는 것; 3) 사용자가 암호화 된보기에 액세스하도록 승인합니다. 암호화 된 뷰 작동 방식 : 사용자가 암호화 된보기를 쿼리 할 때 Oracle은 MEK를 사용하여 데이터를 해독하여 공인 사용자 만 읽기 쉬운 데이터에 액세스 할 수 있도록합니다.

Oracle 설치를 제거하는 방법에 실패했습니다 Oracle 설치를 제거하는 방법에 실패했습니다 Apr 11, 2025 pm 08:24 PM

Oracle 설치 실패에 대한 방법 제거 : Oracle Service를 닫고 Oracle Program 파일 및 레지스트리 키 삭제, Oracle 환경 변수를 제거하고 컴퓨터를 다시 시작하십시오. 제거되지 않으면 Oracle 범용 제거 도구를 사용하여 수동으로 제거 할 수 있습니다.

유효하지 않은 수의 Oracle을 확인하는 방법 유효하지 않은 수의 Oracle을 확인하는 방법 Apr 11, 2025 pm 08:27 PM

Oracle 유효하지 않은 숫자 오류는 데이터 유형 불일치, 숫자 오버플로, 데이터 변환 오류 또는 데이터 손상으로 인해 발생할 수 있습니다. 문제 해결 단계에는 데이터 유형 확인, 디지털 오버 플로우 감지, 데이터 변환 확인, 데이터 손상 확인 및 NLS_NUMERIC_CHARACTERS 매개 변수 구성 및 데이터 확인 로깅 활성화와 같은 다른 가능한 솔루션 탐색이 포함됩니다.

Oracle Cursor를 닫는 문제를 해결하는 방법 Oracle Cursor를 닫는 문제를 해결하는 방법 Apr 11, 2025 pm 10:18 PM

Oracle Cursor Closure 문제를 해결하는 방법에는 다음이 포함됩니다. Close 문을 사용하여 커서를 명시 적으로 닫습니다. For Update 절에서 커서를 선언하여 범위가 종료 된 후 자동으로 닫히십시오. 연관된 PL/SQL 변수가 닫히면 자동으로 닫히도록 사용 절에서 커서를 선언하십시오. 예외 처리를 사용하여 예외 상황에서 커서가 닫혀 있는지 확인하십시오. 연결 풀을 사용하여 커서를 자동으로 닫습니다. 자동 제출을 비활성화하고 커서 닫기를 지연시킵니다.

Oracle 사용자를 설정하는 방법 Oracle 사용자를 설정하는 방법 Apr 11, 2025 pm 08:21 PM

Oracle에서 사용자를 만들려면 다음 단계를 따르십시오. 사용자 명령문을 사용하여 새 사용자를 만듭니다. 보조금 명세서를 사용하여 필요한 권한을 부여하십시오. 선택 사항 : 리소스 문을 사용하여 할당량을 설정하십시오. 기본 역할 및 임시 테이블 스페이스와 같은 다른 옵션을 구성하십시오.

See all articles