操作系统心得

操作系统使用心得

上一篇 / 下一篇 2007-09-27 16:21:47 / 个人分类:AIX

查看( 0 ) / 评论( 0 ) / 评分( 0 / 0 )

AIX是IBM公司开发的业界领先的优秀商务Unix操作系统,在可靠性、可用性、开放性、扩展性、高性能、安全性等方面都非常突出,尤其是在Internet的关键应用领域以及系统和硬件管理能力方面,其性能表现更为出色,受到了业界的普遍认可和广泛使用。以下是笔者几年来使用AIX系统的一点心得,兹供使用该系统的其他读者参考。

1.如何禁止终端上的中断键(CTRL+C)?

在很多应用系统中,系统管理员希望普通用户只运行自己的应用程序,不能进入系统的shell提示符下,但缺省情况下当用户在终端上按CTRL+C键时就会退到系统提示符下。由于用户终端一般没有固定的端口号,为了禁止使用中断键,可采取下面办法:

(1)如果使用ksh, 可在$HOME/.profile中第一行加入如下内容:

trap "echo 'Abnormal operation'; exit" 123915

(2)如果使用csh(ksh亦可),可用如下命令:

%stty intr ^!

如果恢复正常情况,键入下列命令:

% stty intr ^c

2.如何在shell中不回显(echo)字符?

在实际应用中,一般当我们在键盘上键入口令时不希望将其显示在屏幕上,为此可采用下面的两种办法:

·使用stty 命令

stty -echo # do not display password

echo "Enter password: \c"

read PASSWD #get the password

stty echo # restore standard configuration

·使用echo命令

设置保密属性:echo "\033[8m"

取消保密属性:echo "\033[m"

3.如何在某个目录及其所属子目录的所有文件中查找字符串?

在程序维护过程中,有时需要在某个目录及其所属子目录的所有文件中查找某一个字符串,为此可用下面两种方法(假设在*.cp文件中查找字符串"abc",结果放在文件out中):

(1)cat /dev/null > out

find ./ -name "*.cp" -exec grep "abc"{} >> out

(2)find ./ -name "*.cp" | xargs grep "abc" > out

推荐使用第二种方法,因其系统开销小、速度快。

4.如何对/etc/inittab文件中的一行进行注释?

我们都知道在shell中使用"#"作为注释符号,但在/etc/inittab中注释一行的方法是在第一个字符前插入字符":"。

5.如何转换DOS和AIX两种格式的文本文件?

如欲转换DOS和AIX两种格式的文本文件,有两种方法:

(1)用ftp命令:设置ASCII传输类型,在一台运行AIX的机器和另外一台运行Windows的机器之间互相传送,这里不再赘述。

(2)使用AIX2dos或dos2AIX命令

如将DOS格式的文本文件转换为AIX格式,可用命令A:dos2AIX inputfile outfile,反之可用命令:AIX2dos inputfile outfile,关于dos2AIX和AIX2dos命令的详细用法可参阅"dos2AIX -h "和"AIX2dos -h "。注意要使用这两个命令,必须首先安装文件集bos.pci。

6.如何解决某一PV上的VGDA与ODM库不一致的问题?

在系统维护过程中,因为操作错误或其他特殊原因,有可能使某一PV上的LVCB和VGDA与其对应的ODM库不一致,导致ODM库紊乱,对PV的有关操作无法进行,这时可采用如下两个AIX命令加以解决:

redefinevg -d hdisk_name vg_name

该命令以指定PV上的LVM信息重新定义给定VG的ODM库。

或:synclvodm -P -v vgname

该命令同步或重建给定VG的ODM库和LVM信息。

7.如何设置用户的文件大小限制?

在AIX系统中,用户使用系统资源是有一定限制的。如用户缺省可创建或扩展的最大文件为1G(参见/etc/security/limits: fsize = 2097151, fsize_hard=fsize 512-bytes blocks)。

如欲修改,可使用smit:

# smit chuser 选择用户,修改下面两项:

Soft FILE size [4194302]

# (2G,可根据需要设定)

Hard FILE size [4194302]

# (2G, 可根据需要设定)

用该用户身份登录,使用"ulimit -f "和"ulimit -Hf"可分别显示其fsize、fsize_hard的大小。

8、如何按文件大小排序列出一个文件系统下的文件?

当监控某一文件系统的空间使用情况时,如果该文件系统剩余空间较少或已使用空间增长较快,则有必要排序列出该文件系统中所有大于某一给定字节数的文件,以便进一步维护管理。为此,可用如下命令:

# find [filesystem_name] -xdev -size +[512-bytes bloks] -ls | sort -r -n -k7

以上所有命令在AIX4.3.3下全部测试通过。

第 7 楼:AIX环境如何找到活动最频繁的进程

1。下面命令输出中的'C'字段是一个进程的cpu-penalty值(0到120之间),值越大表明进程越活跃。

# ps alxw | sort +5 -n

2.显示前10个累计占用CPU时间的进程

#ps -e|head -n 1;ps -e|grep -v"TIME|0:"|sort +2b -3 -n -r|head -n 10

3。显示前10个当前占用CPU时间的进程

#ps -ef|head -n 1;ps -ef|grep -v"C|0:00"|sort +3b -4 -n -r|head -n 10

4。显示前10个占用CPU应用的进程

#ps gu|head -n 1;ps gu|grep -v"CPU|kproc"|sort +2b -3 -n -r|head -n 10

第 8 楼:AIX中查看用户对系统资源的使用情况

在AIX中可以通过打开acct功能来查看用户的资源使用情况,主要包括:用户连接情况、用户CPU使用情况、

磁盘使用情况和打印机使用情况等。具体的步骤(共7步)有:

1. 在/var/adm/acct目录下创建三个子目录:nite,sum,fiscal

2. 以root登录,到/var/adm目录下,执行/usr/lib/acct/nulladm wtmp pacct。

3. 通过在/etc/rc文件中添加两行(最后一行"exit 0"之上):

echo "Starting Process Accounting"

/usr/bin/su - adm -c /usr/lib/acct/startup

打开记帐功能。

