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

In-depth understanding of the control files of oracle (1)

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Control file for Oracle

What we want to experiment here is whether the database will down if it breaks the fast control file in the state of open.

View the path of controlfiles

SQL > show parameter control_files

NAME TYPE VALUE

-

Control_files string / u01/app/oracle/oradata/orcl/control01.ctl, / u01/app/oracle/fast_recovery_area/orcl/control02.ctl

Damage control file

[oracle@togogo ~] $cat / dev/null > / u01/app/oracle/oradata/orcl/control01.ctl

[oracle@togogo ~] $cat / dev/null > / u01/app/oracle/fast_recovery_area/orcl/control02.ctl

Verify the status of the database

SQL > select * from dual

D

-

X

# do checkpoints and switch redo log

SQL > alter system checkpoint

System altered.

SQL > alter system switch logfile

System altered.

SQL > alter system switch logfile

System altered.

# check alert log

Sat Feb 10 20:09:55 2018

Thread 1 cannot allocate new log, sequence 8

Private strand flush not complete

Current log# 1 seq# 7 mem# 0: / u01/app/oracle/oradata/orcl/redo01.log

Thread 1 advanced to log sequence 8 (LGWR switch)

Current log# 2 seq# 8 mem# 0: / u01/app/oracle/oradata/orcl/redo02.log

Sat Feb 10 20:10:19 2018

Thread 1 cannot allocate new log, sequence 9

Private strand flush not complete

Current log# 2 seq# 8 mem# 0: / u01/app/oracle/oradata/orcl/redo02.log

Thread 1 advanced to log sequence 9 (LGWR switch)

Current log# 3 seq# 9 mem# 0: / u01/app/oracle/oradata/orcl/redo03.log

Thread 1 cannot allocate new log, sequence 10

Checkpoint not complete

Current log# 3 seq# 9 mem# 0: / u01/app/oracle/oradata/orcl/redo03.log

Thread 1 cannot allocate new log, sequence 10

Private strand flush not complete

Current log# 3 seq# 9 mem# 0: / u01/app/oracle/oradata/orcl/redo03.log

Thread 1 advanced to log sequence 10 (LGWR switch)

Current log# 1 seq# 10 mem# 0: / u01/app/oracle/oradata/orcl/redo01.log

Why is that? That's because its process holds a handle and releases it, as follows

[oracle@togogo ~] $ps-ef | grep ckpt | grep-v grep

Oracle 8427 1 0 19:47? 00:00:00 ora_ckpt_orcl

[oracle@togogo ~] $cd / proc/8427/fd

[oracle@togogo fd] $ls-ltr | grep control

Lrwx- 1 oracle oinstall 64 Feb 10 20:09 257-> / u01/app/oracle/fast_recovery_area/orcl/control02.ctl

Lrwx- 1 oracle oinstall 64 Feb 10 20:09 256-> / u01/app/oracle/oradata/orcl/control01.ctl

# session 1 trace tracking

Here's a command, strace.

Give me an example.

Strace-o output.txt-T-tt-e trace=all-p 28979

The meaning above is to track all system calls (- e trace=all) of the 28979 process, and count the time spent by the system calls, as well as the start time (and displayed in a visual time-minute-second format), and finally store the recording results in the output.txt file.

[oracle@togogo fd] $strace-fr-o / tmp/8427.log-p 8427

Process 8427 attached-interrupt to quit

# observe trace.log

8427 0.000156 gettimeofday ({1518265363, 443228}, NULL) = 0

8427 0.000176 gettimeofday ({1518265543, 106769}, NULL) = 0

8427 0.000077 gettimeofday ({1518265543, 106845}, NULL) = 0

8427 0.000072 gettimeofday ({1518265543, 106917}, NULL) = 0

8427 0.000077 pwrite64 (25625302\ 0\ 0\ 3) = 16384

8427 0.006462 gettimeofday ({1518265543, 113463}, NULL) = 0

8427 0.000089 gettimeofday ({1518265543, 113548}, NULL) = 0

8427 0.000080 pwrite64 (257, 16384, 49152) = 16384.

8427 0.000734 gettimeofday ({1518265543, 114364}, NULL) = 0

8427 0.000081 gettimeofday ({1518265543, 114443}, NULL) = 0

8427 0.000081 gettimeofday ({1518265543, 114525}, NULL) = 0

8427 0.000078 gettimeofday ({1518265543, 114603}, NULL) = 0

8427 0.000211 gettimeofday ({1518265543, 114816}, NULL) = 0

8427 0.000080 gettimeofday ({1518265543, 114891}, NULL) = 0

8427 0.000081 pread64 (25625302\ 0\ 0\ 1) = 16384

The 256257 represents the file descriptor FD file discription

16384 represents the size of a block.

49152 is the offset.

From the above, we can draw a conclusion.

1. Process information can be seen under / proc, for example: / proc/8427/stat

two。 For linux, the reading and writing of files is achieved by calling the function read,pwrite64.

3. We can find the mechanism that the checkpoint process ckpt 3s triggers once.

4. The operation of pwrite64 is accomplished by writing two files fd (256.257), where the corresponding offset is 49152, and we know that the block size of the three written files (we know it is controlfile) is 16384.

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

Database

Wechat

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

12
Report