20180226alter system archive log current-阿里云开发者社区

开发者社区> lfreeali> 正文

20180226alter system archive log current

简介: [20180226]alter system archive log current.txt --//当日志写满以后,切换日志归档大部分由归档进程ARCH负责将在线重做日志归档.
+关注继续查看

[20180226]alter system archive log current.txt

--//当日志写满以后,切换日志归档大部分由归档进程ARCH负责将在线重做日志归档.
--//如果手工执行alter system archive log current,alter system switch logfie切换日志时,两者存在不同.
--//通过测试说明问题:

1.环境:
SCOTT@book> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

SYS@book> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/app/oracle/archivelog/book/
Oldest online log sequence     707
Next log sequence to archive   709
Current log sequence           709

2.测试:

SCOTT@book> @ &r/spid
       SID    SERIAL# PROCESS                  SERVER    SPID       PID  P_SERIAL# C50
---------- ---------- ------------------------ --------- ------ ------- ---------- --------------------------------------------------
       274         11 10422                    DEDICATED 10423       21          6 alter system kill session '274,11' immediate;

--//进程=10423
--//产生一些日志.

SYS@book> @ &r/currredo
Current log sequence No Percent Full bytes used exclude header Left space logfile size
----------------------- ------------ ------------------------- ---------- ------------
                    709   4.89941406                   2568192   49860096     52428800

$ strace -f -p 10423 -o /tmp/sw.log
...

SCOTT@book> alter system archive log current ;
System altered.

$ strace -f -p 10423 -o /tmp/sw.log
Process 10423 attached - interrupt to quit
^CProcess 10423 detached

3.检查跟踪文件:
SCOTT@book> show parameter log_archive_dest_1
NAME               TYPE   VALUE
------------------ ------ -----------------------------------------------------------------------------------------------------------
log_archive_dest_1 string LOCATION=/u01/app/oracle/archivelog/book/ MANDATORY VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=book

$ ls -l /u01/app/oracle/archivelog/book/1_709_896605872.dbf
-rw-r----- 1 oracle oinstall 2594304 2018-02-26 09:43:10 /u01/app/oracle/archivelog/book/1_709_896605872.dbf

