搜尋
首頁資料庫mysql教程OracleStudy之案例--通过IPCS查看共享内存之“怪现象”

Oracle Study之案例--通过IPCS查看共享内存之“怪现象” 在Oracle 11gR2环境下,通过ipcs命令查看共享内存,竟然发现分配给Oracle的内存只有4096Bytes,而在Oracle 10g环境下从未发现这种问题! [root@rh6~]#ipcs-a------SharedMemorySegments--------keyshm

Oracle Study之案例--通过IPCS查看共享内存之“怪现象”   

       在Oracle 11gR2环境下,通过ipcs命令查看共享内存,竟然发现分配给Oracle的内存只有4096Bytes,而在Oracle 10g环境下从未发现这种问题!

[root@rh6 ~]# ipcs -a
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x00000000 0          root       644        52         2
0x00000000 32769      root       644        16384      2
0x00000000 65538      root       644        268        2
0x00000000 98307      gdm        600        393216     2          dest
0x00000000 131076     gdm        600        393216     2          dest
0x00000000 163845     gdm        600        393216     2          dest
0x00000000 196614     gdm        600        393216     2          dest
0x00000000 229383     gdm        600        393216     2          dest
0x4b4218ec 557064     oracle     660        4096       0
------ Semaphore Arrays --------
key        semid      owner      perms      nsems
0x00000000 0          root       600        1
0x00000000 98305      root       600        1
0x000000a7 327682     root       600        1
0xbe61d9cc 983043     oracle     660        154
------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages

数据库版本:

16:27:09 SYS@ test3 >select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0      Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production

Oraccle 11g的通过以下两个参数实现内存的自动个管理:

16:27:19 SYS@ test3 >show parameter mem
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address             integer     0
memory_max_target                    big integer 300M
memory_target                        big integer 300M
shared_memory_address                integer     0

在Oracle 11g中用看Oracle的共享内存段---------IPCS

1、会不会是参数memory_max_target有关系呢?把它设为0,然后重启数据库。

16:28:11 SYS@ test3 >alter system set memory_target=0 ;
System altered.

16:36:44 SYS@ test3 >show parameter mem

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
hi_shared_memory_address             integer                0
memory_max_target                    big integer            300M
memory_target                        big integer            0
shared_memory_address                integer                0

16:30:51 SYS@ test3 >startup force ;
ORACLE instance started.
Total System Global Area  313860096 bytes
Fixed Size                  1336232 bytes
Variable Size             205524056 bytes
Database Buffers          100663296 bytes
Redo Buffers                6336512 bytes
Database mounted.
Database opened.

再看共享内存:

[oracle@rh6 ~]$ ipcs -a
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x00000000 0          root       644        52         2
0x00000000 32769      root       644        16384      2
0x00000000 65538      root       644        268        2
0x4b4218ec 622600     oracle     660        4096       0
------ Semaphore Arrays --------
key        semid      owner      perms      nsems
0xbe61d9cc 1114115    oracle     660        154
------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages

发现分配给Oracle的共享内存仍然很小,看来不是memory_target 参数的问题


2、尝试调整memory_max_target参数,将其恢复到系统默认值:

16:39:49 SYS@ test3 >alter system set sga_max_size=300m scope=spfile;
System altered.

16:40:06 SYS@ test3 >alter system reset memory_max_target scope=spfile sid='*';
System altered.

16:40:40 SYS@ test3 >startup force nomount;
ORACLE instance started.
Total System Global Area  313860096 bytes
Fixed Size                  1336232 bytes
Variable Size             205524056 bytes
Database Buffers          100663296 bytes
Redo Buffers                6336512 bytes

16:40:52 SYS@ test3 >show parameter mem
NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
hi_shared_memory_address             integer                0
memory_max_target                    big integer            0
memory_target                        big integer            0
shared_memory_address                integer                0

16:40:59 SYS@ test3 >show parameter sga
NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
lock_sga                             boolean                FALSE
pre_page_sga                         boolean                FALSE
sga_max_size                         big integer            300M
sga_target                           big integer            180M

查看系统共享内存:

[oracle@rh6 ~]$ ipcs -a
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x00000000 0          root       644        52         2
0x00000000 32769      root       644        16384      2
0x00000000 65538      root       644        268        2
0x4b4218ec 884744     oracle     660        316669952  16
------ Semaphore Arrays --------
key        semid      owner      perms      nsems
0xbe61d9cc 1638403    oracle     660        154
------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages

