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