- Database Storage Architecture
The files that make up Oracle DB can be categorized into the following categories:?
Control Files:Contains data related to the database itself, which is the physical database structure information. These files are critical to the database. Without these files, you cannot open the data file to access the data in the database.
Data files:The user or application data that contains the database, as well as the metadata and data dictionary?
online redo log files: Used for instance recovery of a database. If the database server crashes, but no data files are lost, the instance can use the information in these files to recover the database. The following additional files are important for running a database successfully:?
parameter File: Used to define the configuration at instance startup?
Password file: Allow Sysdba, Sysoper, and sysasm to connect remotely to an instance and perform administrative tasks?
Backup Files: Used for database recovery. If the original file is damaged or deleted in the event of a media failure or user error, you typically want to restore the backup file.
Archive redo log files: Contains the real-time history of data changes (redo) occurrences of the instance. With these files and database backups, you can recover lost data files. That is, the archive log can restore the restored data file.
Trace File: Each server and background process can write to the associated trace file. When the process detects an internal error, the process dumps information about the error to the appropriate trace file. Some of the information that is written to the trace file is provided for the database administrator, and other information is provided for Oracle support Services.
Alert log Files: These files contain special tracking entries. The alert log for a database is a chronological list of message logs and error logs. Oracle recommends that you periodically review the alert logs.
- Logical and physical database structure
The database has a logical structure and a physical structure.
Scenario SchemaA scenario is a collection of database objects owned by a database user. A schema object is a logical structure that directly references database data. Schema objects include structures such as tables, views, sequences, stored procedures, synonyms, indexes, clusters, and database links. Typically, scenario objects include everything that an application creates in the database.
database, table space, and data filesRelationships between databases, tablespaces, and data files: Each database is logically divided into one or more table spaces. One or more data files are explicitly created for each tablespace to store the data for all logical structures in the table space physically. If the table space is temporary, the tablespace will have temporary files instead of data files.
Table SpaceThe database is divided into logical storage units, called table spaces, that are used to group related logical structures together. For example, a table space typically divides all objects of an application into a group to simplify some administrative operations. You can use one tablespace to hold application data and another to store application indexes.
Data BlockFrom the bottom up, Oracle DB data is stored in a "data block". A block of data corresponds to the physical database space of a specific number of bytes in the disk. The block size of each tablespace is specified when the table space is created. The database uses and allocates free database space in the Oracle data block.
AreaThe next level of logical database space is "zone". A zone is a specific number of contiguous blocks of data (obtained by a single assignment) that are used to store specific types of information.
segmentThe logical database storage layer above the zone is called "segment". A segment is a set of extents assigned to a logical structure. For example:?
Data Segment : Each non-clustered, index-not-indexed table has a data segment, except for external tables, global temporary tables, and partitioned tables, each of which has one or more segments. All the data in the table is stored in the extents of the corresponding data segment. For partitioned tables, each partition has a data segment. Each cluster also has a data segment. The data for each table in the cluster is stored in the data segment of the cluster.
? Index segment: Each index has an index segment that stores all of its data. For partitioned indexes, each partition has an index segment.
Restore Segments: Create an undo table space for each DB instance. The tablespace contains a large number of restore segments that are used to temporarily store restore information. The information in the restore segment is used to generate read-consistent database information, and is used to roll back uncommitted transactions for the user during the database recovery process.
Temporary Segment: The temporary segment is created by Oracle DB when a temporary workspace is required to execute the SQL statement. When the statement finishes executing, the extents of the temporary segment are returned to the instance for future use. Specify a default temporary tablespace for each user, or specify a default temporary tablespace to use in the database scope. Oracle DB dynamically allocates space. If the existing area in the segment is full, additional areas will be added. Because the extents are allocated as needed, the extents in the segment may or may not be adjacent to the disk. These zones can come from different data files that belong to the same table space.
- Table spaces and data files
The database is divided into "table spaces", which are logical storage units that can be used to group related logical structures together. Each database is logically divided into one or more table spaces.
explicitly create one or more for each table space
a data file, each data file belongs to only one table space, and the table space physically stores the data for all logical structures in the table space. Note: You can also create large file table spaces, which have only one file. This file is usually very large, and its size can reach the maximum size allowed by the row ID architecture. This maximum size is the block size of the tablespace multiplied by 236, that is, if the block size is up to KB, the maximum size is TB. Traditional small file tablespace (the default) typically contains multiple data files, but these files cannot be large.
- System and Sysaux table spaces
? The SYSTEM and Sysaux table spaces are the required table spaces that are created when the database is created. These table spaces must be online. The SYSTEM table space is used for core functions such as data dictionary tables. The secondary Sysaux table space is used for additional database components, such as Oracle Enterprise Manager Repository. It is not recommended to use the system and Sysaux table spaces to store application data.
Each Oracle DB must contain a system tablespace and a sysaux table space。
they are created automatically when the database is created. The system default value is to create a small file table space. You can also create large file table spaces, which Oracle DB can use to manage oversized files. The status of a tablespace can be either online (accessible) or offline (inaccessible). When you open a database, the system table space is always
in the online state。 This table space
can store tables that support the core functionality of the database, such as a data dictionary table。 The Sysaux table space is the secondary tablespace for the system table space. The Sysaux table space can store many database components (such as EM), and to make all database components work properly, the tablespace
must be in online state。 Note: The Sysaux table space can be taken offline for table space recovery, while the system table space is not. Neither of these table spaces can be set to read-only.
- segments, areas, and blocks
?
segment exists in the table space?
segment is a collection of extents?
a zone is a collection of databases?
data blocks mapped to disk blocksA subset of database objects, such as tables and indexes, are stored in a table space as segments.
Each segment contains one or more extents. Zones consist of contiguous blocks of data, which means that each zone can only exist in one data file. The data block is the smallest I/O unit in the database. When the database requests a block set from the operating system (OS), the OS maps the block set to the actual file system or disk block on the storage device. Therefore, you do not have to know the physical address of any data in the database. This also means that a data file can be striped or mirrored on multiple disks. You can set the size of the data block when you create the database. For most databases, the default 8 KB block size is sufficient. When the database supports data warehouse applications that have large tables and indexes, it is best to set a larger block size. When a database supports transactional applications that perform random reads and writes, it is a good idea to specify a smaller block size. The maximum value of the block size depends on the OS. The minimum value for Oracle block size is 2 KB, which is rarely used. You can set a table space with a block size that is not standard.
- Automated storage Management
? is a portable, high-performance clusterFile System? Manage Oracle DB files? Cluster file system via ASM(ACFS) managing Applicationsfile? Distributing data to individual disksto balance the load? Set up data mirroring to prevent failures? Addressing storage management challenges automated Storage Management (ASM) provides file system and volume Manager vertical integration for Oracle DB files. ASM can be managedsingle symmetric multi-processing (SMP) computer, or manage multiple nodes of a cluster to support Oracle Real applicationClusters (RAC). The Oracle ASM cluster file System (ACFS) is a multi-platform, scalable file system and storage management technology thattechnology extends the capabilities of ASM to support application files external to Oracle DB, such as executables, reports,BFILE, video, audio, text, images, and other general-purpose application file data. ASM distributes input/output (I/O) loads across all available resources, eliminating the ability to manually optimize I/O and optimize performance. ASM helps DBAs manage dynamic database environments, allowing DBAs to increase data without shutting down the databasethe size of the library to adjust the storage allocation. ASM can maintain redundant copies of data to provide fault tolerance, and can also be built on vendor-supplied storage mechanismsabove. Data management is achieved by selecting the required reliability and performance metrics for each type of data, rather than individuallymanually interact with the file. By automating the manual completion of storage, the ASM functionality saves DBA time, thereby increasing the administrator'sability to manage more and larger databases, and to be more efficient.
ASM does not interfere with any existing database functionality. Existing databases can work as usual. New files can beis created as an ASM file, and existing files can be managed in the same way or ported to ASM. Illustrates the relationship between Oracle DB data files and ASM storage components. The Crow foot mark represents a one-to-many relationship. Oracle DB data files are a one-to-one between files or ASM files stored in the operating system's file systemrelationships. An Oracle ASM Disk Group is a collection of one or more Oracle ASM disks that are managed as a single logical unit. The data structures in the disk group are self-contained, using some space to meet the metadata requirements. Oracle ASM disks areA storage device provisioned for the Oracle ASM Disk group, either a physical disk or a partition, storage arrayLogical Unit Number (LUN), logical Volume (LV), or file connected to the network. Each ASM disk is divided into many ASMallocation Unit (AU), which is the minimum amount of contiguous disk space that ASM can allocate. When you create an ASM disk group,you can set the size of the ASM allocation unit to 1, 2, 4, 8, 16, 32, or up to MB, depending on the disk grouplevel of compatibility. One or more ASM allocation units form an ASM area. The Oracle ASM zone is used for storingBare Storage of Oracle ASM file content. An Oracle ASM file consists of one or more file areas. To supportvery large ASM files, which can be used in variable large cells, can be equal to 1 time times, 4 times times, and 16 times times the size of the AU.
- Interacting with Oracle DB: Memory, process, and storage
The following example describes the operation of Oracle DB at the most basic level. In the Oracle DB configuration shown in this example,users and associated server processes run on different computers that are connected over the network. 1. On a node that has Oracle DB installed (often referred to as a "host" or "Database Server"), ainstance. 2. The user initiates an application, thus deriving a user process. The application tries to establish with the servera connection. (This connection can be a local connection, a client/server connection, or a three-tier connection from the middle tier.) 3. The server runs a listener with the appropriate Oracle Net service handler. The listener detects the appprogram makes a connection request and creates a dedicated server process that represents a user process. 4. The user runs a DML-type SQL statement and commits the transaction. For example, a user changes a customer in a tableaddress and submit the changes. 5. The server process receives the statement and checks if there is a shared pool (an SGA component) that contains the same SQLthe shared SQL region of the statement. If a shared SQL zone is found, the server process checks the user for the requestedAccess to the data, and then use the existing shared SQL region to process the statement. If no shared SQL is foundZone, a new shared SQL region is assigned to the statement for parsing and processing the statement. 6. The server process retrieves any of the values stored in the actual data file (table) or database buffer cachethe required data value. 7. The server process modifies data in the SGA. Because the transaction has been committed, the log write process (LGWR) willThe transaction is logged immediately in the Redo log file. Database write process (DBW N) in an efficient time willThe modified block is permanently written to disk. 8. If the transaction succeeds, the server process sends a message over the network to the application. If the transaction processingis unsuccessful, an error message is sent. 9. Throughout the process, other background processes are also running to monitor for situations where intervention is required. In addition, the databaseThe server manages transaction processing for other users and prevents contention between transactions that request the same data. Source: http://blog.csdn.net/rlhua/article/details/12233167