• Oracle临时表空间组


    Oracle 10g之前,同一用户的多个会话只可以使用同一个临时表空间,因为在给定的时间只有一个临时表空间默认给用户,为了解决这个潜在的瓶颈,Oracle支持临时表空间组即包含多个临时表空间的集合。临时表空间组逻辑上就相当于一个临时表空间。

    Example:

     1 SQL>create temporary tablespace temp1 tempfile '/u01/app/oracle/oradata/orcl/temp01.dbf' size 10M;
     2 
     3 SQL>create temporary tablespace temp2 tempfile '/u01/app/oracle/oradata/orcl/temp02.dbf' size 10M;
     4 
     5 SQL>create temporary tablespace temp3 tempfile '/u01/app/oracle/oradata/orcl/temp03.dbf' size 10M;
     6 
     7 SQL>select name from v$tempfile;
     8 
     9 NAME
    10 
    11 -----------------------------------------------------------------------------------------------
    12 
    13 /u01/app/oracle/oradata/orcl/temp01.dbf
    14 
    15 /u01/app/oracle/oradata/orcl/temp02.dbf
    16 
    17 /u01/app/oracle/oradata/orcl/temp01.dbf
    18 
    19 SQL>select tablespace_name from dba_tablespaces where contents='TEMPORARY';
    20 
    21 TABLESPACE_NAME
    22 
    23 -----------------------------------------------------------------------------------------------
    24 
    25 TEMP1
    26 
    27 TEMP2
    28 
    29 TEMP3
    30 
    31 添加temp1,temp2,temp3到临时表空间组tempgrp中
    32 
    33 SQL>alter tablespace temp1 tablespace group tempgrp;
    34 
    35 SQL>alter tablespace temp2 tablespace group tempgrp;
    36 
    37 SQL>alter tablespace temp3 tablespace group tempgrp;
    38 
    39 启用临时表空间组
    40 
    41 SQL>alter database default temporary tablespace tempgrp;
    42 
    43 SQL>select * from dba_tablespace_groups;
    44 
    45 GROUP_NAME                               TABLESPACE_NAME
    46 
    47 -----------------------------------------------------------------------------------------
    48 
    49 TEMPGRP                 TEMP1
    50 
    51 TEMPGRP                 TEMP2
    52 
    53 TEMPGRP                 TEMP3
    54 
    55 此时数据库所有用户的默认临时表空间为tempgrp
    56 
    57 SQL>select username,defualt_tablespace,temporary_tablespace from dba_user where username='SCOTT';
    58 
    59 USERNAME                  DEFAULT_TABLESPACE                                  TEMPORARY_TABLESPACE
    60 
    61 ---------------------------------------------------------------------------------------------------------------
    62 
    63 SCOTT                        USERS                                                          TEMPGRP
    64 
    65 删除临时表空间组
    66 
    67 1.必须先删除成员
    68 
    69 SQL>alter tablespace temp1 tablespace group '';(表示删除temp1)
    70 
    71 SQL>select * from dba_tablespace_groups;
    72 
    73 GROUP_NAME                               TABLESPACE_NAME
    74 
    75 -----------------------------------------------------------------------------------------
    76 
    77 TEMPGRP                 TEMP2
    78 
    79 TEMPGRP                 TEMP3
    80 
    81 同理将temp2,temp3删除
    82 
    83 当表空间组是数据库默认表空间时,最后一个成员删除报错:ORA-10919:Defualt temporary tablespace group must be have at least one tablespace
    84 
    85 SQL>alter database default temporary tablespace temp;
    86 
    87 此时再删除最后一个成员,临时表空间组自动消失
    88 
    89 SQL>select * from dba_tablespace_groups;
    90 
    91 no rows selected
    92 
    93 删除temp1表空间及数据文件
    94 
    95 SQL>drop temporary tablespace temp1 including contents and datafiles;
    View Code
  • 相关阅读:
    二分查找 【数组的二分查找】
    二分答案 [TJOI2007]路标设置
    队测 逆序对 permut
    【线段树】 求和
    状压DP Sgu223 骑士
    状压DP Poj3311 Hie with the Pie
    状压DP入门 传球游戏之最小总代价
    状压DP 小W选书籍
    状压DP [Usaco2008 Nov]mixup2 混乱的奶牛
    __gcd()用法
  • 原文地址:https://www.cnblogs.com/haimishasha/p/5476022.html
Copyright © 2020-2023  润新知