RHEL4.5 for x86的ORACLE SGA擴充套件

byfree發表於2008-06-27

昨天按照biti大師的文章,在我的生產庫上降低了SGA的起點。原理我就不介紹了,這裡只記錄我的操作過程及結果。

調整前,先檢視資料庫的共享記憶體段資訊:
# ipcs
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status     
0x00000000 425984     gdm       600        393216     2          dest        
0xb66f38d0 360455     oracle    640        1679366236 19                     

------ Semaphore Arrays --------
key        semid      owner      perms      nsems    
0x0d33616c 98304      oracle    640        201      
0x0d33616d 131073     oracle    640        201      
0x0d33616e 163842     oracle    640        201      
0x0d33616f 196611     oracle    640        201      
0x0d336170 229380     oracle    640        201      

------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages   

SGA為1679366236

再檢視pmon或任意oracle程式的虛擬地址分配資訊:
# ps -ef|grep pmon|grep -v grep
oracle    5120     1  0 Jun26 ?        00:00:00 ora_pmon_orcl

# cat /proc/5120/maps
0017f000-00194000 r-xp 00000000 fd:00 14812134   /lib/ld-2.3.4.so
00194000-00195000 r--p 00015000 fd:00 14812134   /lib/ld-2.3.4.so
00195000-00196000 rw-p 00016000 fd:00 14812134   /lib/ld-2.3.4.so
002ef000-002f1000 r-xp 00000000 fd:00 14812137   /lib/libdl-2.3.4.so
002f1000-002f3000 rw-p 00001000 fd:00 14812137   /lib/libdl-2.3.4.so
00772000-00784000 r-xp 00000000 fd:00 14812146   /lib/libnsl-2.3.4.so
00784000-00786000 rw-p 00011000 fd:00 14812146   /lib/libnsl-2.3.4.so
00786000-00788000 rw-p 00786000 00:00 0
08048000-0a672000 r-xp 00000000 fd:00 1394588    /opt/oracle/product/9.2.0/bin/oracle
0a672000-0af58000 rw-p 02629000 fd:00 1394588    /opt/oracle/product/9.2.0/bin/oracle
0af58000-0afca000 rw-p 0af58000 00:00 0
50000000-b0200000 rw-s 00000000 00:06 196609     /SYSV51125e54 (deleted)
b7886000-b78a7000 rw-p b7886000 00:00 0
b78a7000-b78b0000 r-xp 00000000 fd:00 14811186   /lib/libnss_files-2.3.4.so
b78b0000-b78b2000 rw-p 00008000 fd:00 14811186   /lib/libnss_files-2.3.4.so
b78b2000-b7932000 rw-p 00000000 00:0d 2046       /dev/zero
b7932000-b7a58000 rw-p b7932000 00:00 0
b7a58000-b7b7c000 r-xp 00000000 fd:00 14811143   /lib/i686/libc-2.3.4.so
b7b7c000-b7b7d000 r--p 00123000 fd:00 14811143   /lib/i686/libc-2.3.4.so
b7b7d000-b7b80000 rw-p 00124000 fd:00 14811143   /lib/i686/libc-2.3.4.so
b7b80000-b7b82000 rw-p b7b80000 00:00 0
b7b82000-b7ba3000 r-xp 00000000 fd:00 14811145   /lib/i686/libm-2.3.4.so
b7ba3000-b7ba5000 rw-p 00020000 fd:00 14811145   /lib/i686/libm-2.3.4.so
b7ba5000-b7bb3000 r-xp 00000000 fd:00 14811147   /lib/i686/libpthread-0.10.so
b7bb3000-b7bb5000 rw-p 0000d000 fd:00 14811147   /lib/i686/libpthread-0.10.so
b7bb5000-b7bf8000 rw-p b7bb5000 00:00 0
b7bf8000-b7ee0000 r-xp 00000000 fd:00 1394375    /opt/oracle/product/9.2.0/lib/libjox9.so
b7ee0000-b7ff3000 rw-p 002e7000 fd:00 1394375    /opt/oracle/product/9.2.0/lib/libjox9.so
b7ff3000-b7ff5000 rw-p b7ff3000 00:00 0
b7ff5000-b7ff6000 r-xp 00000000 fd:00 1394489    /opt/oracle/product/9.2.0/lib/libskgxn9.so
b7ff6000-b7ff8000 rw-p 00000000 fd:00 1394489    /opt/oracle/product/9.2.0/lib/libskgxn9.so
b7ff8000-b7ff9000 r-xp 00000000 fd:00 1392915    /opt/oracle/product/9.2.0/lib/libskgxp9.so
b7ff9000-b7ffa000 ---p 00001000 fd:00 1392915    /opt/oracle/product/9.2.0/lib/libskgxp9.so
b7ffa000-b7ffb000 rw-p 00001000 fd:00 1392915    /opt/oracle/product/9.2.0/lib/libskgxp9.so
b7ffb000-b7ffc000 r-xp 00000000 fd:00 1394515    /opt/oracle/product/9.2.0/lib/libodmd9.so
b7ffc000-b7ffd000 rw-p 00000000 fd:00 1394515    /opt/oracle/product/9.2.0/lib/libodmd9.so
b7ffd000-b7ffe000 r-xp 00000000 fd:00 14811212   /lib/libcwait.so
b7ffe000-b7fff000 rw-p 00000000 fd:00 14811212   /lib/libcwait.so
b7fff000-b8000000 rw-p b7fff000 00:00 0
bffed000-c0000000 rwxp bffed000 00:00 0
ffffe000-fffff000 ---p 00000000 00:00 0

