在数据库启动的时候,oracle将会验证OS文件大小与文件头记录的大小进行比较。
如果OS文件大小不是数据库参数DB_BLOCK_SIZE的整数倍,将会报ORA-27046。
- ORA-27046: file size is not a multiple of logical block size 。
如果OS文件大小是数据库参数DB_BLOCK_SIZE的整数倍,但是OS显示的文件大小比文件头记录的小,那么数据库启动将会报ORA-01200错误。
- ORA-01200: actual file size of 7399 is smaller than correct size of 12800.
如果OS文件大小是数据库参数DB_BLOCK_SIZE的整数倍,而且OS显示的文件大小和文件头记录一样大,那么数据库将会正常启动。
如果OS文件大小是数据库参数DB_BLOCK_SIZE的整数倍,但是OS显示的文件大小比文件头记录的大,那么数据能正常启动吗?
我测试了一下,确实能正常启动。
- SQL> select file#,blocks,name from v$datafile_header;
- FILE# BLOCKS NAME
- ---------- ---------- --------------------------------------------------
- 1 88320 /u01/app/oracle/oradata/huateng/system01.dbf
- 2 62720 /u01/app/oracle/oradata/huateng/sysaux01.dbf
- 3 10880 /u01/app/oracle/oradata/huateng/undotbs01.dbf
- 4 640 /u01/app/oracle/oradata/huateng/users01.dbf
- 5 12800 /u01/app/oracle/oradata/huateng/example01.dbf
- 6 5120 /u01/app/oracle/oradata/huateng/htyansp01.dbf
- 7 2000 /u01/app/oracle/oradata/huateng/file01.dbf
- SQL> select file_id,file_name,blocks from dba_data_files;
- FILE_ID FILE_NAME BLOCKS
- ---------- -------------------------------------------------- ----------
- 4 /u01/app/oracle/oradata/huateng/users01.dbf 640
- 3 /u01/app/oracle/oradata/huateng/undotbs01.dbf 10880
- 2 /u01/app/oracle/oradata/huateng/sysaux01.dbf 62720
- 1 /u01/app/oracle/oradata/huateng/system01.dbf 88320
- 5 /u01/app/oracle/oradata/huateng/example01.dbf 12800
- 6 /u01/app/oracle/oradata/huateng/htyansp01.dbf 5120
- 7 /u01/app/oracle/oradata/huateng/file01.dbf 2000
- 7 rows selected.
如下是文件头信息:
- [oracle@db2server ~]$ bbed filename=/u01/app/oracle/oradata/huateng/htyansp01.dbf password=blockedit
- BBED: Release 2.0.0.0.0 - Limited Production on Thu Aug 16 15:17:38 2012
- Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
- ************* !!! For Oracle Internal Use only !!! ***************
- BBED> p offset 44
- kcvfh.kcvfhhdr.kccfhfsz
- -----------------------
- ub4 kccfhfsz @44 0x00001400
文件头记录的文件大小为5120个BLOCKS
- SQL> ! ls -ltr /u01/app/oracle/oradata/huateng/htyansp01.dbf
- -rw-r--r-- 1 oracle oinstall 60620800 08-16 14:45 /u01/app/oracle/oradata/huateng/htyansp01.dbf
- SQL> show parameter db_block_size
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- db_block_size integer 8192
- SQL> select 60620800/8192 -1 from dual;
- 60620800/8192
- -------------
- 7399
OS显示文件的大小为7399个BLOCKS,比文件头记录的多了2000多个。
数据库也能正常启动,也能建表。
- SQL> startup force
- ORACLE instance started.
- Total System Global Area 380817408 bytes
- Fixed Size 1336680 bytes
- Variable Size 268438168 bytes
- Database Buffers 104857600 bytes
- Redo Buffers 6184960 bytes
- Database mounted.
- Database opened.
- SQL> create table itpub(id int) tablespace htyansp;
- Table created.
阅读(1009) | 评论(0) | 转发(0) |