425alter database force logging修改那裡

lfree發表於2014-04-25

[20140425]alter database force logging修改那裡.txt

連結:http://blog.itpub.net/267265/viewspace-1145697/
昨天有別人問,如果在主庫執行alter database force logging,備用庫不會也修改嗎?實際上這個要看執行這條命令修改那裡的資訊.

SYS@test> @ver
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

SYS@test> @spid

SPID
------
18319

SYS@test> alter database no force logging;
Database altered.

$ strace -p 18319 -o /tmp/xx1

SYS@test> alter database  force logging;
Database altered.


--看看/tmp/xx1記錄了什麼資訊:

$ grep -i write  /tmp/xx1
write(10, "write(10, "Fri Apr 25 10:20:04 2014\n", 25) = 25
write(10, "alter database  force logging", 29) = 29
write(10, "\n", 1)                      = 1
write(10, "write(10, "ALTER DATABASE FORCE LOGGING com"..., 111) = 111
write(10, "\n", 1)                      = 1
pwrite(256, "\25\302\0\0\21\0\0\0\375Og2\377\377\1\4\235H\0\0\0\0\0"..., 16384, 278528) = 16384
pwrite(257, "\25\302\0\0\21\0\0\0\375Og2\377\377\1\4\235H\0\0\0\0\0"..., 16384, 278528) = 16384
pwrite(256, "\25\302\0\0\17\0\0\0\375Og2\377\377\1\4D\1\0\0\0\4\0\0"..., 16384, 245760) = 16384
pwrite(257, "\25\302\0\0\17\0\0\0\375Og2\377\377\1\4D\1\0\0\0\4\0\0"..., 16384, 245760) = 16384
pwrite(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4ST\0\0\0\0\0\0\0\0 "..., 16384, 16384) = 16384
pwrite(257, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4ST\0\0\0\0\0\0\0\0 "..., 16384, 16384) = 16384
write(10, "write(10, "Completed: alter database  force"..., 40) = 40
write(10, "\n", 1)                      = 1
write(12, "\0\265\0\0\6\0\0\0\0\0\10\6\0\303\226\346\302\0\0\0\0\3"..., 181) = 181


$ cd /proc/18319/fd
$ ll
total 13
lr-x------  1 oracle11g oinstall 64 2014-04-25 10:22:38 0 -> /dev/null
l-wx------  1 oracle11g oinstall 64 2014-04-25 10:22:38 1 -> /dev/null
l-wx------  1 oracle11g oinstall 64 2014-04-25 10:22:38 12 -> pipe:[137955042]
l-wx------  1 oracle11g oinstall 64 2014-04-25 10:22:38 2 -> /dev/null
lrwx------  1 oracle11g oinstall 64 2014-04-25 10:22:38 256 -> /u01/app/oracle11g/oradata/test/control01.ctl
lrwx------  1 oracle11g oinstall 64 2014-04-25 10:22:38 257 -> /u01/app/oracle11g/oradata/test/control02.ctl
lr-x------  1 oracle11g oinstall 64 2014-04-25 10:22:38 3 -> /dev/null
lr-x------  1 oracle11g oinstall 64 2014-04-25 10:22:38 4 -> /dev/null
lr-x------  1 oracle11g oinstall 64 2014-04-25 10:22:38 5 -> /u01/app/oracle11g/product/11.2.0/db_2/rdbms/mesg/oraus.msb
lr-x------  1 oracle11g oinstall 64 2014-04-25 10:22:38 6 -> /proc/18319/fd
lr-x------  1 oracle11g oinstall 64 2014-04-25 10:22:38 7 -> /dev/zero
lrwx------  1 oracle11g oinstall 64 2014-04-25 10:22:38 8 -> socket:[137955061]
lr-x------  1 oracle11g oinstall 64 2014-04-25 10:22:38 9 -> pipe:[137955041]

--從上面的資訊看修改的檔案控制程式碼是10,256,257,12.
--很明顯寫入的資訊在控制檔案.這些資訊不會透過日誌傳輸到備用機器.所以備用庫不會跟著變化.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-1149160/,如需轉載,請註明出處,否則將追究法律責任。

相關文章