怎么修改内核参数中 kernel.sem

怎么修改内核参数中 kernel.sem,第1张

得重新编译内核,之前修改源代码的顶层目录下的Makefile文件,比如2.6.29.1内核的Makefile中:VERSION=2PATCHLEVEL=6SUBLEVEL=29EXTRAVERSION=.1

由于Linux的内核参数信息都存在内存中,因此可以通过命令直接修改,并且修改后直接生效。但是,当系统重新启动后,原来设置的参数值就会丢失,而系统每次启动时都会自动去/etc/sysctl.conf文件中读取内核参数,因此将内核的参数配置写入这个文件中,是一个比较好的选择。

首先打开/etc/sysctl.conf文件,查看如下两行的设置值,这里是:

kernel.shmall

=

2097152

kernel.shmmax

=

4294967295

如果系统默认的配置比这里给出的值大,就不要修改原有配置。同时在/etc/sysctl.conf文件最后,添加以下内容:

fs.file-max

=

6553600

kernel.shmmni

=

4096

kernel.sem

=

250

32000

100

128

net.ipv4.ip_local_port_range

=

1024

65000

net.core.rmem_default

=

4194304

net.core.rmem_max

=

4194304

net.core.wmem_default

=

262144

net.core.wmem_max

=

262144

这里的“fs.file-max

=

6553600”其实是由“fs.file-max

=

512

*

PROCESSES”得到的,我们指定PROCESSES的值为12800,即为“fs.file-max

=512

*12800”。

sysctl.conf文件修改完毕后,接着执行“sysctl

-p”使设置生效。

[root@localhost

~]#

sysctl

-p

常用的内核参数的含义如下。

kernel.shmmax:表示单个共享内存段的最大值,以字节为单位,此值一般为物理内存的一半,不过大一点也没关系,这里设定的为4GB,即“4294967295/1024/1024/1024=4G”。

kernel.shmmni:表示单个共享内存段的最小值,一般为4kB,即4096bit.

kernel.shmall:表示可用共享内存的总量,单位是页,在32位系统上一页等于4kB,也就是4096字节。

fs.file-max:表示文件句柄的最大数量。文件句柄表示在Linux系统中可以打开的文件数量。

ip_local_port_range:表示端口的范围,为指定的内容。

kernel.sem:表示设置的信号量,这4个参数内容大小固定。

net.core.rmem_default:表示接收套接字缓冲区大小的缺省值(以字节为单位)。

net.core.rmem_max

:表示接收套接字缓冲区大小的最大值(以字节为单位)

net.core.wmem_default:表示发送套接字缓冲区大小的缺省值(以字节为单位)。

net.core.wmem_max:表示发送套接字缓冲区大小的最大值(以字节为单位)。

oracle on linux安装多台服务器时可以采用一次安装副本多台克隆即可,简单快速.

**************************************************************

1、检查下列包是否安装

**************************************************************

yum -y install gcc gcc-c++ make binutils compat-libstdc++-33 compat-libcap1 \

elfutils-libelf elfutils-libelf-devel glibc glibc-devel glibc-common \

libaio libaio-devel libgcc libstdc++ libstdc++-devel sysstat expat \

ksh unixODBC unixODBC-devel

--配置系统

# grep MemTotal /proc/meminfo

MemTotal: 4946772 kB

# grep SwapTotal /proc/meminfo

SwapTotal:12289716 kB

# df -h

FilesystemSize Used Avail Use% Mounted on

/dev/sda2 17G 2.8G 14G 18% /

/dev/sda11012M 40M 921M 5% /boot

none 891M 0 891M 0% /dev/shm

/dev/hdc 192M 192M 0 100% /media/cdrom

**************************************************************

2.参数修改

**************************************************************

1.设置需要的IP

2、修改host文件

在/etc/hosts文件中添加一个全限定域名,如:

vi /etc/hosts

192.168.50.180 vp01 vp01.vpay.com

192.168.50.190 vp02 vp02.vpay.com

3. 查看修改结果

hostname

cat /etc/hosts | grep `eval hostname`

4、设置核心参数

1、在/etc/sysctl.conf文件中加入下列行:

#vi /etc/sysctl.conf

fs.suid_dumpable = 1

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmmni = 4096

# semaphores: semmsl, semmns, semopm, semmni

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default=4194304

net.core.rmem_max=4194304

net.core.wmem_default=262144