4. 将/etc/filesystems中要加入磁盘记帐的文件系统相关节中的account值改成true

5. 修改/etc/qconfig文件,要加入打印机使用记帐的打印队列的描述节中添加一行,如: lp0:

device=dlp0

acctfile = /var/adm/qacct # 添加行

6. 修改cron,例/var/spool/cron/crontabs/adm文件:

10 23 * * 0-6 /usr/lib/acct/runacct 2> /usr/adm/acct/nite/accterr > /dev/null

0 23 * * 0-6 /usr/lib/acct/dodisk > /dev/null 2>&1

0 * * * * /usr/lib/acct/ckpacct > /dev/null 2>&1

15 4 1 * * /usr/lib/acct/monacct > /dev/null 2>&1

7. 如果要使用adm用户进行记帐管理,首先要给它分配密码,然后在PATH环境变量中包括/usr/lib/acct以方便命令执行。

完成这些步骤后,系统会在步骤一生成的目录下定期生成报告文件,记录各用户的资源使用情况。

第 9 楼:AIX的系统备份和恢复

备份和恢复是系统管理员经常要做的事情, 主要包括rootvg备份和用户数据备份.

1. 操作系统和系统程序的备份:

将一盘新磁带或无用磁带插入磁带机

#tctl -f /dev/rmt0 rewind

#smit mksysb

在"备份设备或文件"中添入"/dev/rmt0"后回车.

系统会运行很长时间, 等到屏幕显示OK后拿出磁带. 这时候, 系统备份完成. 注意: mksysb仅备份rootvg中已安装的文件系统.

2. 用户数据备份

· 常用磁带机选项

/dev/rmt0: 若选择/dev/rmt0, 在插入磁带和写完一次磁带时, 磁带机都将磁带反绕到头. 因此, 下一次备份文件将覆盖本次备份.

/dev/rmt0.1: 若选择/dev/rmt0.1, 则插入磁带和写完一次磁带时, 磁带机均不反绕磁带. 因此, 一盘磁带可以连续备份几个文件或文件系统.

· #smit fs

选择"备份文件系统"

添入要备份的"文件系统名称"

添入"/dev/rmt0.1"

重复上述操作即可在同一盘磁带上备份多个文件系统.

3. rootvg的恢复

· 启动机器进入维护模式

参见安装手册, 当出现"Welcome to Base Operating System Installation and Maintanence"时,

选3 "Start Maintenance Mode for System Recovery"

· 恢复系统

继续选4 "Install from a System Backup"

出现"Choose mksysb Device"画面, 选"/dev/rmt0"并插入磁带后回车.这时候, 系统自动恢复操作系统.

4. 用户数据恢复

#tctl -f /dev/rmt0 rewind

#smit fs

选择"恢复文件系统"

添入"设备名称"和"目标目录"

系统会自动找到相应目录恢复.

第 10 楼:AIX如何自动启动和关闭软件的运行?

本文档讨论了如何定制系统, 以使用户定义的应用在系统引导过程中自动启动, 并在系统关闭时自动停止.

1. 自动启动定制的软件

在系统引导时, init进程顺序检测/etc/inittab文件, 决定在引导过程中进行什么样的操作.如果应用, 进程或其它的用户操作需要在系统引导过程中进行, 则要在/etc/inittab文件中加入相应的条目.通常的做法是创建一个名为rc.local的脚本文件, 将所有要在系统引导过程中启动的用户应用写入该脚本文件中. 该脚本文件可以在/etc/inittab文件中被调用, 通常是在所有系统应用和服务启动后, 在用户登录被允许之前被调用. 位置通常是在主控登录的条目前.

下面是一个例子:

rc.local:2:wait:/etc/rc.local > /dev/console 2>&1

在上面的条目中, init将在执行余下的条目之前等待该脚本程序的完成.如果进程, 应用或命令需要通过特定的用户运行, 则可在运行的命令中加入su命令.

如: su myuser "-c /usr/bin/myapp"

建议在脚本程序中加入应用开始启动和完成启动的输出提示.

如:

#!/bin/ksh

echo "Starting User Applications...."

echo "Starting Application XYZ"

su myuser "-c /usr/bin/myapp"

echo "Startup of User Applications completed"

2. 自动停止定制的软件

shutdown命令用于关闭AIX系统. 在此操作中会关闭所有AIX子系统及文件系统.如果名为/etc/rc.shutdown的脚本程序存在, 系统会首先执行该脚本程序中的命令. 在该脚本程序中可以加入关闭用户应用的命令. 建议在脚本程序中加入应用停止运行和完成停止运行的输出提示. 如:

#!/bin/ksh

echo "Stopping User Applications...."

echo "Stopping Application XYZ"

[ commands to stop application ]

echo "Shutdown of User Applications completed"

第 11 楼:如何查看操作系统中是否安装了某个补丁程序?

使用命令:

lslpp -Bl Uxxxxxx

Uxxxxxx 是补丁程序的ID.

例: lslpp -Bl U465241 命令可用于查看系统中是否安装了ID为U4652241的补丁程序.

第 12 楼:如何检查AIX文件系统的病毒?

#virscan directory

例如: virscan /usr

第 13 楼:AIX如何解决"device busy"问题

当我们对网络或网卡进行操作时,经常会遇到"device busy", 而不让我们进行操作. 例如:

rmdev -l ent1

Method error (/etc/methods/ucfgdevice):

0514-062 Cannot perform. the requested function because the

specified device is busy.

1.首先我们要确认网络接口已经"down"及 "detached".

使用以下脚本文件可以"down"及"detach"所有TCP/IP网络接口.

interfaces=`lsdev -Cc if -F name | grep -v lo0`

for interface in $interfaces

do

ifconfig $interface down

ifconfig $interface detach

done

2. 检查是否下列应用正在运行:

1) SNA : lssrc -g sna (检查SNA是否运行)

stopsrc -g sna(中断)

stopsrc -f -s sna(强行中断)

如果以上两条命令都不起作用: /usr/bin/sna -stop sna -t forced

如果仍不能中断: /usr/bin/sna -stop sna -t cancel

