Home > database >  How to avoid the partial Oracle to write
How to avoid the partial Oracle to write

Time:10-03

I rookie, a recent study in MySQL (learn MySQL while compared to Oracle) encounter a problem
MySQL by double write to avoid the partial page. Write this partial page write feeling is equivalent to the Oracle of the split block. The Oracle to write how to ensure that dirty block won't produce the split block?

I know the rman can avoid the split block because it to oracle block size as the smallest unit of I/o, if found the checksum is not consistent, will be stressed, by avoiding the split repeatedly read block. When performing manual begin backup command, each time a block is changed the datbase writes the before - the image of the - block to the redo stream before modifying the block. Then, the database also records the changes to the block in the redo log, by writing redo the oracle block before the mirror, make in the whole recovery is the ability to access oracle block before - image, on this basis, through the redo records in recovery. So if you want to restore the split block, is to have the split mirror before the whole block.

But in normal DBWR write block, will not record befor - image to redo. Oracle how to solve this problem

CodePudding user response:

back. So if you want to restore the split block, is to have the split block before the entire image.

Do not understand the principle of MySQL, you said this, should be an Oracle UNDO, you first introduce baidu;

CodePudding user response:

Split block refers to an Oracle block is composed of multiple OS block, write must have successively, so external tools with OS backup block backup for the unit, it may be an Oracle block is inconsistent with the multiple OS version block under the situation,
The rman is to put this group OS block as a whole unit to deal with, all read in, can be written to the backup, if versions, if you don't agree all stressed,
So read dirty piece of it doesn't matter, as long as there are ways to detect inconsistencies, discarding the re-read the inconsistent data directly to the line,

CodePudding user response:

reference 1st floor wmxcn2000 response:
back. So if you want to restore the split block, is to have the split block before the entire image.

Do not understand the principle of MySQL, you said this, should be an Oracle UNDO, you first introduce baidu;

To undo ok

Citing a & lt; Book to double the write a description of the contents:
If the Insert Buffer to the InnoDB storage engine is to improve performance, then the doublewrite twice (write) to the InnoDB storage engine is the reliability of the data page,

When the database is down, it may be the InnoDB storage engine is written to a particular page to the table, and wrote a part of this page is only 16 KB page, for example, wrote the first 4 KB, only occurs after downtime, this kind of situation is called part write failure (partial page write), the InnoDB storage engine before using doublewrite technology, once seen as part of the writing failure and cause data loss,

Experienced dbas may think, in the event of failure, write can recover the redo log, it is a way, but must be clearly aware that the redo log is recorded in the page for the physical operation, such as offset 800, write "aaaa" records, if the page itself has been damaged, to redo again is meaningless, that is to say, before the application (apply) redo logs, the user needs a copy of the page, when written to failure occurs, the first through the pages of transcripts to restore the page, to redo again, this is the doublewrite,

CodePudding user response:

refer to the second floor Tiger_Zhao response:
split block refers to an Oracle block is composed of multiple OS block, write must have successively, so external tools with OS backup block backup for the unit, it may be an Oracle block is inconsistent with the multiple OS version block under the situation,
The rman is to put this group OS block as a whole unit to deal with, all read in, can be written to the backup, if versions, if you don't agree all stressed,
So read dirty piece of it doesn't matter, as long as there are ways to detect inconsistencies, the inconsistent data directly to the discarded rereading,


To my question is not a dirty read, it is Oracle block and OS is not the same as the block size. Oracle to write an Oracle block to disk, including 8 k, and an OS block may be 4 k, then may produce the two do not match the block 4 k, Oracle, how to ensure that won't produce this inconsistency?

CodePudding user response:

reference ashic reply: 3/f
Quote: refer to 1st floor wmxcn2000 response:

back. So if you want to restore the split block, is to have the split block before the entire image.

Do not understand the principle of MySQL, you said this, should be an Oracle UNDO, you first introduce baidu;

To undo ok

Citing a & lt; Book to double the write a description of the contents:
If the Insert Buffer to the InnoDB storage engine is to improve performance, then the doublewrite twice (write) to the InnoDB storage engine is the reliability of the data page,

When the database is down, it may be the InnoDB storage engine is written to a particular page to the table, and wrote a part of this page is only 16 KB page, for example, wrote the first 4 KB, only occurs after downtime, this kind of situation is called part write failure (partial page write), the InnoDB storage engine before using doublewrite technology, once seen as part of the writing failure and cause data loss,

Experienced dbas may think, in the event of failure, write can recover the redo log, it is a way, but must be clearly aware that the redo log is recorded in the page for the physical operation, such as offset 800, write "aaaa" records, if the page itself has been damaged, to redo again is meaningless, that is to say, before the application (apply) redo logs, the user needs a copy of the page, when written to failure occurs, the first through the pages of transcripts to restore the page, to redo again, this is the doublewrite,


Well,

CodePudding user response:

reference 1st floor wmxcn2000 response:
back. So if you want to restore the split block, is to have the split block before the entire image.

Do not understand the principle of MySQL, you said this, should be an Oracle UNDO, you first introduce baidu;

That you said, I also feel the need to split the block before the mirror, but normal DBWR write dirty block to disk.
Combined with oracle block size is 8 k, OS block size of 4 k, so at this time an oracle blokc=2 * OS block
Join the DBWR write dirty block, wrote the first 4 k, crash occurred at this time, such as power supply hang up and then the oracle block after the first 4 k and 4 k is inconsistent, for oracle block this inconsistency, through redo can't recover. So the oracle if not produce I assume that this kind of situation?

MySQL by double write to avoid this kind of question
Dirty pages in the buffer pool refresh, do not write disk directly, but through the memcpy function will dirty pages copied to the memory of the first doublewrite buffer, then through the doublewrite buffer and then divided into two times, each time 1 MB sequentially write Shared table space physical disk, and then call fsync function, it will change the real written goals to share data file

In a data write failure will have two kinds of circumstances,
- if you are writing doublewrite buffer itself fails, then the data will not be written to disk, which is the real page without damage, the innodb when will load the raw data from disk, and then through the innodb transaction log to calculate the correct data, to write to the doublewrite buffer

- if the doublewrite buffer to write successful, but to write a disk failure (by comparing the checksum), innodb need not through the transaction log to calculate, but directly with double the write data buffer to write it again.

CodePudding user response:

reference 4 floor ashic response:
to my question is not a dirty read, is an Oracle block and OS is not the same as the block size. Oracle to write an Oracle block to disk, including 8 k, and an OS block may be 4 k, then may produce the two do not match the block 4 k, Oracle, how to ensure that won't produce this inconsistency?

These two 4 k itself in Oracle cache, to fetch the data from the cache directly take, always consistent,
Only Oracle outside of the program, read from the hard disk to read 4 k of old, the possibility of 4 k new data,

CodePudding user response:

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related