Create a new tablespace in Oracle

Source: Internet
Author: User

View table space and Data File Information
Select tablespace_name, file_name, ceil (bytes/1024/1024) mb
From dba_data_files order by 1;

Create a tablespace

Create tablespace tanzugan logging datafile 'H: \ APP \ ZUGANTAN \ ORADATA \ ORCL2012 \ tanzugan. dbf'
SIZE 100 m reuse extent management local segment space management auto;

--- View tablespace Information

Select * from dba_data_files order by 1;

------ Interspersed order by 1 order by2

Order by 1 sort by the first column

Order by 2 sort by the second column

If only two columns are written as order by 3, an error is returned.

-------------------

Add a new data file
Alter tablespace ts1 add datafile 'd: \ Oracle \ ORADATA \ Ora10 \ ts1.2 'size 2 m;
Data Files can only be added and cannot be deleted unless the tablespace is deleted. However, the 10 Gb database version can be deleted.

-------------------- Delete a tablespace Data File

Alter tablespace ts1 drop datafile 'd: \ ORACLE \ ORADATA \ ORA10 \ TS1.2 ';

-----------------------------------------

Change the data file size
It can be increased or reduced.
Alter database datafile '..... 'Resize 100 m;

Automatic expansion of data files
Select FILE_NAME, AUTOEXTENSIBLE, MAXBLOCKS,
INCREMENT_BY from dba_data_files;
Change to auto Scaling
Alter database datafile 'd: \ ORACLE \ ORADATA \ O10 \ TS1.1'
Autoextend on next 1 m maxsize: 100 m;
Change to manual extension
Alter database datafile 'd: \ ORACLE \ ORADATA \ O10 \ TS1.1'
Autoextend off;
Tablespace read-only
Alter tablespace users read only;
Verify
Select TABLESPACE_NAME, STATUS from dba_tablespaces;
Read/write
Alter tablespace users read write;
Tables in read-only tablespaces cannot be dml, but can be dropped.
Because DROP operations are performed on the system tablespace, the SYSTEM tablespace cannot be read-only.

Offline tablespace
Alter tablespace users offline;
Verify
Select TABLESPACE_NAME, STATUS from dba_tablespaces;
Online
Alter tablespace users online;
Only the complete data file can be online. If the file is incomplete, restore it.
Restore the consistency before going online;
Files can be accessed only when they are online.

For more information about Oracle, see Oracle topics page http://www.bkjia.com/topicnews.aspx? Tid = 12

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.