2) IPX: ps -ef |grep npsd

ps -ef |grep sapd (IPX是否运行)

/usr/lpp/netware/bin/stopnps (中断)

3) Netbios: ps -ef | grep netbios (是否运行)

mcs0 unload (中断)

以上步骤对于大部分"device busy"问题都可解决.

第 14 楼:何为AIX 5L?

AIX 5L 是AIX的下一代产品(当前为AIX V4),它支持IBM POWER 和Intel 64位(IA-64)平台.―L‖ 指Linux affinity.

第 15 楼:使用命令行安装删除文件包

在AIX 中, 一般使用"smit"命令来安装和删除文件包,但有时经常会遇到"smit"本身被破坏的情况, 我们可以使用"installp"命令来安装及删除文件包.

安装: installp -ac -Q -d /dev/cd0

删除: installp -u

第 16 楼:何为AIX/Montery

AIX/Monterey是IBM下一发展阶段的UNIX操作系统,其中AIX核心为Intel系统带来了极易扩展、高度可用、具有业界非凡实力的UNIX操作系统所具有的全部优势。AIX/Monterey是一项主要的UNIX操作系统方案的成果,该项方案由IBM领导,并与SCO和Intel合作,获得了业界领先的软件和系统厂商的广泛支持。AIX/Monterey是一个大规模的企业级UNIX操作系统,目前运行于各种Intel 32位体系架构(IA-32)及POWER体系架构之上。该产品将于今年晚些时候扩展到IA-64这一Intel的64位体系架构。AIX/Monterey所支持的系统十分广泛,包括从部门级服务器到大型数据中心服务器。AIX/Monterey融合了多种操作系统的最佳特性,包括AIX系统、IBM的DYNIX/ptx,以及SCO的UnixWare,其中DYNIX/ptx来自Sequent,运行NUMA-Q,而UnixWare则是当今运行于Intel平台上的最大份额的一种UNIX操作系统。今年晚些时候,对于那些偏爱基于Intel64位Itanium3系统的客户而言,IBM将为其提供AIX/Monterey/64,使其拥有与运行于RS/6000上的AIX同样强大的功能。AIX/Monterey则将继续满足客户对跨越各种基于Intel和POWER的系统、行业性强的企业级UNIX平台的需求。我们将在AIX/Monterey中构建强大的Linux兼容性,以帮助使Linux应用在AIX/Monterey上得以轻松实现,并帮助推动AIX/Monterey应用运行于未来版本的Linux之中。应用的可移植性有望比Linux的成熟提前实现,这将为客户的顺利过渡提供坚实的基础。另外,我们还将与开放源码团体共同合作,将AIX/Monterey技术应用于Linux之中,以便帮助建立起一种更好的Linux系统。

IBM完全能够帮助客户适应Linux的发展,其所具备的出众能力是其它任何UNIX厂商都无法企及的。对于运行于AIX/Monterey这一功能强大的全新操作系统之上的应用而言,IBM计划使其在未来能够轻松地移植到Linux中,并帮助客户保护其在硬件、应用、数据、过程和技术等方面的投资,因此,现今投资AIX/Monterey的客户可以充满自信地应对Linux的不断发展。

第 17 楼:如何查找系统中的某个文件存在于哪个文件集中?

当操作系统上由于未安装特定的文件集而无法执行某个命令时, 可以参考下面的方法确定所需的文件集.

首先确认系统中已安装了文件集 bos.content_list:

# lslpp -l bos.content_list

然后用下面的命令查找与指定文件相关的文件集:

# /usr/sbin/which_fileset

如, # /usr/sbin/which_fileset iostat

/usr/bin/iostat bos.acct

查找指定的文件集中包含哪些文件:

# lslpp -f

如, # lslpp -f bos.acct

....

/usr/bin/iostat

....

第 18 楼:如何减小 /var/adm/wtmp 文件的大小?

文件 /var/adm/wtmp 的大小会在每次用户登录时增长, 但从不自动减小. wtmp 文件的内容会被命令 last 使用, 用于显示登录系统和重启机器的情况.该文件不能被删除, 但它的内容可用如下命令清除:

# > /var/adm/wtmp

第 19 楼:AIX使用异步I/O(aio)提高系统性能

如果是同步I/O,当一个I/O操作执行时,应用程序必须等待,直到此I/O执行完.

相反,异步I/O操作在后台运行,I/O操作和应用程序可以同时运行,提高了系统性能.

使用异步I/O会提高I/O流量,如果应用是对裸设备进行操作,这种优势更加明显.

因此象数据库,文件服务器等应用往往会利用异步I/O,使得多个I/O操作同时执行.

1. 如何知道是否需要异步I/O?

* 执行命令:"vmstat # #" 如果"wa"值超过25%.

* 执行命令:"iostat # #" 如果"%tm_act"值超过35%.

2. 查询有几个AIO服务器: pstat -a | grep aios | wc -l

3. 应该设几个AIO服务器?

一般为硬盘数的10倍,但不要超过80.

4. AIO驱动程序: bos.rte.aio

5. 配置AIO为可用: # smit chgaio ->

STATE to be configured at system restart [available]

第 20 楼:AIX如何管理Paging Space

Paging Space 的大小应符合应用的需要.太大会浪费硬盘空间,太小会影响系统的运行.Paging Space的确定原则: 1. 系统实际内存小于64MB, paging space= 2 * RAM

2. 系统实际内存在 64MB to 256MB 之间, Page Space = RAM size + 16MB

3. 系统实际内存大于 256MB , Page Space = 512 + ( RAM - 256 ) * 1.25

4. 对于AIX 4.3.3 当内存达到4GB 到8GB,因为AIX 4.3.3 使用延迟的(deferred )paging space.Paging Space主要根据应用的要求来定.

一般可初始3GB, 然后观察paging space的使用情况,如果使用率超过70%, 则需要增加paging space.

以上计算方法只是粗略地算法,用户可根据实际情况调整.

* 如果系统出现以下几种情况,则说明需要扩大paging Space: 1. 下列任意错误信息之一: INIT: Paging space is low

