EBS DBA指南笔记(三)

第五章 patchinghtml

 

patch的做用:解决应用代码的问题;安装新的特征;更新technology stack组件。打patch不是一个简单的过程,但咱们也不必深究里面每一个细节。java

EBS的patch分为两类:node

Oracle Applications patching:改变应用的代码程序web

Technology stack components patching:更新或修复oracle相关的软件,好比JDK,FORMS,REPORT,iAS。sql

这一章咱们主要讲第一类patch,第二类patch对OS的依赖性很大。数据库

 

1.Applications Patchingapache

打patch的几个重要步骤:缓存

a.Preparing to patch:注意看readme。安全

b.Applying patches:包括unbundling the patch,enabling maintenance mode, applying the patch with adpatch, and implementing manual steps。session

c.Monitoring and resolving patching issues:use log files and AD control utility监控patch worker processes。

d.Post-patching steps and cleaning up:验证补丁和清理打完补丁后不在须要的文件。

 

应用patch还能够继续分类:

One-off patch:针对特定的bug。

Minipack patch:one-off patch的集合,有时针对特定的模块。字母代号能够看出版本号,好比AD的版本,minipack patch会叫AD.I

Family Pack patch:minipack的集合,针对一组应用模块。一样字母代号也能看出版本号,好比HR套件J版本的patch:HR_PF.J

Maintenance Pack patch:family pack的集合,针对应用的一个更新版本。好比EBS 11.5.10就是一个maintenance pack。

这些patch的大小逐渐递增,复杂度也愈来愈高。

 

此外还有一些特定类型的patch:

Consolidated patch:合并的patch,由一系列one-off patch组成。

Interoperability patch:相互性patch,好比DB升级到10g,那么应用就须要这种类型的patch。

NLS patch:安装了多语言环境后,须要对特定的语言更新一些信息。

Rollup patch:一组one-off patch的集合,用来更新特定产品的代码级别。

Legislative patch:针对HR 顾客薪水册的一个patch。它包含多个国家不一样格式的数据(翻译的很差,呵呵)。

 

Preparing to patch: 必定要仔细阅读readme,它包含了全部的步骤和你须要注意的地方。特别是一些先决条件是否知足了,若是不知足须要按说明一步一步实施,直到条件知足。

注意:若是补丁已经打上了,如今想回退回去,这是不可行的。因此打补丁以前最好有个全系统备份。

建议用电子表格记录打patch的过程。

 

补丁报告:判断某个补丁是否已经布置上了,查询minipack,family pack的版本。咱们能够经过如下几种方法查询:

Using the adphrept.sql script

Executing the patchsets.sh utility

Querying the database

Using Oracle Application Manager (OAM)

 

Using the adphrept.sql script:$AD_TOP//patch/115/sql/adphrept.sql 这个SQL能够产生一个补丁报告。关于这个SQL的使用方法和参数可参见MetaLink Note 162498.1。也能够查看书的155页。这个脚本产生一个txt or html格式的报告。运行这个SQL须要用apps的帐号。As of Application Utility Minipack version I (AD.I), adphrept.sql no longer generates a text report, but rather an XML report is generated.

patchsets.sh utility:这个工具能够对patch版本进行比较。输出文件有三个字段分别为:Baseline Version: Running Version: Latest Available, Status:

Querying the database:查询ad_bugs表。里面有个bu_number字段。

use OAM: applied patches;patch wizard

 

打patch:打patch的几个步骤:

1. Download and unbundle the patch.

2. Identify patch drivers required for the patch.

3. Place the instance in maintenance mode.

4. Use the AD Patch utility to apply patch driver files.

5. Perform any manual steps that may be required.

adpatch必须是应用的属主才能运行。

 

Download and unbundle the patch:注意文件系统的空间。

Identifying Patch Drivers:c-copy driver,用来更新文件。d-database driver,用来更新数据库代码级别和对象。g-generate driver。 u-unified driver,是对前三种driver的整合。

Enabling Maintenance Mode:有两种方法:adadmin选择菜单;运行$AD_TOP/patch/115/sql/adsetmmd.sql with the ENABLE parameter  $AD_TOP/patch/115/sql/adsetmmd.sql with the DISABLE parameter

