Oracle tablespace and data files

Source: Internet
Author: User

Create a tablespace in Oracle

1. Create a common tablespace
Create tablespace oracle_tablespace
Datafile '/home/oracle/oradata/orcl/oracle_tablespace.dbf'
Size 100 m
Autoextend on next 10 M maxsize 200 M
Extent management local
Uniform size 1 m;

2. Create an undo tablespace
CREATE undo tablespace undo_oracle
Datafile '/home/oracle/oradata/orcl/undo_oracle.dbf'
Size 50 m
Extent management local;

3. Create a temporary tablespace
CREATE temporary tablespace temporary_oracle
Tempfile '/home/oracle/oradata/orcl/temporary_oracle.dbf'
Size 50 m
Autoextend on next 10 M maxsize 100 M
Extent management local
Uniform size 1 m;

 


Extended tablespace

1. Expand data table space

Alter tablespace oracle_tablespace add datafile '/home/oracle/oradata/orcl/oracle_tablespace1.dbf' size 100 M;

2. Expand the undo tablespace

Alter tablespace oracle_tablespace add datafile '/home/oracle/oradata/orcl/undo_tablespace1.dbf' size 100 M;

3. extended temporary tablespace

Alter tablespace oracle_tablespace add tempfile '/home/oracle/oradata/orcl/temporary_tablespace1.dbf' size 100 M;


Delete a tablespace

-- Delete empty tablespace, but does not contain physical files
Drop tablespace tablespace_name;
-- Delete non-empty tablespace, but does not contain physical files
Drop tablespace tablespace_name including contents;
-- Delete empty tablespace, including physical files
Drop tablespace tablespace_name including datafiles;
-- Delete non-empty tablespace, including physical files
Drop tablespace tablespace_name including contents and datafiles;
-- If the tables in other tablespaces have foreign keys and other CONSTRAINTS associated with the table fields in the current tablespace, cascade constraints must be added.
Drop tablespace tablespace_name including contents and datafiles cascade constraints;

  • 1
  • 2
  • 3
  • Next Page

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.