Basic Operation of Oracle Database-- Tablespace Management
Introduction: ORACLE is physically composed of the following files on disk: data files and control files and LOGFILE
Tablespaces only talk about relevant data files.
First of all, make the concept clear: table space is a concept defined internally by ORACLE to unify ORACLE physics and logic.
Physically, a table space is made up of specific numbers on one or more disks
According to files (at least 1-to-1, can be 1-to-many), logically a tablespace is made up of a specific or
Made up of data in multiple user mode tables, indexes, etc.
Therefore, from the user's point of view, we should not see the physical data files on disk, their perspective from small to large:
Field value-- > record value-- > Table data-- > user-- > Tablespace-- > ORACLE
From an ORACLE DBA perspective, the relationship should be like this: data file-- > tablespace-- > ORACLE.
To sum up, that is to say, tables cannot exist alone in ORACLE, they must belong to a certain user, and the data of a certain user must exist in a tablespace.
Temporary tablespaces are used for sorting, index tablespaces for placing indexes, UNDO tablespaces for rollbacks, and user tablespaces for storing user tables.
The system tablespace is used to store data dictionaries. The purpose of oracle is to improve system performance and system security.
Because oracle has not only user rights but also resource permissions, it can better control and assign the use of permissions.
Oracle database diagram:
Specific experimental steps:
1 create a database:
2 create tablespaces:
[oracle@localhost ~] $sqlplus / as sysdba
SQL > create tablespace tbs_work
2 datafile'/ orc/app/oracle/oradata/worktbs01.dbf'
3 size 10M autoextend on
The tablespace has been created.
3 resize the tablespace:
Method 1: modify the size directly
SQL > alter database datafile
2'/ orc/app/oracle/oradata/worktbs01.dbf'
3 resize 100M
Method 2: add files
SQL > alter tablespace tbs_work
2 add datafile
3'/ orc/app/oracle/oradata/worktbs02.dbf'
4 size 50M autoextend on
The tablespace has changed.
Tablespace permissions:
SQL > alter tablespace tbs_work read only
The tablespace has changed. (read only)
SQL > alter tablespace tbs_work read write
The tablespace has changed. (default: read and write)
Delete tablespaces:
SQL > drop tablespace tbs_work including contents
The tablespace was deleted. (including contents optionally deletes table spaces with content)