ksh: cannot fork no swap space

Not enough memory

Fork function failed

fork () system call failed

Unable to fork, too many processes

Fork failure - not enough memory available

Fork function not allowed. Not enough memory available.

Cannot fork: Not enough space

2. 使用命令" lsps -a" ,其结果%USED 列的平均值大于80%.

3. 使用命令"lsps -s" 其结果%USED 列大于80%.

* 使用下列命令也可以检查paging space是否够用:

iostat

vmstat

lsps

第 21 楼:如何在AIX 4.3中安装联机手册?

使用联机手册之前,需安装相应的软件包。

解答 AIX 4.3 安装介质包含两张联机文档光盘(Documentation CD): Base Documentation CD 和 Extended Documentation CD。使用命令man查看系统命令之前

需要按照下列步骤安装相应的软件包: 1. 正确设置环境变量LANG的值,如―en_US‖为英文环境,―zh_CN‖为简体中文环境。可以用命令

export LANG=en_US

设置。

2. 使用man查看系统命令之前必须安装下列软件包:

bos.html.en_US.topnav.navigate - Top Level Navigation

bos.html.en_US.nav - Online Navigation

bos.html.en_US.cmds.cmds1 - AIX Commands Reference 1

bos.html.en_US.cmds.cmds2 - AIX Commands Reference 2

bos.html.en_US.cmds.cmds3 - AIX Commands Reference 3

bos.html.en_US.cmds.cmds4 - AIX Commands Reference 4

bos.html.en_US.cmds.cmds5 - AIX Commands Reference 5

bos.html.en_US.cmds.cmds6 - AIX Commands Reference 6

使用命令

lslpp -l

检查上述软件包是否已经安装。

3. 如果需要查询AIX 系统调用及C语言库函数,则要安装软件包 bos.html.en_US.techref.base - AIX Base Tech Ref

bos.html.en_US.techref.commo - AIX Commo Tech Ref

4. Documentation CD中还包含许多其它的手册,可根据需要安装相应的软件包。

在AIX系统中安装软件包可使用smit管理菜单。在命令行输入

smit install_all

选择:

1. CD-ROM 设备(通常为/dev/cd0)。

2. 将光标移至"SOFTWARE to install" 并按下或―+7‖。

3. 将光标移至要安装的软件包并按下 或 ―+7‖选择要安装的软件包。

4. 选中所有要安装的软件包后按?lt;Enter> 开始安装,之后需再次按下确认后继续安装,直至成功。

此时就可以使用man查看系统命令了!

第 22 楼:如何在AIX中设置中文环境

环境

平台:RS/6000

软件版本: AIX 4.2 或更新版本

在AIX中使用中文有两种途径:第一是在安装AIX时选择中文语言,装好的系统自动显示中文(这种方法不推荐使用,它没有第二种方法使用起来灵活)。第二是安装AIX时选择英文,系统启动后手工设置中文环境,方法如下:

1. 将AIX系统盘的第一张光盘放入光驱;

2. 运行命令:

smitty

--> System Environments

--> Manage Languange Environment

--> Change/Show Primary Language Environment

--> Change/Show Cultural Convention, Language, or Keyboard

在随后显示的菜单中将光标分别移到以下字段:

Primary CULTURAL Convention

Primary LANGUAGE translation

Primary KEYBOARD

按下,从弹出的菜单中选择―IBM-eucCN‖将上述字段改为简体中文,按下回车键后系统自动从光盘安装中文环境软件包。此操作完成后重新启动系统,操作界面即为简体中文。 需要输入中文时使用下列功能键切换输入方法:

AIX 4.3.3 以前的版本: + F1 --- + F4 切换到各种中文输入方法;

右 --- 切换到英文输入;

AIX 4.3.3: CTRL + [F2] : 智能 ABC ;

CTRL + [F4] : 拼音输入;

CTRL + [F5] : 五笔输入;

CTRL + [F6] : 郑码输入 ;

CTRL + [F7] : 表形码输入;

CTRL + [F9] : 内码输入;

CTRL + [F10] :英文半角;

此外,AIX还包含另外两种中文环境,即―UTF8‖和―GBK‖,它们与―IBM-eucCN‖之区别在于包含了繁体汉字的使用。上述三种中文环境的设置方法均相同。

第 23 楼:AIX 的许可权限---ACL

ACL是对标准权限位的扩展。通过修改分配给个人或组的标准权限,对每个文件或目录进行更精细的控制。对每个组或用户,有3种权限分配情况:

PERMIT : 准许对文件或目录的特定权限。

DEMY : 限制对文件或目录的特定权限。

SPECIFY : 明确地定义文件或目录权限。

"acledit "命令用于建立ACL。首先必须设置文本编辑器.如:export EDITOR=/usr/bin/vi。 然后使用:acledit file_name

屏幕上将会显示:

attributes:

base permissions

owner (rcunning): rwx

group (staff): r—

others: ---

extended permissions

disabled

要设置扩展的权限,将―disabled ‖设置改为―enabled‖:

extend permissions

enabled

使用permit、deny 或specify关键字来定义扩展权限。前面的例子表明只有所有者能对这个文件写操作。组成员能读此文件而其他用户则没有任何许可权限。如果要使用户" joe"能够读写这个文件,用以下命令:

extended permissions

enabled

permit rw- u: joe.

要允许组用户joegroup读这个文件,用以下命令:

rermit r-- g: joegroup

你能够通过在同一行中合并多个条目来对权限进行微调。如果只想为pete提供读写权,而他是系统组的一部分,则用以下命令:

permit rw- u: pete, g: system

要为几个用户或组增加许可权限,则使用分行命令 :

permit rw- u: joe

permit rw- u: pete

使用" ls -el"命令,查看ACL是否已在文件中设置。如"ls -el profile"命令显示:

— rwxw--------+

最后的+表示文件已具 有有效的ACL 。

注意:使用有数字争议的chmod 命令将使文件或目录的ACL无效。

第 24 楼:AIX管理经验谈

