Archive for the ‘Oracle10g’ tag
How to Generate AWR Differences Report
生成系统正常期间内和故障期间内的AWR性能数据比较报告,可能可以帮助我们更加简单的定位问题所在。
可以通过awrddrpt.sql脚本生成。
SQL> @?/rdbms/admin/awrddrpt.sql
脚本会要求输入需要比较的第一份和第二份AWR报告的起始结束Snap ID,生成的AWR报告基本上如下图所示。
在普通的AWR报告各个部分都增加了1st, 2nd以及%Diff,这表示第一份时,第二份时各自的情况以及两次的相差百分比。
如果我们因为某些原因(比如权限问题)无法读取awrddrpt.sql,那么也可以通过DBMS_WORKLOAD_REPOSITORY.AWR_DIFF_REPORT_TEXT函数来完成。
DBMS_WORKLOAD_REPOSITORY.AWR_DIFF_REPORT_TEXT( dbid1 IN NUMBER, inst_num1 IN NUMBER, bid1 IN NUMBER, eid1 IN NUMBER, dbid2 IN NUMBER, inst_num2 IN NUMBER, bid2 IN NUMBER, eid2 IN NUMBER) RETURN awrdrpt_text_type_table PIPELINED;
dbid通过以下SQL获取。
SQL> SELECT DBID FROM v$database; DBID ---------- 777920305
inst_num通过以下SQL获得。
SQL> SELECT instance_number FROM v$instance; INSTANCE_NUMBER --------------- 1
bid和eid分别是Begin Snap ID和End Snap ID,通过以下SQL获得。
SQL> SELECT snap_id, end_interval_time 2 FROM dba_hist_snapshot 3 WHERE end_interval_time > trunc(sysdate-1) 4 ORDER BY snap_id; SNAP_ID END_INTERVAL_TIME ---------- -------------------------------------------------------------------------------- 377 25-FEB-10 01.10.10.657 PM 378 25-FEB-10 02.00.21.884 PM 379 25-FEB-10 04.49.00.861 PM
将上述获得值全部作为参数值传入AWR_DIFF_REPORT_TEXT函数,执行即可。由于输出结果较长,使用spool打印到文件中方便查看。
SQL>spool awrdiff_1_377_1_378.txt SQL> SELECT * FROM 2 TABLE(DBMS_WORKLOAD_REPOSITORY.AWR_DIFF_REPORT_TEXT(777920305,1,377,378, 3 777920305,1,378,379)); SQL>spool off
How to resolve ORA-15025 when creating ASM diskgroup on Solaris
操作系统版本:Solaris10 Sparc 64bit
数据库版本:Oracle 10.2.0.4
在创建ASM Diskgroup的时候出现如下图报错。
检查当前系统裸设备的设置。
partition> p Current partition table (original): Total disk cylinders available: 53154 + 2 (reserved cylinders) Part Tag Flag Cylinders Size Blocks 0 root wm 0 0 (0/0/0) 0 1 swap wu 0 0 (0/0/0) 0 2 backup wu 0 - 53153 1.99TB (53154/0/0) 4269595050 3 unassigned wm 0 0 (0/0/0) 0 4 unassigned wm 0 0 (0/0/0) 0 5 unassigned wm 0 0 (0/0/0) 0 6 usr wm 0 - 53153 1.99TB (53154/0/0) 4269595050 7 unassigned wm 0 0 (0/0/0) 0
注意到被使用的裸设备d0s6的扇区划分是从0开始的,这在Solaris操作系统中将会导致Oracle无法读取该裸设备,因此引发了上面的错误。
解决方法是分配出一小部分空间给其它分区。比如分配100M给d0s3。
partition> p Current partition table (unnamed): Total disk cylinders available: 53154 + 2 (reserved cylinders) Part Tag Flag Cylinders Size Blocks 0 root wm 0 0 (0/0/0) 0 1 swap wu 0 0 (0/0/0) 0 2 backup wu 0 - 53153 1.99TB (53154/0/0) 4269595050 3 unassigned wm 0 - 2 117.66MB (3/0/0) 240975 4 unassigned wm 0 0 (0/0/0) 0 5 unassigned wm 0 0 (0/0/0) 0 6 usr wm 3 - 26112 1000.06GB (26110/0/0) 2097285750 7 unassigned wm 0 0 (0/0/0)
再次重新创建ASM磁盘组,成功。
How to identify the cluster name
在为RAC环境配置database control的时候,会被问及cluster name,当然我们知道默认安装的Oracle Cluster Name就是crs,但是如何确认到底CRS的名字是什么呢?
[oracle@dbserver1 oracle10g]$ emca -config dbcontrol db -cluster -EM_NODE dbserver1 -EM_SID_LIST intertol2,intertol3,intertol4 STARTED EMCA at Jul 27, 2009 4:20:25 PM EM Configuration Assistant, Version 10.2.0.1.0 Production Copyright (c) 2003, 2005, Oracle. All rights reserved. Enter the following information: Database unique name: intertol Database Control is already configured for the database intertol You have chosen to configure Database Control for managing the database intertol This will remove the existing configuration and the default settings and perform a fresh configuration Do you wish to continue? [yes(Y)/no(N)]: Y Listener port number: 1521 Cluster name:
实际上Oracle提供了一个实用程序cemutlo来获取cluster name。
[oracle@dbserver1 ~]$ $ORA_CRS_HOME/bin/cemutlo -h
Usage: /u01/app/oracle/product/crs/bin/cemutlo.bin [-n] [-w]
where:
-n prints the cluster name
-w prints the clusterware version in the following format:
<major_version>:<minor_version>:<vendor_info>
[oracle@dbserver1 ~]$ cemutlo -n
crs另外还有使用ocrdump命令或者ocrconfig命令来间接获得cluster name的方法,详细参看《怎么查安装CRS时设置的cluster name》。
![Chanel [K]](http://www.dbform.com/wp-content/chanelk.png)