建议停应用在设置维护模式,若是在线设置维护模式,即便你禁止维护模式,仍是要重启应用才能解除维护模式。咱们能够用adpatch的hotpatch选项来打patch这样不用将instance置于维护模式。但oracle仍是建议置于维护模式后打patche这样能够提升打patche过程当中的性能。

use adpatch:在执行adpatch以前须要去掉应用或数据库的密码约束,以避免在建新用户的时候出错。adpatch有一些有用的选项能够经过adpatch help=y来查看。通用语法为:adpatch options=[option1, option2..]

经常使用的一些选项能够看书的162页。若是你打patch的数量较多,能够选择nocompilejsp,nocompiledb, noprereq, and novalidate选项,这样能够加速打patch的速度。在打patch结束的时候会编译JSP和DB对象,这时候将DB置为noarchive模式也能够是打patch的过程得到好的性能。切换到存放patch driver的路径而后运行adpatch。以后会问你一些问题。若是遇到不是u driver那么按c,d,g driver的顺序打。打patch的时候也能够不是交互式的,defaultsfile选项指定一个文件位于:$APPL_TOP/admin/$CONTEXT_NAME,这个选项一般用interactive=no的模式

 

Performing Manual Steps:当打patch的过程当中须要手工运行一些命令的时候,咱们能够编写一些脚本,这样不但会减小错误并且加快打patch的过程。

 

特殊的考虑:

Applying Legislative Patches:For Oracle Payroll customers, there is another category of patch required by the system. The hrglobal patch supports the legislative requirements of multiple countries.

hrglobal patch的打法跟普通patch有所不一样,请参考书的165页。

Using AD Merge:当要布置一组大patch的时候,好比maintenance pack,累积更新。咱们能够将多个patch合并成一个patch。这会使性能获得提升。把这些patch放到一个目录,而后用admrgpch进行合并。例如:

admrgpch /source_dir /target_dir   运行完成后在目标目录有个名为u_merged.drv的文件,这就是合并后的patch driver。详细的使用过程能够参考MetaLink Note 228779.1。关于admrgpch的一些经常使用选项请参考书的167页。

Applying NLS Patches:额外的语言环境须要NLS patch。多种语言的patch应该先打英文的patch。能够利用admrgpch来将英文的patch合并成一个patch,将非英文的合并成另外一个patch。

Performing Multi-Node Patching:若是是共享应用层的文件系统,patch将应用到全部节点。若是不是共享的应用层文件系统,那么每一个相关的文件系统都要布置补丁。详情参见MetaLink Note 233428.1    --describes sharing the application-tier filesystem.

 

监控和解决补丁的问题:

adpatch session有时会显示错误或者某个任务运行很长时间。这种状况咱们须要查看adpatch日志或者是相关联的work log file。咱们必须找到work失败的缘由,而后用adctrl继续patching的过程。

查看日志文件:日志文件的目录在$APPL_TOP/admin/$CONTEXT_NAME/log 日志文件名能够在打patch的过程当中指定。关于works 的日志命名通常为:adwork[xxx].log。xxx为patch worker process的编号。

使用AD Control:这是管理patch works的管理工具。当works出问题的时候,须要DBA用adctrl介入。adctrl在admin node上执行。“Skip Worker”这个选项在adctrl中是隐藏的。他的选项代号是8。使用这个选项最好在oracle support的支持下运行。AD.I这个版本,adctrl能够以非交互式的方式运行。这样能够加快补丁问题的解决。

解决worker失败的问题:If a worker has failed, the adpatch session will normally display a failedworker message。经过adctrl能够看到worker的状态。若是worker失败能够查看它的日志,若是worker的问题解决了,能够用adctrl从新运行worker。如下是在打patch的过程当中常常遇到的问题:

Error message: ORA-01013: user requested cancel of current operation

Resolution to error: If this error occurs, simply use adctrl to restart the

worker on the current machine.

Error message: Patch not applied successfully, adpatch did not cleanup

its restart files (*rf9).

Resolution to error: If this error occurs, execute the following as the

instance owner:

$cd $APPL_TOP/admin/$CONTEXT_NAME

$mv restart restart_old

$mkdir restart

