Skip to content

Oracle - 3. page

Oracle 19c 新特性一览
可用性
一般
简化了 DG Broker中对于数据库参数的管理
动态修改Fast-Start Failover (FSFO)目标库
Broker的FSFO支持仅观察模式
当主库闪回时,备库也会跟着闪回
将主库还原点传播
DG多实例REDO应用支持IM
ADG中DML重定向
PDB支持恢复目录
定期清除闪回日志以提高FRA大小的可预估
DG中引入新的参数用于调整自动解决中断方案
更细粒度的补充日志
分片
跨分片传播参数值值
同一个CDB中支持多个PDB分片
System-Managed Sharding支持多表家族
支持在备用分片目录数据库上执行多分片查询
跨分片生成唯一的序列
大数据和数据仓库
一般
提升SQL诊断和修复能力
自动索引
基于Bitmap的count distinct的SQL函数
大数据和In-Memory外部表性能提升
自动解决SQL计划回归
实时统计信息
高频率的优化器统计信息收集
混合分区表
数据库总体新特性
自动化安装、配置和打补丁
DBCA静默方式复制一个数据库
DBCA静默方式克隆一个远端PDB
DBCA静默方式将一个PDB迁移到另一个CDB中
简化基于镜像的Oracle客户端安装
安装Oracle数据库root脚本支持自动执行
支持Oracle集群升级的干运行验证(Dry-Run Validation)。
自动化升级、迁移和工具
数据泵在导入时支持排除加密字句
数据泵在TTS导入过程中,允许表空间保持只读
数据泵中传输表空间的测试模式
数据泵支持资源限制
一般新特性
数据泵命令行参数:ENABLE_SECURE_ROLES
Data Pump Import supports wildcard dump file names for URL-based dump files maintained in object stores
Data Pump command-line parameter CREDENTIAL allows Import from object stores
性能
一般新特性
SQL隔离
为IM自动启用资源管理
在填充时,IM会等待
Memoptimized Rowstore – Fast Ingest
Automatic Database Diagnostic Monitor (ADDM)支持PDB
实时SQL监控
PDB中负载捕捉和重放
RAC和GRID
一般新特性
奇偶校验保护文件–Parity Protected Files
自动化PDB迁移
Automated Transaction Draining for Oracle Grid Infrastructure Upgrades
Oracle 支持重新升级和打补丁
Oracle Grid支持零停机打补丁
安全
一般新特性
ALTER SYSTEM命令中新的字句 FLUSH PASSWORDFILE_METADATA_CACHE
在非OMF模式下透明在线转换支持自动重命名
Key Management of Encrypted Oracle-Managed Tablespaces in Transparent Data Encryption
支持离线表空间加密的附加算法
Support for Host Name-Based Partial DN Matching for Host Certificates
Privilege Analysis Now Available in Oracle Database Enterprise Edition
Support for Oracle Native Encryption and SSL Authentication for Different Users Concurrently
能够从仅模式帐户授予或撤消管理权限
Automatic Support for Both SASL and Non-SASL Active Directory Connections
统一审计TOP语句
从Oracle数据库帐户中删除的密码
Signature-Based Security for LOB Locators
New EVENT_TIMESTAMP_UTC Column in the UNIFIED_AUDIT_TRAIL View
New PDB_GUID Audit Record Field for SYSLOG and the Windows Event Viewer
Database Vault Operations Control for Infrastructure Database Administrators
Database Vault Command Rule Support for Unified Audit Policies
可用性
一般
简化了 DG Broker中对于数据库参数的管理
用户可以通过ALTER SYSTEM命令或DGMGRL中EDIT DATABASE … SET PARAMETER命令来管理,设置所有DG相关的参数。而且 可以通过ALL来一次性修改所有DG环境中的数据库某个参数的,而不用一个一个去修改。

动态修改Fast-Start Failover (FSFO)目标库
目前,DBA必须禁用Fast-Start Failover (FSFO)才能更改FSFO目标备用数据库。 从19c开始,令允许用户动态地将FSFO目标备用数据库更改为目标列表中的另一个备用数据库,而无需先禁用FSFO。

Broker的FSFO支持仅观察模式
当数据库管理员配置DG Broker的FSFO功能时,现在可以将其配置为仅观察模式用来创建测试模式,以查看在正常生产处理期间何时发生故障转移或其他交互。这允许用户更精确地调整FSFO参数属性,并发现其环境中的哪些情况会导致自动故障转移发生。这样可以更容易地证明使用自动故障转移来减少故障转移的恢复时间。

此配置允许用户测试自动故障转移配置,而不会对生产数据库产生任何实际影响。这改进了Broker中已存在的现有故障转移验证,并帮助用户更轻松地了解FSFO自动故障转移过程。

当主库闪回时,备库也会跟着闪回
闪回数据库将整个数据库移动到较旧的时间点,并使用RESETLOGS打开数据库。在DG中,如果主数据库闪回,则备库不再与主库同步。在以前的版本中,需要将备库设置为与主库相同的时间点需要手动过程来闪回备用数据库。 19c中引入了一个新参数,该参数使备库能够在主库上执行闪回数据库时自动闪回。

通过在主数据库闪回时自动闪回备用数据库,减少了时间,精力和人为错误,从而实现更快的同步和缩短的恢复时间目标(RTO)。

将主库还原点传播
在此之前,在主库上定义正常还原点或保证还原点,以便在出现任何逻辑损坏问题时实现快速时间点恢复。 但是,此还原点存储在控制文件中,不会传播到备库。如果发生故障转移,备库成为主库,并且还原点信息将丢失。 而这个新特性可确保还原点从主库传播到备库,以便即使在故障转移事件后还原点也可用。

DG多实例REDO应用支持IM
在此之前,多实例REDO应用和IM列式存储不能同时启用。从19c开始,可以同时启用。

ADG中DML重定向
ADG DML重定向允许在ADG备库上执行DML。执行DML时,该操作将传递到它相关的主库上执行,并且事务的REDO将应用到备库。简而言之,就是

PDB支持恢复目录
支持可插拔数据库(PDB)作为目标数据库,并且可以使用虚拟专用目录(VPC)用户更精细地控制在PDB级别执行备份和还原操作的权限。 元数据视图也是有限的,因此VPC用户只能查看用户已被授予权限的数据。 在以前的版本中,不支持在目标数据库是PDB时与恢复目录的连接。

Oracle 19c为容器数据库(CDB)和PDB级备份和还原提供了完整的备份和恢复灵活性,包括恢复目录支持。

定期清除闪回日志以提高FRA大小的可预估
当拥有许多都使用快速恢复区(FRA)的数据库。 他们通常使用recovery_dest_size初始化参数设置FRA。 而当需要足够的FRA空间时,闪回日志是不会被清除的,这样就会造成FRA压力。 在许多情况下,唯一的补救措施是关闭闪回日志记录并将其重新打开。 而在19c中,此功能使闪回空间的使用从存储管理角度变得可预测,因为闪回不会占用保留所需的空间。此功能还允许用户通过调整闪回日志保留时间来控制空间压力。

FRA对数据库至关重要,因为它存储备份,联机重做日志,归档重做日志和闪回日志。当FRA空间使用满了,会影响数据库的正常使用,后果非常严重。

DG中引入新的参数用于调整自动解决中断方案
DG在主库和备库上有多个进程,用于处理重做传输和归档,这些进程通过网络相互通信。在某些故障情况下,网络挂起,断开连接和磁盘I/O问题,这些进程可能会挂起,可能导致重做传输和GAP解决的延迟。 DG有一个内部机制来检测这些挂起的进程并终止它们,从而允许正常的中断解决方案发生。 在Oracle 19c中,DBA可以使用两个新参数DATA_GUARD_MAX_IO_TIME和DATA_GUARD_MAX_LONGIO_TIME来调整此检测周期的等待时间。 这些参数允许根据用户网络和磁盘I/O行为调整特定DG配置的等待时间。

更细粒度的补充日志
为逻辑备用或完整数据库复制要求设计并实现了补充日志记录。这会在仅复制表的子集的环境中增加不必要的开销。细粒度的补充日志记录为部分数据库复制用户提供了一种方法,可以禁用不感兴趣的表的补充日志记录,这样即使在数据库或模式级别启用了补充日志记录,也不会为不感兴趣的表提供补充日志记录开销。

使用此功能可以显着减少资源使用和重做生成方面的开销,以防数据库中只有部分表需要补充日志记录,例如在GoldenGate部分复制配置中。

分片
跨分片传播参数值值
在19c之前,DBA不得不一个一个去修改每个分片的参数值。而从19c开始,只需要在分片catalog数据库上执行即可。

同一个CDB中支持多个PDB分片
在此之前,只支持同一个CDB中一个PDB作为分片。当然还是有一些限制,如:该CDB中的不同PDB必须是不同分片数据库中的分片。

System-Managed Sharding支持多表家族
在此之前,不管什么方式的Sharding支持一个表家族。

支持在备用分片目录数据库上执行多分片查询
在此之前,只能在主分片目录数据库上支持。

跨分片生成唯一的序列
在此之前,只能通过手动方式来保证序列的唯一性在所有分片数据库上。从19c开始,这一切交给Oracle就可以了。

大数据和数据仓库
一般
提升SQL诊断和修复能力
SQL诊断和修复工具(如SQL Test Case Builder和SQL Repair Advisor)已得到增强,可为管理有问题的SQL语句提供更好的诊断和修复功能。

自动索引
自动索引功能可自动执行索引管理任务,例如根据应用程序工作负载的变化在Oracle数据库中创建,重建和删除索引。

基于Bitmap的count distinct的SQL函数
在12c中就引入了count distinct,用于粗略统计一列不同值的个数。在19c中持续增强,性能和准确性大大提高。

大数据和In-Memory外部表性能提升
IM外部表添加了对ORACLE_HIVE和ORACLE_BIGDATA驱动程序,并行查询,RAC,DG和按需填充的支持。

自动解决SQL计划回归
SQL计划管理在AWR中搜索SQL语句。通过最高负载确定优先级,它在所有可用源中查找备用计划,为SQL计划基准添加性能更好的计划。 Oracle数据库还提供计划比较工具和改进的提示报告。

实时统计信息
Oracle将在DML执行期间,自动收集统计信息。

高频率的优化器统计信息收集
用户可以为某些对象指定更高频率的统计信息收集。从而达到,有力生成更准确的执行计划。。。

混合分区表
混合分区表功能通过使分区驻留在Oracle数据库段以及外部文件和源中来扩展Oracle分区。此功能显着增强了大数据SQL的分区功能,其中表的大部分可以驻留在外部分区中。

数据库总体新特性
自动化安装、配置和打补丁
DBCA静默方式复制一个数据库
可通过DBCA中createDuplicateDB命令来复制一个数据库。

DBCA静默方式克隆一个远端PDB
可通过DBCA中createFromRemotePDB命令来克隆PDB。

DBCA静默方式将一个PDB迁移到另一个CDB中
可通过DBCA中relocatePDB命令来迁移PDB。

简化基于镜像的Oracle客户端安装
从Oracle Database 19c开始,Oracle Database Client软件可用作下载和安装的映像文件。 您必须将映像软件解压缩到您希望Oracle主目录所在的目录中,然后运行runInstaller脚本以启动Oracle Database Client安装。 当然依然提供二进制文件继续以传统格式提供为non-zip文件。

安装Oracle数据库root脚本支持自动执行
从Oracle Database 19c开始,数据库安装程序或设置向导提供了一些选项,用于设置在数据库安装期间根据需要自动运行根配置脚本的权限。 您可以继续手动运行根配置脚本。

支持Oracle集群升级的干运行验证(Dry-Run Validation)。
从19c开始,支持以干运行方式(模拟升级)来验证是否满足升级要求,而不是真正的升级。

