临时表空间

来源:互联网 发布:什么数据比金十数据好 编辑:程序博客网 时间:2024/06/06 01:53

一、临时表空间存放用户临时数据,不能存放永久数据。oracle以64kb的块尺寸向PGA中写数据,建议临时表空间的区段尺寸为64kb的整数倍。

二、创建临时表空间

         如:create temporary tablespace tbs_name

                 tempfile 'tempfile_path_nmae' size nm

                也可以使临时文件自动扩展 如:

                create temporary tablespace tbs_name

                 tempfile 'tempfile_path_nmae' size nm

                 autoextend on;

                 临时表空间的区段尺寸分配类型为统一,不能为自动。

                 create temporary tablespace tbs_name

                 tempfile 'tempfile_path_nmae' size nm

                 uniform size 1m;

三、默认临时表空间

        更改数据库默认临时表空间:

        alter database default temporary tablespace tbs_name

        不能删除默认临时表空间,要想删除首先指定新的默认临时表空间。

四、临时表空间组

  1、创建临时表空间组:

    create temporary tablespace tbs_name

    tempfile 'tempfile_path_nmae' size nm

    tablespace group group_name;  --在创建临时表空间时指定临时表空间组名,如该组名不存在,则创建该临时表空间组。

                                                                --如果没有指定组名,则为普通的临时表空间。

    alter tablespace tbs_name tablespace group group_name; --在更改临时表空间所属组时,如指定的组不存在,则创建。

  2、向临时表空间组中添加临时表空间

    alter tablespace tbs_name tablespace group group_name;

    也可以使用单引号使临时表空间脱离组成为普通的临时表空间。

    alter tablespace tbs_name tablespace group '';

3、设定临时表空间组为默认临时表空间

    alter database default temporary tablespace group_name;

  4、设定用户的默认临时表空间为临时表空间组

    create user user_name identified by password

    temporary tablespace group_name;

    或者:

    alter user user_name temporary tablespace group_name;

 

 

 

原创粉丝点击