After cleaning up the restart files, you may then restart the adpatch

session using adpatch.

Error message: ERROR: Javakey subcommand exited with status 1

Resolution to error: If this error occurs, the identity.obj file needs to

be re-created. See Chapter 2 for steps to recreate the identity.obj file.

Then, use adctrl to restart the failed worker.

Error message: No error message is displayed; rather the worker log file

states that the worker is complete, yet adctrl indicates that the worker is

still running.

Resolution to error: This patching problem occurs when the worker is

complete, but did not update patching tables correctly to notify the

adpatch session that it has finished. In this scenario, the adpatch session

is still waiting for the finish return code from the worker. When this

occurs, use adctrl to fail the worker, then restart the worker.

 

Tip Any form, library, or report that fails to generate during the patch process can be

regenerated manually after all patching and post-patching steps have completed. If the

object still fails to compile, open an SR.

 

打patch过程遇到问题须要注意的地方:a.打patch的时候hung住了,或者worker失败,但又找不到缘由。这时能够查看数据库的无效对象,若是无效对象较多,能够进行编译后在进行adpatch。

b.若是adpatch session hung了,其它的一些解决方法也执行过了。这时能够尝试重启DB。有时这种方法是必须的,好比打较大的patch(maintenance patch)

c.打补丁遇到错误的时候,可能须要打另外一个补丁来解决这个错误。

 

Post-Patching Steps:不少补丁到最后都会有这一步,这一步主要的动做以下:Typical post-patching steps include generating message files, regenerating JAR files, regenerating menu options, relinking

executables, recompiling invalids, and recompiling flexfields. 这个动做也能够用adadmin来完成。 打完patch后,须要检查dba_jobs看看有没有新的job,这个job是否是必须的。

 

Patching Cleanup:能够删除的文件:$FND_TOP/bin directory are files such as FNDSCH.sav and FNDSCH.xxxxx, where xxxx is a number. These files are copies of the FNDSCH file created by the patch utility.

$APPL_TOP下运行find命令找出这些文件:$find . -name "*.sav"  这些均可以安全的删除。 当有些文件你没法肯定是能删除时,最好作备份。删除后看应用是否正常。最后patch的原文件也能够删除。

 

2.Database Patching

注意添加opatch路径:export PATH=$PATH:$ORACLE_HOME/OPatch

打内部补丁:切换到补丁所在目录,$opatch apply                  查看DB打过的内部补丁:$opatch lsinventory

若是opatch失败,在$ORACLE_HOME/.patch_storage目录下有个patch_locked的文件,这个文件须要删除。

 

3. Patching Best Practices

oracle每季度发布一次关键patch。Technology stack components and product groups such as AD and FND are often prerequisites for future patches, such as Maintenance Packs and mandatory Family Packs.

 

 

 

第六章 Toolkit

1.EBS的一些工具和命令

应用各组件的启动关闭脚本:参见P178.由于存放启动关闭脚本的目录常常用到,因此咱们能够自定义一个环境变量,如:export SCRIPT_TOP=$APPLCOMN/admin/scripts/$CONTEXT_NAME

adstpall.sh and adstrtal.sh 这两个脚本能够定制。

 

2.修改应用,oracle,applsys,apps的密码

修改应用用户的密码能够进系统界面改:安全-》用户-》定义。也能够用FNDCPASS工具改。好比修改用户test的密码为hello:

$FNDCPASS APPS/APPS 0 Y system/manager USER test hello        --apps,system均须要正确的密码。

修改oracle用户的密码也能够用这个工具。好比修改AP这个用户的密码为passwd#1:

$FNDCPASS APPS/APPS 0 Y system/manager ORACLE AP passwd#1

修改applsys,apps的密码也是用这个工具。applsys,apps这两个用户的密码是同步的。举个修改apps密码为oracle#1的例子:

$FNDCPASS APPS/APPS 0 Y system/manager SYSTEM APPLSYS oracle#1

用FNDCPASS修改apps的密码后还须要作一些工做:运行autoconfig或者修改如下这些文件的apps密码:

$ORACLE_HOME/listener/cfg/wdbsvr.app

adcmctl.sh

$OA_HTML/bin/appsweb.cfg