在AIX中可以通过打开acct功能来查看用户的资源使用情况, 主要包括: 用户连接情况、用户CPU使用情况、磁盘使用情况和打印机使用情况等。 具体的步骤(共7步)有:

1. 在/var/adm/acct目录下创建三个子目录:nite,sum,fiscal

2. 以root登录,到/var/adm目录下,执行/usr/lib/acct/nulladm wtmp pacct。

3. 通过在/etc/rc文件中添加两行(最后一行"exit 0"之上):

echo "Starting Process Accounting" /usr/bin/su - adm -c /usr/lib/acct/startup 打开记帐功能。

4. 将/etc/filesystems中要加入磁盘记帐的文件系统相关节中的account值改成true

5. 修改/etc/qconfig文件,要加入打印机使用记帐的打印队列的描述节中添加一行, 如: lp0: device=dlp0 acctfile = /var/adm/qacct # 添加行

6. 修改cron,例/var/spool/cron/crontabs/adm文件:

10 23 * * 0-6 /usr/lib/acct/runacct \

2> /usr/adm/acct/nite/accterr > /dev/null

0 23 * * 0-6 /usr/lib/acct/dodisk > /dev/null 2>&1

0 * * * * /usr/lib/acct/ckpacct > /dev/null 2>&1

15 4 1 * * /usr/lib/acct/monacct > /dev/null 2>&1

7. 如果要使用adm用户进行记帐管理,首先要给它分配密码,

然后在PATH环境变量中包括/usr/lib/acct以方便命令执行。

完成这些步骤后,系统会在步骤一生成的目录下定期生成报告文件,

记录各用户的资源使用情况。

第 25 楼:AIX简介

AIX 全名为(Advanced Interactive Executive),它是IBM 公司的UNIX操作系统, 整个系统的设计从网络、主机硬件系统,到操作系统完全遵守开放系统的原则。 下面对AIX 作以介绍。

RS/6000 采用IBM 的UNIX操作系统-AIX作为其操作系统。这是一

个目前操作系统界最成功,应用领域最广,最开放的第二代的UNIX系

统。它特别适合于做关键数据处理(CRITICAL)。

AIX 包含了许多IBM 大型机传统受欢迎的特征,如系统完整性,系统可管理 性和系统可用性。

在 AIX 操作系统上,有许多的数据库和开发工具,用户除了选用已有的应用 软件外,还可以根据各自的需要进行开发。

此外,在AIX 之上,有一组功能强,使用方便的系统管理工具。对于异种平台 互存,互操作有很成熟的解决方案。

由于该 UNIX 的先进的内核技术和最好的开放性,因此,虽然RS/6000

从宣布到今天只有短短的5 年多的时间,它已在各行各业有了广泛的运用,

并在1993和19xx年连续二年在MIDRANGE商用 UNIX 领域处于第一位。

RISC SYSTEM/6000的操作系统是AIX ,它是性能卓越的、开放的

UNIX,汇集了多年来计算机界在UNIX上的研究成果,以IBM 在计算机

体系结构、操作系统方面40多年极其丰富的经验。最大限度的使用RISC

技术,安装了象AIX 这样的具备工业界实力的UNIX操作系统。

它既可连接SAA 体系结构,又能与非IBM 系统的网络相连,因此,可以

和多数专业银行现有的系统实现互连,这对今后业务系统拓展将带来极大的

灵活性,并降低投资。

AIX 遵循一系列的国际标准:

* IEEE POSIX1004.1-1990

* X/OPEN 移植指南ISSUE3的基本级(XPG3)

* AES/OS REVISION A (OSF/1 LEVEL 2 资格)

* FIPS 151-1

* AIX的编译器: XLC、C++(可选)、FORTRAN(可选)、PASCAL(可选)、COBOL(可选) * ADA 的编译器已达到XPG3―成员‖级的认可。

* AIX 支持多用户、多任务。

AIX有一些其它特性包括:

AIX 提供了3 种SHELL :SYSTEM V的KORN、BOURNE SHELL和4.3BSDC SHELL作为可选择的UNIX系统界面;

安全设施满足TCB (Trusted Computing Base)的C2级;

实时处理能力,这对于―面向交易‖的应用至关重要(如零售业

和银行等),它使RS/6000 获得极高的响应和吞吐量;

虚拟存储管理,当需要时,可将一些不常用的模块转送至外存,

提高内存的可利用性。

先进的文件系统,使得系统管理更加有效,并提高了数据可靠性

以及完整性。

能兼容DOS 应用程序和数据。

InfoExplorer,快速信息超文本索引系统- 不仅包括文字,而且

对包含声音、图像的索引系统,这是个联机的文件接口。包括全部的

超文本的索引和查找,以及面向任务和坐标的多重导引和索引系统。

这个文字及图形索引系统以一个灵活的、基于任务的方式去使用详细

资料及培训资料。

高级系统管理工具(SMIT,System Management Interface Tool)。

提供一级菜单驱动程序,诸如完成软件的安装与设置、设备的设置及

管理、问题的测定、存贮管理等。可以自动地进行I/O 设备设置,

ASCII 终端也可充当系统控制台。在LAN 上可以进行远程系统的安装。

第 26 楼:AIX网络诊断及解决现场实例

AIX网络诊断及解决现场实例

/作者:viperonline 发表于:2004-05-12 20:55:52

问题:有两台aix的测试机器,一台做应用,一台做数据库,都在同一个网段下(无双机),其中应用网络没有问题,而数据库这台网络有问题,内网下载只有30几K。

解决方法:对比法

由于这两台机器属于同一网段,机型完全一样,可以将两台机器的网络设置进行细致的对比,看看有何差异,然后改之。

使用netstat -v ent0 | grep -p "Specific Statistics"命令分别查看两台机器

应用:

netstat -v ent0 | grep -p "Specific Statistics"

10/100 Mbps Ethernet PCI Adapter II (1410ff01) Specific Statistics:

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

Link Status: Up

Media Speed Selected: Auto negotiation

Media Speed Running: 100 Mbps Full Duplex

Receive Pool Buffer Size: 1024

Free Receive Pool Buffers: 1024

