Drop user user_name cascade; Create a table space
CREATE tablespace DATA01 DataFile '/oracle/oradata/db/data01.dbf ' SIZE 500M Uniform SIZE 128k; #指定区尺寸为128k, if not specified, the zone size defaults to 64k
Delete a table space
DROP tablespace data01 including CONTENTS and datafiles;
First, create a table space
CREATE tablespace DATA01 DataFile '/oracle/oradata/db/data01.dbf ' SIZE 500M Uniform SIZE 128k; #指定区尺寸为128k, if not specified, the zone size defaults to 64k
Second, create the undo table space
CREATE UNDO tablespace UNDOTBS02 DataFile '/oracle/oradata/db/undotbs02.dbf ' SIZE 50M
#注意: You can only use one undo table space at some point in the open state, and if you want to use a new tablespace, you must switch to that table space:
ALTER SYSTEM SET Undo_tablespace=undotbs02;
Iii. establishment of temporary table spaces
CREATE Temporary tablespace temp_data Tempfile '/oracle/oradata/db/temp_data.dbf ' SIZE 50M
Four, change the table space state
1. Make Tablespace offline
ALTER tablespace game OFFLINE;
If you accidentally delete a data file, you must have the recover option
ALTER tablespace game OFFLINE for RECOVER;
2. Bring the table space online
ALTER tablespace game ONLINE;
3. Make data files offline
ALTER DATABASE datafile 3 OFFLINE;
4. Bring the data file online
ALTER DATABASE datafile 3 ONLINE;
5. Make table space Read-only
ALTER tablespace game READ only;
6. Make the table space readable and writable
ALTER tablespace game READ WRITE;
Five, delete table space
DROP tablespace data01 including CONTENTS and datafiles;
Vi. expansion of the table space
First look at the name of the tablespace and the file that belongs to it
Select Tablespace_name, file_id, file_name, Round (bytes/(1024*1024), 0) Total_space From Dba_data_files Order BY Tablespace_name;
1. Additional Data files ALTER tablespace Game ADD datafile '/oracle/oradata/db/game02.dbf ' SIZE 1000M;
2. Manually increase the size of the data file ALTER DATABASE datafile '/oracle/oradata/db/game.dbf ' RESIZE 4000M;
3. Set up data file automatic expansion ALTER DATABASE datafile '/oracle/oradata/db/game.dbf Autoextend on NEXT 100M MAXSIZE 10000M;
View table space Information after setting
SELECT a.tablespace_name,a.bytes total,b.bytes USED, c.bytes free, (b.bytes*100)/a.bytes "% USED", (c.bytes*100)/a.bytes "% free" From SYS. Sm$ts_avail A,sys. Sm$ts_used B,sys. Sm$ts_free C WHERE A.tablespace_name=b.tablespace_name and A.tablespace_name=c.tablespace |