----------------------------临时表空间--------------------------------------
create temporary tablespace temp2 tempfile '' size 20m reuse;创建临时表空间
select name,bytes from v$tempfile;查询临时表空间
select tablespace_name,file_name from dba_temp_files; 查询
alter tablespace temp2 add/drop tempfile'' size 20m;加和删文件
alter database default temporary tablespace users;改数据库的默认临时表空间
select * from user_users;
alter user scott temporary tablespace temp;修改用户默认临时表空间
drop tablespace temp2 including contens and datafiles;删表空间
create temporary tablespace temp2 tempfile '' size 20m reuse tablespace
group group1; 创建表空间并加组
select * from dba_tablespace_groups;查看表空间组 表空间组只能加临时表空间
alter tabelspace temp tablespace group group1;将一个表空间加入到一个表空间组
alter user scott temporary tablespace group1; 更改用户的临时表空间组
创建会话级的临时表:
create global temporary table tmp1
on commit preserve rows
as select * from emp;
创建事务级的临时表:
create global temporary table tmp2
as select * from emp;
select table_name,logging,temporary,duration from user_tables;查询临时表的参数
-------------------------普通数据的管理 表空间 段 区 块----------------------
show parameter block 看当前设置的数据库块的参数
show parameter cache_size 看各种物理块对应在内存中空间的参数 该参数是指明在内存空间中换分出多大的空间来读以该标准块来创建的表 在没有设置之前 所有value值默认为0
一般数据库的block大小一般设置为8k 是为标准块
其他的像是4k一个块等都属于非标准块 在创建一个非标准块的表时 需要特别指定块的大小
alter system set db_4k_cache_size=10m; 指定db_4k_cache_size的参数值
create smallfile tablespace t4k datafile '' size 10m blocksize 4k;创建 每块大小为4k的10m普通表空间 在不指定参数值的时候 是无法指定块的大小来创建表空间的
create tablespace tnolog datafiel '' size 5m nologging|froce logging;创建一个表空间并设置为不产生/强制产生日志