自动化升级、迁移和工具
数据泵在导入时支持排除加密字句
可通过新的参数OMIT_ENCRYPTION_CLAUSE来忽略具有加密列的对象。

数据泵在TTS导入过程中,允许表空间保持只读
就是在TTS过程中,可以在源库和目标库上都可以降表空间至于只读模式,可以提供读的服务。而不是之前的只能保证源库的只读,目标库表空间无法正常使用。

数据泵中传输表空间的测试模式
可传输表空间的测试模式使用可传输表空间或完全可传输导出/导入执行仅元数据导出测试。 它还消除了源数据库表空间处于只读模式的要求。

现在,DBA可以更轻松地确定导出所需的时间,并发现闭包检查未报告的无法预料的问题。

数据泵支持资源限制
在数据泵的导出、导入过程中,可以限制其资源的使用。可通过两个新参数来实现:MAX_DATAPUMP_JOBS_PER_PDB 和 MAX_DATAPUMP_PARALLEL_PER_JOB。

一般新特性
数据泵命令行参数:ENABLE_SECURE_ROLES
默认情况下,Data Pump不再启用受密码保护的安全角色。从19c开始,您必须为单个导出或导入作业显启用受密码保护的角色。 添加了一个新的命令行参数,ENABLE_SECURE_ROLES =YES|NO,可用于为单个导出
或导入作业显式启用或禁用这些类型的角色。

Data Pump Import supports wildcard dump file names for URL-based dump files maintained in object stores
Data Pump command-line parameter CREDENTIAL allows Import from object stores
性能
一般新特性
SQL隔离
由于过度消耗CPU和I/O资源而由Oracle资源管理器终止的SQL语句可以自动隔离。与终止的SQL语句关联的执行计划将被隔离,以防止它们再次执行。

为IM自动启用资源管理
当INMEMORY_SIZE不为0时,那么资源管理器将被自动启用。

在填充时,IM会等待
DBMS_INMEMORY_ADMIN.POPULATE_WAIT新函数会让对象一直处于等待状态无法被访问,直到指定优先级的对象已填充到指定的百分比。

新函数确保在允许应用程序访问之前已填充指定的In-Memory对象。例如,数据库可能包含许多具有各种优先级设置的内存中表。 在受限会话中,您可以使用POPULATE_WAIT函数来确保完全填充每个In-Memory表。之后,您可以禁用受限会话,以确保应用程序仅查询表的In-Memory中表示。

Memoptimized Rowstore – Fast Ingest
Automatic Database Diagnostic Monitor (ADDM)支持PDB
实时SQL监控
PDB中负载捕捉和重放
在此之前,只能在CDB root容器级别捕获负载和重放。从19c开始,支持PDB级别。

RAC和GRID
一般新特性
奇偶校验保护文件–Parity Protected Files
REDUNDANCY文件类型属性指定文件组的冗余。 PARITY值指定冗余的单奇偶校验。 奇偶校验适用于一次写入文件,例如存档日志和备份集。

传统的两个或三个ASM镜像用于与数据库备份操作相关联的文件时,会消耗大量空间。 备份文件是一次写入文件,此功能允许保护奇偶校验而不是传统镜像。这样可以节省大量空间。

自动化PDB迁移
在Oracle Grid中,可以使用Fleet Patching和Provisioning自动将PDB从一个CDB重定位到另一个CDB。

Automated Transaction Draining for Oracle Grid Infrastructure Upgrades
Oracle 支持重新升级和打补丁
使用Fleet Patching和Provisioning来打补丁和升级Oracle Restart。 在以前的版本中,Oracle Restart
环境要求用户执行修补和升级操作,通常需要手动干预。Fleet Patching和Provisioning自动执行这些
过程。

Oracle Grid支持零停机打补丁
安全
一般新特性
ALTER SYSTEM命令中新的字句 FLUSH PASSWORDFILE_METADATA_CACHE
ALTER SYSTEM命令中新的子句FLUSH PASSWORDFILE_METADATA_CACHE使用数据库密码文件的最新详细信息刷新元数据缓存。可以通过查询V $ PASSWORDFILE_INFO视图来检索数据库密码文件的最新详细信息。

更改数据库密码文件名或位置时,此功能非常有用,并且需要使用更新的数据库密码文件的详细信息刷新元数据缓存。

在非OMF模式下透明在线转换支持自动重命名
从19c开始,在非OMF模式下的透明数据加密联机转换中,不再需要在ADMINISTER KEY MANAGEMENT SQL语句中包含FILE_NAME_CONVERT子句。 文件名保留其原始名称。

Key Management of Encrypted Oracle-Managed Tablespaces in Transparent Data Encryption
支持离线表空间加密的附加算法
Support for Host Name-Based Partial DN Matching for Host Certificates
Privilege Analysis Now Available in Oracle Database Enterprise Edition
Support for Oracle Native Encryption and SSL Authentication for Different Users Concurrently
能够从仅模式帐户授予或撤消管理权限
Automatic Support for Both SASL and Non-SASL Active Directory Connections
统一审计TOP语句
从Oracle数据库帐户中删除的密码
Signature-Based Security for LOB Locators
New EVENT_TIMESTAMP_UTC Column in the UNIFIED_AUDIT_TRAIL View
New PDB_GUID Audit Record Field for SYSLOG and the Windows Event Viewer
Database Vault Operations Control for Infrastructure Database Administrators
Database Vault Command Rule Support for Unified Audit Policies

https://docs.oracle.com/en/database/oracle/oracle-database/19/newft/new-features.html#GUID-06A15128-1172-48E5-8493-CD670B9E57DC

Oracle 19c 新特性一览

19c的重要特性之一DML重定向,原理发送到ADG备库上的DML操作,自动转发到主库执行,然后通过主库日志传递到备库实时应用,在保证了ACID的前提下,增强了备库的功能性

在 18c 中,这个特性是否启用通过隐含参数 _enable_proxy_adg_redirect 控制;

在 19c 中,则由显式参数 ADG_REDIRECT_DML控制;

SQL> show parameter ADG_REDIRECT_DML

NAME TYPE VALUE
———————————— ———– ——————————
adg_redirect_dml boolean FALSE

SQL> alter system set adg_redirect_dml=true scope=both;

System altered.

SQL> create user test identified by test;
create user test identified by test
*
ERROR at line 1:
ORA-16000: database or pluggable database open for read-only access

SQL> create table test(id int,sdate char(20));
create table test(id int,sdate char(20))
*
ERROR at line 1:
ORA-16000: database or pluggable database open for read-only access

SQL> conn luda/luda
Connected.
SQL> show parameter ADG_REDIRECT_DML

NAME TYPE VALUE
———————————— ———– ——————————
adg_redirect_dml boolean TRUE
SQL>
alter session set events ‘10046 trace name context forever ,level 12′;

insert into test values (1, to_char(current_timestamp at time zone dbtimezone,’dd-mon-rr hh:mi:ss’));

alter session set events ‘10046 trace name context off’;

select distinct(m.sid),p.pid,p.tracefile from v$mystat m,v$session s,v$process p where m.sid=s.sid and s.paddr=p.addr;

SID PID
———- ———-
TRACEFILE
——————————————————————————–
223 44
/u01/app/oracle/diag/rdbms/std/orcl/trace/orcl_ora_1768553.trc

格式化输出

tkprof /u01/app/oracle/diag/rdbms/std/orcl/trace/orcl_ora_1768553.trc /home/oracle/orcl_ora_1768553.out

[oracle@oracle19c ~]$ cat orcl_ora_1768553.out

TKPROF: Release 19.0.0.0.0 – Development on Mon Apr 27 07:56:09 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

Trace file: /u01/app/oracle/diag/rdbms/std/orcl/trace/orcl_ora_1768553.trc
Sort options: default

********************************************************************************
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
********************************************************************************

The following statement encountered a error during parse:

insert into test values (1, to_char(current_timestamp at time zone dbtimezone,’dd-mon-rr hh:mi:ss’))

Error encountered: ORA-01157
********************************************************************************

SQL ID: 8r8b2pyy9qjm2 Plan Hash: 0

alter session set events ‘10046 trace name context forever, level 12’

call count cpu elapsed disk query current rows
——- —— ——– ———- ———- ———- ———- ———-
Parse 0 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
——- —— ——– ———- ———- ———- ———- ———-
total 1 0.00 0.00 0 0 0 0

Misses in library cache during parse: 0
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 106

Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
—————————————- Waited ———- ————
SQL*Net message to client 3 0.00 0.00
SQL*Net message from client 3 26.12 47.13
SQL*Net break/reset to client 3 0.00 0.00
single-task message 1 0.01 0.01
SQL*Net message from dblink 7 0.01 0.02
SQL*Net message to dblink 6 0.00 0.00
SQL*Net vector data to dblink 1 0.00 0.00
asynch descriptor resize 1 0.00 0.00
Disk file operations I/O 1 0.00 0.00
control file sequential read 8 0.00 0.00
********************************************************************************

SQL ID: 06nvwn223659v Plan Hash: 0

alter session set events ‘10046 trace name context off’

call count cpu elapsed disk query current rows
——- —— ——– ———- ———- ———- ———- ———-
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
——- —— ——– ———- ———- ———- ———- ———-
total 2 0.00 0.00 0 0 0 0

Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 106

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

OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS

call count cpu elapsed disk query current rows
——- —— ——– ———- ———- ———- ———- ———-
Parse 1 0.00 0.00 0 0 0 0
Execute 2 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
——- —— ——– ———- ———- ———- ———- ———-
total 3 0.00 0.00 0 0 0 0

Misses in library cache during parse: 1
Misses in library cache during execute: 1

Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
—————————————- Waited ———- ————
SQL*Net message to client 3 0.00 0.00
SQL*Net message from client 3 26.12 47.13
SQL*Net break/reset to client 3 0.00 0.00
single-task message 1 0.01 0.01
SQL*Net message from dblink 7 0.01 0.02
SQL*Net message to dblink 6 0.00 0.00
SQL*Net vector data to dblink 1 0.00 0.00
asynch descriptor resize 1 0.00 0.00
Disk file operations I/O 1 0.00 0.00
control file sequential read 8 0.00 0.00

OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS

call count cpu elapsed disk query current rows
——- —— ——– ———- ———- ———- ———- ———-
Parse 0 0.00 0.00 0 0 0 0
Execute 0 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
——- —— ——– ———- ———- ———- ———- ———-
total 0 0.00 0.00 0 0 0 0

Misses in library cache during parse: 0

2 user SQL statements in session.
0 internal SQL statements in session.
2 SQL statements in session.
********************************************************************************
Trace file: /u01/app/oracle/diag/rdbms/std/orcl/trace/orcl_ora_1768553.trc
Trace file compatibility: 12.2.0.0
Sort options: default

1 session in tracefile.
2 user SQL statements in trace file.
0 internal SQL statements in trace file.
2 SQL statements in trace file.
2 unique SQL statements in trace file.
88 lines in trace file.
47 elapsed seconds in trace file.

Oracle 19C ADG的自动DML重定向 ADG_REDIRECT_DML

RDA Remote Diagnostic Agent

RDA Remote Diagnostic Agent远程诊断代理是Oracle Support售后服务使用的标准工具之一,当用户在Metalink上提交SR(TAR)时可能Oracle GCS(Global Customer Service)支持会需要让用户从MOS上下载RDA工具,通过RDA收集丰富的数据库环境信息(如包含OS、DB、CRS等),以便原厂售后直接从RDA report中抓取诊断信息,避免了因诊断信息不足 而反复信息交互所浪费的时间 ; 此外Oracle的一些ACS高级客户服务的现场服务过程中也会利用到RDA,例如当用户要求ACS到现场进行月度或季度巡检是RDA就是标准的检查工具。

 

