客户装有两套Oracle RAC,以及一套单机Oracle。RAC均是双应用服务器,存储一套为NAS,一套为SAN。通过千兆网连接。三套系统的硬件配置相差不多。
大多数数据的应用在RAC上都很正常,但是有个比较复杂的报表的查询,在单机Oracle上执行只需要5秒左右出结果,但是在两套RAC上,都需要超过20秒的时间才能出来。
后来经过测试,发现还有少数查询速度差异更大,在单机上只要2秒左右,在RAC上超过1分钟,而且远不如报表查询那么复杂。
RAC上绝大多数查询都和单机是相差无几的速度,只有少数查询有这种情况,不知道这是什么问题,也不知道如何解决,求解答~!RAC1:IBM 3650M2*2 、IBM NAS3300 、RH 5
RAC2: IBM 3650M3*2 、IPSAN 、RH 5
单机:IBM 3650M3 、RH 5
具体硬件配置有点不记得,但是RAC2和单机的配置是一样的。所有测试数据都是从RAC1上打的dmp包,并在RAC2和单机上导入的。
RAC上绝大多数查询都和单机是相差无几的速度,只有少数查询有这种情况,不知道这是什么问题,也不知道如何解决,求解答~!谢谢

解决方案 »

  1.   

    看看执行计划差异,
    RAC里的索引和单机索引的使用情况还是有区别的
      

  2.   

    2012-06-28 17:31:37,359 - DEBUG - select kk.* from (select sms_sales_header.business_date,sms_sc.sc_code,sms_user.full_name,sms_sales_header.actual_amount,sms_sub.id as subid,sms_sc.id as scid,sms_sales_header.TYPE,sms_sales_header.id,sms_sales_header.pay_type , sms_business_area.ba_name , sms_sales_header.pcc_used_id , sms_user.BUSINESS_AREA_ID as ba_id,sms_user.id as userId from sms_sales_header,sms_user,sms_sub,sms_sc,sms_business_area,sms_sub_type_ref where sms_sales_header.sub_id = sms_sub.id and sms_sales_header.operator_by = sms_user.id and sms_user.BUSINESS_AREA_ID = sms_business_area.ID and sms_sub.id = sms_sub_type_ref.sub_id and sms_sales_header.sc_id = sms_sc.id(+) and sms_sales_header.type <> 33 and 1= ? and sms_sales_header.business_date > ? and sms_sales_header.business_date < ? and sms_user.operator_area_id = ? )kk 2012-06-28 17:31:37,359 - DEBUG - conditon is:1,2012-04-28 00:00:00.0,2012-04-29 00:00:00.0,3,2012-06-28 17:31:37,359 - DEBUG - countsql=SELECT COUNT(*)  from (select sms_sales_header.business_date,sms_sc.sc_code,sms_user.full_name,sms_sales_header.actual_amount,sms_sub.id as subid,sms_sc.id as scid,sms_sales_header.TYPE,sms_sales_header.id,sms_sales_header.pay_type , sms_business_area.ba_name , sms_sales_header.pcc_used_id , sms_user.BUSINESS_AREA_ID as ba_id,sms_user.id as userId from sms_sales_header,sms_user,sms_sub,sms_sc,sms_business_area,sms_sub_type_ref where sms_sales_header.sub_id = sms_sub.id and sms_sales_header.operator_by = sms_user.id and sms_user.BUSINESS_AREA_ID = sms_business_area.ID and sms_sub.id = sms_sub_type_ref.sub_id and sms_sales_header.sc_id = sms_sc.id(+) and sms_sales_header.type <> 33 and 1= ? and sms_sales_header.business_date > ? and sms_sales_header.business_date < ? and sms_user.operator_area_id = ? )kk 2012-06-28 17:31:40,140 - DEBUG - SELECT * FROM (SELECT originTable.*, ROWNUM rn FROM (select kk.* from (select sms_sales_header.business_date,sms_sc.sc_code,sms_user.full_name,sms_sales_header.actual_amount,sms_sub.id as subid,sms_sc.id as scid,sms_sales_header.TYPE,sms_sales_header.id,sms_sales_header.pay_type , sms_business_area.ba_name , sms_sales_header.pcc_used_id , sms_user.BUSINESS_AREA_ID as ba_id,sms_user.id as userId from sms_sales_header,sms_user,sms_sub,sms_sc,sms_business_area,sms_sub_type_ref where sms_sales_header.sub_id = sms_sub.id and sms_sales_header.operator_by = sms_user.id and sms_user.BUSINESS_AREA_ID = sms_business_area.ID and sms_sub.id = sms_sub_type_ref.sub_id and sms_sales_header.sc_id = sms_sc.id(+) and sms_sales_header.type <> 33 and 1= ? and sms_sales_header.business_date > ? and sms_sales_header.business_date < ? and sms_user.operator_area_id = ? )kk ) originTable WHERE ROWNUM < 11 ) WHERE rn >=12012-06-28 17:31:41,546 - DEBUG -  row count : 10这个是在单机数据库中的运行日志,这条sql是这个报表最简单的一种情况,更复杂的还有多个联合查询。
    第一、二行是系统输入时留下的,
    第三行是查询总数量的sql,也是输入
    第四行查询第一到第十条记录,此时第三条已经完成,可以看到花了接近3秒
    第五行是第四行的结果,返回10条记录,从时间看是1秒多在单机上一共花费4秒张左右的时间。
    但是这一系列查询在RAC上需要花费超过20秒的时间,客户那边的日志我正在联系获取。
      

  3.   

    估计不是执行计划改变这么简单哦应用对于rac,需要做特定的优化的
      

  4.   


    除了各种系统资源的配置,不知道如何对RAC做特定的优化啊,有没有资料?