$AD_TOP/admin/template/CGIcmd.dat (if in use)

注意:FNDCPASS的修改不一样类型用户密码的参数:USER,ORACLE,SYSTEM.

若是你想加密wdbsvr.app文件中apps的密码能够按如下步骤进行:

1. Set the following in the wdbsvr.app file: administrators = all

2. Comment out the following in the wdbsvr.app file: custom_auth

3. Restart the HTTP Server.

4. Go to the following URL:

http://[hostname.domain.com]:[port]/pls/admin/gateway.html

5. Edit the Applications DAD by entering the new APPS password.

6. Save the configuration. The password in the wdbsvr.app file is now

encrypted.

7. Set the following in the wdbsvr.app file: administrators=system

8. Set the following in the wdbsvr.app file: custom_auth=CUSTOM

 

3.从新连接应用执行文件。

有时,从新连接执行文件是必须的。好比:打patch的最后提交阶段;解决应用的执行问题。从新连接执行文件有两种工具能够完成:AD ADMIN; AD RELINK

AD RELINK: adrelink.sh force={y|n} [<optional args>] "<targets>" or  adrelink.sh force={y|n} [<optional args>] filelist=<file>

--"<targets>" is "<product> <module name>", and <file> is the name of a file that contains a list of files to relink.

举个例子:$adrelink.sh force=y "ad adadmin"

$adrelink.sh force=y "ad adadmin""ad adpatch"

$adrelink.sh force=y "ad all"

 

AD ADMIN:须要回答一些问题。

 

4.从新生成Forms, Libraries, and Menus

能够用f60gen或AD ADMIN来完成。

f60gen:可从新生成forms, libraries, and menus。详细语法以下:

f60gen [filename.[fmb|mmb|pll]] module_type=[form|menu|library] output_file=[path/file_name].[fmx|mmx|plx] userid=[apps]/[apps_password]

举例:$cd $AU_TOP/forms/US

$f60gen module=GLXJIRUN.fmb module_type=form output_file=$GL_TOP/forms/US/GLXJIRUN.fmx userid=APPS/APPS

AD ADMIN:有不少选项能够选择。

 

5.从新编译JSP页面。

JSP页面会自动编译,但有时手工编译会提升性能。编译的工具是:JSP precompiler. JSP预编译程序会调用ojspCompile.pl Perl script. 使用这个工具的前提在metalink Note 215268.1上有介绍。这个工具的具体语法以下:

ojspCompile.pl [COMMAND] [ARGS]

举例:$ojspCompile.pl --compile --flush -p 10    --force compiling all JSP pages with parallel execution of 10

$ojspCompile.pl --compile -s 'jtf%'    --compiling all JSPs that start with the string jtf:

$ojspCompile.pl --compile -log /oracle/admin/vis/log/compile_jsps.log      --compiling all delta JSP pages:

 

6.肯定各组件的版本。

查看应用文件的版本:ident,adident,string均可以查看。ident在SUN,AIX上用不起来。

[ident|adident] [pattern] [file1 |, file2, file3, . . .]

举例:$ident Header OA.jsp

OA.jsp:

$Header OA.jsp 115.56 2004/07/16 04:02:21 atgops1 noship $

 

$strings -a [filename] | grep [pattern]

举例:$strings -a OA.jsp | grep Header

<%! public static final String RCS_ID = "$Header: OA.jsp 115.56

 

JInitiator Version:分应用端和客户端的版本。

应用端:查看$OA_HTML/bin/appsweb_${CONTEXT_NAME}.cfg file

客户端:到控制面板查看。

应用端和客户端的JInitiator Version必定要相同,不然会出问题。

 

Apache Version and Rollup Patch:$cd $APACHE_TOP/Apache/bin/

$httpd -version

EBS11.5.10.2的版本是这样的:$ cd $IAS_ORACLE_HOME/Apache/Apache/bin

$httpd -version

 

Forms and PL/SQL Version:   $f60gen help=y或者能够到客户端打开form session而后click on the Help ➤About menu

得到了forms的version咱们能够知道forms的patches。具体信息咱们能够参考MetaLink Note 266541.1

Forms Patchset Forms Version

17              6.0.8.26

16              6.0.8.25