说具体参考My Oracle Support(metalink)的《Remote Diagnostic Agent (RDA) 4 – Getting Started [ID 314422.1]》专栏中下载到各个平台的最新版RDA。

首先配置就是选择我们要使用的RDA module和一些临时设置,先来认识一下有哪些module:

 

将下载到的rda zip包解压

[oracle@vrh8 ~]$ unzip /tmp/p9079828_418_LINUX.zip 

[oracle@vrh8 ~]$ cd rda

[oracle@vrh8 rda]$ ./rda.sh -h
Usage: rda.pl [-bcdflntvwxy] [-ABCDEHIKLMPQRSTV] [-e list] [-m dir]
              [-s name] [-o out] [-p prof] arg ...
        -A      Authentify user through the setup file
        -B      Start background collection
        -C      Collect diagnostic information
        -D      Delete specified modules from the setup
        -E      Explain specified error numbers
        -H      Halt background collection
        -I      Regenerate the index
        -K      Kill background collection
        -L      List the modules available
        -M      Display the related manual pages
        -O      Render output specifications from STDIN
        -P      Package the reports (tar or zip)
        -Q      Display the related setup questions
        -R      Generate specified reports
        -S      Setup specified modules
        -T      Execute test modules
        -V      Display component version numbers
        -b      Don't backup setup file before saving
        -c      Check the RDA installation and exit
        -d      Set debug mode
        -e list Specify a list of alternate setting definitions (var=val,...)
        -f      Set force mode
        -h      Display the command usage and exit
        -l      Use a lock file to prevent concurrent usage of a setup file
        -m dir  Specify the module directory ('modules' by default)
        -n      Start a new data collection
        -o out  Specify the file for background collection output redirection
        -p prof Specify the setup profile ('Default' by default)
        -q      Set quiet mode
        -s name Specify the setup name ('setup' by default)
        -t      Set trace mode
        -v      Set verbose mode
        -w      Wait as long as the background collection daemon is active
        -x      Produce module cross reference
        -y      Accept all defaults and skip all pauses

列出所有可用module

[oracle@vrh8 rda]$ ./rda.sh -L Module

Available data collection modules are:
  ACFS     Collects ASM Cluster File System Information
  ACT      Collects Oracle E-Business Suite Application Information
  ADBA     Collects ACS Oracle Database Assessment
  ADX      Collects AutoConfig and Rapid Clone Information
  AGT      Collects Enterprise Manager Agent Information
  APEX     Collects APEX Information
  ASAP     Collects Oracle Communications ASAP Information
  ASBR     Collects Application Server Backup and Recovery Information
  ASG      Collects Application Server Guard Information
  ASIT     Collects Oracle Application Server Installation Information
  ASM      Collects Automatic Storage Management Information
  B2B      Collects Oracle Business to Business Information
  BAM      Collects Business Activity Monitoring Information
  BEE      Collects Beehive Information
  BI       Collects Oracle Business Intelligence Enterprise Edition Info.
  BPEL     Collects Oracle BPEL Process Manager Information
  BR       Collects Database Backup and Recovery Information
  BRM      Collects Oracle Communications BRM Information
  CCR      Collects OCM Diagnostic Information
  CFG      Collects Key Configuration Information
  COHR     Collects Oracle Coherence Information
  CONT     Collects Oracle Content Services Information
  CRID     Collects Oracle Access Manager (COREid) Information
  D2PC     Collects Distributed Transaction Information
  DB       Controls RDBMS Data Collection
  DBA      Collects RDBMS Information
  DBC      Collects Database Control Information
  DBM      Collects RDBMS Memory Information
  DEV      Collects Oracle Developer Information
  DG       Collects Data Guard Information
  DNFS     Collects Direct NFS Information
  DSCS     Collects Discussions Information
  DSCV     Collects Oracle Discoverer Information
  ECM      Controls Oracle Enterprise Content Management 11g Data Collection
  EM       Collects Enterprise Manager OMS and Repository Info (Obsolete)
  END      Finalizes the Data Collection
  EPMA     Collects Enterprise Performance Management Architect Information
  ESB      Collects Enterprise Service Bus Information
  ESS      Collects Oracle Essbase Information
  ESSO     Collects Oracle Enterprise Single Sign-On Information
  EXA      Collects Exadata Information
  FLTR     Controls Report Content Filtering
  GRDN     Collects Oracle Guardian Information
  GRID     Controls Grid Control Data Collection
  GTW      Collects Transparent/Procedural Gateway Information
  HFM      Collects Oracle Hyperion Financial Management information
  HPL      Collects Oracle Hyperion Planning Information
  IA       Collects Intelligent Agent Information
  IAS      Collects Web Server Information
  IFS      Collects iFS (iFS, CMSDK, Files) Information
  INI      Initializes the Data Collection
  INST     Collects the Oracle Installation Information
  IPSA     Collects Oracle Communications IP Service Activator Information
  J2EE     Collects J2EE/OC4J Information
  JDBC     Collects Oracle Java DB Connectivity (JDBC) Information
  JDEV     Collects Oracle JDeveloper Information
  JIVE     Collects Jive Information
  LANG     Collects Oracle Language Information
  LOAD     Produces the External Collection Reports
  LOG      Collects Database Trace and Log Files
  MAIL     Collects Oracle Collaboration Suite Mail Information
  MSLG     Collects Microsoft Languages Information
  ND       Collects Oracle Communications Network Discovery Information
  NET      Collects Network Information
  NM       Collects Oracle Communications Network Mediation Information
  NPRF     Samples Performance Information (root not required)
  OCAL     Collects Oracle Calendar Information
  OCFS     Collects Oracle Cluster File System Information
  OCM      Setting up Configuration Manager Interface
  OCS      Controls Oracle Collaboration Suite Data Collection
  ODI      Collects Oracle Data Integrator Information
  ODM      Collects Oracle Data Mining Information
  OES      Collects Oracle Express Server Information
  OID      Collects Oracle Internet Directory Information
  OIM      Collects Oracle Identity Manager Information
  OLAP     Collects OLAP Information
  OMM      Collects Oracle Multimedia or Oracle interMedia Information
  OMS      Collects Oracle Management Server Information (obsolete)
  ONET     Collects Oracle Net Information
  OS       Collects the Operating System Information
  OVD      Collects Oracle Virtual Directory Information
  OVMM     Collects Oracle VM Manager Information
  OVMS     Collects Oracle VM Server Information
  OWB      Collects Oracle Warehouse Builder Information
  OWSM     Collects Oracle Web Services Manager Information
  PDA      Collects Oracle Portal Information
  PDBA     Collects PeopleSoft Information from an Oracle Database
  PERF     Collects Performance Information
  PLNC     Collects Oracle PL/SQL Native Compilation Information
  PROF     Collects the User Profile
  PS       Collects Oracle Communications Policy Services Information
  PWEB     Collects PeopleSoft Information from Web Application Server
  RAC      Collects Cluster Information
  RACD     Performs a Database Hang Analysis
  RDSP     Produces the Remote Data Collection Reports
  RET      Collects Oracle Retail Information
  REXE     Performs the Remote Data Collections
  RPRF     Samples Performance Information (root privileges required)
  RSRC     Collects Database Resource Manager Information
  RTC      Collects Real Time Communication Information
  SEBL     Collects Siebel Information
  SES      Collects Oracle Secure Enterprise Search Information
  SMPL     Controls Sampling
  SOA      Collects Oracle SOA Suite Information
  SP       Collects SQL*Plus/iSQL*Plus Information
  SSO      Collects Single Sign-On Information
  STC      Collects Streams Configuration Information
  STM      Collects Streams Monitoring Information
  TOPL     Collects Oracle TopLink Information
  TTEN     Collects Oracle TimesTen In-Memory Database Information
  UCM      Collects Oracle Universal Content Management Information
  UOA      Collects Oracle Universal Online Archive 11g Information
  WAC      Collects Web Access Client Information
  WCI      Collects Oracle WebCenter Information
  WEBC     Collects Oracle Web Cache Information
  WKSP     Collects Workspaces Information
  WLS      Collects Oracle WebLogic Server Information
  WMC      Collects Webmail Client Information
  WRLS     Collects Wireless Information
  XDB      Collects XDB Information
  XSMP     Samples User Defined Data
  XTRA     Collects User Defined Data

 

 

如以上列表中RAC模块用来Collects Cluster Information收集集群信息, 而RACD模块则负责收集RAC数据库挂起的相关信息Performs a Database Hang Analysis。

 

我们在配置RDA的时可以直接执行./rda.sh, 脚本会提示我们需要选择启用哪些Module,但是因为Module过多,整个配置过程就会浪费很多时间。

 

为了避免每配置一套新环境都要大费周章确认那么多模块, 所以在RDA中定义了很多典型场景使用的profile, 这些profile已经配好了固定的一些Module , 下面我们来看一下RDA profile:

 

 

列出所有目前可用的profile

[oracle@vrh8 rda]$ ./rda.sh -L profiles
Available profiles are:
  9iAS               Oracle Application Server 9i problems
  AS10g              Oracle Application Server 10g problems
  AS10g_Identity     Oracle Identity Management 10g problems
  AS10g_MidTier      Oracle Application Server 10g Middle Tier problems
  AS10g_Repository   Oracle Application Server 10g metadata repository problems
  AS10g_WebTier      Oracle Application Server 10g WebTier problems
  AS_BackupRecovery  Oracle Application Server backup/recovery problems
  Act                Oracle Application Overview
  AppsCheck          Equivalent to AppsCheck
  AsmFileSystem      Oracle ASM Cluster File System problems
  Bam                Business Activity Monitoring problems
  Beehive            Oracle Beehive problems
  DB10g              Oracle Database 10g problems
  DB11g              Oracle Database 11g problems
  DB8i               Oracle Database 8i problems
  DB9i               Oracle Database 9i problems
  DB_Assessment      Oracle Database assessment collections
  DB_BackupRecovery  Oracle Database backup and recovery problems
  DB_Perf            Oracle Database performance problems
  DataGuard          Data Guard problems
  DirectNFS          Direct NFS problems
  Discoverer10g      Oracle Discoverer 10g problems
  Discoverer11g      Oracle Discoverer 11g problems
  EnterpriseSearch   Oracle Secure Enterprise Search problems
  Essbase            Oracle Essbase problems
  FM11g_Bi           Business Intelligence Enterprise Edition 11g problems
  FM11g_Ecm          Oracle Enterprise Content Management 11g problems
  FM11g_Forms        Oracle Forms 11g problems
  FM11g_Identity     Oracle Identity Management 11g problems
  FM11g_Odi          Oracle Data Integrator Standalone 11g problems
  FM11g_Portal       Oracle Portal 11g problems
  FM11g_Reports      Oracle Reports 11g problems
  FM11g_Soa          Oracle SOA Suite 11g problems
  FM11g_WebTier      Oracle Fusion Middleware 11g Web Tier problems
  FM11g_WlsBi        Business Intelligence Enterprise Edition 11g with WLS
  FM11g_WlsForms     Oracle Forms 11g with WLS problems
  FM11g_WlsIdentity  Oracle Identity Management 11g with WLS problems
  FM11g_WlsOdi       Oracle Data Integrator Suite 11g with WLS problems
  FM11g_WlsPortal    Oracle Portal 11g with WLS problems
  FM11g_WlsReports   Oracle Reports 11g with WLS problems
  FM11g_WlsWebTier   Oracle Fusion Middleware 11g Web Tier with WLS problems
  FinManagement      Oracle Hyperion Financial Management problems
  GridControl        Grid Control problems
  InterMedia         Oracle interMedia problems
  Linux              Linux problems
  LinuxPerf          Linux performance problems
  Maa_Assessment     Maximum Availability Architecture assessment collections
  Multimedia         Oracle Multimedia problems
  OSMonitor          Operating System performance sampling
  OVMManager         Oracle VM Manager problems
  Pda10g             Portal 10g problems
  Pda11g             Portal 11g problems
  Pda9i              Portal 9i problems
  PeopleSoft_DB      PeopleSoft Oracle Database tier assessment collections
  PeopleSoft_Web     PeopleSoft Web application server assessment collections
  Rac                Real Application Cluster problems
  Rac_AdvancedAsm    Cluster with ASM problems (ASM advanced mode)
  Rac_Asm            Cluster with ASM problems
  Rac_Assessment     Real Application Cluster assessment collections
  Rac_Perf           Cluster performance problems
  Retail             Oracle Retail problems
  Security           Filter sensitive information from the reports
  SupportInformer70  Oracle Communication BRM 7.0 problems
  SupportInformer72  Oracle Communication BRM 7.2 problems
  SupportInformer73  Oracle Communication BRM 7.3 problems
  SupportInformer74  Oracle Communication BRM 7.4 problems
  TimesTen           Oracle TimesTen problems
  TopLink10g         Oracle TopLink 10g problems
  WebCenter10g       Oracle WebCenter 10g problems
  WebCenter11g       Oracle WebCenter 11g problems
  WebCenterCont10g   Oracle WebCenter 10g with Oracle Content Services problems
  WebLogicServer     Oracle WebLogic Server problems

 

 

