ORAchk 之前被称为RACcheck,后来它的用途进行了扩展,改名为了ORAchk,它是在数据库系统进行健康检查的一个专用工具,这个工具主要用来检查软件的配置是否符合要求以及一些最佳实践是否被应用了。通过这个工具,用户可以很方便地、自动化地对自己的系统进行健康检查和评估。
ORAchk 能够检查的软件主要有:OS、Oracle Clusterware (CRS)、 Grid Infrastructure environment(GI)、Automatic Storage Management (ASM)以及Real Application Clusters (RAC)、单实例数据库、Golden Gate。ORAchk更多信息可参考MOS文档1268927.2
Oracle ORAchk支持的平台
以下平台支持Oracle ORAchk:
*不支持Linux Itanium
*在32位EBS环境中仅支持32位平台使用命令./orachk -ebs32bit
[root@host1 /]# mkdir /orachk
[root@host1 /]# cd /orachk/
[root@host1 orachk]# unzip orachk.zip
[root@host1 /]# chown -R oracle:oinstall /orachk
[root@host1 orachk]# chmod 755 orachk
[root@rac2 ~]# mkdir /orachk
[root@rac2 ~]# cd /orachk/
[root@rac2 orachk]# unzip orachk.zip
[root@rac2 orachk]# chmod 755 orachk
1)停止所有活动的Oracle ORAchk daemon客户端
[root@rac2 orachk]# ./orachk -d stop_client
2)停止任何正在运行的Oracle ORAchk daemon
[root@rac2 orachk]# ./orachk -d stop
3)从自动重新启动配置中删除Oracle ORAchk daemon
[root@rac2 orachk]# ./orachk -initrmsetup
4)删除Oracle ORAchk安装目录
[root@rac2 orachk]# rm -rf /orachk/
每个数据库PSU都包含创建时可用的最新Oracle ORAchk版本。应用数据库PSU时,包含的ORAchk将在$ORACLE_HOME/suptools中暂存。
在下次运行时,如果PSU复制的版本比安装的版本新,则Oracle ORAchk会提示进行升级。
MOS文档1268927.2下载最新的ORAchk
1)升级前检查
[oracle@host1 orachk]$ pwd
/u01/app/oracle/product/18.1.0/dbhome_1/suptools/orachk
[oracle@host1 orachk]$./orachk -u -o pre
2)查看当前版本
[oracle@host1 orachk]$ ./orachk -v
ORACHK VERSION: 12.2.0.1.4_20171127
3)升级
将环境变量RAT_UPGRADE_LOC设置下载的ORAchk压缩包存放的目录。
[oracle@host1 orachk]$ export RAT_UPGRADE_LOC=/orachk/
[oracle@host1 orachk]$ ./orachk
Running orachk
----------------------------------------------------------
PATH : /u01/app/oracle/product/18.1.0/dbhome_1/suptools/orachk
VERSION : 12.2.0.1.4_20171127
COLLECTIONS DATA LOCATION : /u01/app/oracle/orachk/
----------------------------------------------------------
This version of orachk was released on 27-Nov-2017 and its older than 120 days
Latest version of orachk 12.2.0.1.4_20180518 is available at /orachk//.Do you want to upgrade to the latest version of orachk? [y/n][y] y
NOTE: Please ignore "No such file or directory" errors for the file/directory orachk.py,build,cwallet.sso, wallet.pm,lib. This is due to the change in directory structure between the versions 12.2.0.1.3 and 12.2.0.1.4
Running latest version...
Running orachk
----------------------------------------------------------
PATH : /u01/app/oracle/product/18.1.0/dbhome_1/suptools/orachk
VERSION : 18.2.0_20180518
COLLECTIONS DATA LOCATION : /u01/app/oracle/orachk/
----------------------------------------------------------
[oracle@host1 orachk]$ ./orachk -v
ORACHK VERSION: 18.2.0_20180518
如果已设置RAT_UPGRADE_LOC但不想升级,则仍可以使用-noupgrade选项运行Oracle ORAchk:
[oracle@host1 orachk]$./orachk –noupgrade
4)升级后检查
[oracle@host1 orachk]$./orachk -u -o post
注意:
如果在RAT_UPGRADE_LOC中具有最新版本并且还不想升级,请使用-ngradegrade选项。
在RAT_UPGRADE_LOC中使用-noupgrade而没有最新版本仍会提示您下载最新版本。
MOS文档1268927.2下载最新的ORAchk
1)升级前检查
[grid@rac2 orachk]$ pwd
/u01/app/18.1.0/grid/suptools/orachk
[grid@rac2 orachk]$ ./orachk -u -o pre
2)查看当前版本
[grid@rac2 orachk]$ ./orachk -v
ORACHK VERSION: 12.1.0.2.7_20160526
3)升级
将环境变量RAT_UPGRADE_LOC设置下载的ORAchk压缩包存放的目录。
[grid@rac2 orachk]$ export RAT_UPGRADE_LOC=/orachk/
[grid@rac2 orachk]$ ./orachk
Running orachk
----------------------------------------------------------
PATH : /u01/app/18.1.0/grid/suptools/orachk
VERSION : 12.2.0.1.4_20171127
COLLECTIONS DATA LOCATION : /u01/app/grid/orachk/
----------------------------------------------------------
This version of orachk was released on 27-Nov-2017 and its older than 120 days
Latest version of orachk 12.2.0.1.4_20180518 is available at /orachk//.Do you want to upgrade to the latest version of orachk? [y/n][y] y
NOTE: Please ignore "No such file or directory" errors for the file/directory orachk.py,build,cwallet.sso, wallet.pm,lib. This is due to the change in directory structure between the versions 12.2.0.1.3 and 12.2.0.1.4
Running latest version...
Running orachk
----------------------------------------------------------
PATH : /u01/app/18.1.0/grid/suptools/orachk
VERSION : 18.2.0_20180518
COLLECTIONS DATA LOCATION : /u01/app/grid/orachk/
----------------------------------------------------------
[grid@rac2 orachk]$ ./orachk -v
ORACHK VERSION: 18.2.0_20180518
如果已设置RAT_UPGRADE_LOC但不想升级,则仍可以使用-noupgrade选项运行Oracle ORAchk:
[grid@rac2 orachk]$./orachk –noupgrade
4)升级后检查s
[grid@rac2 orachk]$./orachk -u -o post
[root@host1 orachk]# ./orachk
Checking ssh user equivalency settings on all nodes in cluster for root
List of running databases
1. cndba
2. None of above
Select databases from list for checking best practices. For multiple databases, select 1 for All or comma separated number like 1,2 etc [1-2][1]. 1
. .
Checking Status of Oracle Software Stack - Clusterware, ASM, RDBMS
. . . . . . . . . . .
. . . . . . . . . . .
-------------------------------------------------------------------------------------------------------
Oracle Stack Status
-------------------------------------------------------------------------------------------------------
Host Name CRS Installed ASM HOME RDBMS Installed CRS UP ASM UP RDBMS UP DB Instance Name
-------------------------------------------------------------------------------------------------------
host1 No No Yes No No Yes cndba
-------------------------------------------------------------------------------------------------------
Copying plug-ins
. .
. . . . . .
*** Checking Best Practice Recommendations ( PASS / WARNING / FAIL ) ***
. .
Collections and audit checks log file is
/orachk/orachk_host1_PDBCNDBA_072518_100235/log/orachk.log
============================================================
Node name - host1
============================================================
……
--------------------------------------------------------------------------------
RDBMS homes patches summary report
--------------------------------------------------------------------------------
Total patches Applied on RDBMS Applied on ASM ORACLE_HOME
--------------------------------------------------------------------------------
1 1 0 /u01/app/oracle/product/18.1.0/dbhome_1
--------------------------------------------------------------------------------
------------------------------------------------------------
Detailed report (html) - /orachk/orachk_host1_PDBCNDBA_072518_100235/orachk_host1_PDBCNDBA_072518_100235.html
UPLOAD [if required] - /orachk/orachk_host1_PDBCNDBA_072518_100235.zip
ORAchk 检查完成之后会生成一个html报告,这个报告的命名为:orachk_节点名_数据库名_时间.html,比如
orachk_host1_PDBCNDBA_072518_100235.html。同时,它还会把所有的输出文件都打包为一个.zip文件,比如orachk_host1_PDBCNDBA_072518_100235.zip,可以把这个.zip文件从RAC服务器上下载到本地的windows,解压后查看其中的生成的orachk_节点名_数据库名_时间.html 这一个文件就可以。
生成的报告也非常简单、清晰,在报告最上部会列出这次检查的分数,满分是100分。
ORAchk会自动识别CRS HOME,请用户确认(当然,检查单实例就没有这个问题了),还会提问是检查集群中的哪个数据库。因为RAC的所有实例的主机都会执行检查,如果以前没有配置过root用户的用户等效性,还会自动帮你配置,也都比较简单,跟着提示做就可以。
[root@rac2 orachk]# ./orachk
Clusterware stack is running from /u01/app/18.1.0/grid. Is this the correct Clusterware Home?[y/n][y]
Checking ssh user equivalency settings on all nodes in cluster for root
Node rac1 is not configured for ssh user equivalency and the orachk uses ssh to execute checks on remote nodes.
Without passwordless ssh orachk can not run audit checks on the remote nodes.
If necessary due to security policies the orachk can be run on each node using -localonly option.
Do you want to configure SSH for user root on rac1 [y/n][y] y
Enter rac1 root password :
Verifying root password ...
Node rac1 has been configured for ssh user equivalency for root
Searching for running databases . . . . .
. .
List of running databases registered in OCR
1. cndba
2. None of above
Select databases from list for checking best practices. For multiple databases, select 1 for All or comma separated number like 1,2 etc [1-2][1]. 1
. . . .
Checking Status of Oracle Software Stack - Clusterware, ASM, RDBMS
. . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-------------------------------------------------------------------------------------------------------
Oracle Stack Status
-------------------------------------------------------------------------------------------------------
Host Name CRS Installed RDBMS Installed CRS UP ASM UP RDBMS UP DB Instance Name
-------------------------------------------------------------------------------------------------------
rac2 Yes Yes Yes Yes Yes cndba2
rac1 Yes Yes Yes Yes Yes cndba1
-------------------------------------------------------------------------------------------------------
Copying plug-ins
. .
. . . . . .
*** Checking Best Practice Recommendations ( PASS / WARNING / FAIL ) ***
. .
Collections and audit checks log file is
/orachk/orachk_rac2_CNDBAPDB_072518_101258/log/orachk.log
Starting to run orachk in background on rac1
============================================================
Node name - rac2
============================================================
……
------------------------------------------------------------
CLUSTERWIDE CHECKS
------------------------------------------------------------
------------------------------------------------------------
Detailed report (html) - /orachk/orachk_rac2_CNDBAPDB_072518_101258/orachk_rac2_CNDBAPDB_072518_101258.html
UPLOAD [if required] - /orachk/orachk_rac2_CNDBAPDB_072518_101258.zip
ORAchk 检查完成之后会生成一个html报告,这个报告的命名为:orachk_节点名_数据库名_时间.html,比如
orachk_rac2_CNDBAPDB_072518_101258.html。同时,它还会把所有的输出文件都打包为一个.zip文件,比如orachk_rac2_CNDBAPDB_072518_101258.zip,可以把这个.zip文件从RAC服务器上下载到本地的windows,解压后查看其中的生成的orachk_节点名_数据库名_时间.html 这一个文件就可以。
生成的报告也非常简单、清晰,在报告最上部会列出这次检查的分数,满分是100分。