Oracle Hot Backup user management backup block tear

Source: Internet
Author: User

Oracle hot backup-basic user management backup knowledge and explanation: http://blog.csdn.net/wanghui5767260/article/details/20627639

User Management backup: refers to the hot backup mode of the tablespace by placing it in the hot backup mode, and then copying it using the operating system tool.

1. Separate storage of tablespaces

2. Freeze other parts of the file header. At this time, only the file header is a good part.

3. Changed log Behavior

Tutorial steps:1. create a big table with a serial number as the test table tyger 2. the tablespace hot standby mode is not enabled. ① check the current log generation. ② update the 3rd rows of data in the test table, view the log generation amount ③ update the log generated by 3rd rows of Data New log generation-old log generation 3. enable the tablespace hot standby mode ① update 3rd rows of data at a time, and view the log generated amount ② compare with the logs generated by the hot standby mode update operation, you will find that a large number of logs are generated ③ update 10,000th rows of data, check the log generation quantity. 4. Compare and find that the update operation also generates a large number of logs. 5. Update 10,001st rows of data. 6. Check the log generation. 6. Check that this update operation produces a small number of logs. 1. create a big table tyger with serial numbers, so that the adjacent rows will be in the same block, and the serial numbers will not be in the same block if they are far apart.
SYS @ ORCL> create table tyger tablespace users as select rownum rn, o .*
2 from dba_objects o;


Table created.

2. view the current log generation (the tablespace hot standby mode is not enabled)
SYS @ ORCL> select ms. statistic #, name, value
2 from v $ mystat MS, v $ statname sn
3 where ms. statistic # = sn. statistic # and name = 'redo size ';


STATISTIC # NAME VALUE
----------------------------------------------------------------------
134 redo size 12245956


3. Change the data of 3rd rows in the table tyger
SYS @ ORCL> update tyger set object_id = 99999 where rn = 3;


1 row updated.


SYS @ ORCL> commit;


Commit complete.


4. view the log generation after updating 3rd rows of data
SYS @ ORCL> select ms. statistic #, name, value
2 from v $ mystat MS, v $ statname sn
3 where ms. statistic # = sn. statistic # and name = 'redo size ';


STATISTIC # NAME VALUE
----------------------------------------------------------------------
134 redo size 12246604


5. Calculate the log volume generated when 3rd rows are updated.
SYS @ ORCL> select 12246604-12245956 from dual;


12246604-12245956
-----------------
648 // hot standby mode not enabled


6. Enable the hot standby mode of users tablespace
SYS @ ORCL> alter tablespace users begin backup;


Tablespace altered.


7. Continue to update the ID of row 3rd

SYS @ ORCL> update tyger set object_id = 88888 where rn = 3;


1 row updated.


SYS @ ORCL> commit;


Commit complete.


8. view the current log generation.
SYS @ ORCL> select ms. statistic #, name, value
2 from v $ mystat MS, v $ statname sn
3 where ms. statistic # = sn. statistic # and name = 'redo size ';


STATISTIC # NAME VALUE
----------------------------------------------------------------------
134 redo size 12256856


9. Calculate the number of logs generated when 3rd rows of data are updated after the hot standby mode is enabled (significantly higher than the number of logs in the hot standby mode is 10252> 648)
SYS @ ORCL> select 12256856-12246604 from dual;


12256856-12246604
-----------------
10252 // a large number of logs are generated after the hot standby mode is enabled


10. Update the ID of row 10,000th to view the updated log volume.
SYS @ ORCL> update tyger set object_id = 77777 where rn = 10000;


1 row updated.


SYS @ ORCL> commit;


Commit complete.


SYS @ ORCL> select ms. statistic #, name, value
2 from v $ mystat MS, v $ statname sn
3 where ms. statistic # = sn. statistic # and name = 'redo size ';


STATISTIC # NAME VALUE
----------------------------------------------------------------------
134 redo size 12265660


11. Calculate the log generation after updating 10,000th rows
SYS @ ORCL> select 12265660-12256856 from dual;


12265660-12256856
-----------------
8804 // 10,000th rows updated for the first time to generate a large volume of logs


12. Continue to update 10,001st rows of data to view log generation
SYS @ ORCL> update tyger set object_id = 98765 where rn = 10001;


1 row updated.


SYS @ ORCL> select ms. statistic #, name, value
2 from v $ mystat MS, v $ statname sn
3 where ms. statistic # = sn. statistic # and name = 'redo size ';


STATISTIC # NAME VALUE
----------------------------------------------------------------------
134 redo size 12266140

13. At this time, it is found that the number of data logs that continue to update 10,000th rows is small after 10,001st rows are updated.
SYS @ ORCL> select 12266140-12265660 from dual;


12266140-12265660
-----------------
480 // update 10,001st rows again to generate a small log volume


Conclusion:When a user backs up a data file in backup mode, the SCN number in the header of the data file to be backed up is frozen, but other data blocks are still good. You can continue to write data, when 10000 rows of data are updated, the header of the data block is frozen, so a large number of logs are generated. However, when 10001 rows of data are updated, the header of the data file is frozen, therefore, the number of logs generated is very small. Therefore, the log behavior is changed through hot backup-the user manages the backup mode.

As shown in the figure, for a data block that is undergoing hot backup-the user manages the backup, the SCN Number of the data block header has been frozen. When the backup process suddenly crashes, the block status: the block header is frozen, half of the data block is backed up, and the other half is not backed up. To re-enable the database, you need to re-perform hot backup on the block.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.