上例列出了该版本RDA默认就有的Profile , 如DB11g这个profile是用来收集11g Database数据库的诊断信息的, 而DB10g 是收集10g Database诊断信息的, DB_Perf是收集数据库性能诊断信息的。

可以具体了解 这些profile 预设了哪些Module:

 

 

[oracle@vrh8 rda]$ ./rda.sh -M -p DB11g
NAME
    Profile DB11g - Oracle Database 11g problems

MODULES
    The DB11g profile uses the following modules:
      OS        Collects the Operating System Information
      PROF      Collects the User Profile
      PERF      Collects Performance Information
      NET       Collects Network Information
      ONET      Collects Oracle Net Information
      INST      Collects the Oracle Installation Information
      DB        Controls RDBMS Data Collection
      DBA       Collects RDBMS Information
      DBM       Collects RDBMS Memory Information
      LOG       Collects Database Trace and Log Files
      DNFS      Collects Direct NFS Information
      SP        Collects SQL*Plus/iSQL*Plus Information
      GRID      Controls Grid Control Data Collection
      AGT       Collects Enterprise Manager Agent Information
      DBC       Collects Database Control Information

[oracle@vrh8 rda]$ ./rda.sh -M -p DB10g
NAME
    Profile DB10g - Oracle Database 10g problems

MODULES
    The DB10g profile uses the following modules:
      OS        Collects the Operating System Information
      PROF      Collects the User Profile
      PERF      Collects Performance Information
      NET       Collects Network Information
      ONET      Collects Oracle Net Information
      INST      Collects the Oracle Installation Information
      DB        Controls RDBMS Data Collection
      DBA       Collects RDBMS Information
      DBM       Collects RDBMS Memory Information
      LOG       Collects Database Trace and Log Files
      SP        Collects SQL*Plus/iSQL*Plus Information
      GRID      Controls Grid Control Data Collection
      AGT       Collects Enterprise Manager Agent Information
      DBC       Collects Database Control Information

 

 

除了module之外profile可能还定义了一些临时变量如force_onet_tests 是否强制做oracle net网络测试等, 可以用-f( Set force mode)选项来列出这些temporary settings:

 

 

[oracle@vrh8 rda]$ ./rda.sh -fM -p DB10g
NAME
    Profile DB10g - Oracle Database 10g problems

MODULES
    The DB10g profile uses the following modules:
      OS        Collects the Operating System Information
      PROF      Collects the User Profile
      PERF      Collects Performance Information
      NET       Collects Network Information
      ONET      Collects Oracle Net Information
      INST      Collects the Oracle Installation Information
      DB        Controls RDBMS Data Collection
      DBA       Collects RDBMS Information
      DBM       Collects RDBMS Memory Information
      LOG       Collects Database Trace and Log Files
      SP        Collects SQL*Plus/iSQL*Plus Information
      GRID      Controls Grid Control Data Collection
      AGT       Collects Enterprise Manager Agent Information
      DBC       Collects Database Control Information

SETTINGS
    The DB10g profile sets the following temporary settings:
      force_db_tests=1
      force_dba_tests=1
      force_dbm_tests=1
      force_log_tests=1
      force_onet_tests=1

 

 

也可以列出全部预定义的profile的Module信息:

 

 

[oracle@vrh8 rda]$ ./rda.sh -xv profiles
Treating profiles ...
Profile Cross Reference

Defined Profiles:
  9iAS               S100OS, S105PROF, S110PERF, S120NET, S130INST, S300IAS,
                     S305ASBR, S306ASG, S310J2EE, S330SSO, S340OID, S350WEBC
  AS10g              S100OS, S105PROF, S110PERF, S120NET, S130INST, S300IAS,
                     S305ASBR, S306ASG, S310J2EE, S330SSO, S340OID, S350WEBC
  AS10g_Identity     S100OS, S105PROF, S110PERF, S120NET, S130INST, S300IAS,
                     S305ASBR, S306ASG, S310J2EE, S330SSO, S340OID, S342OVD
  AS10g_MidTier      S100OS, S105PROF, S110PERF, S120NET, S130INST, S249WRLS,
                     S290DEV, S300IAS, S310J2EE, S325PDA, S350WEBC, S390DSCV
  AS10g_Repository   S100OS, S105PROF, S110PERF, S120NET, S130INST, S300IAS,
                     S305ASBR, S306ASG, S310J2EE
  AS10g_WebTier      S100OS, S105PROF, S110PERF, S120NET, S130INST, S300IAS,
                     S310J2EE, S350WEBC, S410GRID
  AS_BackupRecovery  S100OS, S300IAS, S305ASBR
  Act                S100OS, S105PROF, S110PERF, S130INST, S500ACT
  AppsCheck          S100OS, S105PROF, S110PERF, S130INST, S500ACT
  AsmFileSystem      S100OS, S105PROF, S120NET, S122ONET, S130INST, S402ASM,
                     S403ACFS
  Bam                S100OS, S105PROF, S110PERF, S120NET, S374BAM
..........

 

 

 

使用-Q 选项可以更详细地列出profile相关的问题:

 

 

[oracle@vrh8 rda]$ ./rda.sh -Q -p DB11g

NAME
    S120NET - Collects Network Information

SETTING DESCRIPTION
  NETWORK_PING_TESTS
    "Do you want RDA to perform the network ping tests (Y/N)?"

  LOCAL_NODE
    "Enter the name of the node the script is running on (used for ping
    tests)"

  WAN_NODE
    "Enter a remote node connecting to this server (used for ping tests)"

  RDBMS_NODE
    "Enter the node hosting the database instance (used for ping tests)"

  WEB_NODE
    "Enter the node where the Web Server/Forms server is on (used for ping
    tests)"

...............

 

 

通过继承profile的定义可以快速配置RDA,例如我们尝试使用DB11g这个profile:

 

 

[oracle@vrh8 rda]$ ./rda.sh -S -p DB11g

使用profile后RDA问你的问题明显减少了哦

之后在运行rda.sh就会收集信息了

[oracle@vrh8 rda]$ ./rda.sh
-------------------------------------------------------------------------------
RDA Data Collection Started 06-Feb-2012 01:23:22
-------------------------------------------------------------------------------
Processing Initialization module ...
Enter the password for 'SYSTEM':
Please re-enter it to confirm:
Processing OCM module ...
Processing PERF module ...
Processing CFG module ...
Processing OS module ..

 

 

可能你还是觉得麻烦:”我使用oracle操作系统用户登录的,为啥每次还要输密码呢?直接sysdba不行吗?” 对于有些内部视图X$ View的查询也确实需要sysdba权限, 我们可以如下设置来使用sysdba身份:

 

[oracle@vrh8 rda]$ ./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/ -p DB11g

[oracle@vrh8 rda]$ ./rda.sh
-------------------------------------------------------------------------------
RDA Data Collection Started 06-Feb-2012 01:27:37
-------------------------------------------------------------------------------
Processing Initialization module ...
Processing OCM module ...
Processing PERF module ...
Processing CFG module ...
Processing OS module ...

 

 

除了单独使用某个profile外,我们还可以组合使用多个profile,使用-p profile1-profile2这样的语法即可,如:

 

[oracle@vrh8 rda]$ ./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/ -p DB11g-DataGuard

使用-p profile1-profile2这样的模式即可

 

 

RDA经过配置后会默认将配置信息写到其目录下的setup.cfg文件中,之后再使用rda.sh收集信息即会沿用该cfg文件:

 

 

cat setup.cfg

# Oracle Remote Diagnostic Agent - Setup Information
###############################################################################

#------------------------------------------------------------------------------
# Data Collection Overview
#------------------------------------------------------------------------------
# S000INI=pending
# S010CFG=pending
# S020SMPL=pending
# S090OCM=pending
# S100OS=pending
# S105PROF=pending
# S110PERF=pending
# S120NET=pending
# S122ONET=pending
# S130INST=pending
# S200DB=skip
# S201DBA=pending
# S203DBM=pending
# S204LOG=pending
# S205BR=pending
# S212DNFS=skip
# S213SP=skip
# S400RAC=pending
# S400RACD=skip
# S401OCFS=skip
# S405DG=pending
# S410GRID=skip
# S420AGT=skip
# S430DBC=skip
# S909RDSP=skip
# S919LOAD=pending
# S990FLTR=skip
www.askmaclean.com
www.askmaclean.com
# S999END=pending
.................

 

 

除了最常见的DB11g 、 DB10g外还有一些很有用的profile可以加速我们对问题的诊断, 在这里分享一下:

 

 

For 11g

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/ -p DB11g

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/,ALERT_TEXT=1 -p DB11g
--收集alert文本

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/,ALERT_TEXT=1,DBCONTROL_SERVER_IN_USE=1 -p DB11g
--收集DBcontrol信息

./rda.sh -vSCRPfy -e SQL_SYSDBA=1,SQL_LOGIN=/,ALERT_TEXT=1 -p DB11g
--收集诊断信息并打包

DB10g 

./rda.sh -S -p DB10g

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/ -p DB10g

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/,DBCONTROL_SERVER_IN_USE=1 -p DB10g

DB9i

./rda.sh -S -p DB9i

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/ -p DB9i

DB_BackupRecovery 收集备份恢复信息

./rda.sh -S -p DB_BackupRecovery

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/,RMAN_IN_USE=0 -p DB_BackupRecovery
--不使用RMAN备份

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/,RMAN_IN_USE=1,RMAN_CATALOG=0 -p DB_BackupRecovery
--使用RMAN但不使用CATALOG恢复目录

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/,RMAN_IN_USE=1,RMAN_CATALOG=1,RMAN_SCHEMA=rman,RMAN_EXPORT_USER=rman@catlogdb -p DB_BackupRecovery

DB_Perf 收集数据库性能信息

./rda.sh -S -p DB_Perf

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/ -p DB_Perf

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/,PERF_START_TIME=11-Mar-2010_12:00,PERF_END_TIME=11-Mar-2010_13:00 -p DB_Perf
--指定收集性能信息的时间段 

DataGuard 收集dg 信息