15              6.0.8.24

14              6.0.8.23

 

Oracle Applications Framework Version:using the ident, adident, or strings command to retrieve header information from the OA.jsp file in the $OA_HTML and $FND_TOP/html directories.

Header information is then used to look up the corresponding OA Framework version。具体信息请参考:MetaLink Note 275874.1

OA Framework Version OA.jsp Version

5.10                  115.56

5.7                   115.36

5.6                   115.27

举例:$ident Header $FND_TOP/html/OA.jsp

还有一种方法可得到OA Framework version。http://[hostname.domain.com]:[port]/OA_HTML/OAInfo.jsp

 

OJSP Version:http://[hostname.domain.com]:[port]/OA_HTML/test.jsp   --11.10.5.2好像没有这个文件。

 

JDK Version:$java -version

 

Java Class File Versions:

unzip -l apps.zip | grep [class file]    --Review the zip file to obtain the full path of the zipped Java class:

unzip -j apps.zip [path/class file]     --Extract the Java class from the zipped file:

strings -a [class file] | grep Header   --Retrieve the header information from the Java class with the strings command:

若是不在压缩包里,能够用如下命令:

$strings -a $JAVA_TOP/oracle/apps/inv/mo/server/MOLine.class | grep '$Header'

 

数据库的版本:SQL> select comp_name, version, status  from dba_registry;  --可得到DB各组件的版本。

 

7.其它的一些命令和用法

unix的一些基本命令(略)

找到并删除进程的内存段和信号量:当中止或kill一个进程后,而后重启这个进程会发现它的内存段和信号量并无释放。有两个命令用来查看和删除这些内存段和信号量:ipcs;ipcrm

$ipcs -a

------ Shared Memory Segments --------

key shmid owner perms bytes nattch

status

0x00000000 6946816 oracle 600 1056768 12 dest

0x00000000 6979585 oracle 600 1056768 12 dest

0x00000000 7012354 vis 600 8589316 10 dest

0x00000000 7045123 oracle 600 1056768 11 dest

0x00000000 7077892 vis 600 1056768 10 dest

0x00000000 7110661 oracle 600 8589316 9 dest

------ Semaphore Arrays --------

key semid owner perms nsems status

0x00000000 1081344 oracle 600 1

0x00000000 32769 vis 600

 

$ipcs -a | grep vis

0x00000000 7012354 vis 600 8589316 10 dest

0x00000000 7077892 vis 600 1056768 10 dest

0x00000000 32769 vis 600

 

$ipcs -help   --查看一些参数信息。

ipcrm -m [segment number]  --语法,删除内存段

$ipcrm -m 7012354  --7012354是memory segment

$ipcrm -s [segment number]  --语法,删除信号量

$ipcrm -s 32769

 

查找并删除打印任务:lpstat -p[print queue]

$lpstat -p  --列出全部的的打印任务。

lprm -P[print queue] [job number]

$lprm -P lp1 785  --删除指定的打印任务。

 

结束DB sessions:alter system kill session '&sid,&serial#';

 

8.调度脚本

能够用crontab和EM 10g Grid Control来完成调度。EM 10g Grid Control还能够用来管理和监控EBS,详细信息请参考MetaLink Note 308320.1

注意:EM Management Packs须要额外的lisence。

 

9.常规的一些维护

这些维护包括:收集统计信息;从新编译无效对象;清理日志文件;重建索引;重启apache server;清除并发请求日志;清除工做流历史数据;清除归档数据。

收集统计信息:根据业务繁忙状况,但至少一周统计一次。使用fnd_stats来进行统计信息的收集,它是基于dbms_stats package的。在EBS中不能使用dbms_stats package来收集信息,只能用fnd_stats。如下是一些范例:

fnd_stats.gather_schema_statistics: Used to gather statistics for schemas

fnd_stats.gather_tables_stats: Used to gather table-level statistics

fnd_stats.gather_column_stats: Used to gather column-level statistics

fnd_stats.gather_index_stats: Used to gather index statistics

SQL> exec fnd_stats.gather_schema_statistics('ALL')

SQL> exec fnd_stats.gather_schema_statistics('GL')

SQL>exec fnd_stats.gather_schema_statistics('HR',estimate_percent=>30);

