☆ Database----containers for storing data
The primary function of a database is to save data.
The storage structure of the database---how the data is stored in the database
The storage structure of the ☆oracle database:
Logical storage structure: How data is organized and managed within Oracle
Physical storage structure: how Oracle External (operating system) organizes and manages data
Oracle manages the logical storage structure and the physical storage structure separately.
☆ Logical Storage structure:
Oracle logically divides the saved data into small units for storage and maintenance, and a higher level of logical storage structure is made up of these basic small units.
Logical structure type: Small to large fast--> area--> segment--> table space
Quick: The most basic unit that Oracle uses to manage storage space, and also the smallest logical storage structure.
When the Oracle database is in the input and output, it is the logical read-write operation with fast units.
Fast----> OS fast integer multiples (1, 2, 4, etc.)
The Oracle fast size is determined at the time the database is created and cannot be modified later.
Area: A logical storage structure faster than a higher level is composed of a continuous fast
Oracle's storage space allocation and recovery is based on the district as the basic unit
Segment: Multiple zones that make up these areas can be contiguous or discontinuous. Oracle creates "segments" for these objects when the user creates objects in the database that have an actual storage structure (objects that hold the data), such as tables, indexes, and so on. Generally one object has only one segment
Table space: The most advanced logical storage structure each database consists of one or more tablespaces, and a default system tablespace is created automatically when the database is created.
By using tablespace---Oracle combines all the relevant logical structures and objects.
Logical Structure Relationship:
Block---> A sheet of white area---> White Paper---> Multiple notebooks in a file bag
Table Space---> Filing cabinets (multiple file bags)
☆ Block Management: block of available storage space for management
Block structure:
The header information area of the block
Quick head: Contains the General property information of the block, such as the physical address of the block, the type of segment that the block belongs to
Table directory: If the fast-stored data is table data, save information about the table in the table directory
Row directory: Related information for row records such as rowID
Block's storage area:
Free Space Row Space
Storage space management for blocks:
Pctfree parameter: Specifies the minimum amount of free space that must be retained in the block. Oracle marks blocks as unavailable when the free storage space in the block is reduced to the proportions set by Pctfree
pctused parameter: Create a percentage that is marked as available when the storage space already used in the block is lowered to this percentage only.
These two parameters apply to table spaces and segments.
☆ District Management: Oracle utilization area for storage space allocation work mechanism
When you create a database object that has a separate segment structure, such as when you create a table, Oracle creates a data segment for the table and assigns an ' initial area ' to the data segment.
STORAGE: How to distribute the following areas
You can also create a table space--Set a default storage:default for the table space STORAGE
Local Management Method table space automatic bitmap
Dictionary Management Way table space Manual available Quick list
Users can reclaim unused extents in objects such as tables, indexes, and so on by executing the following command:
ALTER TABLE table_name DEALLOCATE unused;
☆ Segment Management: A separate logical storage structure
A segment belongs to only one specific database object (table, index, and so on). Whenever you create a database object that has a separate segment, Oracle creates a segment for it. When you create a segment, you can specify Pctfree, pctused, and other parameters to control how fast storage space is managed, or you can specify storage parameters such as initial, NEXT, Pctincrease, and so on, to specify how the area is allocated. If you do not specify these parameters for a segment, the paragraph automatically inherits the corresponding parameters of the table space.
Different types of database objects have different types of segments:
Type of segment:
Data segments: Saving records in a table
Index segment: Index entries in an index
Temporary segment: When performing operations such as queries, Oracle may need to use temporary storage space to temporarily save parsed query statements and temporary data generated during the sort process.
Oracle will need to use temporary segments when performing the following types of SQL statements:
CREATE index
Select ....
SELECT DISTINCT
Select ... Group by
Select ... union
.......
If you frequently need to execute a statement of the type above, it is recommended that you adjust the Sort_area_size initialization parameter class to increase the sorting area so that the sort operation can be done in memory and improve performance
Rollback segment:
☆ tablespace: An Oracle database is composed of one or more tablespaces in the system table space
Special types of Table spaces:
In addition to the normal tablespace used to store user data, there may be three special types of tablespaces in a single database: System tablespace, undo tablespace, temp table space
system table space: a default table space
Information saved in the system table space:
* Database data dictionary (a data dictionary is a set of internal system tables and views that hold information about the database itself, and other objects for use within Oracle);
* Store source code and parsing code for all PL/SQL programs, including stored procedures and functions, packages, database triggers, and so on. In a database where you need to save a large number of pl/sql programs, you should set up a system table space that is large enough
* Stores the definition of database objects (tables, views, sequences).
Undo tablespace: Undo section under Automatic revocation management
You can use at most one undo tablespace per instance
Temporary tablespace: Storage of temporary data generated during SQL execution
How the table space is managed: The settings for various storage parameters are actually for segments, but Oracle still recommends setting the storage parameters at the table space level as much as possible.
Oracle Physical Storage Architecture
As a whole, Oracle's data is logically stored in a tablespace and physically stored in the corresponding data file in the table space.
An Oracle database is logically composed of one or more tablespaces, each of which is physically composed of one or more data files.
The database physical storage structure includes the following three types of physical files:
* Data Files
* Control the basic information of the file database at least one tells the database where to find data files and redo log files. It is important to successfully start and run the database
* Redo log files At least two Oracle to use log files in a circular fashion
In Oracle, all changes that the user makes to the database are actually in memory, and Oracle writes the results of the data manipulation changes to the data file at intervals, but the redo records generated by the data modification operation are written to the redo log file at any time.