暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

oracle initrans and maxtrans

原创 Anbob 2011-06-16
1312
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE    9.2.0.1.0       Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production
SQL> create table testinit(id number)
2  initrans 1;
表已创建。
SQL> select table_name,ini_trans,max_trans from user_tables  where table_name='TESTINIT';
TABLE_NAME                      INI_TRANS  MAX_TRANS
------------------------------ ---------- ----------
TESTINIT                                1        255
SQL> drop table testinit;
表已删除。
SQL> create table testinit(id number)  initrans 3;
表已创建。
SQL> select table_name,ini_trans,max_trans from user_tables
2  where table_name='TESTINIT';
TABLE_NAME                      INI_TRANS  MAX_TRANS
------------------------------ ---------- ----------
TESTINIT                                3        255
SQL> create table testmax(id number)   maxtrans 100;
表已创建。
SQL> select table_name,ini_trans,max_trans from user_tables    where table_name='TESTMAX';
TABLE_NAME                      INI_TRANS  MAX_TRANS
------------------------------ ---------- ----------
TESTMAX                                 1        100
SQL> drop table testmax ;
表已删除。
SQL> create table testmax(id number)   maxtrans 256;
maxtrans 256
*
第 2 行出现错误:
ORA-02209: 无效的 MAXTRANS 选项值
####################################换11G#########
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
PL/SQL Release 11.1.0.6.0 - Production
CORE    11.1.0.6.0      Production
TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production
SQL> create table testinit(id int)
2  initrans 1;
表已创建。
SQL> select table_name,ini_trans,max_trans from user_tables  where table_name='TESTINIT';
TABLE_NAME                      INI_TRANS  MAX_TRANS
------------------------------ ---------- ----------
TESTINIT                                1        255
SQL> drop table testinit purge;
表已删除。
SQL> create table testinit(id number)  initrans 3;
表已创建。
SQL> select table_name,ini_trans,max_trans from user_tables  where table_name='TESTINIT';
TABLE_NAME                      INI_TRANS  MAX_TRANS
------------------------------ ---------- ----------
TESTINIT                                3        255
SQL> create table testmax(id number)   maxtrans 100;
表已创建。
SQL> select table_name,ini_trans,max_trans from user_tables  where table_name='TESTINIT';
TABLE_NAME                      INI_TRANS  MAX_TRANS
------------------------------ ---------- ----------
TESTINIT                                3        255
SQL> drop table testmax purge;
表已删除。
SQL> create table testmax(id number)   maxtrans 256;
create table testmax(id number)   maxtrans 256
*
第 1 行出现错误:
ORA-02209: 无效的 MAXTRANS 选项值

note:官方
In earlier releases of Oracle Database, the MAXTRANS parameter limited the number of transaction entries that could concurrently use data in a data block. This parameter has been deprecated.
Oracle Database now automatically allows up to 255 concurrent update transactions for any data block, depending on the available space in the block.
The database ignores MAXTRANS when specified by users only for new objects created when the COMPATIBLE initialization parameter is set to 10.0 or greater.

也就是说从Oracle10g开始,对于单个数据块,Oracle缺省最大支持255个并发,MAXTRANS参数被废弃,无论你是否指定,11G中initrans 默认为3,9i是默认为1,这也是oracle 一直在需要一个平衡点。

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论