Oracle table tablespace data files

Source: Internet
Author: User

The data file is the physical storage unit of the database, while the tablespace is the logical component of the database. The database data is stored in the tablespace, and a tablespace can be composed of one or more data files. A data file can only belong to one tablespace. Once a data file is added to a tablespace, it cannot be deleted. to delete a data file, you can only delete the tablespace it belongs.
The tablespace to be generated is generally performed by DBA or privileged users. To generate a tablespace as another identity, this user must be granted the create tablespace permission. When a tablespace is generated, a data file is generally generated and the file size and segment size are determined.
Generate a tablespace to determine the data file, file size, and partition size.

 

Create tablespace date01 datafile D:/Oracle/oradata/scut/date01.dbf size 200 m uniform size 128 K
Delete a tablespace and data file:
Drop tablespace date01 including contents and datafiles;

Change the size of a tablespace:
? Add a data file:
Alter tablespace date01 add datafile D:/Oracle/oradata/scut/date03.dbf size 50 m;
? Manually add File Size
Alter database datafile D:/Oracle/oradata/scut/date03.dbf resize 100 m;
? Set automatic extension of file data
Alter database datafile D:/Oracle/oradata/scut/date03.dbf autoextend on next 10 m maxsize 500 m;

Move data files:
There are two ways to move data files: Alter tablespace and alter database.
? Move data files in the open state
In this state, the alter DataSpace command is used to move a file and the tablespace is required to be offline. Because system and undo tablespaces cannot be offline, they cannot be moved in this way.
The following describes how to move a common data file:
? Determine the tablespace in which the file is located:
Select tablespace_name from dba_data_files where file_name = D:/Oracle/oradata/date03.dbf;
? Take the tablespace offline:
Alter tablespace date01 offline;
? Use the OS command to move files:
Host move D:/Oracle/oradata/scut/date03.dbf D:/Oracle/ora92/date03.dbf;
? Run the alter DataSpace command to ensure that the file is moved:
Alter tablespace date01 rename datafile D:/Oracle/oradata/scut/date03.dbf to D:/Oracle/ora92/date03.dbf ';
? Bringing tablespaces online:
Alter tablespace date01 online;

? Move data files in the Mount status
In the Mount state, any data files, including system and undo tablespaces, can be moved. It uses the alter database command.
? Close Database
Shutdown immediate
Startup Mount
? Mobile Data
Host move D:/Oracle/oradata/scut/date03.dbf D:/Oracle/ora92/date03.dbf;
? Execute alter Database
Alter database date01 renam File '..... 'To '...... '
? Open Database
Alter database open

Table space, user, table relationship:
The tablespace is the container of the database logical object, and the user is the owner of the database logical object.
User -- has --> tables -- save in --> tablespace

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.