net.core.wmem_max=1048586

5、运行下列命令改变核心参数:

#/sbin/sysctl -p

6、在/etc/security/limits.conf文件中加入下列行:

# vi /etc/security/limits.conf

oracle softnproc 2047

oracle hardnproc 16384

oracle softnofile 1024

oracle hardnofile 65536

oracle hardstack 10240

7、在/etc/pam.d/login文件中加入下列行:

# vi +13 /etc/pam.d/login

sessionrequired pam_limits.so

**************************************************************

3.创建下列组和用户

**************************************************************

groupadd oinstall

groupadd dba

groupadd oper

useradd -g oinstall -G dba,oper -d /home/oracle -m oracle

passwd oracle

123

**************************************************************

4.设置oracle用户的环境变量

**************************************************************

用oracle登录在:/home/oracle/.bash_profile文件末尾,注意把其中ORACLE_SID换成自己的实例名:

# vi /home/oracle/.bash_profile

也可以

#su - oracle

#vi .bash_profile

增加下列内容:

# Oracle Settings

TMP=/tmp

export TMP

TMPDIR=$TMP

export TMPDIR

ORACLE_BASE=/u01/app/oracle

export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1

export ORACLE_HOME

ORACLE_SID=jinri

export ORACLE_SID

ORACLE_TERM=xterm

export ORACLE_TERM

PATH=/usr/sbin:$PATH

export PATH

PATH=$ORACLE_HOME/bin:$PATH

export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

export LD_LIBRARY_PATH

CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

export CLASSPATH

#LD_ASSUME_KERNEL=2.4.1

export LD_ASSUME_KERNEL

#set language

NLS_LANG="SIMPLIFIED CHINESE"_CHINA.AL32UTF8

export NLS_LANG

EDITOR=vi

export EDITOR

if [ $USER = "oracle" ]then

if [ $SHELL = "/bin/ksh" ]then

ulimit -p 16384

ulimit -n 65536

else

ulimit -u 16384 -n 65536

fi

fi

alias oratrace="cat $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/trace/alert_jinri.log"

alias oradata="cd $ORACLE_BASE/oradata/$ORACLE_SID"

alias oranetwork="cd $ORACLE_HOME/network/admin"

alias topc='ps -e -o pcpu,pid,user,tty,args | sort -n -k 1 -r | head'

alias topm='ps -e -o pmem,pid,user,tty,args | sort -n -k 1 -r | head'

----新建必要的数据目录

#mkdir /u01/backup/ &&chown -R oracle.oinstall /u01/backup/

# mkdir /data/ctl

# chown -R oracle.oinstall /data/ctl/

**************************************************************

5.副本克隆安装数据库

**************************************************************

--1.vp01正常关闭数据库

[oracle@vp01 20760982]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on 星期一 9月 28 18:27:13 2015

Copyright (c) 1982, 2013, Oracle. All rights reserved.

连接到:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>shutdown immediate

数据库已经关闭。

已经卸载数据库。

ORACLE 例程已经关闭。

SQL>exit

[oracle@vp01 20760982]$ lsnrctl stop

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 28-9月 -2015 18:27:39

Copyright (c) 1991, 2013, Oracle. All rights reserved.

正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))

命令执行成功

---2.vp01打包

$cd /u01/

$tar czvf oracle.tar.gz /u01/

---3.vp01将oracle安装副本压缩包传递到vp02

scp -r -p -P 16335 /u01/oracle.tar.gz oracle@10.174.157.163:/u01/backup/

---4.vp02解压修改权限

#chown -R oracle.oinstall /u01/backup/oracle.tar.gz

#cd /u01/backup/

# tar zxvf oracle.tar.gz -C /u01/

--移动目录到上一层

# cd /u01/u01/ &&mv app/ ../ &&ls /u01/u01/ && ls /u01/app/

#rm -rf /u01/u01

---控制文件有个副本在不同目录

#cp /u01/app/oracle/oradata/jinri/control01.ctl /data/ctl/control03.ctl

#chown -R oracle.oinstall /u01/app/

#chown -R oracle.oinstall /data/ctl/

--relink

$cd

$relink all

writing relink log to: /u01/app/oracle/product/11.2.0/dbhome_1/install/relink.log

----5.修改监听解析文件

$ cat /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = jinri)

(SID_NAME = jinri)

)

)

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 10.174.157.163)(PORT = 1521))

)

)

ADR_BASE_LISTENER = /u01/app/oracle

[oracle@vp02 ~]$

#将vp01修改为vp02对应IP

$ cat /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

JINRI =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = vp02)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = jinri)

)

)

-----6.附加oracle主目录

cd $ORACLE_HOME/oui/bin

$ $ORACLE_HOME/oui/bin/runInstaller –silent -attachHome -invPrtLoc /u01/app/oraInventory/oraInst.loc \

ORACLE_HOME_NAME="OraDb11g_home1" \

ORACLE_HOME="/u01/app/oracle/product/11.2.0/dbhome_1"

Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB. Actual 4999 MBPassed

The inventory pointer is located at /etc/oraInst.loc

The inventory is located at /u01/app/oraInventory

Please execute the '/u01/app/oraInventory/orainstRoot.sh' script at the end of the session.

'AttachHome' was successful.

#/u01/app/oraInventory/orainstRoot.sh

--注册前

$ cat /u01/app/oraInventory/ContentsXML/inventory.xml

<?xml version="1.0" standalone="yes" ?>

<!-- Copyright (c) 1999, 2013, Oracle and/or its affiliates.

All rights reserved. -->

<!-- Do not modify the contents of this file by hand. -->

<INVENTORY>

<VERSION_INFO>

<SAVED_WITH>11.2.0.4.0</SAVED_WITH>

<MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>

</VERSION_INFO>

<HOME_LIST>

</HOME_LIST>

<COMPOSITEHOME_LIST>

</COMPOSITEHOME_LIST>

</INVENTORY>

--注册前

$ cat /u01/app/oraInventory/ContentsXML/inventory.xml

<?xml version="1.0" standalone="yes" ?>

<!-- Copyright (c) 1999, 2013, Oracle and/or its affiliates.

All rights reserved. -->

<!-- Do not modify the contents of this file by hand. -->

<INVENTORY>

<VERSION_INFO>

<SAVED_WITH>11.2.0.4.0</SAVED_WITH>

<MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>

</VERSION_INFO>

<HOME_LIST>

<HOME NAME="OraDb11g_home1" LOC="/u01/app/oracle/product/11.2.0/dbhome_1" TYPE="O" IDX="1"/>

</HOME_LIST>

<COMPOSITEHOME_LIST>

</COMPOSITEHOME_LIST>

</INVENTORY>

$ cat /etc/oraInst.loc

inventory_loc=/u01/app/oraInventory

inst_group=oinstall

----7.分离oracle主目录(需要的时候)

$ORACLE_HOME/oui/bin/runInstaller –silent -detachHome -invPrtLoc /u01/app/oraInventory/oraInst.loc \

ORACLE_HOME_NAME="OraDb11g_home1" \

ORACLE_HOME="/u01/app/oracle/product/11.2.0/dbhome_1"

----8.启动监听文件

$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 28-9月 -2015 19:30:48

Copyright (c) 1991, 2013, Oracle. All rights reserved.

启动/u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: 请稍候...

TNSLSNR for Linux: Version 11.2.0.4.0 - Production

系统参数文件为/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

写入/u01/app/oracle/diag/tnslsnr/vp02/listener/alert/log.xml的日志信息

监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vp02)(PORT=1521)))

正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))

LISTENER 的 STATUS

------------------------

别名 LISTENER

版本 TNSLSNR for Linux: Version 11.2.0.4.0 - Production

启动日期 28-9月 -2015 19:30:48

正常运行时间 0 天 0 小时 0 分 2 秒

跟踪级别 off

安全性ON: Local OS Authentication

SNMP OFF

监听程序参数文件 /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

监听程序日志文件 /u01/app/oracle/diag/tnslsnr/vp02/listener/alert/log.xml

监听端点概要...

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vp02)(PORT=1521)))

监听程序不支持服务

命令执行成功

$ tnsping jinri

TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 28-9月 -2015 19:31:11

Copyright (c) 1997, 2013, Oracle. All rights reserved.

已使用的参数文件:

/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora

已使用 TNSNAMES 适配器来解析别名

尝试连接 (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = vp02)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = jinri)))

OK (0 毫秒)


欢迎分享,转载请注明来源:夏雨云

原文地址:https://www.xiayuyun.com/zonghe/179762.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-03-28
下一篇2023-03-28

发表评论

登录后才能评论

评论列表(0条)

    保存