【练习】表空间操作

1.创建表空间 

1)test1:大小为50M,自动扩展最大不能超过2G,表空间本地管理,且segment space management manual。

SQL> create tablespace test1 datafile '/u01/app/oracle/oradata/ORA11GR2/test101.dbf' size 50M
  2  autoextend on next 1M maxsize 2G
  3  extent management local uniform size 1M
  4  segment space management manual;

Tablespace created.

2)tool:大小为40M,本地管理,且扩展时按照统一大小1M扩展。

SQL> create tablespace tool datafile '/u01/app/oracle/oradata/ORA11GR2/test102.dbf' size 40M
  2  extent management local uniform size 1M
  3  segment space management manual;

Tablespace created.

3)创建临时表空间tem11,temp12,大小均为50M,并且加到temp_grp组中,将这个组设置为数据库默认的临时表空间组。

SQL> create temporary tablespace tem11
  2  tempfile '/u01/app/oracle/oradata/ORA11GR2/temp_01.dbf' size 50M
  3  tablespace group temp_grp;

Tablespace created.

SQL> create temporary tablespace tem12
  2  tempfile '/u01/app/oracle/oradata/ORA11GR2/temp_02.dbf' size 50M
  3  tablespace group temp_grp;

Tablespace created.
SQL> alter database default temporary tablespace temp_grp;

Database altered.

4)查看临时表空间。

SQL> select property_value from database_properties where property_name = 'DEFAULT_TEMP_TABLESPACE';

PROPERTY_VALUE
--------------------------------------------------------------------------------
TEMP_GRP

 5)创建小文件表空间(最多4G个块,每块8k,也就是最大32G)。

SQL> create tablespace small_tbs1 datafile
  2  '/u01/app/oracle/oradata/ORA11GR2/tbs1.dbf' size 10M
  3  autoextend on maxsize 1G;

Tablespace created.

6)创建非标块的表空间(先建一个非标块的缓存)。

SQL> alter system set db_16k_cache_size=16M;

System altered.
创建
SQL> create tablespace tbs1 datafile
  2  '/u01/app/oracle/oradata/ORA11GR2/tbs1.dbf' size 10M
  3  blocksize 16k;

Tablespace created.

7)创建undo表空间(每次只能有一个undo表空间在使用)。

SQL> create undo tablespace undo1 datafile '/u01/app/oracle/oradata/ORA11GR2/undo1.dbf' size 100M;

Tablespace created.

切换当前使用的临时表空间:

SQL> alter system set undo_tablespace='undo1';

System altered.

8)删除表空间

SQL> drop tablespace small_tbs1 including contents and datafiles;

Tablespace dropped.
原文地址:https://www.cnblogs.com/tomatoes-/p/6040725.html