【Oracle学习】之 表空间
表空间(1)概念:表空间是数据库的逻辑存储空间,可以理解为在数据库中开辟的一个空间,用于存放数据库的对象,数据库可以由多个表空间组成,而表空间则是由一个或者多个数据文件来组成的,数据文件是物理存储空间
(2)查看用户的表空间:
desc dba_tablespaces
select tablespace_name from dba_tablespaces;
权限大的能访问权限小的表空间,反之则不行。比如:
(3)设置用户的默认或临时表空间
(4)创建表空间
create tablespace test1_tablespace datafile 'test1file.dbf' size 10m;
create temporary tablespace temptest1_tablespace tempfile 'tempfile1.dbf' size 10m;
查看默认情况下的表空间位置desc dba_data_files
select file_name from dba_data_files where tablespace_name = 'TEST1_TABLESPACE';
//显示的是默认情况下创建表空间文件存放的位置
(5)修改表空间
alter tablespace test1_tablespace offline;
desc dba_tablespaces
select status from dba_tablespaces where tablespace_name = 'TEST1_TABLESPACE';
alter tablespace test1_tablespace online;
select status from dba_tablespaces where tablespace_name = 'TEST1_TABLESPACE';
alter tablespace test1_tablespace read only;
select status from dba_tablespaces where tablespace_name = 'TEST1_TABLESPACE';
alter tablespace test1_tablespace read write;
select status from dba_tablespaces where tablespace_name = 'TEST1_TABLESPACE';
alter tablespace test1_tablespace add datafile 'test2_file.dbf' size 10m;
select file_name from dba_data_files where tablespace_name='TEST1_TABLESPACE';
alter tablespace test1_tablespace drop datafile 'test2_file.dbf';
select file_name from dba_data_files where tablespace_name='TEST1_TABLESPACE';
(6)删除表空间
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |