DATAFILEs with MAXSIZE UNLIMITED ... 浅解

DATAFILEs with MAXSIZE UNLIMITED ...

SQL> select file_id,maxbytes/1024/1024 from dba_data_files;

   FILE_ID MAXBYTES/1024/1024

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

         1         32767.9844

         2         32767.9844

         3         32767.9844

         4         32767.9844

the example above come from a 8k tablespace blocksize.

For 4k and 16k tablespace blocksize the maxsize is different indeed :

SQL> alter system set db_16k_cache_size = 100K scope=both;

System altered.

SQL> create tablespace test_bs16
  2  datafile 'C:/ORACLE/ORADATA/DEMO102A/TEST_BS16_01.DBF'
  3  size 10m
  4  autoextend on maxsize unlimited
  5  blocksize 16k

  6  /

Tablespace created.

SQL> select maxbytes
  2  from dba_data_files
  3  where file_name = 'C:/ORACLE/ORADATA/DEMO102A/TEST_BS16_01.DBF';

  MAXBYTES
----------
6,8719E+10

SQL> alter system set db_4k_cache_size = 100K scope=both;

System altered.

SQL> create tablespace test_bs4
  2  datafile 'C:/ORACLE/ORADATA/DEMO102A/TEST_BS4_01.DBF'
  3  size 10m
  4  autoextend on maxsize unlimited
  5  blocksize 4k
 6  /

Tablespace created.

SQL> select maxbytes
  2  from dba_data_files
  3  where file_name = 'C:/ORACLE/ORADATA/DEMO102A/TEST_BS4_01.DBF'
   /

  MAXBYTES
----------
1,7180E+10

SQL> SELECT ((4*1024*1024)-1)*(4*1024) block4K,

  2  ((4*1024*1024)-1)*(8*1024) block8K,

  3  ((4*1024*1024)-1)*(16*1024) block16K

  4  FROM dual;

   BLOCK4K    BLOCK8K   BLOCK16K

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

1.7180E+10 3.4360E+10 6.8719E+10
Assuming you are not using big files, the maximum number of blocks in a data file is 4Mb - 1, so the maximum file size is as shown in the select.

until 9i:
select file_id from dba_data_files where maxblocks=power(2,22)-2;

in 10g:
select file_id from dba_data_files join dba_tablespaces using (tablespace_name) where (bigfile='NO' and maxblocks=power(2,22)-2) or (bigfile='YES' and maxblocks=power(2,32)-3) ;

整理自网络

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值