./rda.sh -S -p DataGuard

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/ -p DataGuard

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/,ONET_IN_USE=1,ALERT_TEXT=1 -p DataGuard
--同时也收集Oracle Net Services信息

RAC 收集Real Application Cluster CRS信息

./rda.sh -S -p Rac

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/ -p Rac

RAC ASM   收集 Rac + Clusterware + Asm 信息

./rda.sh -S -p Rac_Asm

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/,ASM_ORACLE_SID=+ASM1 -p Rac_Asm

Rac_AdvancedAsm 收集更详细的Rac + Clusterware + Asm 信息

./rda.sh -S -p Rac_AdvancedAsm

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/,ASM_ORACLE_SID=+ASM1 -p Rac_AdvancedAsm

Rac_Perf  收集RAC数据库性能信息

./rda.sh -S -p Rac_Perf

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/ -p Rac_Perf

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/,PERF_START_TIME=11-Mar-2010_12:00,PERF_END_TIME=11-Mar-2010_13:00 -p Rac_Perf

DirectNFS 

./rda.sh -S -p DirectNFS

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/ -p DirectNFS

AsmFileSystem

./rda.sh -S -p AsmFileSystem

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/ -p AsmFileSystem

DB_Assessment 

./rda.sh -S -p Rac_Assessment

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/ -p Rac_Assessment

 Rac_Assessment

./rda.sh -S -p Rac_Assessment

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/ -p Rac_Assessment

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/,ASM_ORACLE_SID=+ASM1 -p Rac_Assessment

 Maa_Assessment

./rda.sh -S -p Maa_Assessment

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/ -p Maa_Assessment

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/,ASM_ORACLE_SID=+ASM1 -p Maa_Assessment

Exadata_Assessment

./rda.sh -S -p Exadata_Assessment

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/,ALERT_TEXT=1 -p Exadata_Assessment

 ./rda.sh -vSCRPfy -e SQL_SYSDBA=1,SQL_LOGIN=/,ALERT_TEXT=1,EXA_COLLECT_CELL=0 -p Exadata_Assessment

 ./rda.sh -vSCRPfy -e SQL_SYSDBA=1,SQL_LOGIN=/,ALERT_TEXT=1 -p Exadata_Assessment

Maa_Exa_Assessment

./rda.sh -S -p Maa_Exa_Assessment

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/,ALERT_TEXT=1 -p Maa_Exa_Assessment

./rda.sh -Sy -e SQL_SYSDBA=1,SQL_LOGIN=/,ALERT_TEXT=1,EXA_COLLECT_CELL=0 -p Maa_Exa_Assessment

./rda.sh -vSCRPfy -e SQL_SYSDBA=1,SQL_LOGIN=/,ALERT_TEXT=1 -p Maa_Exa_Assessment

 

 

 

还可以利用rda对OS做数据库软件安装前的预检查,如将需要安装11.2g,则执行 ./rda.sh -T hcve:

 

 

[oracle@vrh8 rda]$ ./rda.sh -T hcve
Processing HCVE tests ...
Available Pre-Installation Rule Sets:
1. Oracle Database 10g R1 (10.1.0) Preinstall (Linux-x86)
2. Oracle Database 10g R1 (10.1.0) Preinstall (Linux AMD64)
3. Oracle Database 10g R1 (10.1.0) Preinstall (IA-64 Linux)
4. Oracle Database 10g R2 (10.2.0) Preinstall (Linux AMD64)
5. Oracle Database 10g R2 (10.2.0) Preinstall (IA-64 Linux)
6. Oracle Database 10g R2 (10.2.0) Preinstall (Linux-x86)
7. Oracle Database 11g R1 (11.1.0) Preinstall (Linux AMD64)
8. Oracle Database 11g R1 (11.1.0) Preinstall (Linux-x86)
9. Oracle Database 11g R2 (11.2.0) Preinstall (Linux-x86)
ID     NAME                 RESULT  VALUE
====== ==================== ======= ==========================================
A00010 OS Certified?        PASSED  Adequate
A00050 Enter ORACLE_HOME    RECORD  /s01/oracle/product/10.2.0/db_1
A00060 ORACLE_HOME Valid?   PASSED  OHexists
A00070 O_H Permissions OK?  PASSED  CorrectPerms
A00080 oraInventory Permiss PASSED  oraInventoryOK
A00090 Got ld,nm,ar,make?   PASSED  ld_nm_ar_make_found
A00100 Umask Set to 022?    PASSED  UmaskOK
A00120 Limit Processes      PASSED  Adequate
A00130 Limit Descriptors    PASSED  Adequate
A00140 LDLIBRARYPATH Unset? PASSED  UnSet
A00180 JAVA_HOME Unset?     PASSED  UnSet
A00190 Enter JDK Home       RECORD
A00200 JDK Version          FAILED  JDK home is missing
A00210 Other O_Hs in PATH?  FAILED  OratabEntryInPath
A00220 Other OUI Up?        PASSED  NoOtherOUI
A00230 /tmp Adequate?       PASSED  TempSpaceOK
A00240 Disk Space OK?       PASSED  DiskSpaceOK
A00250 Swap (in MB)         RECORD  5951
A00260 RAM (in MB)          PASSED  3955
A00270 Swap OK?             PASSED  SwapToRAMOK
A00280 Network              PASSED  Connected
A00290 IP Address           RECORD  192.168.1.191
A00300 Domain Name          RECORD  oracle.com
A00310 DNS Lookup           FAILED  nslookup host.domain
A00320 /etc/hosts Format    FAILED  Missing host.domain
A00330 Kernel Parameters OK PASSED  KernelOK
A00380 Tainted Kernel?      PASSED  NotVerifiable
A00400 ip_local_port_range  PASSED  RangeOK
A00480 EL4 RPMs OK?         SKIPPED NotEL4
A00490 EL5 RPMs OK?         FAILED  [kernel-headers(i386)] not installed ..>
A00530 RHEL4 RPMs OK?       SKIPPED NotRedHat
A00540 RHEL5 RPMs OK?       SKIPPED NotRedHat
A00570 SUSE SLES10 RPMs OK? SKIPPED NotSuSE
A00580 SUSE SLES11 RPMs OK? SKIPPED NotSuSE
Result file: /home/oracle/rda/output/RDA_HCVE_A200DB11R2_lnx_res.htm

 

 

上例对OS做了Oracle Database 11g R2 (11.2.0) Preinstall的预安装检查 ,并给出了检查结果。

 

 

 

还可以使用./rda.sh命令对现有的RDA软件做完整性检测,保证RDA没有被修改过:

 

 

[oracle@vrh8 rda]$ ./rda.sh -cv
Loading the file list ...
Checking the directory '.' ...
Checking the directory 'RDA' ...
Checking the directory 'RDA/Handle' ...
Checking the directory 'RDA/Library' ...
Checking the directory 'RDA/Library/Remote' ...
Checking the directory 'RDA/Local' ...
Checking the directory 'RDA/Object' ...
Checking the directory 'RDA/Operator' ...
Checking the directory 'RDA/Value' ...
Checking the directory 'hcve' ...
Checking the directory 'modules' ...
No issues found
Oracle RDA Remote Diagnostic Agent 使用

(1) 初始化参数设置的建议

(1.1) sec_case_sensitive_loacgon
在12.1.0.1中不建议修改。默认值是true,但是如果设置成false,启动的时候会有提示:ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance。但是设置成false仍然生效,即忽略大小写的密码可以登录。

(1.2) SQLNET.ALLOWED_LOGON_VERSION_SERVER
在12c中默认值是11,所以如10.2.0.5的JDBC连接过来,就会报错ora-28040,虽然可以设置SQLNET.ALLOWED_LOGON_VERSION_SERVER=8来解决这个问题,但是由于今后11.1以下版本的JDBC不再被oracle支持,因此还是建议升级JDBC驱动来实现。
jar file和JDBC驱动之间的关系,参考Doc ID 401934.1。 10.2版本的JDBC,使用ojdbc14.jar;11.2版本的JDBC,使用ojdbc6.jar;12.1.0的JDBC使用ojdbc7.jar。

SQLNET.ALLOWED_LOGON_VERSION_SERVER 的值有{ 8 | 10 | 11 | 12 | 12a },各个值如下含义:
12a for Oracle Database 12c authentication protocols (strongest protection)
12 for the critical patch updates CPUOct2012 and later Oracle Database 11g ,authentication protocols (recommended)
11 for Oracle Database 11g authentication protocols (default)
10 for Oracle Database 10g authentication protocols
8 for Oracle9i authentication protocol
默认值是11,推荐值是12(如果你没有小于10.2.0.5的客户端)

(1.3) AUDIT_TRAIL
取值范围是: { none | os | db [, extended] | xml [, extended] },默认值是db或者none。
和12c的新特性Unified Auditing有关。是否启用unified auditing,可以用select VALUE from V$OPTION where PARAMETER=’Unified Auditing’;检查。

Unified Auditing默认是工作在mixed模式。
建议:
如果你以前没有审计,那么你可以设置成none。
如果以前有审计,建议设置成db。
更多信息,参考 http://tinyurl.com/UnifiedAuditing

(1.4)DEFERRED_SEGMENT_CREATION
从11.2开始,这个值的默认值是true,建议12c中设置成false。

(1.5)JOB_QUEUE_PROCESSES
从11.1开始,这个值是1000,建议设置成和CPU core相等的值。

(1.6)_DATAFILE_WRITE_ERRORS_CRASH_INSTANCE
这个值默认值是true。所有datafile的IO写error,都会导致数据库crash。
在11.2.0.2之前这个值是false,即只是offline datafile(非system),而不crash instance。11.2.0.2之后,是true。
建议:注意这个从11.2.0.2之后的变化。

(1.7) MAX_STRING_SIZE
这是在12c中的新参数。默认值是standard。
这个参数用于控制varchar2,nvarchar2,raw类型的最大值。standard下,行为和12c之前一样,即varchar2和nvarchar2是4000 bytes,raw是2000 bytes,
改成extended之后,启用了32k strings新特性,varchar2、nvarchar2、raw最大长度可以达到32767 bytes。
修改方式:
1. startup upgrade
2. ALTER SYSTEM SET MAX_STRING_SIZE = EXTENDED;
3.运行@?/rdbms/admin/utl32k.sql
但是注意,单向修改,改了之后,就改不回来了。(可以flashback)

注意原生32k strings是以out-of-line的blob方式存储,且还是basic file,而如果是以modify成32k strings的是以in-line的方式行链接存储。
所以转32k strings需要考虑lob效率的问题。

(2)其他在12c中的参数:

(2.1) _OPTIMIZER_AGGR_GROUPBY_ELIM
Values: { TRUE | FALSE } 默认值是true
Recommendation: FALSE – Wrong Results with GROUP BY Clause in Nested Query (Doc ID 19567916.8)
建议值:false

(2.2) INMEMORY_FORCE
Values: { DEFAULT | OFF } 默认值是default
Explanation: In-Memory Optimization
Recommendation: OFF – Unless you have an Oracle In-Memory license
建议值为off,除非你有in-memory的license

(2.3) OPTIMIZER_DYNAMIC_SAMPLING
如果统计信息不存在,进行动态采样的比例。
Values: { 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 } 默认值是2
解释:
a.0: Off
b.2: Check 不多于64个blocks – generate stats during parse
c.11:12c的新增加值,进行动态采样的block数由系统自动决定,采样结果会保留在statistics repository,供下次使用。
建议值:参考在线文档SQL Tuning Guide,最佳实践是在session级设置。

(2.4) AWR Lite Snapshots
参考Doc ID 1993045.1,建议在手工snapshot的时候,用lite模式
–默认值是bestfit
_AWR_SNAPSHOT_LEVEL = BASIC | LITE | TYPICAL | ALL | BESTFIT
–手工snapshot的时候,建议lite
SQL> exec dbms_workload_repository.create_snapshot(‘LITE’);

