This article brings you relevant knowledge aboutOracle, which mainly introduces related issues about table spaces, including the creation, use, renaming, deletion of table spaces, etc. , let’s take a look at it, I hope it will be helpful to everyone.
Recommended tutorial: "Oracle Video Tutorial"
Oracle table space is logically structured under the database. Table spaces can be used to plan the database structure more flexibly. A database can contain multiple table spaces, and each table space can contain multiple data tables. The table space will have independent physical files, which allows users to decide the size, location, etc. of the table space.
create tablespace test datafile 'D:\Database\data\test_data.dbf' size 20M autoextend on next 5M maxsize 500M;
To create a table space, you should use the create tablespace command;
test: table space Name;
datafile 'D:\Database\data\test_data.dbf': Specifies the physical file of the table space;
size 20M: Specifies the initial size of the physical file
autoextend: Specifies when the amount of data exceeds the physical file When the storage space is increased, the file size will be automatically increased;
on next 5M: Specify the size of each increase as 5M;
maxsize 500M: Specify the maximum size of the table space as 500M;
datafile: The 'D:\Database\data' path here must already exist, otherwise an error will be reported if the table space cannot be created;
When executing a SQL statement, the trailing ";" must be written! ! !
select tablespace_name,file_name from dba_data_files order by file_name;
The query results are as shown in the figure:
select user_id,username,default_tablespace from dba_users order by username;
alter database default tablespace test;
The first is that it is allocated when creating a user or manually modified later;
The second is that it has never been allocated or modified, then the default table space of the database is used.
The default table space of Oracle 11g database is not USERS. Therefore, users created without specifying a default table space use the table space USERS. When the default table space of the database is modified to TEST, users created without specifying a default table space will use the table space TEST.
alter tablespace test rename to test_data;
drop tablespace test_data including contents and datafiles;
alter database default tablespace "USERS";
Oracle Video Tutorial"
The above is the detailed content of Graphical analysis of the creation, use, renaming and deletion of Oracle table space. For more information, please follow other related articles on the PHP Chinese website!