Oracle表空间

oracle的tablespace相关知识:
1. 查找有哪些表空间
select * from v$tablespace;
2. 每个表空间有哪些数据文件
 desc dba_data_files;
col filename format a40;
 select file_name, tablespace_name from dba_data_files;
3. 创建表空间
   create tablespace paul datafile '/u01/oracle/SID名字/demo01.dbf' size 20m;
   此时并没有增加机器的硬盘空间,只是一个站位的作用, 用df -h可以验证。
4. 先用select * from v$tablespace;找到相应要找的表空间, 再用desc dba_tablespaces;中可以知道tablespace_name与contents的关系, 用
select tablespace_name, STATUS, contents, EXTENT_MANAGEMENT from dba_tablespaces;可以知道一个表空间的情况。 

5. 增加临时表空间(操作系统并未真正分配空间,只是搭了空位置)
   create temporary tablespace mytempA tempfile 'u01/oradata/*/mytemp01.dbf' size 10m extent management local; 最后一步修改临时表空间,用alter database default temporary tablespace mytempA; 就好了, 呵呵
 迅速创建完成了表空间,主要是操作系统的花招,没有真正实际分配,只是占位罢了。
6. 临时表空间相关知识:
 desc database_properties;
 col property_value format a20;
 col description format a20;
 select * from database_properties;
从中可以知道:DEFAULT_TEMP_TABLESPACE TEMP   Name of default temporary tablespace。
select TABLESPACE_NAME, CONTENTS,EXTENT_MANAGEMENT from dba_tablespaces;
7. 改变表空间状态:
alter tablespace wenchuan read only;
alter tablespace wenchuan read write;
alter tablespace wenchuan offline [normal][temporary][immediate];
alter tablespace wenchuan online;

8. 改变表空间大小




你可能感兴趣的:(oracle,职场,表空间,休闲)