To understand the Oracle architecture, you must first understand two basic concepts: databases and instances.
1. Database
A database is a collection of data.
Whether the database adopts a relational structure or an object-oriented structure, the oracle database stores the data in the data file. internally, the logical ing of database structure data to files allows different data to be stored separately. These logical partitions are called tablespaces.
Table space and file introduction:
1: tablespace
Table space is the logical division of databases. Each database has at least one table space, called a system table space. A table space can only belong to one database.
Each tablespace is composed of one or more files on the same disk. These files are called data files.
Table space features:
(1) control database data disk allocation
(2) restrict the disk space that users can use in the tablespace
(3) tablespaces have the online, offline, readonly, and readwrite attributes.
Modify the properties of a tablespace:
SQL> alter tablespace name attribute;
Query the table space status:
SQL> select tablespace_name, status from dba_tablespaces;
Note: The system, undo, and temp tablespace cannot be set as the offline attribute.
(4) backup and recovery of some databases
(5) The tablespace is expanded by a data file. The tablespace size is equal to the size of the data file that constitutes the tablespace.
Query the ing between a table space and a data file:
SQL> select tablespace_name, bytes, file_name from dba_data_files;
Table space-based operations:
(1) query the user's default tablespace:
SQL> select username, default_tablespace from dba_users;
(2) query the table and the tablespace that stores the table:
SQL> select table_name, tablespace_name from user_tables;
(3) modify the user's default tablespace:
SQL> alter user username default tablespace tablespace_name;
(4) move data from one tablespace to another:
SQL> alter table table_name move tablespace tablespace_name;
2. Data Files
Each tablespace is composed of one or more files on the same disk. These files are called data files. data files can only belong to one tablespace. the data file size can be changed after being created. to create a new tablespace, you must create a new data file. once a data file is added to a tablespace, it cannot be moved from the tablespace or be associated with other tablespaces.
The three types of files required by the database are data file, control file, and redolog file. Other files prameter file, password file, and archived log files are not required by the database. They only support the database.
View the physical file composition of the database:
(1) view data files: SQL> select * from v $ datafile;
(2) view the control file: SQL> select * from v $ controlfile;
(3) view log files: SQL> select * from v $ logfile;
[Content navigation] |
Page 1: Database |
Page 1: Instances |