To see how or what Oracle does while initializing a datafile(file system) while adding it to a tablespace I tried the following little test on my RedHat Linux host. The file system was ext3.
Here is the result when No asynchronous I/O was used. ie. the Oracle parameter filesystemio_options=none
Here is a snippet of the out that was collected by strace. Here we see that the datafile foo5.dbf gets created, and then initialized with 0's
We can also check this by looking directly at the datafile file foo5.dbf
Here is the same test when Asynchronous I/O was used. ie. the Oracle parameter filesystemio_options=asynch
When asynchronous I/O was used, there were lots of io_submit could be see happening as expected. The man page says the following about io_submit "io_submit - Submit asynchronous I/O blocks for processing"
Below is a snippet of the output from the strace file when asynchronous i/o was used to add a datafile to the tablespace.
Here is the result when No asynchronous I/O was used. ie. the Oracle parameter filesystemio_options=none
-bash-3.2$ strace -f sqlplus / as sysdba 2> output.txt SQL*Plus: Release 11.2.0.1.0 Production on Thu Jan 12 15:25:50 2012 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> alter tablespace users add datafile '/oracle/ORCLTBLSP/datafile/foo5.dbf' size 3G; Tablespace altered. SQL> |
Here is a snippet of the out that was collected by strace. Here we see that the datafile foo5.dbf gets created, and then initialized with 0's
[pid 18769] open("/oracle/ORCLTBLSP/datafile/foo5.dbf", O_RDONLY) = 14 [pid 18769] open("/oracle/ORCLTBLSP/datafile/foo5.dbf", O_RDONLY) = 14 [pid 18769] open("/oracle/ORCLTBLSP/datafile/foo5.dbf", O_RDWR) = 14 [pid 18769] pwrite(14, "\0\242\0\0\1\0\0\0\0\0\0\0\0\0\1\5\1\247\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1040384, 8192) = 1040384 [pid 18769] pwrite(14, "\0\242\0\0\200\0\0\0\0\0\0\0\0\0\1\5\200\247\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 1048576) = 1048576 [pid 18769] pwrite(14, "\0\242\0\0\0\1\0\0\0\0\0\0\0\0\1\5\0\246\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 2097152) = 1048576 [pid 18769] pwrite(14, "\0\242\0\0\200\1\0\0\0\0\0\0\0\0\1\5\200\246\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 3145728) = 1048576 [pid 18769] pwrite(14, "\0\242\0\0\0\2\0\0\0\0\0\0\0\0\1\5\0\245\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 4194304) = 1048576 [pid 18769] pwrite(14, "\0\242\0\0\200\2\0\0\0\0\0\0\0\0\1\5\200\245\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 5242880) = 1048576 [pid 18769] pwrite(14, "\0\242\0\0\0\3\0\0\0\0\0\0\0\0\1\5\0\244\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 6291456) = 1048576 |
We can also check this by looking directly at the datafile file foo5.dbf
[root@isvx7 datafile]# hexdump foo5.dbf | more 0000000 a200 0000 0000 ffc0 0000 0000 0000 0000 0000010 fa60 0000 2000 0000 0000 0006 7c7d 7a7b 0000020 81a0 0000 0000 0000 0000 0000 0000 0000 0000030 0000 0000 0000 0000 0000 0000 0000 0000 * 0002000 a20b 0000 0001 0240 0000 0000 0000 0401 0002010 5aa1 0000 0000 0000 0000 0b20 412c 722d 0002020 524f 4c43 4254 534c 0465 0000 0000 0006 0002030 2000 0000 0009 0003 0000 0000 0000 0000 0002040 0000 0000 0000 0000 0000 0000 0000 0000 * 0002060 0000 0000 526b 000f 0000 0000 a9a2 2e09 0002070 56ee 2e08 6c20 000e 0000 0000 0000 0000 0002080 0000 0000 0000 0000 0000 0004 0002 0000 0002090 0000 0000 0001 0000 0000 0000 0000 0000 00020a0 0000 0000 0000 0000 0000 0000 0000 0000 |
Here is the same test when Asynchronous I/O was used. ie. the Oracle parameter filesystemio_options=asynch
When asynchronous I/O was used, there were lots of io_submit could be see happening as expected. The man page says the following about io_submit "io_submit - Submit asynchronous I/O blocks for processing"
Below is a snippet of the output from the strace file when asynchronous i/o was used to add a datafile to the tablespace.
[pid 14927] io_submit(47213877018624, 1, {{0x2af0d65f9430, 0, 1, 0, 14}}) = 1 [pid 14927] io_submit(47213877018624, 1, {{0x2af0d65f9688, 0, 1, 0, 14}}) = 1 [pid 14927] io_submit(47213877018624, 1, {{0x2af0d65f98e0, 0, 1, 0, 14}}) = 1 [pid 14927] io_submit(47213877018624, 1, {{0x2af0d65f9b38, 0, 1, 0, 14}}) = 1 [pid 14927] io_getevents(47213877018624, 4, 128, {{0x2af0d65f9430, 0x2af0d65f9430, 1040384, 0}, {0x2af0d65f9688, 0x2af0d65f9688, 1048576, 0}, {0x2af0d65f98e0, 0x2af0d65f98e0, 1048576, 0}, {0x2af0d65f9b38, 0x2af0d65f9b38, 1048576, 0}}, {0, 0}) = 4 [pid 14927] io_submit(47213877018624, 1, {{0x2af0d65f9430, 0, 1, 0, 14}}) = 1 [pid 14927] io_submit(47213877018624, 1, {{0x2af0d65f9688, 0, 1, 0, 14}}) = 1 [pid 14927] io_submit(47213877018624, 1, {{0x2af0d65f98e0, 0, 1, 0, 14}}) = 1 [pid 14927] io_submit(47213877018624, 1, {{0x2af0d65f9b38, 0, 1, 0, 14}}) = 1 |
No comments:
Post a Comment