--//检查跟踪文件.
10423 lstat("/u01", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
10423 lstat("/u01/app", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
10423 lstat("/u01/app/oracle", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
10423 lstat("/u01/app/oracle/archivelog", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
10423 lstat("/u01/app/oracle/archivelog/book", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
10423 lstat("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", 0x7fff0ed99e40) = -1 ENOENT (No such file or directory)
10423 lstat("/u01", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
10423 lstat("/u01/app", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
10423 lstat("/u01/app/oracle", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
10423 lstat("/u01/app/oracle/archivelog", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
10423 lstat("/u01/app/oracle/archivelog/book", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
10423 stat("/u01/app/oracle/archivelog/book", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
10423 open("/u01/app/oracle/archivelog/book", O_RDONLY) = 11
10423 fstatfs(11, {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=398913534, f_bfree=79430009, f_bavail=58839499, f_files=411828224, f_ffree=411767731, f_fsid={2019274029, -1076953238}, f_namelen=255, f_frsize=4096}) = 0
10423 stat("/u01/app/oracle/archivelog", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
10423 close(11)                         = 0
10423 open("/etc/mtab", O_RDONLY)       = 11
10423 fstat(11, {st_mode=S_IFREG|0644, st_size=392, ...}) = 0
10423 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f611b15c000
10423 read(11, "/dev/cciss/c0d0p2 / ext3 rw 0 0\n"..., 4096) = 392
10423 read(11, "", 4096)                = 0
10423 close(11)                         = 0
10423 munmap(0x7f611b15c000, 4096)      = 0
10423 open("/etc/mtab", O_RDONLY)       = 11
10423 fstat(11, {st_mode=S_IFREG|0644, st_size=392, ...}) = 0
10423 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f611b15c000
10423 read(11, "/dev/cciss/c0d0p2 / ext3 rw 0 0\n"..., 4096) = 392
10423 read(11, "", 4096)                = 0
10423 close(11)                         = 0
10423 munmap(0x7f611b15c000, 4096)      = 0
10423 open("/etc/mtab", O_RDONLY)       = 11
10423 fstat(11, {st_mode=S_IFREG|0644, st_size=392, ...}) = 0
10423 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f611b15c000
10423 read(11, "/dev/cciss/c0d0p2 / ext3 rw 0 0\n"..., 4096) = 392
10423 read(11, "", 4096)                = 0
10423 close(11)                         = 0
10423 munmap(0x7f611b15c000, 4096)      = 0
10423 stat("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", 0x7fff0ed9aec8) = -1 ENOENT (No such file or directory)
10423 lstat("/u01", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
10423 lstat("/u01/app", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
10423 lstat("/u01/app/oracle", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
10423 lstat("/u01/app/oracle/archivelog", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
10423 lstat("/u01/app/oracle/archivelog/book", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
10423 lstat("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", 0x7fff0ed99d60) = -1 ENOENT (No such file or directory)
10423 lstat("/u01", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
10423 lstat("/u01/app", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
10423 lstat("/u01/app/oracle", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
10423 lstat("/u01/app/oracle/archivelog", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
10423 lstat("/u01/app/oracle/archivelog/book", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
10423 stat("/u01/app/oracle/archivelog/book", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
10423 open("/u01/app/oracle/archivelog/book", O_RDONLY) = 11
10423 fstatfs(11, {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=398913534, f_bfree=79430009, f_bavail=58839499, f_files=411828224, f_ffree=411767731, f_fsid={2019274029, -1076953238}, f_namelen=255, f_frsize=4096}) = 0
10423 stat("/u01/app/oracle/archivelog", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
10423 close(11)                         = 0
10423 open("/etc/mtab", O_RDONLY)       = 11
10423 fstat(11, {st_mode=S_IFREG|0644, st_size=392, ...}) = 0
10423 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f611b15c000
10423 read(11, "/dev/cciss/c0d0p2 / ext3 rw 0 0\n"..., 4096) = 392
10423 read(11, "", 4096)                = 0
10423 close(11)                         = 0
10423 munmap(0x7f611b15c000, 4096)      = 0
10423 open("/etc/mtab", O_RDONLY)       = 11
10423 fstat(11, {st_mode=S_IFREG|0644, st_size=392, ...}) = 0
10423 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f611b15c000
10423 read(11, "/dev/cciss/c0d0p2 / ext3 rw 0 0\n"..., 4096) = 392
10423 read(11, "", 4096)                = 0
10423 close(11)                         = 0
10423 munmap(0x7f611b15c000, 4096)      = 0
10423 open("/etc/mtab", O_RDONLY)       = 11
10423 fstat(11, {st_mode=S_IFREG|0644, st_size=392, ...}) = 0
10423 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f611b15c000
10423 read(11, "/dev/cciss/c0d0p2 / ext3 rw 0 0\n"..., 4096) = 392
10423 read(11, "", 4096)                = 0
10423 close(11)                         = 0
10423 munmap(0x7f611b15c000, 4096)      = 0
10423 stat("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", 0x7fff0ed9afa8) = -1 ENOENT (No such file or directory)
10423 stat("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", 0x7fff0ed9b0c0) = -1 ENOENT (No such file or directory)
10423 open("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", O_RDWR|O_CREAT|O_EXCL|O_SYNC, 0660) = 11
10423 fstat(11, {st_mode=S_IFREG|0640, st_size=0, ...}) = 0
10423 fstatfs(11, {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=398913534, f_bfree=79430009, f_bavail=58839499, f_files=411828224, f_ffree=411767730, f_fsid={2019274029, -1076953238}, f_namelen=255, f_frsize=4096}) = 0
10423 lseek(11, 0, SEEK_SET)            = 0
10423 write(11, "\0\"\0\0\0\0\300\377\0\0\0\0\0\0\0\0\254K\0\0\0\2\0\0\312\23\0\0}|{z"..., 512) = 512
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10423 fstatfs(11, {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=398913534, f_bfree=79430008, f_bavail=58839498, f_files=411828224, f_ffree=411767730, f_fsid={2019274029, -1076953238}, f_namelen=255, f_frsize=4096}) = 0
10423 ftruncate(11, 2594304)            = 0
10423 close(11)                         = 0
10423 stat("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", {st_mode=S_IFREG|0640, st_size=2594304, ...}) = 0
10423 stat("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", {st_mode=S_IFREG|0640, st_size=2594304, ...}) = 0
10423 open("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", O_RDONLY) = 11
10423 ioctl(11, BLKSSZGET, 0x7fff0ed92c98) = -1 ENOTTY (Inappropriate ioctl for device)
10423 close(11)                         = 0
10423 statfs("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=398913534, f_bfree=79430008, f_bavail=58839498, f_files=411828224, f_ffree=411767730, f_fsid={2019274029, -1076953238}, f_namelen=255, f_frsize=4096}) = 0
10423 open("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", O_RDONLY) = 11
10423 fstatfs(11, {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=398913534, f_bfree=79430008, f_bavail=58839498, f_files=411828224, f_ffree=411767730, f_fsid={2019274029, -1076953238}, f_namelen=255, f_frsize=4096}) = 0
10423 lseek(11, 0, SEEK_SET)            = 0
10423 read(11, "\0\"\0\0\0\0\300\377\0\0\0\0\0\0\0\0\254K\0\0\0\2\0\0\312\23\0\0}|{z"..., 512) = 512
10423 close(11)                         = 0
10423 statfs("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=398913534, f_bfree=79430008, f_bavail=58839498, f_files=411828224, f_ffree=411767730, f_fsid={2019274029, -1076953238}, f_namelen=255, f_frsize=4096}) = 0
10423 statfs("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=398913534, f_bfree=79430008, f_bavail=58839498, f_files=411828224, f_ffree=411767730, f_fsid={2019274029, -1076953238}, f_namelen=255, f_frsize=4096}) = 0
10423 open("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", O_RDWR) = 11
10423 getrlimit(RLIMIT_NOFILE, {rlim_cur=64*1024, rlim_max=64*1024}) = 0
10423 fcntl(11, F_DUPFD, 256)           = 263
10423 close(11)                         = 0
10423 fcntl(263, F_SETFD, FD_CLOEXEC)   = 0
10423 fstatfs(263, {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=398913534, f_bfree=79430008, f_bavail=58839498, f_files=411828224, f_ffree=411767730, f_fsid={2019274029, -1076953238}, f_namelen=255, f_frsize=4096}) = 0
10423 fcntl(263, F_GETFL)               = 0x8002 (flags O_RDWR|O_LARGEFILE)
10423 fcntl(263, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
10423 stat("/mnt/ramdisk/book/redo03.log", {st_mode=S_IFREG|0640, st_size=52429312, ...}) = 0
10423 stat("/mnt/ramdisk/book/redo03.log", {st_mode=S_IFREG|0640, st_size=52429312, ...}) = 0
10423 statfs("/mnt/ramdisk/book/redo03.log", {f_type=0x1021994, f_bsize=4096, f_blocks=2097152, f_bfree=1075079, f_bavail=1075079, f_files=16532649, f_ffree=16532631, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0
10423 open("/mnt/ramdisk/book/redo03.log", O_RDONLY) = 11
10423 lseek(11, 0, SEEK_SET)            = 0
10423 read(11, "\0\"\0\0\0\0\300\377\0\0\0\0\0\0\0\0g\310\0\0\0\2\0\0\0\220\1\0}|{z"..., 4096) = 4096
10423 close(11)                         = 0
10423 pread(262, "\1\"\0\0\1\0\0\0\305\2\0\0\0\200\"\213\0\0\0\0\0\4 \vn!\267OBOOK"..., 1048064, 512) = 1048064
10423 pwrite(263, "\1\"\0\0\1\0\0\0\305\2\0\0\0\200\3\213\0\0\0\0\0\4 \vn!\267OBOOK"..., 1048064, 512) = 1048064
10423 pread(262, "\1\"\0\0\0\10\0\0\305\2\0\0\0\200'\16           daaaa"..., 1048576, 1048576) = 1048576
10423 pwrite(263, "\1\"\0\0\0\10\0\0\305\2\0\0\0\200'\16           daaaa"..., 1048576, 1048576) = 1048576
10423 pread(262, "\1\"\0\0\0\20\0\0\305\2\0\0\0\200\16=                "..., 497152, 2097152) = 497152
10423 pread(262, "\1\"\0\0\313\23\0\0\277\2\0\0\330\200\217l\5\1$\0\3\0\377\377f\35\300\0\276\375]\27"..., 4096, 2594304) = 4096
10423 pwrite(263, "\1\"\0\0\0\20\0\0\305\2\0\0\0\200\16=                "..., 497152, 2097152) = 497152
10423 stat("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", {st_mode=S_IFREG|0640, st_size=2594304, ...}) = 0
10423 statfs("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=398913534, f_bfree=79429374, f_bavail=58838864, f_files=411828224, f_ffree=411767730, f_fsid={2019274029, -1076953238}, f_namelen=255, f_frsize=4096}) = 0
10423 open("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", O_RDWR) = 11
10423 lseek(11, 0, SEEK_SET)            = 0
10423 write(11, "\0\"\0\0\0\0\300\377\0\0\0\0\0\0\0\0\254K\0\0\0\2\0\0\312\23\0\0}|{z"..., 512) = 512
10423 ftruncate(11, 2594304)            = 0
10423 close(11)                         = 0
10423 fcntl(263, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0
10423 fcntl(263, F_GETFL)               = 0x8002 (flags O_RDWR|O_LARGEFILE)
10423 fcntl(263, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
10423 stat("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", {st_mode=S_IFREG|0640, st_size=2594304, ...}) = 0
10423 statfs("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=398913534, f_bfree=79429374, f_bavail=58838864, f_files=411828224, f_ffree=411767730, f_fsid={2019274029, -1076953238}, f_namelen=255, f_frsize=4096}) = 0
10423 open("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", O_RDWR) = 11
10423 lseek(11, 0, SEEK_SET)            = 0
10423 write(11, "\0\"\0\0\0\0\300\377\0\0\0\0\0\0\0\0\254K\0\0\0\2\0\0\312\23\0\0}|{z"..., 512) = 512
10423 ftruncate(11, 2594304)            = 0
10423 close(11)                         = 0
10423 fcntl(263, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0
10423 fcntl(263, F_GETFL)               = 0x8002 (flags O_RDWR|O_LARGEFILE)
10423 fcntl(263, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
10423 fcntl(263, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0
10423 fsync(263)                        = 0
10423 close(263)                        = 0
10423 close(262)                        = 0
10423 pread(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4 \275\0\0\0\0\0\0\0\4 \vn!\267O"..., 16384, 16384) = 16384
10423 pread(257, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4 \275\0\0\0\0\0\0\0\4 \vn!\267O"..., 16384, 16384) = 16384
10423 pread(256, "\25\302\0\0\20\0\0\0007\216\0\0\377\377\1\4\273\n\0\0\200\2\0\0\0\0\0\0\0\0\0D"..., 16384, 262144) = 16384
10423 pread(256, "\25\302\0\0\22\0\0\0007\216\0\0\377\377\1\4\3&\0\0\0\0\0\0\0\0\0\0\256\36q5"..., 16384, 294912) = 16384
10423 times({tms_utime=18, tms_stime=7, tms_cutime=0, tms_cstime=0}) = 7418497018
10423 pread(256, "\25\302\0\0\26\0\0\0007\216\0\0\377\377\1\4\335C\0\0\0\220\1\0\306\2\0\0\1\0\0\0"..., 16384, 360448) = 16384
10423 pread(256, "\25\302\0\0T\2\0\0\326\213\0\0\377\377\1\4\215\247\0\0+\1\0\0T\0\0\0\177Q\3157"..., 16384, 9764864) = 16384
10423 pread(256, "\25\302\0\0Z\2\0\0004\216\0\0\377\377\1\4\361\323\0\0)\363\3009\n\5\1\0\273\2\0\0"..., 16384, 9863168) = 16384
10423 pread(256, "\25\302\0\0\31\1\0\0000\216\0\0\377\377\1\4\356z\0\0\32\1\2\0\342\7\0\0\0\0\0\0"..., 16384, 4603904) = 16384
10423 pread(256, "\25\302\0\0T\2\0\0\326\213\0\0\377\377\1\4\215\247\0\0+\1\0\0T\0\0\0\177Q\3157"..., 16384, 9764864) = 16384
10423 pread(256, "\25\302\0\0Z\2\0\0004\216\0\0\377\377\1\4\361\323\0\0)\363\3009\n\5\1\0\273\2\0\0"..., 16384, 9863168) = 16384
10423 pread(256, "\25\302\0\0004\1\0\0.\216\0\0\377\377\1\4Hl\0\0\0@;\1\0\0\0\0\0\0\227\0"..., 16384, 5046272) = 16384
10423 pread(256, "\25\302\0\0T\2\0\0\326\213\0\0\377\377\1\4\215\247\0\0+\1\0\0T\0\0\0\177Q\3157"..., 16384, 9764864) = 16384
10423 pread(256, "\25\302\0\0Z\2\0\0004\216\0\0\377\377\1\4\361\323\0\0)\363\3009\n\5\1\0\273\2\0\0"..., 16384, 9863168) = 16384
10423 lstat("/u01/app/oracle/diag/rdbms/book/book/alert/log.xml", {st_mode=S_IFREG|0640, st_size=10065509, ...}) = 0
10423 stat("/u01/app/oracle/diag/rdbms/book/book/alert/log.xml", {st_mode=S_IFREG|0640, st_size=10065509, ...}) = 0
10423 lstat("/u01/app/oracle/diag/rdbms/book/book/alert/log.xml", {st_mode=S_IFREG|0640, st_size=10065509, ...}) = 0
10423 open("/u01/app/oracle/diag/rdbms/book/book/alert/log.xml", O_WRONLY|O_CREAT|O_APPEND, 0660) = 11
10423 fcntl(11, F_SETFD, FD_CLOEXEC)    = 0
10423 write(11, "<msg time='2018-02-26T09:43:10.2"..., 292) = 292
10423 close(11)                         = 0
10423 stat("/u01/app/oracle/diag/rdbms/book/book/alert/log.xml", {st_mode=S_IFREG|0640, st_size=10065801, ...}) = 0
10423 times({tms_utime=18, tms_stime=7, tms_cutime=0, tms_cstime=0}) = 7418497018
10423 lstat("/u01/app/oracle/diag/rdbms/book/book/trace/alert_book.log", {st_mode=S_IFREG|0640, st_size=2242370, ...}) = 0
10423 open("/u01/app/oracle/diag/rdbms/book/book/trace/alert_book.log", O_WRONLY|O_CREAT|O_APPEND, 0660) = 11
10423 fcntl(11, F_SETFD, FD_CLOEXEC)    = 0
10423 write(11, "Archived Log entry 1259 added fo"..., 77) = 77
10423 write(11, "\n", 1)                = 1
10423 close(11)                         = 0
10423 times({tms_utime=18, tms_stime=7, tms_cutime=0, tms_cstime=0}) = 7418497018
10423 pread(256, "\25\302\0\0\26\0\0\0007\216\0\0\377\377\1\4\335C\0\0\0\220\1\0\306\2\0\0\1\0\0\0"..., 16384, 360448) = 16384
10423 pwrite(256, "\25\302\0\0Y\2\0\0008\216\0\0\377\377\1\4\0J\0\0)\363\3009\n\5\1\0\273\2\0\0"..., 16384, 9846784) = 16384
10423 pwrite(257, "\25\302\0\0Y\2\0\0008\216\0\0\377\377\1\4\0J\0\0)\363\3009\n\5\1\0\273\2\0\0"..., 16384, 9846784) = 16384
10423 pwrite(256, "\25\302\0\0\25\0\0\0008\216\0\0\377\377\1\4\335C\0\0\0\220\1\0\306\2\0\0\1\0\0\0"..., 16384, 344064) = 16384
10423 pwrite(257, "\25\302\0\0\25\0\0\0008\216\0\0\377\377\1\4\335C\0\0\0\220\1\0\306\2\0\0\1\0\0\0"..., 16384, 344064) = 16384
10423 pwrite(256, "\25\302\0\0\21\0\0\0008\216\0\0\377\377\1\4\2&\0\0\0\0\0\0\0\0\0\0\256\36q5"..., 16384, 278528) = 16384
10423 pwrite(257, "\25\302\0\0\21\0\0\0008\216\0\0\377\377\1\4\2&\0\0\0\0\0\0\0\0\0\0\256\36q5"..., 16384, 278528) = 16384
10423 pwrite(256, "\25\302\0\0\17\0\0\0008\216\0\0\377\377\1\4$\0\0\0\0\0\0\0\0\0\0\0\0\0\0D"..., 16384, 245760) = 16384
10423 pwrite(257, "\25\302\0\0\17\0\0\0008\216\0\0\377\377\1\4$\0\0\0\0\0\0\0\0\0\0\0\0\0\0D"..., 16384, 245760) = 16384
10423 pwrite(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4 \275\0\0\0\0\0\0\0\4 \vn!\267O"..., 16384, 16384) = 16384
10423 pwrite(257, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4 \275\0\0\0\0\0\0\0\4 \vn!\267O"..., 16384, 16384) = 16384
10423 times({tms_utime=18, tms_stime=7, tms_cutime=0, tms_cstime=0}) = 7418497018
10423 uname({sys="Linux", node="gxqyydg4", ...}) = 0
10423 times({tms_utime=18, tms_stime=7, tms_cutime=0, tms_cstime=0}) = 7418497018
10423 times({tms_utime=18, tms_stime=7, tms_cutime=0, tms_cstime=0}) = 7418497018
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 times({tms_utime=18, tms_stime=7, tms_cutime=0, tms_cstime=0}) = 7418497019
10423 times({tms_utime=18, tms_stime=7, tms_cutime=0, tms_cstime=0}) = 7418497019
10423 times({tms_utime=18, tms_stime=7, tms_cutime=0, tms_cstime=0}) = 7418497019
10423 times({tms_utime=18, tms_stime=7, tms_cutime=0, tms_cstime=0}) = 7418497019
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 times({tms_utime=18, tms_stime=7, tms_cutime=0, tms_cstime=0}) = 7418497019
10423 semctl(222625793, 17, SETVAL, 0x1) = 0
10423 times({tms_utime=18, tms_stime=7, tms_cutime=0, tms_cstime=0}) = 7418497019
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 182972}, ru_stime={0, 73988}, ...}) = 0
10423 times({tms_utime=18, tms_stime=7, tms_cutime=0, tms_cstime=0}) = 7418497019
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 183972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 183972}, ru_stime={0, 73988}, ...}) = 0
10423 getrusage(RUSAGE_SELF, {ru_utime={0, 183972}, ru_stime={0, 73988}, ...}) = 0
10423 times({tms_utime=18, tms_stime=7, tms_cutime=0, tms_cstime=0}) = 7418497019
10423 write(10, "\0\265\0\0\6\0\0\0\0\0\10\6\0\3255^\27\3\0\0\0\2\0\0\0\0\0\0\0\0\0\0"..., 181) = 181
10423 read(7,  <unfinished ...>

$ grep 'pwrite(263' /tmp/sw.log
10423 pwrite(263, "\1\"\0\0\1\0\0\0\305\2\0\0\0\200\3\213\0\0\0\0\0\4 \vn!\267OBOOK"..., 1048064, 512) = 1048064
10423 pwrite(263, "\1\"\0\0\0\10\0\0\305\2\0\0\0\200'\16           daaaa"..., 1048576, 1048576) = 1048576
10423 pwrite(263, "\1\"\0\0\0\20\0\0\305\2\0\0\0\200\16=                "..., 497152, 2097152) = 497152

$ ls -l /u01/app/oracle/archivelog/book/1_709_896605872.dbf
-rw-r----- 1 oracle oinstall 2594304 2018-02-26 09:43:10 /u01/app/oracle/archivelog/book/1_709_896605872.dbf
--//生成文件大小2594304.

$ man pwrite
PREAD(2)                   Linux Programmer's Manual                  PREAD(2)
NAME
       pread, pwrite - read from or write to a file descriptor at a given offset
SYNOPSIS
       #define _XOPEN_SOURCE 500
       #include <unistd.h>
       ssize_t pread(int fd, void *buf, size_t count, off_t offset);
       ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);

--//1048064+1048576+497152 = 2593792
--//2593792-2594304 = -512
--//前面的512字节,os头写入是看前面的命令,开始写入的.

10423 stat("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", 0x7fff0ed9afa8) = -1 ENOENT (No such file or directory)
10423 stat("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", 0x7fff0ed9b0c0) = -1 ENOENT (No such file or directory)
10423 open("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", O_RDWR|O_CREAT|O_EXCL|O_SYNC, 0660) = 11
10423 fstat(11, {st_mode=S_IFREG|0640, st_size=0, ...}) = 0
10423 fstatfs(11, {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=398913534, f_bfree=79430009, f_bavail=58839499, f_files=411828224, f_ffree=411767730, f_fsid={2019274029, -1076953238}, f_namelen=255, f_frsize=4096}) = 0
10423 lseek(11, 0, SEEK_SET)            = 0
10423 write(11, "\0\"\0\0\0\0\300\377\0\0\0\0\0\0\0\0\254K\0\0\0\2\0\0\312\23\0\0}|{z"..., 512) = 512
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10423 fstatfs(11, {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=398913534, f_bfree=79430008, f_bavail=58839498, f_files=411828224, f_ffree=411767730, f_fsid={2019274029, -1076953238}, f_namelen=255, f_frsize=4096}) = 0
10423 ftruncate(11, 2594304)            = 0
10423 close(11)                         = 0

....

10423 stat("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", {st_mode=S_IFREG|0640, st_size=2594304, ...}) = 0
10423 statfs("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=398913534, f_bfree=79429374, f_bavail=58838864, f_files=411828224, f_ffree=411767730, f_fsid={2019274029, -1076953238}, f_namelen=255, f_frsize=4096}) = 0
10423 open("/u01/app/oracle/archivelog/book/1_709_896605872.dbf", O_RDWR) = 11
10423 lseek(11, 0, SEEK_SET)            = 0
10423 write(11, "\0\"\0\0\0\0\300\377\0\0\0\0\0\0\0\0\254K\0\0\0\2\0\0\312\23\0\0}|{z"..., 512) = 512
10423 ftruncate(11, 2594304)            = 0
10423 close(11)                         = 0

--//最后完成后在写入一次.
--//你可以发现3次调用ftruncate(11, 2594304)            = 0

$ xxd -c 16  /u01/app/oracle/archivelog/book/1_709_896605872.dbf | head -2
0000000: 0022 0000 0000 c0ff 0000 0000 0000 0000  ."....?........
0000010: ac4b 0000 0002 0000 ca13 0000 7d7c 7b7a  .K......?..}|{z

--//strace 使用8进制,对比可以发现是一致的.
--//0300(八进制) = 3*8*8= 192 = 0xc0
--//0254 = 2*64+8*5+4 = 172 = 0xac.

3.如果执行alter system switch logfile ;
SCOTT@book> alter system switch logfile ;
System altered.

SCOTT@book> alter system switch logfile ;
System altered.

SCOTT@book> select dest_id,name,sequence#,creator from V$ARCHIVED_LOG where sequence#>=709 and dest_id=1;
   DEST_ID NAME                                                  SEQUENCE# CREATOR
---------- ---------------------------------------------------- ---------- -------
         1 /u01/app/oracle/archivelog/book/1_709_896605872.dbf         709 FGRD
         1 /u01/app/oracle/archivelog/book/1_710_896605872.dbf         710 ARCH
         1 /u01/app/oracle/archivelog/book/1_711_896605872.dbf         711 ARCH

--//参考我以前写的http://blog.itpub.net/267265/viewspace-1711428/ => [20150625]v$archived_log字段creator.txt

REATOR     VARCHAR2(7)     Creator of the archivelog:
ARCH - Archiver process
FGRD - Foreground process
RMAN - Recovery Manager
SRMN - RMAN at standby
LGWR - Logwriter process

--//也做一次跟踪看看:
$ strace -f -p 10423 -o /tmp/sw1.log

SCOTT@book> alter system switch logfile ;
System altered.

$ strace -f -p 10423 -o /tmp/sw1.log
Process 10423 attached - interrupt to quit
^CProcess 10423 detached

$ egrep -e 'read|write' /tmp/sw1.log
10423 read(7, "\0015\0\0\6\0\0\0\0\0\21iH\376\377\377\377\377\377\377\377\1\0\0\0\0\0\0\0\2\0\0"..., 8208) = 309
10423 write(10, "\0\265\0\0\6\0\0\0\0\0\10\6\0\317A^\27\3\0\0\0\7\0\0\0\0\0\0\0\0\0\0"..., 181) = 181
10423 read(7,  <unfinished ...>
--//前台进程看不到读写.

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
使用NAT网关轻松为单台云服务器设置多个公网IP
在应用中,有时会遇到用户询问如何使单台云服务器具备多个公网IP的问题。 具体如何操作呢,有了NAT网关这个也不是难题。
26791 0
阿里云服务器怎么设置密码?怎么停机?怎么重启服务器?
如果在创建实例时没有设置密码,或者密码丢失,您可以在控制台上重新设置实例的登录密码。本文仅描述如何在 ECS 管理控制台上修改实例登录密码。
10083 0
windows server 2008阿里云ECS服务器安全设置
最近我们Sinesafe安全公司在为客户使用阿里云ecs服务器做安全的过程中,发现服务器基础安全性都没有做。为了为站长们提供更加有效的安全基础解决方案,我们Sinesafe将对阿里云服务器win2008 系统进行基础安全部署实战过程! 比较重要的几部分 1.
9161 0
阿里云服务器如何登录?阿里云服务器的三种登录方法
购买阿里云ECS云服务器后如何登录?场景不同,阿里云优惠总结大概有三种登录方式: 登录到ECS云服务器控制台 在ECS云服务器控制台用户可以更改密码、更换系.
13888 0
腾讯云服务器 设置ngxin + fastdfs +tomcat 开机自启动
在tomcat中新建一个可以启动的 .sh 脚本文件 /usr/local/tomcat7/bin/ export JAVA_HOME=/usr/local/java/jdk7 export PATH=$JAVA_HOME/bin/:$PATH export CLASSPATH=.
4659 0
阿里云服务器ECS登录用户名是什么?系统不同默认账号也不同
阿里云服务器Windows系统默认用户名administrator,Linux镜像服务器用户名root
4504 0
阿里云ECS云服务器初始化设置教程方法
阿里云ECS云服务器初始化是指将云服务器系统恢复到最初状态的过程,阿里云的服务器初始化是通过更换系统盘来实现的,是免费的,阿里云百科网分享服务器初始化教程: 服务器初始化教程方法 本文的服务器初始化是指将ECS云服务器系统恢复到最初状态,服务器中的数据也会被清空,所以初始化之前一定要先备份好。
7365 0
+关注
lfreeali
熟悉oracle数据库性能优化,rman备份,数据库恢复技术.
2122
文章
0
问答
文章排行榜
最热
最新
相关电子书
更多
《2021云上架构与运维峰会演讲合集》
立即下载
《零基础CSS入门教程》
立即下载
《零基础HTML入门教程》
立即下载