首页 > Linux操作系统 > Linux操作系统 > 转:Managing swap in Oracle Linux & UNIX

转:Managing swap in Oracle Linux & UNIX

原创 Linux操作系统 作者:v_fantasy 时间:2009-04-13 23:47:53 0 删除 编辑

For those of us who review the Oracle installation documentation, we know that Oracle suggests that you configure a substantial amount of swap space. If you have between 1 and 2G RAM, you need to configure 1.5x RAM for swap space. For 2 to 8G RAM, swap space has to equal RAM. For RAM more than 8G, swap needs to be ¾ RAM.

  • If you have between 1 and 2G RAM, you need to configure 1.5x RAM for swap space.

  • For 2 to 8G RAM, swap space has to equal RAM.

  • For RAM more than 8G, swap needs to be ¾ RAM

No doubt your system administrator (in Unix) will tell you that that is more swap than you need. He may tell you that you only need one or two gig of swap when you have plenty of memory.

I can tell you from personal experience, that your system administrator is wrong if he tells you that. I have been there, and done that as the saying goes. Make sure you configure the full amount of swap recommended by Oracle, more if possible. Here’s why:

In a Unix operating system, there are two methods of allocating swap, eager swap and lazy swap. Under lazy swap, swap space is allocated only when needed, that is when an active process needs additional memory and all real memory is used up. If there is insufficient swap space available, the Operating system will create more swap space by killing idle processes.

Obviously this is a dangerous and undesirable situation. A process using eager swap will allocate swap as it allocates real memory. If your oracle database has 6G RAM allocated in the SGA, it will allocate both 6G RAM and 6G swap. If there is insufficient swap space, it won’t kill other processes to make space.

It will lock up the program attempting to allocate space, and eventually any other processes on the system that need swap space will also hang. In Solaris, I have seen such errors as ‘unable to fork a process’ or Solaris error 12, not enough space. In oracle, you will get messages like this: TNS-12500, TNS-12540, TNS-12560, TNS-00510. Usually your server will lock up shortly after the ‘not enough space’ or ‘unable to fork a process’ message.

The example above actually happened. It was my fault. I had given the Unix system administrator the system requirements, including the amount of swap required. However, I had not followed up to make sure the settings were actually in effect. As it turns out, the Unix administrator had only allocated about 1/3 of the system RAM for swap, relying on his knowledge and understanding of swap. This was my fault because as an Oracle DBA, it was my job to verify everything before you hand the installation over to the users. That includes the system level settings. If you can’t see the settings (but as a DBA you should be able to see the settings), you have to rely on your system administrators word. But I could see the settings, I just didn’t follow up and verify them.

Some Oracle DBA’s I have talked to have allocated twice as much swap space as system RAM, following the older Oracle guidelines. After doing some researched I have discovered that Unix can be configured used to hold an image of the operating system processes for diagnostic purposes in the event of a system crash. Thus, my recommendation is that the minimum swap space should be equal to the available RAM, and configuring twice the amount of RAM is the maximum amount that should be needed. Despite what the official Oracle documentation says.

来自 “ ITPUB博客 ” ,链接:,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录


  • 博文量
  • 访问量