Managing Oracle UNIX Shared memory with IPCS

Source: Internet
Author: User
Tags semaphore

UNIX and Linux Shared Memory and Oracle

The UNIX and LINUX operating systems allocate memory based on a interprocess communication model (IPC) to manage memory s Egments for Oracle database environments.

To obtain details on shared memory for UNIX and LINUX, make use of the IPCS command. Details on syntax is illustrated below from within the UNIX and LINUX mans pages:

NAME

Ipcs:provide Information on IPC facilities

Synopsis

IPCS [-ASMQ] [-tclup]

IPCS [-SMQ]-i ID

Ipcs-h

DESCRIPTION

IPCS provides information on the IPC facilities for which the calling process has Read access

The-i option allows a specific resource ID to be specified. Only information on the this ID would be printed.

Resources may specified as follows:

-M shared memory segments

-Q message queues

Determine what Oracle database have a semaphore set

As we have the noted, when a Oracle database hangs, you could have leftover background processes, held RAM memory segment and H Eld semaphore sets. When you had multiple instances on a UNIX server and need to release a semaphore set for the Oracle database, you must fir St determine which semaphore set belongs to your crippled instance.

Unfortunately, you cannot tell with the IPCS? SA command which semaphore set belongs to each Oracle database. Here are the Oracle procedure for determining the semaphore set number for a individual Oracle database so that can re Move the semaphores with the IPCS command.


Sql> Oradebug Setmypid

Sql> Oradebug IPC

Sql>!VI/U01/APP/ORACLE/DIAG/RDBMS/ORCL/ORCL/TRACE/ORCL_ORA_13358.TRC

2014-09-20 17:35:30.830
Processing oradebug command ' IPC '
Dump of Unix-generic SKGM context
Areaflags 000000F7
RealmFlags 0000000f
Mapsize 00000800
Protectsize 00001000
Lcmsize 00001000
Seglen 00400000
Largestsize 000000007ead3000
Smallestsize 0000000000400000
Stacklimit 0xbda06894
Stackdir-1
Mode 660
Magic Acc01ade
handle:0x1b0058 '/U01/APP/ORACLE/PRODUCT/11.2.0/DB_1ORCL '
Dump of Unix-genericRealm handle '/U01/APP/ORACLE/PRODUCT/11.2.0/DB_1ORCL ', flags = 00000000
Area #0 ' Fixed Size ' containing subareas 0-0
Total size 00000000001476d4 Minimum Subarea Size 00000000
Area Subarea shmid Stable Addr Actual Addr
0 030802000x00000020000000 0x00000020000000
Subarea size Segment Size
0000000000148000 000000003ec00000
Area #1 ' Variable Size ' containing subareas 4-4
Total size 000000003e000000 Minimum Subarea size 00400000
Area Subarea shmid Stable Addr Actual Addr
1 430802000x00000020800000 0x00000020800000
Subarea size Segment Size
000000003e000000 000000003ec00000
Area #2 ' Redo buffers ' containing subareas 1-1
Total size 000000000047a000 Minimum Subarea Size 00000000
Area Subarea shmid Stable Addr Actual Addr
2 130802000x00000020148000 0x00000020148000
Subarea size Segment Size
000000000047a000 000000003ec00000
Area #3 ' Base Allocator Control ' containing subareas 3-3
Total size 0000000000002000 Minimum Subarea Size 00000000
Area Subarea shmid Stable Addr Actual Addr
3 330802000x000000207fe000 0x000000207fe000
Subarea size Segment Size
0000000000002000 000000003ec00000
Area #4 ' Slab Allocator Control ' containing subareas 2-2
Total size 000000000023c000 Minimum Subarea Size 00000000
Area Subarea shmid Stable Addr Actual Addr
4 230802000x000000205c2000 0x000000205c2000
Subarea size Segment Size
000000000023c000 000000003ec00000
Area #5 ' skgm overhead ' containing subareas 5-5
Total size 0000000000003000 Minimum Subarea Size 00000000
Area Subarea shmid Stable Addr Actual Addr
5 530802000x0000005e800000 0x0000005e800000
Subarea size Segment Size
0000000000003000 000000003ec00000
Dump of linux-specific SKGM context
Sharedmmu 00000001
Shareddec 0
Used region 0:start 0000000012000000 length 0000000000400000
Used region 1:start 0000000020000000 length 000000003ec00000
Used region 2:start 00000000af800000 length 0000000010800000
Maximum Processes: = 150
Number of semaphores per set: = 154
Semaphores key overhead per set: = 4
User semaphores per set: = 150
Number of semaphore Sets: = 1
Semaphore identifiers: = 1
Semaphore list=
131073
--------------System semaphore Information-------------
------Shared Memory Segments--------
Key shmid owner perms bytes nattch Status
0x00000000 2883587 Root 644 52 2
0x00000000 2916357 Root 644 16384 2
0x00000000 2949126 Root 644 268 2
0xd3ac6c803080200Oracle 660 4096 0
------Semaphore Arrays--------
Key Semid owner Perms Nsems
0x5c23a1bc131073Oracle 660 154
------Message Queues--------
Key Msqid owner perms used-bytes messages

Since we cannot get the semaphore set number for the crippled database, we must determine the semaphore set using the proc  ESS of elimination. We issues the above commands for each live database on the server, and the un-claimed semaphore set would belong to the CRI ppled instance.

Once identified, you can use the following procedure for removing the semaphore set.

Removing a semaphore set for Oracle

We start by issuing the IPCS, SB command to display details of the semaphore set.

Root> IPCS
------Shared Memory Segments--------
Key shmid owner perms bytes nattch Status
0x7403d635 1769472 Root 600 4 0
0x00000001 1933313 Root 600 655360 2
0x7403d60a 2523138 Root 600 4 0
0x00000000 2883587 Root 644 52 2
0x7403d609 2490372 Root 600 4 0
0x00000000 2916357 Root 644 16384 2
0x00000000 2949126 Root 644 268 2
0x00000000 3014663 GDM 393216 2 dest
0xd3ac6c803080200Oracle 660 4096 0


------Semaphore Arrays--------
Key Semid owner Perms Nsems
0x000000a7 0 Root 600 1
0X5C23A1BC 131073 Oracle 660 154


Now, we can remove the semaphores from the locked-up database. In this example, we assume that set131073Is the one for the crippled database.

Root> ipcrm-s131073

Now we can confirm that the semaphores is deleted.


Root> Ipcs-sb|grep Oracle


s--RA-R 0x00000000-----Oracle DBA 400
S 334 0x00000000--ra-r-----Oracle DBA 300

Managing Oracle UNIX Shared memory with IPCS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.