The concept oracle table space Oracle table space

The concept of Oracle table space

Table space

 

In the database system, the storage space is more important resources, rational use of space, not only can save space, but also can improve the efficiency and performance of the system. Oracle can store huge amounts of data, all data stored in the data file. Affect the performance data file access data file size limited by operating system, and the data is too large to very large. Meanwhile Oracle is a cross-platform database, Oracle data can be easily transplanted on different platforms, then how can we provide unified access to high-capacity format it? Oracle uses table space to solve.
Table space is a logical concept, a number of operating system files (files can not great) can make up a table space. Table space data file unified management of space, a data file can only belong to one table space. A space defined by a plurality of database tablespaces. as the picture shows:

 

 

All Oracle data (including system data), all stored in the table space , table space common are:

Ø system table space: a data storage system, system table space created when the database is created. Table space name is
SYSTEM. Storing the data dictionary , and view and database structures and other important system data information at runtime, such as
lack of fruit SYSTEM space, database impact will be relatively large, although through life while the system is running in
order to expand the space, but still will affect the performance of the database Therefore it is necessary to put the appropriate number when you create the database
data files set larger.
ØTMEP table spaces: temporary table space, the database is created during installation, you can increase the temporary command at run time
table space. The important role of temporary table space is the data sorting . For example, when the user performs such as such as Order by
command, the server needs to sort the data selected, if a large data memory sort area may be installed
no less than too much data, you need to put some sort of intermediate results are written on the hard disk of temporary table space.
Ø custom user table space: Users can create a table space by the CREATE TABLESPACE command

 

Create a table space

 

- Create a table space linux centos6.9

- Create a table space contains two data file sizes are 10MB, 5MB, the requirements for the extent of uniform size 1M

CREATE TABLESPACE nod_tablespace

DATAFILE '/home/oracle/tablespace/A.ORA' SIZE 10M,

'/home/oracle/tablespace/B.ORA' SIZE 5M

EXTENT MANAGEMENT LOCAL

UNIFORM SIZE 1M

 

 

windows version create a table space

Note: Only an administrator can increase table space

When the lack of table space data file can be added to a table space with alter tablespace command and expansion of table space

Modify the table space size

- expansion of table space

 

 

ALTER TABLESPACE nod_tablespace

ADD DATAFILE '/home/oracle/tablespace/C.ORA' SIZE 100M

 

- Check the table space case

SELECT SUM(bytes) / (1024 * 1024) AS free_space, tablespace_name

FROM dba_free_space

GROUP BY tablespace_name;

 

You can specify a table space for the user when creating a user, this user default all database objects are stored in the space

The specified user table space

create user nod identified by nod default tablespace nod_tablespace;

 

Create a table designated table space

create table t2(id int)

tablespace nod_tablespace

 

 

Once created tables and indexes, table space can not be modified secondary

Table space

 

In the database system, the storage space is more important resources, rational use of space, not only can save space, but also can improve the efficiency and performance of the system. Oracle can store huge amounts of data, all data stored in the data file. Affect the performance data file access data file size limited by operating system, and the data is too large to very large. Meanwhile Oracle is a cross-platform database, Oracle data can be easily transplanted on different platforms, then how can we provide unified access to high-capacity format it? Oracle uses table space to solve.
Table space is a logical concept, a number of operating system files (files can not great) can make up a table space. Table space data file unified management of space, a data file can only belong to one table space. A space defined by a plurality of database tablespaces. as the picture shows:

 

 

All Oracle data (including system data), all stored in the table space , table space common are:

Ø system table space: a data storage system, system table space created when the database is created. Table space name is
SYSTEM. Storing the data dictionary , and view and database structures and other important system data information at runtime, such as
lack of fruit SYSTEM space, database impact will be relatively large, although through life while the system is running in
order to expand the space, but still will affect the performance of the database Therefore it is necessary to put the appropriate number when you create the database
data files set larger.
ØTMEP table spaces: temporary table space, the database is created during installation, you can increase the temporary command at run time
table space. The important role of temporary table space is the data sorting . For example, when the user performs such as such as Order by
command, the server needs to sort the data selected, if a large data memory sort area may be installed
no less than too much data, you need to put some sort of intermediate results are written on the hard disk of temporary table space.
Ø custom user table space: Users can create a table space by the CREATE TABLESPACE command

 

Create a table space

 

- Create a table space linux centos6.9

- Create a table space contains two data file sizes are 10MB, 5MB, the requirements for the extent of uniform size 1M

CREATE TABLESPACE nod_tablespace

DATAFILE '/home/oracle/tablespace/A.ORA' SIZE 10M,

'/home/oracle/tablespace/B.ORA' SIZE 5M

EXTENT MANAGEMENT LOCAL

UNIFORM SIZE 1M

 

 

windows version create a table space

Note: Only an administrator can increase table space

When the lack of table space data file can be added to a table space with alter tablespace command and expansion of table space

Modify the table space size

- expansion of table space

 

 

ALTER TABLESPACE nod_tablespace

ADD DATAFILE '/home/oracle/tablespace/C.ORA' SIZE 100M

 

- Check the table space case

SELECT SUM(bytes) / (1024 * 1024) AS free_space, tablespace_name

FROM dba_free_space

GROUP BY tablespace_name;

 

You can specify a table space for the user when creating a user, this user default all database objects are stored in the space

The specified user table space

create user nod identified by nod default tablespace nod_tablespace;

 

Create a table designated table space

create table t2(id int)

tablespace nod_tablespace

 

 

Once created tables and indexes, table space can not be modified secondary

Guess you like

Origin www.cnblogs.com/wwmhxy/p/11576507.html