看来是设置了memory_max_target参数的原因,导致通过ipcs查看到分配给Oracle的内存为4096Bytes!


陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
將用戶添加到MySQL:完整的教程將用戶添加到MySQL:完整的教程May 12, 2025 am 12:14 AM

掌握添加MySQL用戶的方法對於數據庫管理員和開發者至關重要,因為它確保數據庫的安全性和訪問控制。 1)使用CREATEUSER命令創建新用戶,2)通過GRANT命令分配權限,3)使用FLUSHPRIVILEGES確保權限生效,4)定期審計和清理用戶賬戶以維護性能和安全。

掌握mySQL字符串數據類型:varchar vs.文本與char掌握mySQL字符串數據類型:varchar vs.文本與charMay 12, 2025 am 12:12 AM

chosecharforfixed-lengthdata,varcharforvariable-lengthdata,andtextforlargetextfield.1)chariseffity forconsistent-lengthdatalikecodes.2)varcharsuitsvariable-lengthdatalikenames,ballancingflexibilitibility andperformance.3)

MySQL:字符串數據類型和索引:最佳實踐MySQL:字符串數據類型和索引:最佳實踐May 12, 2025 am 12:11 AM

在MySQL中處理字符串數據類型和索引的最佳實踐包括:1)選擇合適的字符串類型,如CHAR用於固定長度,VARCHAR用於可變長度,TEXT用於大文本;2)謹慎索引,避免過度索引,針對常用查詢創建索引;3)使用前綴索引和全文索引優化長字符串搜索;4)定期監控和優化索引,保持索引小巧高效。通過這些方法,可以在讀取和寫入性能之間取得平衡,提升數據庫效率。

mysql:如何遠程添加用戶mysql:如何遠程添加用戶May 12, 2025 am 12:10 AM

ToaddauserremotelytoMySQL,followthesesteps:1)ConnecttoMySQLasroot,2)Createanewuserwithremoteaccess,3)Grantnecessaryprivileges,and4)Flushprivileges.BecautiousofsecurityrisksbylimitingprivilegesandaccesstospecificIPs,ensuringstrongpasswords,andmonitori

MySQL字符串數據類型的最終指南:有效的數據存儲MySQL字符串數據類型的最終指南:有效的數據存儲May 12, 2025 am 12:05 AM

tostorestringsefliceflicyInmySql,ChooSetherightDataTypeBasedyOrneOrneEds:1)USEcharforFixed-LengthStstringStringStringSlikeCountryCodes.2)UseVarcharforvariable-lengtthslikenames.3)USETEXTCONTENT.3)

mysql blob vs.文本:為大對象選擇正確的數據類型mysql blob vs.文本:為大對象選擇正確的數據類型May 11, 2025 am 12:13 AM

選擇MySQL的BLOB和TEXT數據類型時,BLOB適合存儲二進制數據,TEXT適合存儲文本數據。 1)BLOB適用於圖片、音頻等二進制數據,2)TEXT適用於文章、評論等文本數據,選擇時需考慮數據性質和性能優化。

MySQL:我應該將root用戶用於產品嗎?MySQL:我應該將root用戶用於產品嗎?May 11, 2025 am 12:11 AM

No,youshouldnotusetherootuserinMySQLforyourproduct.Instead,createspecificuserswithlimitedprivilegestoenhancesecurityandperformance:1)Createanewuserwithastrongpassword,2)Grantonlynecessarypermissionstothisuser,3)Regularlyreviewandupdateuserpermissions

MySQL字符串數據類型說明了:選擇適合您數據的合適類型MySQL字符串數據類型說明了:選擇適合您數據的合適類型May 11, 2025 am 12:10 AM

mySqlStringDatatAtatPessHouldBechoseBasedondatActarActeristicsAndusecases:1)USEcharforFixed lengthStstringStringStringSlikeCountryCodes.2)usevarcharforvariable-lengtthslikeLikenames.3)usebarnionororvarinyorvarinyorvarybinarydatalgebenedaTalgeextocrabextrapon.4)

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver Mac版

Dreamweaver Mac版

視覺化網頁開發工具

MantisBT

MantisBT

Mantis是一個易於部署的基於Web的缺陷追蹤工具,用於幫助產品缺陷追蹤。它需要PHP、MySQL和一個Web伺服器。請查看我們的演示和託管服務。

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

SublimeText3 英文版

SublimeText3 英文版

推薦:為Win版本,支援程式碼提示!