SQL>conn system/oracle
SQL>CREATE TABLESPACE tbs_peenboo
DATAFILE'/oradata/tbs_peenboo_01.dbf' size 10m
EXTENTMANAGEMENT LOCAL AUTOALLOCATE
SEGMENTSPACE MANAGEMENT AUTO;
SQL>create table t_newtab(c1 date)tablespace tbs_peenboo;
SQL>select extent_id,bytes from dba_extents
Where owner='system' and segment_name='T_NEWTAB';
SQL>ALTER TABLE t_newtab ALLOCATE EXTENT;
SQL>ALTERTABLESPACE T_PEENBOO OFFLINE;
SQL>INSERT INTO T_NEWTAB VALUES (SYSDATE);
----ora-00376:file 6 cannot be read at this time
SQL>ALTER TABLESPACE T_PEENBOO ONLINE;
SQL>INSERT INTO T_NEWTAB VALUES (SYSDATE);
----1 rowcreated
SQL>alter tablespace tbs_peenboo read only;
SQL>INSERT INTO T_NEWTAB VALUES (SYSDATE);
----ora-00372: file 6 cannot be modified atthis time
SQL>droptable t_newtab;
----tabledropped;
SQL>alter tablespace tbs_peenboo read write;
----启用OMF来创建数据文件
SQL>alter system set db_create_file_dest = '/oradata';
--用最少的语法创建表空间
SQL>create tablespace tbs_omfnew;
--确定OMF文件的特性
SQL>selectfile_name,bytes, autoextensible,maxbytes,increment_by
Fromdba_data_files where tablespace_name ='TBS_OMFNEW';
--调整OMF 文件,使特性趋于合理。
SQL>alter database datafile
'/oradata/ORACLE11G/datefile/o1_mf_tbs_omfnew_3olpn462.dbf'
Resize500m;
SQL>alter database datafile
'/oradata/ORACLE11G/datefile/o1_mf_tbs_omfnew_3olpn462.dbf'
Autoextendon next 100m maxsize 2G;
--删除表空间
SQL>droptablespace tbs_omfnew including contents and datafiles;
转载于:https://blog.51cto.com/peenboo/1790368