手机版
你好,游客 登录 注册
背景:
阅读新闻

缩小undo表空间全记录

[日期:2012-07-15] 来源:Linux社区  作者:czmmiao [字体:大 中 小]

相关文件编号:此编号对于一个表空间中的每个文件是唯一的;

块编号:表示包含此行的块在文件中的位置;

行编号:标识块头中行目录位置的位置;

在内部数据对象编号需要32位(bit),相关文件编号需要10位(bit),块编号需要22位(bit),位行编号需要16位,加起来总共是80位或10 个字节,ROWID 使用以64为基数的编码方案来显示该方案将6个位置用于数据对象,编号3个位置用于相关文件编号,6个位置用于块编号,3个位置用于行编号以64为基数的编码方案使用字符A-Z a-z 0-9 + 和/共64 个字符,如下例所示:

AAAB/R AAB AAAGmS AAA

由于block是22位(bit),

22bit就是一个22位二进制数,换算成十进制就是 2的22次方-1=4194303 也就是说,一个datafile最多容纳这么多个blocks

数据块大小(block  size)为2K的数据文件的size最大只能是8G,而依此类推8K数据块的一个数据文件的最大size只能是32G。系统中undo表空间只能使用8k的小表空间,故undo最大的单个数据文件为32GB。

于是创建单个文件大小为30GB的undo表空间

SQL> create undo tablespace UNDOTEMPTBS1 datafile '/dev/rlv_undo_tmp01' size 30G;

Tablespace created.
切换数据库默认undo表空间为UNDOTEMPTBS1

SQL> alter system set undo_tablespace=UNDOTEMPTBS1;

System altered.

SQL> show parameter  undo_tablespace    

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

undo_tablespace                      string      UNDOTEMPTBS1
删除原有undo表空间UNDOTBS1

SQL> drop tablespace UNDOTBS1 including contents and datafiles;

Tablespace dropped.

SQL> show parameter undo_tablespace

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

undo_tablespace                      string      UNDOTEMPTBS1
创建undo表空间UNDOTBS1,这里/dev/rlv_cx_undo1_1和/dev/rlv_cx_undo1_2是之前undo表空间使用的数据文件

SQL> create undo tablespace UNDOTBS1 

  2  datafile '/dev/rlv_cx_undo1_1' size 20400m,

'/dev/rlv_cx_undo1_2' size 20400m;  3  

Tablespace created.

切换数据库默认undo表空间为UNDOTBS1

SQL> alter system set undo_tablespace=UNDOTBS1;

System altered.

删除原有undo表空间UNDOTEMPTBS1

SQL> drop tablespace UNDOTEMPTBS1 including contents and datafiles;

Tablespace dropped.
确认当前undo表空间

SQL> SHOW PARAMETER UNDO_tablespace

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

undo_tablespace                      string      UNDOTBS1

SQL> set linesize 150

SQL> column file_name format a65

SQL> column tablespace_name format a20

SQL> select f.tablespace_name tablespace_name,round((d.sumbytes/1024/1024/1024),2) total_g,

round(f.sumbytes/1024/1024/1024,2) free_g,

round((d.sumbytes-f.sumbytes)/1024/1024/1024,2) used_g,

round((d.sumbytes-f.sumbytes)*100/d.sumbytes,2) used_percent

from (select tablespace_name,sum(bytes) sumbytes from dba_free_space group by tablespace_name) f,

(select tablespace_name,sum(bytes) sumbytes from dba_data_files group by tablespace_name) d 

where f.tablespace_name= d.tSQL> SQL>   2    3    4    5    6    7  ablespace_name

order by d.tablespace_name; 

TABLESPACE_NAME         TOTAL_G     FREE_G     USED_G USED_PERCENT

-------------------- ---------- ---------- ---------- ------------

。。。。。。。。。。。。。省略若干行。。。。。。。。。。。。

SYSAUX                     9.96       8.56        1.4        14.03

SYSTEM                     9.96       8.76        1.2        12.06

UNDOTBS1                  39.84      39.84          0          .01

UNDOTBS2                  39.84      13.73      26.12        65.54

USERS                      4.98        2.3       2.68        53.89

WFLTAIS_DAT               19.92      19.92          0            0


。。。。。。。。。。。。。省略若干行。。。。。。。。。。。。

SQL> select file_name from dba_data_files where file_name like '%undo%';

FILE_NAME

-----------------------------------------------------------------

/dev/rlv_cx_undo1_1

/dev/rlv_cx_undo2_1

/dev/rlv_cx_undo1_2

/dev/rlv_cx_undo2_2

linux
相关资讯       undo 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款