(2.5) _OPTIMIZER_COST_BASED_TRANSFORMATION
默认值是on,从10.2开始,默认值就是on了,但是在11.2.0.3之前,建议设置off

(2.6) SESSION_CACHED_CURSORS
默认值是50,建议设置成200,然后按照208857.1进行调整。
太大容易有shared pool碎片

(2.7) _MEMORY_IMM_MODE_WITHOUT_AUTOSGA
默认值是true,如果需要禁用偷buffer cache的属性,设置成false

(2.8) OPTIMIZER_USE_PENDING_STATISTICS
默认值是false,可以在session级设置成true后,测试新的但是还没发布的统计信息,对sql的影响。

(2.9)OPTIMIZER_USE_INVISIBLE_INDEXES
是否让优化器看见invisible的索引,默认值是false
ALTER INDEX idx_ename ON emp(ename) INVISIBLE;
ALTER SESSION SET OPTIMIZER_USE_INVISIBLE_INDEXES=TRUE;

(2.10) 其他建议值:
a. _optimizer_adaptive_plans=FALSE (需要评估,Adaptive Query Optimization Doc ID 2031605.1)
b. _optimizer_unnest_scalar_sq=FALSE (Bug 19894622 – ORA-600 [kkqcsfixfro:1 — frooutj] error occur in 12c (Doc ID 19894622.8))
c. _rowsets_enabled=FALSE (Bug 22173980 : WRONG RESULTS WHEN “_ROWSETS_ENABLED” = TRUE)
d. _optimizer_reduce_groupby_key=FALSE (Bug 20634449 – Wrong results from OUTER JOIN with a bind variable and a GROUP BY clause in 12.1.0.2)
e. _kks_obsolete_dump_threshold=0 or 8(Huge Trace Files Created Containing “—– Cursor Obsoletion Dump sql_id=%s —–” (Doc ID 1955319.1) ,该参数取值范围是0~8,默认值是1。设置0表示永远不dump,设置8表示parent cursor obsoleted 8次之后才dump。)

(2)其他在12c中的参数:

(2.1) _OPTIMIZER_AGGR_GROUPBY_ELIM
Values: { TRUE | FALSE } 默认值是true
Recommendation: FALSE – Wrong Results with GROUP BY Clause in Nested Query (Doc ID 19567916.8)
建议值:false

(2.2) INMEMORY_FORCE
Values: { DEFAULT | OFF } 默认值是default
Explanation: In-Memory Optimization
Recommendation: OFF – Unless you have an Oracle In-Memory license
建议值为off,除非你有in-memory的license

(2.3) OPTIMIZER_DYNAMIC_SAMPLING
如果统计信息不存在,进行动态采样的比例。
Values: { 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 } 默认值是2
解释:
a.0: Off
b.2: Check 不多于64个blocks – generate stats during parse
c.11:12c的新增加值,进行动态采样的block数由系统自动决定,采样结果会保留在statistics repository,供下次使用。
建议值:参考在线文档SQL Tuning Guide,最佳实践是在session级设置。

(2.4) AWR Lite Snapshots
参考Doc ID 1993045.1,建议在手工snapshot的时候,用lite模式
–默认值是bestfit
_AWR_SNAPSHOT_LEVEL = BASIC | LITE | TYPICAL | ALL | BESTFIT
–手工snapshot的时候,建议lite
SQL> exec dbms_workload_repository.create_snapshot(‘LITE’);

(2.5) _OPTIMIZER_COST_BASED_TRANSFORMATION
默认值是on,从10.2开始,默认值就是on了,但是在11.2.0.3之前,建议设置off

(2.6) SESSION_CACHED_CURSORS
默认值是50,建议设置成200,然后按照208857.1进行调整。
太大容易有shared pool碎片

(2.7) _MEMORY_IMM_MODE_WITHOUT_AUTOSGA
默认值是true,如果需要禁用偷buffer cache的属性,设置成false

(2.8) OPTIMIZER_USE_PENDING_STATISTICS
默认值是false,可以在session级设置成true后,测试新的但是还没发布的统计信息,对sql的影响。

(2.9)OPTIMIZER_USE_INVISIBLE_INDEXES
是否让优化器看见invisible的索引,默认值是false
ALTER INDEX idx_ename ON emp(ename) INVISIBLE;
ALTER SESSION SET OPTIMIZER_USE_INVISIBLE_INDEXES=TRUE;

(2.10) 其他建议值:
a. _optimizer_adaptive_plans=FALSE (需要评估,Adaptive Query Optimization Doc ID 2031605.1)
b. _optimizer_unnest_scalar_sq=FALSE (Bug 19894622 – ORA-600 [kkqcsfixfro:1 — frooutj] error occur in 12c (Doc ID 19894622.8))
c. _rowsets_enabled=FALSE (Bug 22173980 : WRONG RESULTS WHEN “_ROWSETS_ENABLED” = TRUE)
d. _optimizer_reduce_groupby_key=FALSE (Bug 20634449 – Wrong results from OUTER JOIN with a bind variable and a GROUP BY clause in 12.1.0.2)
e. _kks_obsolete_dump_threshold=0 or 8(Huge Trace Files Created Containing “—– Cursor Obsoletion Dump sql_id=%s —–” (Doc ID 1955319.1) ,该参数取值范围是0~8,默认值是1。设置0表示永远不dump,设置8表示parent cursor obsoleted 8次之后才dump。)

(4) 查找补丁信息:

原来是通过dba_registry_history 查询,现在可以通过下面的方法查询:
SQL> exec dbms_qopatch.get_sqlpatch_status;

下面的语句是用来查询inventory的位置:
SQL> select xmltransform(DBMS_QOPATCH.GET_OPATCH_LSINVENTORY,DBMS_QOPATCH.GET_OPATCH_XSLT) from dual;

查询某个patch是否被安装:
SQL> select xmltransform(DBMS_QOPATCH.IS_PATCH_INSTALLED(‘19303936 ‘),DBMS_QOPATCH.GET_OPATCH_XSLT) from dual;

查询所有的patch的情况:
SQL> select xmltransform(DBMS_QOPATCH.GET_OPATCH_LIST,DBMS_QOPATCH.GET_OPATCH_XSLT) from dual;

(5)升级catalog变化:

RMAN Catalog Upgrade:
– SQL> @$ORACLE_HOME/rdbms/admin/dbmsrmansys.sql <<<<需要先运行这一步(以前没有),再运行upgrade catalog – $ rman CATALOG my_catalog_owner@catdb recovery catalog database Password: RMAN> UPGRADE CATALOG;
RMAN> UPGRADE CATALOG;
RMAN> EXIT;

(6)增量统计信息收集增强(增量统计信息收集和交换分区相结合)

–先设置使用过期比例USE_STALE_PERCENT。定义“变化”的分区不会收集新的统计信息,除非有xx%百分比的变化。
SQL> exec DBMS_STATS.SET_DATABASE_PREFS(‘INCREMENTAL_STALENESS’,’USE_STALE_PERCENT’);
–设置过期比例为12%(默认是10%)
SQL> exec DBMS_STATS.SET_DATABASE_PREFS(‘STALE_PERCENT’,’12’);

(7)统计信息情况查看:

–查看整个库的统计信息情况:
SQL> variable mystatrep2 clob;
SQL> set long 1000000
SQL> begin
2 :mystatrep2 := DBMS_STATS.REPORT_STATS_OPERATIONS(since=>SYSTIMESTAMP-
3 1,until=>SYSTIMESTAMP, detail_level=>’TYPICAL’,format=>’TEXT’);
4 end;
5 /

PL/SQL procedure successfully completed.

SQL>
SQL> set serverout on
SQL> set long 999999999
SQL> set line 10000
SQL> set pages 10000
SQL> col mystatrep2 for a200
SQL> print mystatrep2

MYSTATREP2
——————————————————————————————————————————————————————————————————–
——————————————————————————————————————————————————————————————————-
| Operation Id | Operation | Target | Start Time | End Time | Status | Total Tasks | Successful Tasks | Failed Tasks | Active Tasks |
——————————————————————————————————————————————————————————————————-
| 366 | export_stats_for_dp | TEST | 13-JUL-16 02.12.59.130000 PM +08:00 | 13-JUL-16 02.12.59.203000 PM +08:00 | COMPLETED | 0 | 0 | 0 | 0 |
——————————————————————————————————————————————————————————————————-
| 365 | export_stats_for_dp | TEST | 13-JUL-16 02.08.18.857000 PM +08:00 | 13-JUL-16 02.08.18.880000 PM +08:00 | COMPLETED | 0 | 0 | 0 | 0 |
——————————————————————————————————————————————————————————————————-
| 364 | export_stats_for_dp | TEST | 13-JUL-16 02.04.13.425000 PM +08:00 | 13-JUL-16 02.04.13.480000 PM +08:00 | COMPLETED | 0 | 0 | 0 | 0 |
——————————————————————————————————————————————————————————————————-
| 363 | export_stats_for_dp | TEST | 13-JUL-16 01.57.50.812000 PM +08:00 | 13-JUL-16 01.57.50.846000 PM +08:00 | COMPLETED | 0 | 0 | 0 | 0 |
——————————————————————————————————————————————————————————————————-
| 362 | export_stats_for_dp | TEST | 13-JUL-16 01.56.34.637000 PM +08:00 | 13-JUL-16 01.56.34.667000 PM +08:00 | COMPLETED | 0 | 0 | 0 | 0 |
——————————————————————————————————————————————————————————————————-
| 361 | import_stats_for_dp | TEST | 13-JUL-16 01.55.50.018000 PM +08:00 | 13-JUL-16 01.55.50.294000 PM +08:00 | COMPLETED | 0 | 0 | 0 | 0 |
——————————————————————————————————————————————————————————————————-
| 360 | export_stats_for_dp | TEST | 13-JUL-16 01.53.54.840000 PM +08:00 | 13-JUL-16 01.53.54.879000 PM +08:00 | COMPLETED | 0 | 0 | 0 | 0 |
——————————————————————————————————————————————————————————————————-
| 359 | import_stats_for_dp | TEST | 13-JUL-16 01.52.17.822000 PM +08:00 | 13-JUL-16 01.52.18.059000 PM +08:00 | COMPLETED | 0 | 0 | 0 | 0 |
——————————————————————————————————————————————————————————————————-
| 358 | import_stats_for_dp | TEST | 13-JUL-16 01.46.44.289000 PM +08:00 | 13-JUL-16 01.46.44.611000 PM +08:00 | COMPLETED | 0 | 0 | 0 | 0 |
——————————————————————————————————————————————————————————————————-
| 357 | export_stats_for_dp | TEST | 13-JUL-16 01.43.12.810000 PM +08:00 | 13-JUL-16 01.43.13.543000 PM +08:00 | COMPLETED | 0 | 0 | 0 | 0 |
——————————————————————————————————————————————————————————————————-
| 356 | import_stats_for_dp | TEST | 13-JUL-16 01.40.03.349000 PM +08:00 | 13-JUL-16 01.40.03.650000 PM +08:00 | COMPLETED | 0 | 0 | 0 | 0 |
——————————————————————————————————————————————————————————————————-
| 355 | import_stats_for_dp | TEST | 13-JUL-16 01.37.36.601000 PM +08:00 | 13-JUL-16 01.37.36.843000 PM +08:00 | COMPLETED | 0 | 0 | 0 | 0 |
——————————————————————————————————————————————————————————————————-
| 354 | import_stats_for_dp | TEST | 13-JUL-16 01.36.32.072000 PM +08:00 | 13-JUL-16 01.36.32.321000 PM +08:00 | COMPLETED | 0 | 0 | 0 | 0 |
——————————————————————————————————————————————————————————————————-
| 353 | import_stats_for_dp | TEST | 13-JUL-16 01.34.56.514000 PM +08:00 | 13-JUL-16 01.34.56.790000 PM +08:00 | COMPLETED | 0 | 0 | 0 | 0 |
——————————————————————————————————————————————————————————————————-
| 352 | import_stats_for_dp | TEST | 13-JUL-16 12.01.25.756000 PM +08:00 | 13-JUL-16 12.01.26.022000 PM +08:00 | COMPLETED | 0 | 0 | 0 | 0 |
——————————————————————————————————————————————————————————————————-
| 351 | import_stats_for_dp | TEST | 13-JUL-16 11.45.08.131000 AM +08:00 | 13-JUL-16 11.45.08.703000 AM +08:00 | COMPLETED | 0 | 0 | 0 | 0 |
——————————————————————————————————————————————————————————————————-
| 350 | export_stats_for_dp | TEST | 13-JUL-16 11.42.21.767000 AM +08:00 | 13-JUL-16 11.42.24.557000 AM +08:00 | COMPLETED | 0 | 0 | 0 | 0 |
——————————————————————————————————————————————————————————————————-

