Sunday, December 5, 2010

How to fix "file /dev/zero: mmap anon failed: Resource temporarily unavailable" (Solaris)

- Linking Oracle
rm -f /u01/app/oracle/product/11.2.0/db_1/rdbms/lib/oracle
/usr/ccs/bin/ld -o /u01/app/oracle/product/11.2.0/db_1/rdbms/lib/oracle -L/u01/app/oracle/product/11.2.0/db_1/rdbms/lib/ -L/u01/app/oracle/product/11.2.0/db_1/lib/ -dy /u01/app/oracle/product/11.2.0/db_1/lib/prod/lib/amd64/crti.o /u01/app/oracle/product/11.2.0/db_1/lib/prod/lib/amd64/crt1x.o /u01/app/oracle/product/11.2.0/db_1/rdbms/lib/opimai.o /u01/app/oracle/product/11.2.0/db_1/rdbms/lib/ssoraed.o /u01/app/oracle/product/11.2.0/db_1/rdbms/lib/ttcsoi.o -z allextract -lperfsrv11 -z defaultextract /u01/app/oracle/product/11.2.0/db_1/lib/nautab.o /u01/app/oracle/product/11.2.0/db_1/lib/naeet.o /u01/app/oracle/product/11.2.0/db_1/lib/naect.o /u01/app/oracle/product/11.2.0/db_1/lib/naedhs.o /u01/app/oracle/product/11.2.0/db_1/rdbms/lib/config.o -lserver11 -lodm11 -lcell11 -lnnet11 -lskgxp11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lclient11 -lvsn11 -lcommon11 -lgeneric11 -lknlopt `if /usr/ccs/bin/ar tv /u01/app/oracle/product/11.2.0/db_1/rdbms/lib/libknlopt.a | grep xsyeolap.o > /dev/null 2>&1 ; then echo "-loraolap11" ; fi` -lslax11 -lpls11 -lplp11 -lserver11 -lclient11 -lvsn11 -lcommon11 -lgeneric11 `if [ -f /u01/app/oracle/product/11.2.0/db_1/lib/libavserver11.a ] ; then echo "-lavserver11" ; else echo "-lavstub11"; fi` `if [ -f /u01/app/oracle/product/11.2.0/db_1/lib/libavclient11.a ] ; then echo "-lavclient11" ; fi` -lknlopt -lslax11 -lpls11 -lplp11 -ljavavm11 -lserver11 -lwwg `cat /u01/app/oracle/product/11.2.0/db_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /u01/app/oracle/product/11.2.0/db_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnnz11 -lzt11 -lztkg11 -lmm -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lztkg11 `cat /u01/app/oracle/product/11.2.0/db_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /u01/app/oracle/product/11.2.0/db_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnnz11 -lzt11 -lztkg11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 `if /usr/ccs/bin/ar tv /u01/app/oracle/product/11.2.0/db_1/rdbms/lib/libknlopt.a | grep "kxmnsd.o" > /dev/null 2>&1 ; then echo " " ; else echo "-lordsdo11"; fi` -L/u01/app/oracle/product/11.2.0/db_1/ctx/lib/ -lctxc11 -lctx11 -lzx11 -lgx11 -lctx11 -lzx11 -lgx11 -lordimt11 -lclsra11 -ldbcfg11 -lhasgen11 -lskgxn2 -lnnz11 -lzt11 -lxml11 -locr11 -locrb11 -locrutl11 -lhasgen11 -lskgxn2 -lnnz11 -lzt11 -lxml11 -lasmclnt11 -lcommon11 -lcell11 -lskgxp11 -lgeneric11 -lcommon11 -lgeneric11 -loraz -llzopro -lorabz2 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lsnls11 -lunls11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lasmclnt11 `cat /u01/app/oracle/product/11.2.0/db_1/lib/sysliblist` -R /opt/SUNWcluster/lib:/u01/app/oracle/product/11.2.0/db_1/lib:/opt/ORCLcluster/lib/ -Y P,:/opt/SUNWcluster/lib:/opt/ORCLcluster/lib/:/usr/ccs/lib/amd64:/usr/lib/amd64 -Qy -lc -lrt -laio -lposix4 -lkstat -lm /u01/app/oracle/product/11.2.0/db_1/lib/prod/lib/amd64/crtn.o -lpthread
ld: fatal: *** Error code 1
file /dev/zero: mmap anon failed: Resource temporarily unavailable
make: Fatal error: Command failed for target `/u01/app/oracle/product/11.2.0/db_1/rdbms/lib/oracle'


###########SetUp###########

###########Method 1###########


bash-3.00$ swap -s
total: 1333976k bytes allocated + 104980k reserved = 1438956k used, 661796k available

bash-3.00$ /usr/sbin/mkfile 2048m /u01/app/oracle_install_swap

bash-3.00$ swap -a /u01/app/oracle_install_swap
"/u01/app/oracle_install_swap" is not valid for swapping.
It must be a block device or a regular file with the
"save user text on execution" bit set.
bash-3.00# /usr/sbin/lofiadm -a /u01/app/oracle_install_swap
/dev/lofi/1
bash-3.00# ls -l /dev/lofi/1
lrwxrwxrwx 1 root root 29 Dec 5 12:27 /dev/lofi/1 -> ../../devices/pseudo/lofi@0:1
bash-3.00# swap -a /dev/lofi/1
bash-3.00# swap -s
total: 1334520k bytes allocated + 105104k reserved = 1439624k used, 2689628k available
bash-3.00#

###########Method 2###########

bash-3.00# /usr/sbin/mkfile 20m /u01/app/oracle_install_swap1
bash-3.00# chmod 1600 /u01/app/oracle_install_swap1
bash-3.00# ls -l /u01/app/oracle_install_swap1
-rw------T 1 root root 20971520 Dec 5 12:39 /u01/app/oracle_install_swap1
bash-3.00# swap -a /u01/app/oracle_install_swap1



bash-3.00# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c1t0d0s1 30,1 8 2988080 348504
/dev/lofi/1 144,1 8 4194296 3909400
/u01/app/oracle_install_swap1 - 8 40952 15088



PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
22733 oracle 1185M 571M sleep 60 0 0:01:35 6.5% ld/1
1705 oracle 118M 5572K sleep 59 0 0:01:25 1.5% java/15
964 noaccess 126M 6444K sleep 59 0 0:01:14 0.9% java/18


bash-3.00$ while true; do swap -s; sleep 1; done
total: 2021720k bytes allocated + 139628k reserved = 2161348k used, 2032852k available
total: 2021992k bytes allocated + 139356k reserved = 2161348k used, 2032852k available
total: 2022392k bytes allocated + 138956k reserved = 2161348k used, 2032852k available
total: 2022652k bytes allocated + 138696k reserved = 2161348k used, 2032868k available
total: 2023056k bytes allocated + 138292k reserved = 2161348k used, 2032864k available
total: 2023208k bytes allocated + 138140k reserved = 2161348k used, 2032852k available
total: 2023300k bytes allocated + 138048k reserved = 2161348k used, 2032852k available
total: 2023348k bytes allocated + 138000k reserved = 2161348k used, 2032844k available
total: 2023392k bytes allocated + 137956k reserved = 2161348k used, 2032840k available
total: 2023624k bytes allocated + 137724k reserved = 2161348k used, 2032844k available



###########Clean up###########

bash-3.00# lofiadm -d /dev/lofi/1
bash-3.00# ls -l /dev/lofi/1
/dev/lofi/1: No such file or directory
bash-3.00# rm /u01/app/oracle_install_swap

bash-3.00# swap -d /u01/app/oracle_install_swap1
bash-3.00# rm /u01/app/oracle_install_swap1
bash-3.00# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c1t0d0s1 30,1 8 2988080 1775224
bash-3.00#