No Receive Pool Buffer Errors: 0

Receive Buffer Too Small Errors: 0

Entries to transmit timeout routine: 0

Transmit IPsec packets: 0

Transmit IPsec packets dropped: 0

Receive IPsec packets: 0

Receive IPsec packets dropped: 0

Inbound IPsec SA offload count: 0

Transmit Large Send packets: 0

Transmit Large Send packets dropped: 0

Packets with Transmit collisions:

1 collisions: 0 6 collisions: 0 11 collisions: 0 2 collisions: 0 7 collisions: 0 12 collisions: 0 3 collisions: 0 8 collisions: 0 13 collisions: 0 4 collisions: 0 9 collisions: 0 14 collisions: 0 5 collisions: 0 10 collisions: 0 15 collisions: 0 数据库:

netstat -v ent0 | grep -p "Specific Statistics"

10/100 Mbps Ethernet PCI Adapter II (1410ff01) Specific Statistics: --------------------------------------------------------------------

Link Status: Up

Media Speed Selected: 100 Mbps Half Duplex

Media Speed Running: 100 Mbps Half Duplex

Receive Pool Buffer Size: 1024

Free Receive Pool Buffers: 1024

No Receive Pool Buffer Errors: 0

Receive Buffer Too Small Errors: 0

Entries to transmit timeout routine: 0

Transmit IPsec packets: 0

Transmit IPsec packets dropped: 0

Receive IPsec packets: 0

Receive IPsec packets dropped: 0

Inbound IPsec SA offload count: 0

Transmit Large Send packets: 0

Transmit Large Send packets dropped: 0

Packets with Transmit collisions:

1 collisions: 233543413 6 collisions: 0 11 collisions: 0 2 collisions: 0 7 collisions: 0 12 collisions: 0 3 collisions: 0 8 collisions: 0 13 collisions: 0

4 collisions: 0 9 collisions: 0 14 collisions: 0

5 collisions: 0 10 collisions: 0 15 collisions: 0

仔细对比发现数据库这台显然是双工模式与应用这台不同,应用的机器是自适应的,运行时是100M全双工模式,而数据库的机器限制为100M半双工模式,现在就是要将数据库这台改成与应用一样

更改双工模式的命令为smitty chgenet

但是在此之前要将需要更改的网卡down掉,以及所有经过此网卡的服务停止

步骤如下:

ifconfig -a

输出:

en0:

flags=5e080863,80<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD,PSEG,CHAIN>

inet 10.100.10.6 netmask 0xffffff00 broadcast 10.100.10.255

再输入:

ifconfig en0 down

ifconfig en0 detach

smitty chgennt

输出:

[Entry Fields]

Ethernet Adapter ent0

Description 10/100 Mbps Ethernet PCI Adapter II (1410ff01) Status Available

Location 1L-08

Transmit descriptor queue

size [512] +#

Receive descriptor queue

size [512] +#

Software transmit queue

size [8192] +#

Receive buffer pool

size [1024] +#

Media

Speed Auto_Negotiation + IPsec Offload no + Enable hardware transmit and receive

checksum yes +

Enable TCP Large Send

Offload no +

Enable Link Polling no + Time interval for Link

Polling [500] +#

Enable ALTERNATE ETHERNET

address no +

ALTERNATE ETHERNET

address [0x000000000000] + Apply change to DATABASE

only no +

更改之后需要重新设置默认网关(原来的会丢失)

smitty tcpip

Minimum Configuration & Startup

输出:

HOSTNAME [TEST1-CRM-APP-CLS]

* Internet ADDRESS (dotted decimal) [10.100.10.6]

Network MASK (dotted decimal) [255.255.255.0]

* Network INTERFACE en0

NAMESERVER

Internet ADDRESS (dotted decimal) []

DOMAIN Name []

Default Gateway

Address (dotted decimal or symbolic name) [10.100.10.1]

Cost [0] Do Active Dead Gateway

Detection? no

Your CABLE

Type N/A START TCP/IP daemons

Now no

最后将网卡启用

ifconfig en0 up

问题得到解决!!!!

我的主页:/index.html

第 27 楼:IBM巡检流程

1、检查系统硬件情况:设备故障灯是否有亮

2、系统错误报告(errlog)

3、有否发给root用户的错误报告(mail)

4、检查hacmp.out,smit.log,boot.log

5、关键系统的文件使用率不大于80%

6、逻辑卷有否stale

7、内存交换区使用率是否超过70%

8、内存交换区的大小是否为物理内存的1.5倍 + + + #

9、检查备份情况(有否系统备份、用户数据备份、磁带机是否需要清洗)

10、通信(网卡、IP、路由表、ping、/etc/hosts、DNS设置等)

11、是否有数据保护方式如RAID10/RAID5,是否有Hot spare

12、系统DUMP设置是否正确

13、检查系统参数是否正确

1)/etc/enviroment中的TZ不能有夏时制

2)如有数据库:Aio:available

3)HACMP中I/O pacing:High Water Mark/Low Water MArk:33/24

4)HACMP中Syncd:10

5)HACMP中Power Monitorff

14、检查rootvg是否有镜象

15、检查errdemon,srcmstr是否正常运行

16、机房环境(电压、湿度)

17、系统性能:有否性能瓶颈(topas,vmstat)

18、补丁程序(PTF)、微码(是否需要升级)

19、HACMP测试:Cluster Verification

20、系统硬件诊断

21、运行#snap -ac,生成文件snap+s/n.pax.Z

22、机器清洁

注:1~15为A类维护(季度维护),16~18为B类维护(半年维护),19~22为C类维护(年度维护)

我的主页:/index.html

第 28 楼:AIX Useful Commands

compress -c file.txt > file.Z Create a compressed file.

uuencode (infile) (extract-file-name) > (output file)

Converts a binary file to an ASCII file for transfer by modem or email

uudecode (encoded file)

Extracts a binary file from encoded file and calls it the extract-file-name

examples :-

uuencode maymap maymap > maymap.enc

uudecode maymap.enc

od -c /tmp Displays contents of the /tmp directory file