SQL>
–查看某个schema的统计信息收集情况:
SQL> set serverout on
SQL> set long 999999999
SQL> set line 10000
SQL> set pages 10000
SQL> col my_report for a200
SQL> variable my_report clob;
SQL> BEGIN
2 :my_report := DBMS_STATS.REPORT_GATHER_SCHEMA_STATS(ownname => ‘TEST’,
3 detail_level => ‘TYPICAL’, format => ‘TEXT’);
4 END;
5 /

PL/SQL procedure successfully completed.

SQL>
SQL> print my_report

MY_REPORT
——————————————————————————————————————————————————————————————————–
——————————————————————————————————————————————————————————————————-
| Operation Id | Operation | Target | Start Time | End Time | Status | Total Tasks | Successful Tasks | Failed Tasks | Active Tasks |
——————————————————————————————————————————————————————————————————-
| 368 | gather_schema_stats (reporting mode) | TEST | | | | 1 | | | |
——————————————————————————————————————————————————————————————————-
——————————————————————————————————————————————————————————————————-
| |
| ————————————————————————————————————————————————————————————————— |
| T A S K S |
| ————————————————————————————————————————————————————————————————— |
| ——————————————————————————————————————————————————————————————— |
| | Target | Type | Start Time | End Time | Status | |
| ——————————————————————————————————————————————————————————————— |
| | TEST.T1 | TABLE | | | | |
| ——————————————————————————————————————————————————————————————— |
| |
| |
——————————————————————————————————————————————————————————————————-

(8)DBMS_ROLLING

Data Guard Simple Rolling Upgrade
Semi-automation of Transient Logical Standby Rolling Upgrade
Works with Data Guard Broker
Procedure DBMS_ROLLING

(9) Real-Time ADDM:

– MMON进程负责收集数据, 每隔3秒一次,不会有lock/latch
– MMON的子进程创建report,并保留在AWR中,可以通过查询 DBA_HIST_REPORTS

参考 Mike Dietrich Upgrade, Migrate & Consolidate to Oracle Database 12c/ oracleblog

升级到12c/18c以后的版本需要了解的一些方面参数(参考Upgrade, Migrate & Consolidate to Oracle Database 12c)

跟踪oracle 进程链接建立时候发生的情况

 

本方法主要使用触发器的方式对新建立的进程自动进行10046的trace并进行分析的方式,期间使用到truss,需要掌握truss的使用方法,具体如下:

 

创建用户

create user trace_user identified by trace_user account unlock;
grant create session,dba to trace_user;

创建登陆触发器

create or replace trigger sys.set_trace
after logon on database
when (user = 'trace_user')
declare
lcommand varchar(200);
begin
execute immediate 'alter session set statistics_level=all';
execute immediate 'alter session set max_dump_file_size=unlimited';
execute immediate 'alter session set events ''10046 trace name context forever, level 12''';
end set_trace;
/

 

尝试登陆

sqlplus "trace_user/trace_user" << eof
exit;
eof

这将在$ ORACLE_BASE / admin / <db_name> / udump目录下生成(10046)跟踪文件

然后通过查看“e =”部分查看数据库调用(PARSE,BIND,EXEC,FETCH)是否有大量时间,这意味着数据库调用所消耗的持续时间

通过查看“ela =”部分检查等待事件是否有大量时间,这意味着等待事件消耗的持续时间(可能通过进行系统调用)

PARSING IN CURSOR #5 len=131 dep=1 uid=0 oct=3 lid=0 tim=15687899202263 hv=1389591971 ad='ca9a7948'
select privilege#,nvl(col#,0),max(mod(nvl(option$,0),2))from objauth$ where obj#=:1 and grantee#=:2 group by privilege#,nvl(col#,0)
END OF STMT
EXEC #5:c=0,e=145,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,tim=15687899202260
WAIT #5: nam='db file sequential read' ela= 30005 file#=1 block#=24208 blocks=1 obj#=-1 tim=15687899232346
FETCH #5:c=0,e=30075,p=1,cr=2,cu=0,mis=0,r=0,dep=1,og=4,tim=15687899232396

没有数据库调用占用大量时间

less oracle_ora_1118270.trc | grep -i ",e=" | cut -d , -f2 > karlarao.txt ; sed -n 's/e=/ /p' karlarao.txt | sort -nr | less

 358746
 183162
 61293
 44661
 32580
 30075
 28695
 26950
 25837
 24244
 ...

没有等待事件耗费大量时间

less oracle_ora_1118270.trc | grep -i "ela=" | cut -d " " -f8 | sort -nr | less

30005
28624
13253
11592
9650

没有 “os thread startup”事件!

less oracle_ora_1118270.trc | grep -i "ela=" | cut -d "=" -f2 | uniq

'SQL*Net message to client' ela
'SQL*Net message from client' ela
'SQL*Net message to client' ela
'SQL*Net message from client' ela
'SQL*Net message to client' ela
'SQL*Net message from client' ela
'SQL*Net message to client' ela
'SQL*Net message from client' ela
'db file sequential read' ela
'SQL*Net message to client' ela
'SQL*Net message from client' ela
'db file sequential read' ela
'SQL*Net message to client' ela
'db file sequential read' ela
'SQL*Net message from client' ela
'SQL*Net message to client' ela
'SQL*Net message from client' ela
'db file sequential read' ela
'SQL*Net message to client' ela
'SQL*Net message from client' ela
'SQL*Net message to client' ela
'SQL*Net message from client' ela
'SQL*Net message to client' ela
'SQL*Net message from client' ela
'SQL*Net message to client' ela
'SQL*Net message from client' ela

下来对系统调用进行检测,这里使用truss工具

这个工具可以让你做一些应用程序跟踪,这里是跟踪SQL * Plus,并显示应用程序对外部库和内核的调用

truss -c sqlplus "/ as sysdba" << EOF
exit;
EOF

truss -d sqlplus "/ as sysdba" << EOF
exit;
EOF

 

“-c”开关计算跟踪的系统调用,故障和信号

“-d”开关显示每行的时间戳(以秒为单位)。跟踪输出的第一行将显示测量各个时间戳的基准时间

这里下面可以发现是DNS服务导致sqlplus“/ as sysdba”操作减慢,并且有“os线程启动”等待,下面的文本是“truss”输出的部分,当在/etc/resolv.conf和/ etc / hosts上读取时,“(sleep……)”事件表示减速。

ENOTTY和ECONNREFUSED是看到的错误,这里此文件/usr/include/sys/errno.h上找到有关错误消息的更多详细信息。以下是它们的解释

 

#define	ENOTTY	25	/* Inappropriate I/O control operation	*/
#define ECONNREFUSED    79      /* Connection refused */

 

根据“truss -d”的记录,可以看到时间信息从2.3379秒(读取/etc/resolv.conf) – > 7.3477秒 – > 17.3489秒 – > 37.3555秒(读数) / etc / hosts) – > 70.3863秒(已连接)