50000000-b0200000 rw-s 00000000 00:06 196609     /SYSV51125e54 (deleted)
從這段資訊可看出SGA的起點是1.25G(16進位制50000000=10進位制1342177280,1342177280/1024/1024/1024=1.25G)

開始調整,先將oracle shutdown,再執行如下命令
# cd $ORACLE_HOME/rdbms/lib
# cp ksms.s ksms.s.bak
# genksms -s 0x12000000 > ksms.s  (修改共享庫的裝載地址的檔案定義)
# make -f ins_rdbms.mk ksms.o    (編譯好目標檔案)
# make -f ins_rdbms.mk ioracle    (重新編譯Oracle可執行檔案)

如有問題可通過如下方法恢復原有狀態:
# cp ksms.s.bak ksms.s
# make -f ins_rdbms.mk ioracle

oracle program重新編譯成功後,啟動oracle,並調整SGA如下:
SQL> show sga
Total System Global Area 2635668692 bytes
Fixed Size                   453844 bytes
Variable Size            1056964608 bytes
Database Buffers         1577058304 bytes
Redo Buffers                1191936 bytes

再檢視pmon或任意oracle程式的虛擬地址分配資訊:
# ps -ef |grep pmon
oracle    4760     1  0 Jun26 ?        00:00:03 ora_pmon_game
root     18575 17322  0 11:26 pts/2    00:00:00 grep pmon
# cat /proc/4760/maps
0017f000-00194000 r-xp 00000000 fd:00 14812134   /lib/ld-2.3.4.so
00194000-00195000 r--p 00015000 fd:00 14812134   /lib/ld-2.3.4.so
00195000-00196000 rw-p 00016000 fd:00 14812134   /lib/ld-2.3.4.so
002ef000-002f1000 r-xp 00000000 fd:00 14812137   /lib/libdl-2.3.4.so
002f1000-002f3000 rw-p 00001000 fd:00 14812137   /lib/libdl-2.3.4.so
00772000-00784000 r-xp 00000000 fd:00 14812146   /lib/libnsl-2.3.4.so
00784000-00786000 rw-p 00011000 fd:00 14812146   /lib/libnsl-2.3.4.so
00786000-00788000 rw-p 00786000 00:00 0
08048000-0a672000 r-xp 00000000 fd:00 1394588    /opt/oracle/product/9.2.0/bin/oracle
0a672000-0af58000 rw-p 02629000 fd:00 1394588    /opt/oracle/product/9.2.0/bin/oracle
0af58000-0b005000 rw-p 0af58000 00:00 0
12000000-b0200000 rw-s 00000000 00:06 196609     /SYSV51125e54 (deleted)
b7866000-b78a7000 rw-p b7866000 00:00 0
b78a7000-b78b0000 r-xp 00000000 fd:00 14811186   /lib/libnss_files-2.3.4.so
b78b0000-b78b2000 rw-p 00008000 fd:00 14811186   /lib/libnss_files-2.3.4.so
b78b2000-b7932000 rw-p 00000000 00:0d 2046       /dev/zero
b7932000-b7a58000 rw-p b7932000 00:00 0
b7a58000-b7b7c000 r-xp 00000000 fd:00 14811143   /lib/i686/libc-2.3.4.so
b7b7c000-b7b7d000 r--p 00123000 fd:00 14811143   /lib/i686/libc-2.3.4.so
b7b7d000-b7b80000 rw-p 00124000 fd:00 14811143   /lib/i686/libc-2.3.4.so
b7b80000-b7b82000 rw-p b7b80000 00:00 0
b7b82000-b7ba3000 r-xp 00000000 fd:00 14811145   /lib/i686/libm-2.3.4.so
b7ba3000-b7ba5000 rw-p 00020000 fd:00 14811145   /lib/i686/libm-2.3.4.so
b7ba5000-b7bb3000 r-xp 00000000 fd:00 14811147   /lib/i686/libpthread-0.10.so
b7bb3000-b7bb5000 rw-p 0000d000 fd:00 14811147   /lib/i686/libpthread-0.10.so
b7bb5000-b7bf8000 rw-p b7bb5000 00:00 0
b7bf8000-b7ee0000 r-xp 00000000 fd:00 1394375    /opt/oracle/product/9.2.0/lib/libjox9.so
b7ee0000-b7ff3000 rw-p 002e7000 fd:00 1394375    /opt/oracle/product/9.2.0/lib/libjox9.so
b7ff3000-b7ff5000 rw-p b7ff3000 00:00 0
b7ff5000-b7ff6000 r-xp 00000000 fd:00 1394489    /opt/oracle/product/9.2.0/lib/libskgxn9.so
b7ff6000-b7ff8000 rw-p 00000000 fd:00 1394489    /opt/oracle/product/9.2.0/lib/libskgxn9.so
b7ff8000-b7ff9000 r-xp 00000000 fd:00 1392915    /opt/oracle/product/9.2.0/lib/libskgxp9.so
b7ff9000-b7ffa000 ---p 00001000 fd:00 1392915    /opt/oracle/product/9.2.0/lib/libskgxp9.so
b7ffa000-b7ffb000 rw-p 00001000 fd:00 1392915    /opt/oracle/product/9.2.0/lib/libskgxp9.so
b7ffb000-b7ffc000 r-xp 00000000 fd:00 1394515    /opt/oracle/product/9.2.0/lib/libodmd9.so
b7ffc000-b7ffd000 rw-p 00000000 fd:00 1394515    /opt/oracle/product/9.2.0/lib/libodmd9.so
b7ffd000-b7ffe000 r-xp 00000000 fd:00 14811212   /lib/libcwait.so
b7ffe000-b7fff000 rw-p 00000000 fd:00 14811212   /lib/libcwait.so
b7fff000-b8000000 rw-p b7fff000 00:00 0
bfff7000-c0000000 rwxp bfff7000 00:00 0
ffffe000-fffff000 ---p 00000000 00:00 0

12000000-b0200000 rw-s 00000000 00:06 196609     /SYSV51125e54 (deleted)
這裡可看出SGA的起點已經被降到了0x12000000,SGA可分配最大至2.7G了。

調整後,共享記憶體段資訊:
# ipcs
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status     
0x00000000 98304      gdm       600        393216     2          dest        
0x51125e54 196609     oracle    640        2652897280 174                    

------ Semaphore Arrays --------
key        semid      owner      perms      nsems    
0x4b2ca24c 622592     oracle    640        201      
0x4b2ca24d 655361     oracle    640        201      
0x4b2ca24e 688130     oracle    640        201      
0x4b2ca24f 720899     oracle    640        201      
0x4b2ca250 753668     oracle    640        201      

------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages   

SQL> show sga
Total System Global Area 2635668692 bytes
Fixed Size                   453844 bytes
Variable Size            1056964608 bytes
Database Buffers         1577058304 bytes
Redo Buffers                1191936 bytes

特別提示:
以上的操作可能會造成ORACLE崩潰,建議在未上線前修改。

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

相關文章