Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to switch oracle switch logfile logs and what alter system checkpoint does

2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article shows you how to switch oracle switch logfile logs and what alter system checkpoint does, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

What happened to log switching or checkpoint?

1. The log file that has just become active (that is, redo from last_change# to next_change#) is written to the data file by dbwr

2MagneCckpt updates the start scn of all data file headers, that is, v$datafile_header.checkpoint_change# is the log file that has just become active

First_change# of

3Jing ckpt also updates the checkpoint scn of the control file, that is, the v$database.checkpoint_change# is the first_change# of the active status log file.

/ * Test starts * /

/ * data file header scn*/ before the checkpoint occurs

SQL > select checkpoint_change# from v$datafile_header

CHECKPOINT_CHANGE#

-

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

CHECKPOINT_CHANGE#

-

10590730

21 rows selected

SQL > select * from v$log

GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARCHIVED STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME

--

3 1 817 52428800 512 1 NO INACTIVE 10453013 2013-3-24 1 10454569 2013-3-24 1

4 1 818 209715200 512 1 NO INACTIVE 10454569 2013-3-24 1 10492795 2013-3-24 1

51 819 209715200 512 1 NO INACTIVE 10492795 2013-3-24 1 10560992 2013-3-25 1

61 820 209715200 512 1 NO INACTIVE 10560992 2013-3-25 1 10561002 2013-3-25 1

71 821 209715200 512 1 NO INACTIVE 10561002 2013-3-25 1 10561202 2013-3-25 1

8 1 822 209715200 512 1 NO INACTIVE 10561202 2013-3-25 1 10588922 2013-3-25 1

9 1 816 209715200 512 1 NO INACTIVE 10446578 2013-3-24 1 10453013 2013-3-24 1

10 1 823 20971520 512 1 NO CURRENT 10588922 2013-3-25 1 281474976710

8 rows selected

SQL > select checkpoint_change# from v$database

CHECKPOINT_CHANGE#

-

10590730

SQL > select checkpoint_change# from v$datafile

CHECKPOINT_CHANGE#

-

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

CHECKPOINT_CHANGE#

-

10590730

21 rows selected

/ * each scn*/ after log switching

SQL > alter system switch logfile

System altered

SQL > select checkpoint_change# from v$datafile

CHECKPOINT_CHANGE#

-

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

CHECKPOINT_CHANGE#

-

10590730

21 rows selected

SQL > select checkpoint_change# from v$database

CHECKPOINT_CHANGE#

-

10590730

SQL > select * from v$log

GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARCHIVED STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME

--

3 1 817 52428800 512 1 NO INACTIVE 10453013 2013-3-24 1 10454569 2013-3-24 1

4 1 818 209715200 512 1 NO INACTIVE 10454569 2013-3-24 1 10492795 2013-3-24 1

51 819 209715200 512 1 NO INACTIVE 10492795 2013-3-24 1 10560992 2013-3-25 1

61 820 209715200 512 1 NO INACTIVE 10560992 2013-3-25 1 10561002 2013-3-25 1

71 821 209715200 512 1 NO INACTIVE 10561002 2013-3-25 1 10561202 2013-3-25 1

8 1 822 209715200 512 1 NO INACTIVE 10561202 2013-3-25 1 10588922 2013-3-25 1

91 824 209715200 512 1 NO CURRENT 10591778 2013-3-25 1 281474976710

10 1 823 20971520 512 1 NO ACTIVE 10588922 2013-3-25 1 10591778 2013-3-25 1

8 rows selected

SQL > select checkpoint_change# from v$datafile_header

CHECKPOINT_CHANGE#

-

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

CHECKPOINT_CHANGE#

-

10590730

21 rows selected

Summary: alter system checkpoint does not trigger a checkpoint scn that changes data files and data file headers

/ * Let's take a look at what the log switching is like * /

/ * before log switching * /

SQL > select checkpoint_change# from v$datafile_header

CHECKPOINT_CHANGE#

-

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

CHECKPOINT_CHANGE#

-

10590730

21 rows selected

SQL > select checkpoint_change# from v$datafile

CHECKPOINT_CHANGE#

-

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

10590730

CHECKPOINT_CHANGE#

-

10590730

21 rows selected

SQL > select checkpoint_change# from v$database

CHECKPOINT_CHANGE#

-

10590730

SQL > select * from v$log

GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARCHIVED STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME

--

3 1 817 52428800 512 1 NO INACTIVE 10453013 2013-3-24 1 10454569 2013-3-24 1

4 1 818 209715200 512 1 NO INACTIVE 10454569 2013-3-24 1 10492795 2013-3-24 1

51 819 209715200 512 1 NO INACTIVE 10492795 2013-3-24 1 10560992 2013-3-25 1

61 820 209715200 512 1 NO INACTIVE 10560992 2013-3-25 1 10561002 2013-3-25 1

71 821 209715200 512 1 NO INACTIVE 10561002 2013-3-25 1 10561202 2013-3-25 1

8 1 822 209715200 512 1 NO INACTIVE 10561202 2013-3-25 1 10588922 2013-3-25 1

91 824 209715200 512 1 NO CURRENT 10591778 2013-3-25 1 281474976710

10 1 823 20971520 512 1 NO ACTIVE 10588922 2013-3-25 1 10591778 2013-3-25 1

8 rows selected

SQL >

/ * after log switching * /

SQL > alter system switch logfile

System altered

SQL > select * from v$log

GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARCHIVED STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME

--

3 1 825 52428800 512 1 NO CURRENT 10592541 2013-3-25 1 281474976710

4 1 818 209715200 512 1 NO INACTIVE 10454569 2013-3-24 1 10492795 2013-3-24 1

51 819 209715200 512 1 NO INACTIVE 10492795 2013-3-24 1 10560992 2013-3-25 1

61 820 209715200 512 1 NO INACTIVE 10560992 2013-3-25 1 10561002 2013-3-25 1

71 821 209715200 512 1 NO INACTIVE 10561002 2013-3-25 1 10561202 2013-3-25 1

8 1 822 209715200 512 1 NO INACTIVE 10561202 2013-3-25 1 10588922 2013-3-25 1

91 824 209715200 512 1 NO ACTIVE 10591778 2013-3-25 1 10592541 2013-3-25 1

10 1 823 20971520 512 1 NO INACTIVE 10588922 2013-3-25 1 10591778 2013-3-25 1

8 rows selected

/ * referring to the log information above, the checkpoint scn of the control file and the scn of the data file and data file header have updated the first_change#/ of the active log

SQL > select checkpoint_change# from v$database

CHECKPOINT_CHANGE#

-

10591778

SQL > select checkpoint_change# from v$datafile

CHECKPOINT_CHANGE#

-

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

CHECKPOINT_CHANGE#

-

10591778

21 rows selected

SQL > select checkpoint_change# from v$datafile_header

CHECKPOINT_CHANGE#

-

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

10591778

CHECKPOINT_CHANGE#

-

10591778

21 rows selected

Have you learned any knowledge or skills about how to switch oracle switch logfile logs and what alter system checkpoint has done? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report