0.3172:        gethostname(0x0FFFFFFFFFFF9920, 256) = 0
0.3175:        _getpid()                        = 1102056
0.3177:        open("/etc/resolv.conf", O_RDONLY) = 8
0.3180:        kioctl(8, 22528, 0x0000000000000000, 0x0000000000000000) Err#25 ENOTTY
0.3182:        kioctl(8, 22528, 0x0000000000000000, 0x0000000000000000) Err#25 ENOTTY
kread(8, " d o m a i n     this is the domain name, i removed it".., 4096)    = 69
kread(8, " d o m a i n     this is the domain name, i removed it".., 4096)    = 0
0.3190:        close(8)                         = 0
0.3194:        socket(2, 2, 0)                  = 8
0.3197:        getsockopt(8, 65535, 4104, 0x0FFFFFFFFFFF70E4, 0x0FFFFFFFFFFF70E0) = 0
0.3199:        connext(8, 0x09001000A0018600, 16) = 0
0.3202:        send(8, 0x0FFFFFFFFFFF7FF0, 41, 0) = 41
0.3205:        _poll(0x0FFFFFFFFFFF7190, 1, 5000) = 1
0.3208:        nrecvfrom(8, 0x0FFFFFFFFFFF9320, 1024, 0, 0x0FFFFFFFFFFF7950, 0x0FFFFFFFFFFF7178) Err#79 ECONNREFUSED
0.3210:        close(8)                         = 0
0.3212:        socket(2, 2, 0)                  = 8
0.3215:        sendto(8, 0x0FFFFFFFFFFF7FF0, 41, 0, 0x09001000A0018610, 16) = 41
0.3217:        _poll(0x0FFFFFFFFFFF7190, 1, 5000) = 1
0.3220:        nrecvfrom(8, 0x0FFFFFFFFFFF9320, 1024, 0, 0x0FFFFFFFFFFF7950, 0x0FFFFFFFFFFF7178) = 108
0.3222:        close(8)                         = 0
0.3224:        socket(2, 2, 0)                  = 8
0.3227:        getsockopt(8, 65535, 4104, 0x0FFFFFFFFFFF70E4, 0x0FFFFFFFFFFF70E0) = 0
0.3229:        connext(8, 0x09001000A0018600, 16) = 0
0.3231:        send(8, 0x0FFFFFFFFFFF7FF0, 28, 0) = 28
0.3233:        _poll(0x0FFFFFFFFFFF7190, 1, 5000) = 1
0.3236:        nrecvfrom(8, 0x0FFFFFFFFFFF9320, 1024, 0, 0x0FFFFFFFFFFF7950, 0x0FFFFFFFFFFF7178) Err#79 ECONNREFUSED
0.3238:        close(8)                         = 0
0.3240:        socket(2, 2, 0)                  = 8
0.3243:        sendto(8, 0x0FFFFFFFFFFF7FF0, 28, 0, 0x09001000A0018610, 16) = 28
0.3245:        _poll(0x0FFFFFFFFFFF7190, 1, 5000) = 1
0.3248:        nrecvfrom(8, 0x0FFFFFFFFFFF9320, 1024, 0, 0x0FFFFFFFFFFF7950, 0x0FFFFFFFFFFF7178) = 28
0.3250:        close(8)                         = 0
0.3252:        socket(2, 2, 0)                  = 8
0.3373:        sendto(8, 0x0FFFFFFFFFFF7FF0, 28, 0, 0x09001000A0018600, 16) = 28
2.3379:        _poll(0x0FFFFFFFFFFF7190, 1, 5000) (sleeping...)
2.3379:        _poll(0x0FFFFFFFFFFF7190, 1, 5000) = 0
5.3468:        close(8)                         = 0
5.3470:        socket(2, 2, 0)                  = 8
5.3472:        sendto(8, 0x0FFFFFFFFFFF7FF0, 28, 0, 0x09001000A0018600, 16) = 28
7.3477:        _poll(0x0FFFFFFFFFFF7190, 1, 10000) (sleeping...)
7.3477:        _poll(0x0FFFFFFFFFFF7190, 1, 10000) = 0
15.3479:        close(8)                        = 0
15.3482:        socket(2, 2, 0)                 = 8
15.3484:        sendto(8, 0x0FFFFFFFFFFF7FF0, 28, 0, 0x09001000A0018600, 16) = 28
17.3489:        _poll(0x0FFFFFFFFFFF7190, 1, 20000) (sleeping...)
17.3489:        _poll(0x0FFFFFFFFFFF7190, 1, 20000) = 0
35.3491:        close(8)                        = 0
35.3495:        getdomainname(0x0FFFFFFFFFFF9480, 256) = 0
35.3497:        open("/etc/hosts", O_RDONLY)    = 8
35.3500:        kioctl(8, 22528, 0x0000000000000000, 0x0000000000000000) Err#25 ENOTTY
35.3502:        kfcntl(8, F_SETFD, 0x0000000000000001) = 0
35.3505:        kioctl(8, 22528, 0x0000000000000000, 0x0000000000000000) Err#25 ENOTTY
kread(8, " #   @ ( # ) 4 7\t 1 . 1".., 4096)    = 3453
kread(8, " #   @ ( # ) 4 7\t 1 . 1".., 4096)    = 0
35.3514:        close(8)                        = 0
kwrite(9, "01 �0603 s".., 432)    = 432
37.3555:        kread(10, "16060280".., 2064) (sleeping...)
kread(10, "06 E06\b".., 2064)   = 1605
70.3762:        open("/oracle/app/product/10.2/db_1/rdbms/mesg/oraus.msb", O_RDONLY) = 8
70.3764:        kfcntl(8, F_SETFD, 0x0000000000000001) = 0
70.3767:        lseek(8, 0, 0)                  = 0
kread(8, "1513 "011303\t\t".., 256)     = 256
70.3772:        lseek(8, 512, 0)                = 512
kread(8, "1A Q 5 C [ V u �85 �9480".., 512)     = 512
70.3776:        lseek(8, 1024, 0)               = 1024
kread(8, "18 $ 4 = G S".., 512)     = 512
70.3781:        lseek(8, 50688, 0)              = 50688
kread(8, "\f05 ] P05 ^".., 512)     = 512
70.3786:        lseek(8, 512, 0)                = 512
kread(8, "1A Q 5 C [ V u �85 �9480".., 512)     = 512
70.3790:        lseek(8, 1024, 0)               = 1024
kread(8, "18 $ 4 = G S".., 512)     = 512
70.3795:        lseek(8, 50688, 0)              = 50688
kread(8, "\f05 ] P05 ^".., 512)     = 512
70.3799:        lseek(8, 512, 0)                = 512
kread(8, "1A Q 5 C [ V u �85 �9480".., 512)     = 512
70.3804:        lseek(8, 1024, 0)               = 1024
kread(8, "18 $ 4 = G S".., 512)     = 512
70.3808:        lseek(8, 50688, 0)              = 50688
kread(8, "\f05 ] P05 ^".., 512)     = 512
70.3813:        lseek(8, 512, 0)                = 512
kread(8, "1A Q 5 C [ V u �85 �9480".., 512)     = 512
70.3817:        lseek(8, 1024, 0)               = 1024
kread(8, "18 $ 4 = G S".., 512)     = 512
70.3822:        lseek(8, 51712, 0)              = 51712
kread(8, "\n0589 D058A".., 512)     = 512
70.3827:        close(8)                        = 0
kwrite(9, " <0611 k".., 60)     = 60
kread(10, " �06\b".., 2064)   = 179
kwrite(9, " U0603 h".., 85)     = 85
kread(10, "1606\b".., 2064)   = 22
kwrite(9, " U0603 h".., 85)     = 85
kread(10, "1606\b".., 2064)   = 22
70.3854:        lseek(4, 512, 0)                = 512
kread(4, "17 �".., 512)     = 512
70.3858:        lseek(4, 1024, 0)               = 1024
kread(4, "16 * R h819E".., 512)     = 512
70.3863:        lseek(4, 4096, 0)               = 4096
kread(4, "\f82 P86".., 512)     = 512

kwrite(1, "\n", 1)                              = 1
Connected to:
kwrite(1, " C o n n e c t e d   t o".., 14)     = 14
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
kwrite(1, " O r a c l e   D a t a b".., 77)     = 77
With the Partitioning, OLAP, Data Mining and Real Application Testing options
kwrite(1, " W i t h   t h e   P a r".., 78)     = 78

kwrite(1, "\n", 1)                              = 1
70.3882:        kfcntl(1, F_GETFL, 0x0000000000000008) = 2
70.3886:        __libc_sbrk(0x0000000000030020) = 0x000000001023C880
70.3892:        access("login.sql", 0)          Err#2  ENOENT
70.3895:        access("/oracle/app/product/10.2/db_1/sqlplus/admin/glogin.sql", 0) = 0
70.3898:        statfs("/oracle/app/product/10.2/db_1/sqlplus/admin/glogin.sql", 0x0FFFFFFFFFFFDA10) = 0

 

事实证明确实是dns出现了问题,在调整后迅速恢复了响应时间

3.0713:        gethostname(0x0FFFFFFFFFFF9900, 256) = 0
3.0716:        _getpid()                        = 2539762
3.0719:        open("/etc/resolv.conf", O_RDONLY) = 8
3.0721:        kioctl(8, 22528, 0x0000000000000000, 0x0000000000000000) Err#25 ENOTTY
3.0724:        kioctl(8, 22528, 0x0000000000000000, 0x0000000000000000) Err#25 ENOTTY
kread(8, " d o m a i n     this is the domain name, i removed it".., 4096)    = 70
kread(8, " d o m a i n     this is the domain name, i removed it".., 4096)    = 0
3.0731:        close(8)                         = 0
3.0735:        socket(2, 2, 0)                  = 8
3.0740:        getsockopt(8, 65535, 4104, 0x0FFFFFFFFFFF70C4, 0x0FFFFFFFFFFF70C0) = 0
3.0742:        connext(8, 0x09001000A0018600, 16) = 0
3.0746:        send(8, 0x0FFFFFFFFFFF7FD0, 41, 0) = 41
3.0750:        _poll(0x0FFFFFFFFFFF7170, 1, 5000) = 1
3.0753:        nrecvfrom(8, 0x0FFFFFFFFFFF9300, 1024, 0, 0x0FFFFFFFFFFF7930, 0x0FFFFFFFFFFF7158) = 108
3.0756:        send(8, 0x0FFFFFFFFFFF7FD0, 28, 0) = 28
3.0758:        _poll(0x0FFFFFFFFFFF7170, 1, 5000) = 1
3.0761:        nrecvfrom(8, 0x0FFFFFFFFFFF9300, 1024, 0, 0x0FFFFFFFFFFF7930, 0x0FFFFFFFFFFF7158) = 28
3.0764:        close(8)                         = 0
3.0767:        getdomainname(0x0FFFFFFFFFFF9460, 256) = 0
3.0769:        open("/etc/hosts", O_RDONLY)     = 8
3.0771:        kioctl(8, 22528, 0x0000000000000000, 0x0000000000000000) Err#25 ENOTTY
3.0774:        kfcntl(8, F_SETFD, 0x0000000000000001) = 0
3.0777:        kioctl(8, 22528, 0x0000000000000000, 0x0000000000000000) Err#25 ENOTTY
kread(8, " #   @ ( # ) 4 7\t 1 . 1".., 4096)    = 3453
kread(8, " #   @ ( # ) 4 7\t 1 . 1".., 4096)    = 0
3.0786:        close(8)                         = 0
kwrite(9, "01 �0603 s".., 432)    = 432
kread(10, "06 H06\b".., 2064)   = 1608
3.0973:        open("/oracle/app/product/10.2/db_1/rdbms/mesg/oraus.msb", O_RDONLY) = 8
3.0975:        kfcntl(8, F_SETFD, 0x0000000000000001) = 0
3.0978:        lseek(8, 0, 0)                   = 0
kread(8, "1513 "011303\t\t".., 256)     = 256
3.0983:        lseek(8, 512, 0)                 = 512
kread(8, "1A Q 5 C [ V u �85 �9480".., 512)     = 512
3.0988:        lseek(8, 1024, 0)                = 1024
kread(8, "18 $ 4 = G S".., 512)     = 512
3.0993:        lseek(8, 50688, 0)               = 50688
kread(8, "\f05 ] P05 ^".., 512)     = 512
3.0997:        lseek(8, 512, 0)                 = 512
kread(8, "1A Q 5 C [ V u �85 �9480".., 512)     = 512
3.1002:        lseek(8, 1024, 0)                = 1024
kread(8, "18 $ 4 = G S".., 512)     = 512
3.1006:        lseek(8, 50688, 0)               = 50688
kread(8, "\f05 ] P05 ^".., 512)     = 512
3.1011:        lseek(8, 512, 0)                 = 512
kread(8, "1A Q 5 C [ V u �85 �9480".., 512)     = 512
3.1015:        lseek(8, 1024, 0)                = 1024
kread(8, "18 $ 4 = G S".., 512)     = 512
3.1021:        lseek(8, 50688, 0)               = 50688
kread(8, "\f05 ] P05 ^".., 512)     = 512
3.1025:        lseek(8, 512, 0)                 = 512
kread(8, "1A Q 5 C [ V u �85 �9480".., 512)     = 512
3.1029:        lseek(8, 1024, 0)                = 1024
kread(8, "18 $ 4 = G S".., 512)     = 512
3.1034:        lseek(8, 51712, 0)               = 51712
kread(8, "\n0589 D058A".., 512)     = 512
3.1038:        close(8)                         = 0
kwrite(9, " <0611 k".., 60)     = 60
kread(10, " �06\b".., 2064)   = 179
kwrite(9, " U0603 h".., 85)     = 85
kread(10, "1606\b".., 2064)   = 22
kwrite(9, " U0603 h".., 85)     = 85
kread(10, "1606\b".., 2064)   = 22
3.1064:        lseek(4, 512, 0)                 = 512
kread(4, "17 �".., 512)     = 512
3.1069:        lseek(4, 1024, 0)                = 1024
kread(4, "16 * R h819E".., 512)     = 512
3.1073:        lseek(4, 4096, 0)                = 4096
kread(4, "\f82 P86".., 512)     = 512

kwrite(1, "\n", 1)                              = 1
Connected to:
kwrite(1, " C o n n e c t e d   t o".., 14)     = 14
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
kwrite(1, " O r a c l e   D a t a b".., 77)     = 77
With the Partitioning, OLAP, Data Mining and Real Application Testing options
kwrite(1, " W i t h   t h e   P a r".., 78)     = 78

kwrite(1, "\n", 1)                              = 1
3.1095:        kfcntl(1, F_GETFL, 0x0000000000000008) = 2
3.1099:        __libc_sbrk(0x0000000000030020)  = 0x000000001023C880
3.1105:        access("login.sql", 0)           Err#2  ENOENT
3.1109:        access("/oracle/app/product/10.2/db_1/sqlplus/admin/glogin.sql", 0) = 0
3.1112:        statfs("/oracle/app/product/10.2/db_1/sqlplus/admin/glogin.sql", 0x0FFFFFFFFFFFD9F0) = 0
跟踪oracle 进程链接建立时候发生的情况