ls -i Lists files with their inode numbers

echo * Lists files, can be used if ls is corrupt/missing

chtz (timezone eg GMT0BST) Changes the timezone in /etc/environment file chlang (language eg En_GB) Changes the language in /etc/environment file ar -v -t (archive file) List contents of an archive

ar -v -x (archive file) Extracts the archive

ar -v -t /usr/lib/libC-r.a Lists contents of the libC_r.a library

find /source -print | cpio -pdm /target

Copying directories using cpio, creates /target/source directory.

dump -nTv (binary executable) Displays the contents of an executable file dump -c Displays string information

dump -o Displays object file headers

dump -l Displays line numbers

dump -s Displays the text section

snap -ao /dev/rmt0 Create a snapshot onto tape

snap -ad (directory) Create a snapshot into a named directory other than the default (/tmp/ibmsupt)

/usr/dt/bin/dtconfig -d Disables desktop logins

/usr/dt/bin/dtconfig -e Enables desktop logins

/var/dt/Xpid PID of the dtlogin process

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

LICENSES / SOFTWARE INSTALLATION

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

lslicense Displays number of current user licenses

chlicense -u (number) Changes the number of user licenses

( ftp,rexec and rsh (without -i flag) do not need an AIX user license to be able to access the system.

oslevel Returns operating system level

4 . 3 . 3 . 0 <--------- Preventive Maintenance Level

| | |

| | +----------------Modification

| +--------------------Release

+------------------------Version

oslevel -l 4.3.3.0 Displays all filesets that are "downlevel" whence (program) Returns full path of program

whereis (program) Returms full path of program

what (program) Displays identifying info from the executable like version number, when compiled.

lslpp -L all list all installed software

lslpp -L (program set name) Check if software installed

lslpp -f Lists filesets vs packages

lslpp -ha Lists installation history of filesets

lslpp -w /usr/bin/swapon Lists the fileset that the file belongs to lppchk -c Checks file checksums against SWVPD lppchk -l Checks symbolic links against SWVPD

instfix -ik (fix number eg IX66617) Checks id fix is installed

instfix -ik 4330-02_AIX_ML

instfix -i | grep ML Displays all ML's installed

instfix -k IX38794 -d /dev/cd0 Installs a fix from cdrom

/usr/sbin/install_assist Smitty Installation Assistant

/usr/sys/inst.images/sys.bundles Software bundle files

alt_disk_install -c hdisk1 Clones a running rootvg onto hdisk1 alt_disk_install -w Wakes up alt vg

alt_disk_install -s Sends alt vg to sleep !

alt_disk_install -x Removes alt vg from disk

/usr/lpp/bosinst/blvset -d /dev/hdisk0 -p 4.2

Resets the pad string in the BLV to the correct AIX version. Needed if the migration option is missing when installing.

installp -ad (device) (fileset) (level) Install apply and commit fileset installp -pad (device) (fileset) (level) Preview install

installp -u (fileset) Remove fileset

installp -ld (device) List all software on device

example:-

installp -pad /dev/rmt0 X11.base 4.3.3.0

installp -C Cleans up after a premature cancel or interrupted installation. --------------------------------------------------------------------------------

TERMINALS / DISPLAYS

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

/usr/share/lib/terminfo Directory with all support terminal info files. tty Displays what the tty/pty number of the terminal is.

termdef reports the termtype setup in smit for the tty port

that termdef is run on.

chdev -l (device eg tty1) -a term=vt100 Sets tty to a vt100 terminal type penable tty0 adds getty line into /etc/inittab for tty0 and starts getty pdisable tty0 disables the getty line and disables getty

penable / pdisable -a option is for all

stty erase ^? Set backspace key for vt100 terminals

stty erase ^H Set backspace key for wyse50 terminals

lscons Displays the console device

chcons -a login=enable (device eg /dev/tty1) Changes the console device lsdisp Display adapter device information

chdisp Change default display used by LFT subsystem

Create ttys on ports 0 to 7 on adapter sa2 :-

for i in 0 1 2 3 4 5 6 7

do

mkdev -c tty1 -t tty -s rs232 -p sa2 -w$i -a login=enable -a term=vt100 done

portmir -t /dev/tty0 Mirror current terminal onto /dev/tty0

portmir -o Turns off port mirroring

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

NETWORK

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

host (ip or hostname) Resolves a hostname / ip address

hostname Displays hostname

hostname (hostname) Sets the hostname until next reboot

lsdev -Cc if Lists all available/defined network interfaces

chdev -l (device name) -a hostname=(hostname) Changes hostname permanently chdev -l inet0 -a hostname=thomas

ifconfig (device name) Displays network card settings

ifconfig (device name) up Turns on network card

chdev -l (device name) -a state=up Turns on network card

ifconfig (device name) down Turns off network card

ifconfig (device name) detach Removes the network card from the

network interface list

ifconfig en0 inet 194.35.52.1 netmask 255.255.255.0 up

ifconfig lo0 alias 195.60.60.1 Create alias ip address for loopback

route (add/delete) (-net/-host) (destination) (gateway)

Adds or deletes routes to other networks or hosts, does not update

the ODM database and will be lost at reboot.

route add -net 194.60.89.0 194.60.90.4

chdev -l inet0 -a "net,-hopcount,1,-netmask,255.255.255.0,207.156.168.0,10.0.15.254" (destination) ( gateway

Adds route and adds entry into ODM, route survives a reboot,

route -rn Display route table

odmget -q "attribute=route" CuAt Displays routes in the ODM.

lsattr -EHl inet0 Displays routes set in ODM and hostname

odmget -q "name=inet0" CuAt Displays routes set in ODM and hostname refresh -s inetd Refresh inetd after changes to inetd.conf

kill -1 (inetd PID) Refresh inetd after changes to inted.conf

netstat -i Displays interface statistics

entstat -d (ethernet adapter eg en0) Displays ethernet statistics

arp -a Displays ip to mac address table from arp cache

no -a Displays network options use -o to set individual options or

-d to set individual options to default.

no -o ption=value (this value is reset at reboot)

no -o "ipforwarding=1"

traceroute (name or ipaddress) Displays all the hops from source to destination supplied.

ping -R (hostname or ipaddress) Same as traceroute except repeats. spray (hostname or ipaddress) Send a stream of packets to a host stopsrc -g tcpip Stops all running TCP/IP daemons

/etc/tcp.clean Stops all running TCP/IP daemons and removes all lock files

/etc/rc.tcpip Start all TCP/IP daemons.

Do not use startsrc -g tcpip as this will start all TCP/IP daemons including routed & gated

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

N.F.S.

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

exportfs Lists all exported filesystems

exportfs -a Exports all fs's in /etc/exports file

exportfs -u (filesystem) Un-exports a filesystem

mknfs Configures and starts NFS services

rmnfs Stops and un-configures NFS services

mknfsexp -d /directory Creates an NFS export directory

mknfsmnt Creates an NFS mount directory

mount hostname:/filesystem /mount-point Mount an NFS filesystem nfso -a Display NFS Options

nfso -o ption=value Set an NFS Option

nfso -o nfs_use_reserved_port=1

我的主页:/index.html

第 29 楼:BACKUPS

MKSYSB

------

mkszfile -f Creates /image.data file (4.x onwards)

mkszfile -X Creates /fs.size file (3.x)

mksysb -i (device of file) Creates a mksysb image

mksysb does not save any raw data and will not backup a filesystem that

is not mounted.

SAVEVG

------

savevg -if (device or file) (vg) Creates a savevg image

restvg -q -f (device or file) Restore from a savevg image

Ensure that the restvg command is run from /

mkvgdata (vg) Creates new vgname.data file

CPIO ARCHIVE

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

find (filesystem) -print | cpio -ocv > (filename or device)

eg find ./usr/ -print | cpio -ocv > /dev/rmt0

CPIO RESTORE

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

cpio -ict < (filename or d

AIX 20周年征文欣赏:《几种有用的AIX的日志系统》 作者:杜明 作为青岛港信息中心的系统管理员,自己有机会学习和接触到了众多的UNIX服务器产品,从早期的IBM J40到COMPAQ的ES40,20xx年港口因为对外宣传和业务发展的需要决定更新企业门户网站系统,在比较了COMPAQ、HP和IBM的相关UNIX服务器产品后最终决定采用IBM P660服务器作为门户网站系统的数据库和应用服务器,也从此开始了自己和IBM P系列服务器的不解之缘。

随后的几年随着生产的发展和IT技术的进步,港口又先后引进了IBM P650、P680、P550、P570等不同档次的多种机型,大大的提高了各应用系统的运行速度和可靠性。在长期的UNIX

系统建设和维护的过程中我切实感到IBM AIX操作系统的稳定和可靠,相对于其它UNIX系统更简便易学,具有更高的可操作性。但要干好系统维护的工作光靠培训和看书自学是不够的,更多的问题是在平时的工作中遇到的,书中往往没有现成的解决办法,需要自己结合理论做大量的实验才能得到答案的。

为方便日常的维护和监控,AIX为我们提供了大量的各种各样的日志系统,但每个日志存放的具体地方都不同,大家可以通过查看/etc/syslog.conf知道日志配置的具体情况。这些日志记录和监控的内容不一样,有些是系统默认开放的,有些是需要设置才可以打开的,但都给我们的工作带来了很大的便利。下面我将我平时常用到的一些系统日志总结一下,希望对大家的工作有所帮助。

1、系统错误日志

存放路径:/var/adm/ras/errlog

说明:该日志记录了系统所检测到的软硬件故障和错误,尤其对系统的硬件故障有很大的参考价值,是AIX提供的最有价值的日志之一, errlog 文件用more或者其他文本的查看命令来打开我们看到的只是一对乱码,为了能够查看错误日志文件需要使用aix的errpt命令,如:errpt 列信息;errpt –a列详细信息,详细使用方法可以参考man,

2、用户的登录日志

存放路径:/var/adm/wtmp /var/adm/sulog

说明:这些日志记录了用户登录和访问服务器的情况信息,具体的日志文件有wtmp、、sulog等,它们记录的分别是不同的事件,wtmp记录的是历史的login和lognout信息,可以用last命令访问。sulog记录的是用户用su命令转变为另一用户的信息。who、last等这些命令可以查看wtmp和sulog的内容

如:Last –f wtmp

我们想查看最近10次登录的用户和他们的地址,可以用如下命令:

last -10

3、集群管理软件hacmp的日志

存放路径:/tmp/hacmp.out

说明:HACMP是IBM提供的确保系统运行可靠性的集群套件,HACMP在每次启动和关闭时都要经历一段时间以停止服务和转换文件系统,我们可以通过对HACMP。OUT日志文件的跟踪实时的了解HACMP在启动和关闭时的信息,如出现启动失败则可以帮助我们定位错误。 可以使用tail进行跟踪,tail –f /tmp/hacmp.out

4、系统启动错误日志

存放路径:/var/adm/ras/bootlog

说明:该日志可以跟踪系统在Boot过程中发生的问题,包括服务器液晶板上的代码信息都有记载。可以使用alog命令监视这些问题, 存放在/var/adm/ras/bootlog中,可以使用alog –o –t boot命令查看该文件。

5、FTP用户操作日志

存放路径:自定义(建议/tmp/ftplog.out)

说明:很多服务器都会用到FTP功能,大量的用户通过FTP登陆到服务器上给系统的安全性带来了很大的问题,AIX给我们提供了一套很不错的可以记录用户FTP操作情况的日志。 具体设置步骤如下:

在/etc/inetd.conf文件中编辑 FTP 一行,在FTPD后加―-d‖

重启服务: refresh –s inetd

touch /tmp/ftplog.out

在/etc/syslog.conf文件中加上两行:

daemon:debug /tmp/ftplog.out

daemon:info /tmp/ftplog.out

重启服务: refresh –s syslogd

以上只是我在工作中主要用到的一些日志,只是AIX给我们提供了很多其他重要的日志文件中的一部分,大家可以在工作中慢慢体会。

相关推荐