为什么bytes的值比maxbytes的值要大

蜗牛 互联网技术资讯 2021-12-22 237 0

这篇文章主要讲解了“为什么bytes的值比maxbytes的值要大”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“为什么bytes的值比maxbytes的值要大”吧!

目的:
本文解释了DBA_DATA_FILES中bytes的值要比maxbytes的值要大的原因。

描述:
当一个datafile 手工resize到一个大于maxsize(maxbytes)的值之后,DBA_DATA_FILES中bytes的值要比maxbytes的值要大
当该datafile被设置为autoextend on之后,dba_data_files中的maxbytes 值被自动结算为一个非零值。
dba_data_files中的bytes是该datafile的当前的大小(以bytes为单位)

下面是一个示例:

解释:
当datafile 被resize的时候,dba_data_files中的maxbytes 值 不会被更新,此时被更新的列只是bytes列。
dba_data_files中的maxbytes 值是在使用ALTER DATABASE command with MAXSIZE option 时才会被更新的。

Step-1: Create a New Tablespace  
======  ===================================================

SQL> create tablespace tst datafile '/u01/app/oracle/oradata/DBdb/tst.dbf' size 5m autoextend on;

Tablespace created.

SQL> col file_name for a60
SQL> set lines 200
SQL>  select file_name, bytes, maxbytes, autoextensible from dba_data_files;  

FILE_NAME                                                              BYTES   MAXBYTES AUT
----------------------------------------------------------------- ---------- ---------- ---
/u01/app/oracle/oradata/DBdb/users01.dbf                          3207331840 3.4360E+10 YES
/u01/app/oracle/oradata/DBdb/undotbs01.dbf                        2710568960 3.4360E+10 YES
/u01/app/oracle/oradata/DBdb/sysaux01.dbf                          744488960 3.4360E+10 YES
/u01/app/oracle/oradata/DBdb/system01.dbf                         2936012800 3.4360E+10 YES
/u01/app/oracle/oradata/DBdb/example01.dbf                         355205120 3.4360E+10 YES
/u01/app/oracle/fast_recovery_area/DBDB/newback/ts_xxf_01.dbf       10485760          0 NO
/u01/app/oracle/oradata/DBdb/tst.dbf                                 5242880 3.4360E+10 YES

7 rows selected.


Step-2: Alter the MAXSIZE value from default value  
======  ===================================================

SQL> alter database datafile '/u01/app/oracle/oradata/DBdb/tst.dbf' autoextend on maxsize 10m;  

Database altered.

SQL> select file_name, bytes, maxbytes, autoextensible from dba_data_files;

FILE_NAME                                                              BYTES   MAXBYTES AUT
----------------------------------------------------------------- ---------- ---------- ---
/u01/app/oracle/oradata/DBdb/users01.dbf                          3207331840 3.4360E+10 YES
/u01/app/oracle/oradata/DBdb/undotbs01.dbf                        2710568960 3.4360E+10 YES
/u01/app/oracle/oradata/DBdb/sysaux01.dbf                          744488960 3.4360E+10 YES
/u01/app/oracle/oradata/DBdb/system01.dbf                         2936012800 3.4360E+10 YES
/u01/app/oracle/oradata/DBdb/example01.dbf                         355205120 3.4360E+10 YES
/u01/app/oracle/fast_recovery_area/DBDB/newback/ts_xxf_01.dbf       10485760          0 NO
/u01/app/oracle/oradata/DBdb/tst.dbf                                 5242880   10485760 YES

7 rows selected.

Step-3: Resize the datafile to a value higher than MAXBYTES  
======  ===================================================
SQL> alter database datafile '/u01/app/oracle/oradata/DBdb/tst.dbf' resize 20m;

Database altered.

SQL> select file_name, bytes, maxbytes, autoextensible from dba_data_files;

FILE_NAME                                                              BYTES   MAXBYTES AUT
----------------------------------------------------------------- ---------- ---------- ---
/u01/app/oracle/oradata/DBdb/users01.dbf                          3207331840 3.4360E+10 YES
/u01/app/oracle/oradata/DBdb/undotbs01.dbf                        2710568960 3.4360E+10 YES
/u01/app/oracle/oradata/DBdb/sysaux01.dbf                          744488960 3.4360E+10 YES
/u01/app/oracle/oradata/DBdb/system01.dbf                         2936012800 3.4360E+10 YES
/u01/app/oracle/oradata/DBdb/example01.dbf                         355205120 3.4360E+10 YES
/u01/app/oracle/fast_recovery_area/DBDB/newback/ts_xxf_01.dbf       10485760          0 NO
/u01/app/oracle/oradata/DBdb/tst.dbf                                20971520   10485760 YES

7 rows selected.

SQL>

表空间tst(/u01/app/oracle/oradata/DBdb/tst.dbf  )能达到的最大大小是dba_data_files.bytes的值。

感谢各位的阅读,以上就是“为什么bytes的值比maxbytes的值要大”的内容了,经过本文的学习后,相信大家对为什么bytes的值比maxbytes的值要大这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是蜗牛博客,小编将为大家推送更多相关知识点的文章,欢迎关注!

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:niceseo99@gmail.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

评论

有免费节点资源,我们会通知你!加入纸飞机订阅群

×
天气预报查看日历分享网页手机扫码留言评论Telegram