oracle of "the provincial system."


                                                                            oracle of "the provincial system."

Yuan did what a creative, that pioneered the provincial system, the provincial system we still use ------- national, provincial, city, county, town, such a system is clearly the area one benefit is ease of management.



oracle internal spatial structure is very complicated, as a country with a large area of the same. Therefore, it has taken since the Yuan Dynasty inherited "the provincial system" ------ database database, table space tablespace, segment segment, District extent, block block, database consists of one or more table space composition, tables space contains segments, comprising a segment region, region comprises blocks. These so-called table space, space segment, the space area, a space block does not exist actually, as we assigned 08 for convenience of 30 degrees north latitude 24 degrees 38 Control, longitude 108 degrees east longitude 114 degrees 47 minutes to 15 points this 211,800 square kilometers of land between, so we put its name to "Hunan", followed by another named individual cities, districts, villages and towns.



01. segment segment


Table space segment is the major organization, storage space is occupied by the database objects, such as tables, indexes, and rollback segments. For example, you create a table, create a table segment; when you create an index, it will create an index segment; you when you create a function that creates a function segment, and so on, each object occupy storage space last It will be stored in a segment. We can view dba_segments view the main pieces of information space:

QQ picture 20190709210344.png




02 District extent

Segment in turn consisting of one or more segments. Traditional each segment has at least one section, starting from oracle 11gR2 section introduces the concept of "delay" ------ When you create an object, oracle does not allocate a new segment for the segment immediately, only when the data is actually written to the object (such as insert statements), oracle will assign the first segment for this segment. The second section is not necessarily immediately disk location on the first section, there may not even file the first section is located, it's like a city of A and B areas are adjacent, However, the physical structure of the B zone that is not in the A region 522 km2 inside. The size of the segments may be different, may be an oracle data block, the view may be as large as 2GB. DBA_EXTENTS we can easily understand the region:

QQ picture 20190709210635.png





03 block

Oracle block is the smallest allocation unit space, it can be understood as towns . Line data or index entries sort results are stored in the temporary block. Typically Oralce is read from the disk block. Size of the data block is specified by the number of bytes KB default is 8KB. Oracle common block size of four kinds: 2KB, 4KB, 8KB, 16KBBlock size can be viewed at: 8192KB = 1024KB * 8


Regardless of the block size, all the blocks are substantially comply with the internal structure of FIG: List of Tables directory row + + + free space data space.

QQ picture 20190709205116.png



04 Table space tablespace

Table space is a container, which contains a segment. Each segment only belong to a table space, as every city belongs to the same fixed provinces. A space table may have multiple segments. Table space for all segments in a segment of the segment belongs. Segment table space will not cross the border. Tablespace (logical structure) itself can have one or more data files (dbf, data structures). A section will only be stored in a data file. However, the segment can have different segments from multiple data files. So in practice we often go to view the table space usage:

select a.tablespace_name,
       round(a.maxbytes /1024/1024/1024) "Sum GB",
       round((a.bytes - b.free_bytes) /1024/1024/1024) "used GB",
       (a.bytes - b.free_bytes) "used ",
       round((a.maxbytes-(a.bytes - b.free_bytes)) /1024/1024/1024) "free_all GB",
       round(((a.bytes - b.free_bytes) / a.maxbytes) * 100, 2) "percent_used"
  from (select tablespace_name, sum(decode(maxbytes,0,decode(autoextensible,'YES',34359721984,bytes),maxbytes)) maxbytes,sum(bytes) bytes
          from dba_data_files
         group by tablespace_name) a,
       (select tablespace_name, sum(bytes) free_bytes
          from dba_free_space
         group by tablespace_name) b
 where a.tablespace_name = b.tablespace_name
 and a.tablespace_name in ('USERS')
 order by ((a.bytes - b.free_bytes) / a.maxbytes) desc;


Table space is not enough, we can add data files to the specified table space:

ALTER TABLESPACE app_data ADD DATAFILE

'/home/ORACLE/PRODUCT/10.2.0/ORADATA/EDWTEST/APP04.DBF' SIZE 50M AUTOEXTEND ON NEXT 5M MAXSIZE 100M;



Summarize the relationship between the Oracle "province" system logical structure and physical structure (DBF) is:

1> database consists of one or more tablespaces;

2> tablespace by one or more data files. Table space contains segments.

3> segment (Table, index, etc.) composed of one or more sections. Cross-section table space can not be stored, however, the data in segments across file (of course, belong to the same table space) to store.

4> section on the disk is a set of logically contiguous blocks. Only a segment table space, and always a file in the table space.

5> database block is the smallest allocation unit, the minimum I / O units are used by the database.



Skills, finance and investment, reading, writing, public welcome attention to number "Stone notes" or sweep the oh:

qrcode_for_gh_57fca887e14f_258.jpg






Guess you like

Origin blog.51cto.com/11218855/2418733