Oracle provides a script named coe_stats.sql to assist with automating the gathering of statistics.

咱们也能够经过提交并发请求来按期的收集统计信息。咱们能够查询上次进行统计数据的时间。举例:

SQL> select table_name, last_analyzed from dba_objects  where owner='GL' and table_name='GL_BALANCES';

fnd_stats.verify_stats ('[schema]', '[schema.table_name1, schema.table_name2, . . . ,schema.table_namen]')

SQL> exec fnd_stats.verify_stats('GL', 'GL.GL_BALANCES');

 

从新编译无效对象:

SQL> exec utl_recomp.recomp_parallel(8);  用adadmin也能够编译。最好按期执行这个操做。

 

清理日志文件:清理日志能够节省文件系统空间。举个清除过时日志的脚本:

#Script used to rotate and remove log files > 30 days old

#Script name is rotate_logs.sh

LOGFILES=$1

NUM_DAYS_RETAIN=30

DATE=`date +%m%d%y`

#read in list of logfiles

awk '{print $0}' $LOGFILES | while read FILENAME

do

# check that file exists.

if [ -f $FILENAME ]

then

# Make sure the entry does not refer to multiple files

RESULTS=`ls -l $FILENAME | wc -l`

if [ $RESULTS -gt 1 ]

then

exit 1

fi

# backup file and remove old copies

cp $FILENAME $FILENAME.$DATE

cp /dev/null $FILENAME

find . -name "$FILENAME.*" -a -mtime +NUM_DAYS_RETAIN -exec rm {}

\;

fi

done

 

 

$cat logfiles.txt   --这个文件做为脚本的参数,列出了须要清除的日志文件。

/u01/oratop/iAS/Apache/Apache/logs/error_log

/u01/oratop/iAS/Apache/Jserv/logs/jserv.log

/u01/oratop/8.0.6/network/log/sqlnet.log

 

$sh rotate_logs.sh logfiles.txt  --执行这个脚本。咱们也能够将它写入crontab按期执行。

一些常见log的路径能够参考书的214页。

 

重建索引:bde_rebuild.sql这个脚本是oracle提供的,用来重建索引。最新的版本能够参考MetaLink Note 182699.1。rebuild index能够在线进行,但最好在DB不忙的时候。另外这个过程会记录大量的redolog,因此你的archive所在的目录要足够大。

 

重启apache server:缘由:完全的断开JDBC thin client端跟数据库的链接;让应用的配置生效。手工清除apache缓存。

 

清除并发请求日志:能够提交标准请求:Purge Concurrent Request and/or Manager Data来清除并发请求和(或)管理器数据,主要是清理表的一些历史数据,和一些log,out文件。FNDCPPUR也能够干这个事情,具体没用过。

 

清除工做流历史数据:提交标准请求:Purge Obsolete Workflow Runtime Data。 FNDWFPR也能够干这个事情。主要是清除表的一些历史记录。建议天天按期执行。

 

清除归档数据:根据各公司的状况定。对数据的保留时间各公司的要求是不同的。

 

10.克隆

快速克隆:有两篇文档能够参考:MetaLink Notes 230672.1 and 216664.1

在OAM里有克隆向导:Site Map ➤Maintenance ➤Cloning menu options. Two wizards, Simple Clone and Advanced Clone。建议如今测试环境测试。

注意:若是应用层没用打PATCH,也就是说APPL_TOP没有改动。咱们能够只clone数据库。

克隆后要处理的工做:快速clone没有清理工做流相关的表和配置文件,site-level profiles除外。另外若是打印机的需求不同,还须要在clone instance从新定义打印机。具体详细的工做能够参考MetaLink Note 230672.1

其它一些处理工做可能要看你的环境需求。好比修改APPS密码;从APPLCSF删除一些文件;限制一些用户访问系统。

注意:Do not end-date the GUEST or SYSADMIN account in the application, as it will render the application unusable until the accounts are un-end-dated.

 

 

 

第七章 资源

EBS DBA能够利用的一些资源:Oracle Support;用户社区和会议;在线资源;相关的书籍和期刊

http://www.oaug.org

http://www.ioug.org
相关文章
相关标签/搜索