分类: Oracle
2017-03-24 09:28:56
作为目前行业界最成熟和成功的商业数据库管理系统软件,Oracle开发出很多有助于系统调试和运维的工具。借助这些优秀的免费工具,可以大大方便我们日常运维和管理工作。
无论是作为专业DBA,还是第三方支持人员,数据库巡检都是日常工作中不可缺少的工作内容。巡检项目通常是设置好的项目内容,有时候我们还会准备一些脚本或者命令作为收集手段。巡检项目类型也会包括从操作系统、硬件文件系统,到数据库内存配置等广泛的内容。其实,我们就可以借助Oracle提供的Remote Diagnosis Agent(简称RDA)来完成繁复的工作。
1、RDA简述
RDA全称为Remote Diagnosis Agent,是Oracle客户服务机构基于perl书写的一个简单工具。RDA原始的初衷并不是帮我们进行巡检,而是在于信息收集。当客户遇到技术困难或者问题的时候,Oracle客服人员需要了解系统状态和各种参数信息来进行故障诊断。如果采用问答反馈方式,是非常消耗时间的,所以Oracle通常会要求客户使用RDA收集全套相关信息,来方便诊断和减少交互次数。
RDA的两个特色是我们比较关注的重点,一个是支持平台范围广,另一个是覆盖产品领域宽。
在平台方面,RDA可以支持常见的主流操作系统,包括传统主机Unix、Linux到Windows系统。具体如下(引自MOS:[ID 314422.1]):
?Apple Mac OS X/Darwin
?HP OpenVMS Alpha 7.3-2 and above
?HP OpenVMS Itanium
?HP Tru64 UNIX
?HP-UX Itanium
?HP-UX PA-RISC (32 and 64 bit)
?IBM AIX on POWER Systems(32 and 64 bit)
?IBM Dynix/Ptx
?IBM Linux on POWER
?IBM zSeries Based Linux
?Linux Itanium
?Linux x86 (32 and 64 bit)
?Microsoft Windows 7
?Microsoft Windows 2000 Workstation and Server
?Microsoft Windows 2003 Server
?Microsoft Windows 2008
?Microsoft Windows Vista
?Microsoft Windows XP Professional
?Sun Solaris Intel
?Sun Solaris SPARC (32 and 64 bit)
此外,RDA对Oracle整条产品线的支持也是比较完善的,大部分Oracle产品都可以通过RDA进行巡检控制。具体产品列表请参见官方文档阐述。
2、下载和安装
我们首选需要从Oracle客户支持网站MOS上面下载到最新版本的RDA,文档编号为ID 314422.1。针对不同的操作系统平台,Oracle提供了不同的压缩包版本。笔者下载了对Linux系统支持的RDA版本,文件名为p15929817_430_LINUX.zip。
RDA是建立在perl基础上的工具包,首先需要确认是否已经安装。
[root@bspdev /]# perl -v
This is perl, v5.8.8 built for i386-linux-thread-multi
Copyright 1987-2006, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at the Perl Home Page.
创建专门的目录,上传RDA压缩包。
[root@bspdev /]# mkdir rda
[root@bspdev /]# cd rda
[root@bspdev rda]#
利用上传FTP/SFTP上传压缩文件,并且解压。
[root@bspdev rda]# pwd
/rda
[root@bspdev rda]# ls -l
total 58628
-rw-r--r-- 1 root root 59968755 Feb 26 06:14 p15929817_430_LINUX.zip
--解压软件
[root@bspdev rda]# unzip p15929817_430_LINUX.zip
(篇幅原因,省略……)
inflating: rda/engine/rda_linux
inflating: rda/engine/rda_linux56
creating: rda/ccr/
inflating: rda/ccr/ccr-Production-10.3.7.0.2-Linux-i386.zip
[root@bspdev rda]#
改变目录和文件对象。
[root@bspdev /]# chown -R oracle:oinstall rda
[root@bspdev /]# su - oracle
[oracle@bspdev ~]$ cd /rda
[oracle@bspdev rda]$ ls -l
total 58636
-rw-r--r-- 1 oracle oinstall 59968755 Feb 26 06:14 p15929817_430_LINUX.zip
drwxr-xr-x 11 oracle oinstall 4096 Dec 6 11:45 rda
-r--r--r-- 1 oracle oinstall 48 Dec 6 11:45 readme.txt
注意,在rda目录下,包括三个执行文件,分别对应不同的应用场合。如果是windows系列OS,可以使用cmd程序。Unix/Linux程序调用rda.sh/rda.pl脚本。
[oracle@bspdev rda]$ ls -l | grep rda
-r-xr-xr-x 1 oracle oinstall 19027 Aug 22 2012 irda.pl
-r-xr-xr-x 1 oracle oinstall 7558 Jan 10 2012 rda.cmd
-r-xr-xr-x 1 oracle oinstall 7768 Jan 10 2012 rda.com
-r-xr-xr-x 1 oracle oinstall 59244 Nov 7 17:31 rda.pl
-r-xr-xr-x 1 oracle oinstall 8513 Feb 22 2012 rda.sh
-r--r--r-- 1 oracle oinstall 3344 Aug 22 2012 README_irda.txt
[oracle@bspdev rda]$
之后,我们可以使用-cv参数来验证安装的正确性。
[oracle@bspdev rda]$ ./rda.sh -cv
Loading the file list ...
Checking the directory '.' ...
(篇幅原因,省略部分……)
Checking the directory 'engine' ...
Checking the directory 'hcve' ...
Checking the directory 'modules' ...
No issues found
[oracle@bspdev rda]$
3、配置和执行
RDA是通过模块配置的方法来进行配置和收集信息,我们可以通过-L modules参数配置来查看RDA可以支持的所有可收集模块。
[oracle@bspdev rda]$ ./rda.sh -L modules
Available data collection modules are:
ACFS Collects ASM Cluster File System Information
ACT Collects Oracle E-Business Suite Application Information
(篇幅原因,有省略……)
XPLR Performs Oracle Explorer Collections
XSMP Samples User Defined Data
XTRA Collects User Defined Data
[oracle@bspdev rda]$
注意这个列表,其中每一行表示一个RDA支持的产品类型。前面的简写用于进行配置。那么,是不是每次RDA都会收集这些产品呢?答案是否定的。
我们只需要配置和运行我们需要监控的模块,最常用的包括OS,DB,DBA和INST。标准的流程是我们首先使用-S进行配置。
[oracle@bspdev rda]$ ./rda.sh -S OS DBA DB INST
-------------------------------------------------------------------------------
S000INI: Initializes the Data Collection
-------------------------------------------------------------------------------
RDA uses the output file prefix to identify all files belonging to the same
data collection. The prefix must start with a letter and must contain only
alphanumeric characters.
Enter the prefix to be used for all the generated files
Hit 'Return' to accept the default (RDA)
>
Enter the directory used for all the files to be generated
Hit 'Return' to accept the default (/rda/rda/output) –生成文件目录
>
Do you want to keep report packages from previous runs (Y/N)?
Hit 'Return' to accept the default (N)
>
Enter the Oracle home to be used for data analysis
Hit 'Return' to accept the default (/u01/oracle)
>
Enter the network domain name for this server
Hit 'Return' to accept the default (localdomain)
>
-------------------------------------------------------------------------------
S010CFG: Collects Key Configuration Information
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
S090OCM: Set up the Configuration Manager Interface
-------------------------------------------------------------------------------
RDA benefits from Oracle Configuration Manager by improving its data
collection. Oracle Configuration Manager (OCM) collects the configuration
information and uploads it to the OCM Repository in connected mode. When OCM
is configured in disconnected mode, it adds the OCM payload to the RDA report
packages in future RDA runs.
Select the mode that you want to install Oracle Configuration Manager in
/u01/oracle
C Connected Mode
D Disconnected Mode
Enter the letter corresponding to your choice
Hit 'Return' to accept the default (C)
>
Do you want to install OCM Database collection scripts (Y/N)?
Hit 'Return' to accept the default (Y)
>
Enter a SYSDBA user for installing the OCM Database collection scripts
Hit 'Return' to accept the default (sys)
>
Is /u01/oracle an Oracle E-Business Suite Database Oracle home (Y/N)?
Hit 'Return' to accept the default (N)
>
-------------------------------------------------------------------------------
S909RDSP: Produces the Remote Data Collection Reports
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
S919LOAD: Produces the External Collection Reports
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
S999END: Finalizes the Data Collection
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
S100OS: Collects the Operating System Information
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
S130INST: Collects the Oracle Installation Information
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
S200DB: Controls Oracle RDBMS Data Collection
-------------------------------------------------------------------------------
Is there a Oracle database for RDA to analyze (Y/N)?
Hit 'Return' to accept the default (Y)
>
Is the database associated to the current Oracle home (Y/N)?
Hit 'Return' to accept the default (Y)
>
Enter the Oracle SID to be analyzed
Hit 'Return' to accept the default (wilson)
>
Is the INIT.ORA for the database to be analyzed located on this system? (Y/N)
Hit 'Return' to accept the default (Y)
>
Enter the location of the spfile or the INIT.ORA (including the directory and
file name)
Hit 'Return' to accept the default (/u01/oracle/dbs/spfilewilson.ora)
>
Enter an Oracle User ID (userid only) to view DBA_ and V$ tables. If RDA will
be run under the Oracle software owner's ID, enter a forward slash (/) here,
and enter Y at the SYSDBA prompt to avoid a prompt for the database password
at runtime.
Hit 'Return' to accept the default (system)
>
Is 'system' a SYSDBA user (will connect as SYSDBA) (Y/N)?
Hit 'Return' to accept the default (N)
>
-------------------------------------------------------------------------------
S201DBA: Collects Oracle RDBMS Information
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
S990FLTR: Controls Report Content Filtering
-------------------------------------------------------------------------------
[oracle@bspdev rda]$
在配置过程中,会有很多参数需要用户确认,一般来说默认取值就可以满足需求。如果有特殊情况,可以进行修改。
配置过程的本质是生成一份新的配置文件setup.cfg,其中包括了所有的配置内容。
[oracle@bspdev rda]$ cat setup.cfg
###############################################################################
# Oracle Remote Diagnostic Agent - Setup Information
###############################################################################
#------------------------------------------------------------------------------
# Data Collection Overview
#------------------------------------------------------------------------------
# S000INI=pending
# S010CFG=pending
# S090OCM=pending
# S100OS=pending
# S130INST=pending
# S200DB=skip
# S201DBA=pending
# S909RDSP=skip
# S919LOAD=pending
# S990FLTR=skip
# S999END=pending
(篇幅原因,有省略……)
#------------------------------------------------------------------------------
# S990FLTR: Controls Report Content Filtering
#------------------------------------------------------------------------------
#B.Is the security filter enabled?
RDA_FILTER=0
#B."Is the filter defined?
FILTER_DEFINED=0
#------------------------------------------------------------------------------
# S999END: Finalizes the Data Collection
#------------------------------------------------------------------------------
#B.Multi-run collection indicator
S999END_MRC=0
下面我们执行程序。使用-S参数来配置。中间可能会有参数配置和密码输入项目。
[oracle@bspdev rda]$ ./rda.sh -vCRP OS DB DBA INST
Collecting diagnostic data ...
-------------------------------------------------------------------------------
RDA Data Collection Started 26-Feb-2013 06:51:12
-------------------------------------------------------------------------------
Processing Initialization module ...
Enter the password for 'SYSTEM': --输入密码
Please re-enter it to confirm:
Processing OCM module ...
Processing CFG module ...
Processing OS module ...
(篇幅原因,有省略…..)
Packaging the reports ...
You can review the reports by transferring the contents of the
/rda/rda/output directory to a location where you have web-browser access.
Then, point your browser at this file to display the reports:
RDA__start.htm
Based on your server configuration, some possible alternative approaches are:
- If your client computer with a browser has access to a web shared
directory, copy the /rda/rda/output directory to the web shared directory
and visit this URL:
or
- If your client computer with a browser has FTP access to the server
computer with the /rda/rda/output directory, visit this URL:
ftp://root@bspdev.localdomain//rda/rda/output/RDA__start.htm
If this file was generated to assist in resolving a Service Request, please
send /rda/rda/output/RDA.RDA_bspdev.zip to Oracle Support by uploading the
file via My Oracle Support. If ftp'ing the file, please be sure to ftp in
BINARY format.
Please note: Do not submit any health, payment card or other sensitive
production data that requires protections greater than those specified in the
Oracle GCS Security Practices
(http://www.oracle.com/us/support/library/customer-support-security-practices-069170.pdf).
Information on how to remove data from your submission is available at
Updating the setup file ...
生成结束,在output目录上,我们可以看到生成的报告文件。
[oracle@bspdev output]$ pwd
/rda/rda/output
[oracle@bspdev output]$ ls -l
total 3948
drwxr-x--- 2 oracle oinstall 4096 Feb 26 06:56 extern
drwxr-x--- 2 oracle oinstall 4096 Feb 26 06:52 JOB_RDA
-rw-r----- 1 oracle oinstall 272 Feb 26 06:56 RDA__blank.htm
-rw-r----- 1 oracle oinstall 3670 Feb 26 06:52 RDA_CFG_database.htm
-rw-r----- 1 oracle oinstall 1082 Feb 26 06:51 RDA_CFG_database.txt
(篇幅原因,有省略…..)
-rw-r----- 1 oracle oinstall 0 Feb 26 06:56 RDA_S999END.txt
-rw-r----- 1 oracle oinstall 907 Feb 26 06:56 RDA__start.htm
[oracle@bspdev output]$
4、结果查看
我们将输出文件转移到Windows环境下,选择RDA_start.htm,就可以启动结果报告。
在Main Index中,我们可以看到选择的OS、Instance和Database等相关条目。借助两个导航条,可以查看各种信息。
5、结论
RDA应该说是Oracle官方提供的专用的检测巡检工具。在国外有很多DBA在使用其进行日常巡检,国内应用相对较少。本篇着重在于介绍基本的使用和报告生成,具体更加复杂的应用我们在之后慢慢深入。