Linux 11G RAC启用HugePages与AMM的禁用

HugePages是集成到Linux kernel 2.6中的一个功能。启用HugePages可以使用操作系统来支持比缺省的内存页(4KB)更大的内存页。使用非常大的内存页大小可以通过减少访问页表条目所需要的系统资源数量而提高系统性能。HugePages对于32位与64位系统都是有效的。HugePage的大小范围从2MB到256MB,依赖于内核版本和硬件架构。对于Oracle数据库,使用HugePages减少操作系统维护内存页
状态并增加Translation Lookaside Buffer(TLB)的撞击率。

1.使用HugePages来优化SGA
不使用HugePages时,操作系统将保持每个内存页大小为4KB,当为SGA分配内存页时,操作系统内核必须对分配给SGA的每个4KB页使用页生命周期(脏,可用,映射到进程,等等)持续更新。

使用HugePages时,操作系统页表(虚拟内存到物理内存的映射)很小,因为每个页表条目指向的内存页大小从2MB到256MB。同时内核有比较少的内存页生命周期被监控。例如,如果64位硬件使用HugePages,并且想要映射256MB的内存,你可能只需要一个页表条目(PTE)。如果不使用HugePages并且想要映射256MB内存,那么必须有256*1024KB/4KB=65536个PTEs。

HugePages提供了以下优点:
通过增加TLB撞击率来提高性能
内存页被锁定在内存中并且不会发生交换,对共享内存结构比如SGA提供了随机访问
连续内存页预分配除了用于系统的共享内存比如SGA不能用于其它的目的
因为使用大的内存页大小所以虚拟内存相关的内核有较少性能开销

2 对Linux配置HugePages
运行以下命令来判断内核是否支持HugePages:

[root@jyrac1 ~]# uname -r
2.6.18-164.el5

[root@jyrac1 ~]# grep Huge /proc/meminfo
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
Hugepagesize:     2048 kB

有一些Linux缺省情况下是不支持HugePages的。 对于这样的系统使用config_hugetlbfs和config_hugetlb_page配置选项来构建Linux内核。config_hugetlbfs位于文件系统并且当你选择config_hugetlbfs时需要同时选择config_hugetlb_page。

编辑/etc/security/limits.conf文件来设置memlock。memlock设置以KB为单位,并且当启用HugePages内存时,最大锁定内存限制应该被设置为当前可随机访问内存的90%,当没有启用HugePages内存时,最大锁定内存限制应该被设置成至少3145728KB(3GB)。例如,如果有2G可随机访问内存,并且增加以下条目来增加最大锁定内存地址空间:

[root@jyrac1 ~]# vi /etc/security/limits.conf
grid soft memlock 2097152
grid hard memlock 2097152
oracle soft memlock 2097152
oracle hard memlock 2097152

也可以将memlock的值设置为比SGA的值大

以grid用户登录,并执行ulimit -l命令来验证新设置的memlock是否生效

[grid@jyrac1 ~]$ ulimit -l
2097152

以oracle用户登录,并执行ulimit -l命令来验证新设置的memlock是否生效

[oracle@jyrac1 ~]$ ulimit -l
2097152

运行以下命令来显示Hugepagesize变量:

[oracle@jyrac1 ~]$ grep Hugepagesize /proc/meminfo
Hugepagesize:     2048 kB

完成以下过程来创建一个脚本用来为当前共享内存段计算hugepages配置的建议值创建一个hugepages_settings.sh脚本并增加以下内容:

[root@jyrac1 /]# vi hugepages_settings.sh
#!/bin/bash
#
# hugepages_settings.sh
#
# Linux bash script to compute values for the
# recommended HugePages/HugeTLB configuration
# on Oracle Linux
#
# Note: This script does calculation for all shared memory
# segments available when the script is run, no matter it
# is an Oracle RDBMS shared memory segment or not.
#
# This script is provided by Doc ID 401749.1 from My Oracle Support 
# http://support.oracle.com

# Welcome text
echo "
This script is provided by Doc ID 401749.1 from My Oracle Support 
(http://support.oracle.com) where it is intended to compute values for 
the recommended HugePages/HugeTLB configuration for the current shared 
memory segments on Oracle Linux. Before proceeding with the execution please note following:
 * For ASM instance, it needs to configure ASMM instead of AMM.
 * The 'pga_aggregate_target' is outside the SGA and 
   you should accommodate this while calculating SGA size.
 * In case you changes the DB SGA size, 
   as the new SGA will not fit in the previous HugePages configuration, 
   it had better disable the whole HugePages, 
   start the DB with new SGA size and run the script again.
And make sure that:
 * Oracle Database instance(s) are up and running
 * Oracle Database 11g Automatic Memory Management (AMM) is not setup 
   (See Doc ID 749851.1)
 * The shared memory segments can be listed by command:
     # ipcs -m


Press Enter to proceed..."

read

# Check for the kernel version
KERN=`uname -r | awk -F. '{ printf("%d.%d\n",$1,$2); }'`

# Find out the HugePage size
HPG_SZ=`grep Hugepagesize /proc/meminfo | awk '{print $2}'`
if [ -z "$HPG_SZ" ];then
    echo "The hugepages may not be supported in the system where the script is being executed."
    exit 1
fi

# Initialize the counter
NUM_PG=0

# Cumulative number of pages required to handle the running shared memory segments
for SEG_BYTES in `ipcs -m | cut -c44-300 | awk '{print $1}' | grep "[0-9][0-9]*"`
do
    MIN_PG=`echo "$SEG_BYTES/($HPG_SZ*1024)" | bc -q`
    if [ $MIN_PG -gt 0 ]; then
        NUM_PG=`echo "$NUM_PG+$MIN_PG+1" | bc -q`
    fi
done

RES_BYTES=`echo "$NUM_PG * $HPG_SZ * 1024" | bc -q`

# An SGA less than 100MB does not make sense
# Bail out if that is the case
if [ $RES_BYTES -lt 100000000 ]; then
    echo "***********"
    echo "** ERROR **"
    echo "***********"
    echo "Sorry! There are not enough total of shared memory segments allocated for 
HugePages configuration. HugePages can only be used for shared memory segments 
that you can list by command:

    # ipcs -m

of a size that can match an Oracle Database SGA. Please make sure that:
 * Oracle Database instance is up and running 
 * Oracle Database 11g Automatic Memory Management (AMM) is not configured"
    exit 1
fi

# Finish with results
case $KERN in
     '2.2') echo "Kernel version $KERN is not supported. Exiting." ;;
    '2.4') HUGETLB_POOL=`echo "$NUM_PG*$HPG_SZ/1024" | bc -q`;
           echo "Recommended setting: vm.hugetlb_pool = $HUGETLB_POOL" ;;
    '2.6') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
    '3.8') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
    '3.10') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
    '4.1') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
esac

# End

执行以下命令来改变hugepages_settings.sh脚本的权限

[root@jyrac1 /]# chmod +x hugepages_settings.sh

运行hugepages_settings.sh脚本来计算hugepages配置的参数值

[root@jyrac1 /]# ./hugepages_settings.sh
This script is provided by Doc ID 401749.1 from My Oracle Support 
(http://support.oracle.com) where it is intended to compute values for 
the recommended HugePages/HugeTLB configuration for the current shared 
memory segments on Oracle Linux. Before proceeding with the execution please note following:
 * For ASM instance, it needs to configure ASMM instead of AMM.
 * The 'pga_aggregate_target' is outside the SGA and 
   you should accommodate this while calculating SGA size.
 * In case you changes the DB SGA size, 
   as the new SGA will not fit in the previous HugePages configuration, 
   it had better disable the whole HugePages, 
   start the DB with new SGA size and run the script again.
And make sure that:
 * Oracle Database instance(s) are up and running
 * Oracle Database 11g Automatic Memory Management (AMM) is not setup 
   (See Doc ID 749851.1)
 * The shared memory segments can be listed by command:
     # ipcs -m


Press Enter to proceed...

***********
** ERROR **
***********
Sorry! There are not enough total of shared memory segments allocated for 
HugePages configuration. HugePages can only be used for shared memory segments 
that you can list by command:

    # ipcs -m

of a size that can match an Oracle Database SGA. Please make sure that:
 * Oracle Database instance is up and running 
 * Oracle Database 11g Automatic Memory Management (AMM) is not configured

从上面的信息可以看到需要确认Oracle实例是否正在运行,如果是Oracle 11g不能使用AMM

[root@jyrac1 ~]# ps -ef | grep pmon
grid      4116     1  0 Apr18 ?        00:00:03 asm_pmon_+ASM1
oracle    4944     1  0 Apr18 ?        00:00:03 ora_pmon_jyrac1
root     18184 29273  0 15:15 pts/1    00:00:00 grep pmon

上面信息可以看到Oracle实例正在运行。

[grid@jyrac1 ~]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.4.0 Production on Wed Apr 20 15:20:23 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
With the Real Application Clusters and Automatic Storage Management options

SQL> set long 900
SQL> set linesize 900
SQL> show parameter instance_name

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
instance_name                        string                 +ASM1
SQL> show parameter memory

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
memory_max_target                    big integer            1076M
memory_target                        big integer            1076M


[oracle@jyrac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed Apr 20 15:21:04 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> set long 900
SQL> set linesize 900
SQL> show parameter instance_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      jyrac1
SQL> show parameter memory

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address             integer     0
memory_max_target                    big integer 2G
memory_target                        big integer 2G
shared_memory_address                integer     0

确实asm与数据库实例都启用了AMM,需要禁用AMM但是可以使用ASMM修改ASM实例,禁用AMM,但使用ASMM,如果是RAC所有节点都需要修改

SQL> alter system set sga_max_size=640M scope=spfile sid='*';

System altered.

SQL> alter system set sga_target=640M scope=spfile sid='*';

System altered.

SQL> alter system set pga_aggregate_target=320M scope=spfile sid='*';

System altered.

SQL>  alter system set memory_target=0 scope=spfile sid='*';

System altered.

这里对于memory_target不能使用reset否则会出现以下错误:

SQL> startup
ORA-01078: failure in processing system parameters
ORA-00843: Parameter not taking MEMORY_MAX_TARGET into account
ORA-00849: SGA_TARGET 671088640 cannot be set to more than MEMORY_MAX_TARGET 0.
SQL> alter system reset memory_max_target scope=spfile sid='*';

System altered.

修改数据库实例,禁用AMM,但使用ASMM,如果是RAC所有节点都需要修改

SQL> alter system set sga_max_size=640M scope=spfile sid='*';

System altered.

SQL> alter system set sga_target=640M scope=spfile sid='*';

System altered.

SQL> alter system set pga_aggregate_target=320M scope=spfile sid='*';

System altered.

SQL> alter system reset memory_max_target scope=spfile sid='*';

System altered.

SQL> alter system reset memory_target scope=spfile sid='*';

System altered.

重启ASM与数据库实例,如果是RAC所有节点都需要重启,首先停止ASM与数据库实例

[grid@jyrac1 ~]$ srvctl stop asm -n jyrac1 -f
[grid@jyrac1 ~]$ srvctl stop asm -n jyrac2 -f
[grid@jyrac1 ~]$ srvctl stop database -d jyrac



[grid@jyrac1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.CRSDG.dg
               OFFLINE OFFLINE      jyrac1                                       
               OFFLINE OFFLINE      jyrac2                                       
ora.DATADG.dg
               OFFLINE OFFLINE      jyrac1                                       
               OFFLINE OFFLINE      jyrac2                                       
ora.LISTENER.lsnr
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.asm
               OFFLINE OFFLINE      jyrac1                   Instance Shutdown   
               OFFLINE OFFLINE      jyrac2                   Instance Shutdown   
ora.gsd
               ONLINE  OFFLINE      jyrac1                                       
               ONLINE  OFFLINE      jyrac2                                       
ora.net1.network
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.ons
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.registry.acfs
               OFFLINE OFFLINE      jyrac1                                       
               OFFLINE OFFLINE      jyrac2                                       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       jyrac2                                       
ora.cvu
      1        ONLINE  ONLINE       jyrac2                                       
ora.jyrac.db
      1        OFFLINE OFFLINE                               Instance Shutdown   
      2        OFFLINE OFFLINE                               Instance Shutdown   
ora.jyrac1.vip
      1        ONLINE  ONLINE       jyrac1                                       
ora.jyrac2.vip
      1        ONLINE  ONLINE       jyrac2                                       
ora.oc4j
      1        ONLINE  ONLINE       jyrac2                                       
ora.scan1.vip
      1        ONLINE  ONLINE       jyrac2             

启动ASM与数据库实例

grid@jyrac1 ~]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.4.0 Production on Wed Apr 20 17:48:32 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ASM instance started

Total System Global Area  669581312 bytes
Fixed Size                  1366724 bytes
Variable Size             643048764 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled

SQL> show parameter instance_name

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
instance_name                        string                 +ASM2
SQL> show parameter memory

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
memory_max_target                    big integer            0
memory_target                        big integer            0
SQL> show parameter sga

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
lock_sga                             boolean                FALSE
sga_max_size                         big integer            640M
sga_target                           big integer            640M

grid@jyrac2 ~]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.4.0 Production on Wed Apr 20 17:48:32 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ASM instance started

Total System Global Area  669581312 bytes
Fixed Size                  1366724 bytes
Variable Size             643048764 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled

SQL> show parameter instance_name

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
instance_name                        string                 +ASM2
SQL> show parameter memory

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
memory_max_target                    big integer            0
memory_target                        big integer            0
SQL> show parameter sga

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
lock_sga                             boolean                FALSE
sga_max_size                         big integer            640M
sga_target                           big integer            640M

[grid@jyrac1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.CRSDG.dg
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.DATADG.dg
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.LISTENER.lsnr
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.asm
               ONLINE  ONLINE       jyrac1                   Started             
               ONLINE  ONLINE       jyrac2                   Started             
ora.gsd
               ONLINE  OFFLINE      jyrac1                                       
               ONLINE  OFFLINE      jyrac2                                       
ora.net1.network
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.ons
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.registry.acfs
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       jyrac1                                       
ora.cvu
      1        ONLINE  ONLINE       jyrac1                                       
ora.jyrac.db
      1        OFFLINE OFFLINE                               Instance Shutdown   
      2        OFFLINE OFFLINE                               Instance Shutdown   
ora.jyrac1.vip
      1        ONLINE  ONLINE       jyrac1                                       
ora.jyrac2.vip
      1        ONLINE  ONLINE       jyrac2                                       
ora.oc4j
      1        ONLINE  ONLINE       jyrac1                                       
ora.scan1.vip
      1        ONLINE  ONLINE       jyrac1                 

从上面的信息可以看到asm实例已经启动了并且禁用了AMM

[grid@jyrac1 ~]$ srvctl start database -d jyrac
[grid@jyrac1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.CRSDG.dg
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.DATADG.dg
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.LISTENER.lsnr
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.asm
               ONLINE  ONLINE       jyrac1                   Started             
               ONLINE  ONLINE       jyrac2                   Started             
ora.gsd
               ONLINE  OFFLINE      jyrac1                                       
               ONLINE  OFFLINE      jyrac2                                       
ora.net1.network
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.ons
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.registry.acfs
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       jyrac1                                       
ora.cvu
      1        ONLINE  ONLINE       jyrac1                                       
ora.jyrac.db
      1        ONLINE  ONLINE       jyrac1                   Open                
      2        ONLINE  ONLINE       jyrac2                   Open                
ora.jyrac1.vip
      1        ONLINE  ONLINE       jyrac1                                       
ora.jyrac2.vip
      1        ONLINE  ONLINE       jyrac2                                       
ora.oc4j
      1        ONLINE  ONLINE       jyrac1                                       
ora.scan1.vip
      1        ONLINE  ONLINE       jyrac1   

SQL> show parameter instance_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      jyrac1
SQL> show parameter memory

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address             integer     0
memory_max_target                    big integer 0
memory_target                        big integer 0
shared_memory_address                integer     0
SQL> show parameter sga

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 640M
sga_target                           big integer 640M


SQL> show parameter instance_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      jyrac2
SQL> show parameter memory

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address             integer     0
memory_max_target                    big integer 0
memory_target                        big integer 0
shared_memory_address                integer     0
SQL> show parameter sga

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 640M
sga_target                           big integer 640M                   

数据库也已经成功启动并且禁用了AMM

再次执行hugepages_settings.sh脚本计算HugePages的大小

[root@jyrac1 /]# ./hugepages_settings.sh
Recommended setting: vm.nr_hugepages = 649

编辑/etc/sysctl.conf文件增加参数vm.nr_hugepages = 649,并执行sysctl -p命令使用修改立即生效,但oracle实例并没有使用HugePages从HugePages_Total与HugePages_Free相等可以判断出来。

[root@jyrac1 /]# vi /etc/sysctl.conf
vm.nr_hugepages = 649
[root@jyrac1 /]# sysctl -p

[root@jyrac1 /]# grep Huge /proc/meminfo
HugePages_Total:   649
HugePages_Free:    649
HugePages_Rsvd:      0
Hugepagesize:     2048 kB

重启实例

SQL> startup
ASM instance started

Total System Global Area  669581312 bytes
Fixed Size                  1366724 bytes
Variable Size             643048764 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled

查看asm实例的alert_+ASM1.log可以看到如下信息:

Starting ORACLE instance (normal)
************************ Large Pages Information *******************
Per process system memlock (soft) limit = 2048 MB
 
Total Shared Global Region in Large Pages = 642 MB (100%)
 
Large Pages used by this instance: 321 (642 MB)
Large Pages unused system wide = 328 (656 MB)
Large Pages configured system wide = 649 (1298 MB)
Large Page size = 2048 KB
SQL> startup
ORACLE instance started.

Total System Global Area  669581312 bytes
Fixed Size                  1366724 bytes
Variable Size             243270972 bytes
Database Buffers          419430400 bytes
Redo Buffers                5513216 bytes
Database mounted.
Database opened.

查看实例jyrac1的alert_jyrac1.log可以看到如下信息:

Starting ORACLE instance (normal)
************************ Large Pages Information *******************
Per process system memlock (soft) limit = 2048 MB
 
Total Shared Global Region in Large Pages = 642 MB (100%)
 
Large Pages used by this instance: 321 (642 MB)
Large Pages unused system wide = 7 (14 MB)
Large Pages configured system wide = 649 (1298 MB)
Large Page size = 2048 KB


[root@jyrac1 /]# grep Huge /proc/meminfo
HugePages_Total:   649
HugePages_Free:    239
HugePages_Rsvd:    232
Hugepagesize:     2048 kB

从上面的信息可以看到已经使用了Hugepages

3.HugePages的限制
HugePages有以下限制:
a.对于Oracle 11g及以上版本数据库实例必须对memory_target与memory_max_target参数执行alter system reset命令,但对于ASM实例,对于memory_target参数只能设置为0。
b.AMM与HugePages是不兼容的,当使用AMM,整个SGA内存通过在/dev/shm创建文件来进行内存的分配,当使用AMM分配SGA时,HugePages不会被保留。
c.如果在32位系统中使用VLM,那么对数据库buffer cache不能使用HugePages。但对于SGA中的其它组件比如shared_pool,
large_pool等等可以使用HugePages。对于VLM(buffer cache)分配内存是通过使用共享内存文件系统(ramfs/tmpfs/shmfs)来实现的。
d.HugePgaes在系统启动后不受分配或释放,除非系统管理员通过修改可用页数或改变池大小来改变HugePages的配置。如果在系统启动时内存中没有保留所需要内存空间,那么HugePages会分配失败。
e.确保HugePages配置合理,如果内存耗尽,应用将不能使用HugePages。
f.如果当实例启动用没有足够的HugePages并且参数use_large_pages设置为only,那么Oracle数据库将会启动失败并向alert.log中记录相关信息。

Oracle 11g RAC跨实例控制并行

在Oracle 10g RAC中的并行执行是由两个参数来控制的:instance_groups和parallel_instance_group这两个参数在Oracle 10g RAC中必须同时设置。

instance_groups可以有多个值但是静态值,parallel_instance_group可以在系统级别与会话级别进行修改。

在Oracle 10g RAC中,为了使用并行执行需要设置parallel_instance_group参数,并且parallel_instance_group的值必须是该实例instance_groups所指定的参数值之一。

例如,有一个3节点的Oracle 10g RAC在spfile中有以下设置:
myrac1.instance_groups=’rac’,’rac1′
myrac2.instance_groups=’rac’,’rac2′
myrac3.instance_groups=’rac’,’rac3′
myrac1.parallel_instance_group=’rac1’#节点1的并行执行只能在节点1上运行
myrac2.parallel_instance_group=’rac2’#节点2的并行执行只能在节点2上运行
myrac3.parallel_instance_group=’rac3’#节点3的并行执行只能在节点3上运行

在11gRAC中,因为向后兼容仍然可以使用instance_groups和parallel_instance_group参数。然而,在Oracle 11g RAC中不需要这样做,instance_groups参数已经被废弃并且保留只是为了向后兼容。

在Oracle 11gRAC中并行查询子进程与服务集成在一起,因此不需要再设置instance_groups和parallel_instance_group参数。因为不需要设置instance_groups参数,而是可以直接设置服务名,
例如:alter session set parallel_instance_group=service_name。因为在11g中instance_groups参数已经被废弃,可以继续使用,但是它只是为了向后兼容。

在Oracle 11g RAC中也可以不需要设置parallel_instance_groups参数来限制并行查询子进程在指定的实例上运行。如果以并行方式来执行SQL语句,那么缺省情况下并行进程只会在你通过服务名所连接到的数据库实例上运行。这不会影响其它的并行操作比如并行恢复或gv$视图的查询处理。为了覆盖这种行为,可以设置parallel_instance_group参数。

可以使用srvctl add service命令来创建服务。例如,数据库名是rac且有2个实例,rac1和rac2。
对每个实例创建一个服务

[grid@rac1 ~]$ srvctl add service -d rac -s rac1 -r rac1 -a rac2
[grid@rac1 ~]$ srvctl add service -d rac -s rac2 -r rac2 -a rac1
[grid@rac1 ~]$ srvctl start service -d rac -s rac1
[grid@rac1 ~]$ srvctl start service -d rac -s rac2

上面的语句将创建两个服务,每个实例一个,-r参数指定首选实例,-a参数指定可用实例。
1.如果使用其中的一个服务连接数据库,并且没有显式地设置parallel_instance_groups参数,那么并行执行将被限制在你的连接的实例上执行

例如,如果连接到rac1,因上连接到rac1实例,那么并行查询了进程将只能在rac1的r参数所指定的实例rac1上运行。

SQL> conn sys/system@rac1 as sysdba

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
rac1

SQL> show parameter parallel_instance_group

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
parallel_instance_group              string
SQL> show parameter instance_groups

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_groups                      string

SQL> show parameter parallel_degree_policy

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
parallel_degree_policy               string      auto
SQL> set timing on
SQL> set autotrace on
SQL> select /*+ parallel(t1,60) */ count(*) from t1;

  COUNT(*)
----------
  11121536

Elapsed: 00:00:41.25

Execution Plan
----------------------------------------------------------
Plan hash value: 3110199320

--------------------------------------------------------------------------------
------------------------

| Id  | Operation              | Name     | Rows  | Cost (%CPU)| Time     |    T
Q  |IN-OUT| PQ Distrib |

--------------------------------------------------------------------------------
------------------------

|   0 | SELECT STATEMENT       |          |     1 |   793   (0)| 00:00:01 |
   |      |            |

|   1 |  SORT AGGREGATE        |          |     1 |            |          |
   |      |            |

|   2 |   PX COORDINATOR       |          |       |            |          |
   |      |            |

|   3 |    PX SEND QC (RANDOM) | :TQ10000 |     1 |            |          |  Q1,
00 | P->S | QC (RAND)  |

|   4 |     SORT AGGREGATE     |          |     1 |            |          |  Q1,
00 | PCWP |            |

|   5 |      PX BLOCK ITERATOR |          |    10M|   793   (0)| 00:00:01 |  Q1,
00 | PCWC |            |

|   6 |       TABLE ACCESS FULL| T1       |    10M|   793   (0)| 00:00:01 |  Q1,
00 | PCWP |            |

--------------------------------------------------------------------------------
------------------------


Note
-----
   - dynamic sampling used for this statement (level=2)
   - Degree of Parallelism is 60 because of hint


Statistics
----------------------------------------------------------
        430  recursive calls
          0  db block gets
     281608  consistent gets
     158184  physical reads
       3328  redo size
        425  bytes sent via SQL*Net to client
        419  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
         21  sorts (memory)
          0  sorts (disk)
          1  rows processed

在执行时查询并行子进程的是否只在rac1上运行

SQL> SELECT inst_id,sid, event, seq#,p1,p2,p3, wait_time FROM gv$session_wait WHERE upper(event) like ('PX%') ORDER BY 1;

   INST_ID        SID EVENT                                                                  SEQ#         P1         P2         P3  WAIT_TIME
---------- ---------- ---------------------------------------------------------------- ---------- ---------- ---------- ---------- ----------
         1         29 PX Deq: Execution Msg                                                    54  268566527          1 1113052640         -1
         1        105 PX Deq: Execution Msg                                                     2  268566527          1 1113043256         -1
         1         43 PX Deq: Execution Msg                                                    57  268566527          1 1113057500          0
         1         44 PX Deq: Execution Msg                                                    55  268566527          1 1011415624         -1
         1         50 PX Deq: Execution Msg                                                    45  268566527          1 1113065368         -1
         1         53 PX Deq: Execution Msg                                                    64  268566527          1 1113070008          0
         1         54 PX Deq: Execute Reply                                                  8603        200          1          0          0
         1         55 PX Deq: Execution Msg                                                    59  268566527          1 1113049700         -1
         1         62 PX Deq: Execution Msg                                                    68  268566527          1 1113067520          0
         1         69 PX Deq: Execution Msg                                                    53  268566527          1 1113068028          0
         1         74 PX Deq: Execution Msg                                                    60  268566527          1 1113066504         -1

   INST_ID        SID EVENT                                                                  SEQ#         P1         P2         P3  WAIT_TIME
---------- ---------- ---------------------------------------------------------------- ---------- ---------- ---------- ---------- ----------
         1         79 PX Deq: Execute Reply                                                   641        200          1          0          0
         1         80 PX Deq: Execution Msg                                                    59  268566527          1 1113068568         -1
         1         81 PX Deq: Execution Msg                                                    63  268566527          1 1113069048         -1
         1         88 PX Deq: Execution Msg                                                    59  268566527          1 1113051680          0
         1         97 PX Deq: Execution Msg                                                    46  268566527          1 1011409340          0


16 rows selected.

可以看到并行子进程全都是在实例rac1上运行。

2.一旦创建这些服务名之后,服务名rac1和rac2可以作为parallel_instance_groups的参数值,不管你使用那个服务名来进行数据库连接例如,如果使用通用的数据库服务名rac来进行连接,发现连接到了rac1实例,那么并行子进程会在当前所连接的实例或所有实例上运行。

SQL> conn sys/system@rac as sysdba

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
rac1

SQL> show parameter parallel_instance_group

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
parallel_instance_group              string
SQL> show parameter instance_groups

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_groups                      string

SQL> show parameter parallel_degree_policy

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
parallel_degree_policy               string      auto
SQL> set timing on
SQL> set autotrace on
SQL> select /*+ parallel(t1,60) */ count(*) from t1;

  COUNT(*)
----------
  11121536

Elapsed: 00:00:41.25

Execution Plan
----------------------------------------------------------
Plan hash value: 3110199320

--------------------------------------------------------------------------------
------------------------

| Id  | Operation              | Name     | Rows  | Cost (%CPU)| Time     |    T
Q  |IN-OUT| PQ Distrib |

--------------------------------------------------------------------------------
------------------------

|   0 | SELECT STATEMENT       |          |     1 |   793   (0)| 00:00:01 |
   |      |            |

|   1 |  SORT AGGREGATE        |          |     1 |            |          |
   |      |            |

|   2 |   PX COORDINATOR       |          |       |            |          |
   |      |            |

|   3 |    PX SEND QC (RANDOM) | :TQ10000 |     1 |            |          |  Q1,
00 | P->S | QC (RAND)  |

|   4 |     SORT AGGREGATE     |          |     1 |            |          |  Q1,
00 | PCWP |            |

|   5 |      PX BLOCK ITERATOR |          |    10M|   793   (0)| 00:00:01 |  Q1,
00 | PCWC |            |

|   6 |       TABLE ACCESS FULL| T1       |    10M|   793   (0)| 00:00:01 |  Q1,
00 | PCWP |            |

--------------------------------------------------------------------------------
------------------------


Note
-----
   - dynamic sampling used for this statement (level=2)
   - Degree of Parallelism is 60 because of hint


Statistics
----------------------------------------------------------
        430  recursive calls
          0  db block gets
     281608  consistent gets
     158184  physical reads
       3328  redo size
        425  bytes sent via SQL*Net to client
        419  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
         21  sorts (memory)
          0  sorts (disk)
          1  rows processed

在执行时查询并行子进程的是否只在rac1上运行

SQL> SELECT inst_id,sid, event, seq#,p1,p2,p3, wait_time FROM gv$session_wait WHERE upper(event) like ('PX%') ORDER BY 1;
   INST_ID        SID EVENT                                                                  SEQ#         P1         P2         P3  WAIT_TIME
---------- ---------- ---------------------------------------------------------------- ---------- ---------- ---------- ---------- ----------
         1         29 PX Deq: Execution Msg                                                    43  268566527          1 1113052640          0
         1         33 PX Deq: Execute Reply                                                 60924        200          1          0          0
         1        104 PX Deq: Execution Msg                                                    51  268566527          1 1113063216          0
         1        103 PX Deq: Execution Msg                                                    48  268566527          1 1011409820          0
         1        101 PX Deq: Execution Msg                                                    53  268566527          1 1113042688          0
         1        100 PX Deq: Execution Msg                                                    53  268566527          1 1011414604          0
         1         99 PX Deq: Execution Msg                                                    54  268566527          1 1113050660          0
         1         91 PX Deq: Execution Msg                                                    59  268566527          1 1113054620          0
         1         90 PX Deq: Execution Msg                                                    47  268566527          1 1011408860          0
         1         88 PX Deq: Execution Msg                                                    60  268566527          1 1113043256          0
         1         87 PX Deq: Execution Msg                                                    45  268566527          1 1113046760          0
         1         86 PX Deq: Execution Msg                                                    52  268566527          1 1113065936          0
         1         85 PX Deq: Execution Msg                                                    45  268566527          1 1113062708          0
         1         84 PX Deq: Execution Msg                                                    59  268566527          1 1011409340          0
         1         83 PX Deq: Execution Msg                                                    45  268566527          1 1113043764          0
         1         82 PX Deq: Execution Msg                                                    46  268566527          1 1113059480          0
         1         81 PX Deq: Execution Msg                                                    52  268566527          1 1113064800          0
         1         80 PX Deq: Execution Msg                                                    43  268566527          1 1113066504          0
         1         76 PX Deq: Execution Msg                                                    61  268566527          1 1113056540          0
         1         69 PX Deq: Execution Msg                                                    48  268566527          1 1113067012          0
         1         68 PX Deq: Execution Msg                                                    48  268566527          1 1113049700          0
         1         66 PX Deq: Execution Msg                                                    61  268566527          1 1011415624          0
         1         64 PX Deq: Execution Msg                                                     2  268566527          1 1113068028         -1
         1         62 PX Deq: Execution Msg                                                    39  268566527          1 1113067520          0
         1         59 PX Deq: Execution Msg                                                    49  268566527          1 1113044840          0
         1         58 PX Deq: Execution Msg                                                    47  268566527          1 1113048740          0
         1         57 PX Deq: Execution Msg                                                    50  268566527          1 1113064232          0
         1         54 PX Deq: Execute Reply                                                 11610        200          1          0          0
         1         53 PX Deq: Execution Msg                                                    52  268566527          1 1113065368          0
         1         43 PX Deq: Execution Msg                                                    42  268566527          1 1113047780          0
         2         80 PX Deq: Execution Msg                                                   133  268566527          2 1112541100          0
         2         83 PX Deq: Execution Msg                                                   119  268566527          2 1112529160          0
         2         78 PX Deq: Execution Msg                                                   107  268566527          2 1112534620          0
         2         77 PX Deq: Execution Msg                                                   144  268566527          2 1112535100          0
         2         76 PX Deq: Execution Msg                                                   146  268566527          2 1112540140          0
         2         74 PX Deq: Execution Msg                                                   118  268566527          2 1112530660          0
         2         73 PX Deq: Execution Msg                                                   150  268566527          2 1112536660          0
         2         72 PX Deq: Execution Msg                                                   125  268566527          2 1112531140          0
         2         71 PX Deq: Execution Msg                                                   157  268566527          2 1112533660          0
         2         70 PX Deq: Execution Msg                                                   146  268566527          2 1112530180          0
         2         69 PX Deq: Execution Msg                                                   135  268566527          2 1112532640          0
         2         67 PX Deq: Execution Msg                                                   128  268566527          2 1112556120          0
         2         66 PX Deq: Execution Msg                                                   135  268566527          2 1112532100          0
         2         65 PX Deq: Execution Msg                                                   124  268566527          2 1112555640          0
         2         63 PX Deq: Execution Msg                                                   126  268566527          2 1112528620          0
         2         62 PX Deq: Execution Msg                                                   183  268566527          2 1112537140          0
         2         60 PX Deq: Execution Msg                                                   182  268566527          2 1112541580          0
         2         59 PX Deq: Execution Msg                                                   103  268566527          2 1112535580          0
         2         58 PX Deq: Execution Msg                                                   160  268566527          2 1112539600          0
         2         57 PX Deq: Execution Msg                                                   164  268566527          2 1112538580          0
         2         56 PX Deq: Execution Msg                                                   124  268566527          2 1112527528          0
         2         53 PX Deq: Execution Msg                                                   145  268566527          2 1112539060          0
         2         49 PX Deq: Execution Msg                                                   140  268566527          2 1112538100          0
         2         37 PX Deq: Execution Msg                                                   112  268566527          2 1112537620          0
         2         36 PX Deq: Execution Msg                                                   153  268566527          1 1112536120          0
         2         34 PX Deq: Execution Msg                                                    14  268566527          2 1112531620         -1
         2         81 PX Deq: Execution Msg                                                   157  268566527          2 1112533180          0
         2         79 PX Deq: Execution Msg                                                   128  268566527          2 1112557244          0

58 rows selected.

从上面的信息可以看到通过通用服务名rac虽然连接到的实例是rac1,在执行并行查询时并行子进程在实例rac1与rac2上运行,并不是只在rac1实例上运行。

如果你想限制你的查询只在rac1实例上执行,那么执行
alter session set parallel_instance_group=rac1命令,这将限制并行子进程只在指定服务名所相关的实例上运行,比如rac1。

SQL> alter session set parallel_instance_group='rac1';

Session altered.

SQL> show parameter parallel_instance_group

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
parallel_instance_group              string      rac1

SQL> select /*+ parallel(t1,60) */ count(*) from t1;

  COUNT(*)
----------
  11121536

Elapsed: 00:00:41.25

Execution Plan
----------------------------------------------------------
Plan hash value: 3110199320

--------------------------------------------------------------------------------
------------------------

| Id  | Operation              | Name     | Rows  | Cost (%CPU)| Time     |    T
Q  |IN-OUT| PQ Distrib |

--------------------------------------------------------------------------------
------------------------

|   0 | SELECT STATEMENT       |          |     1 |   793   (0)| 00:00:01 |
   |      |            |

|   1 |  SORT AGGREGATE        |          |     1 |            |          |
   |      |            |

|   2 |   PX COORDINATOR       |          |       |            |          |
   |      |            |

|   3 |    PX SEND QC (RANDOM) | :TQ10000 |     1 |            |          |  Q1,
00 | P->S | QC (RAND)  |

|   4 |     SORT AGGREGATE     |          |     1 |            |          |  Q1,
00 | PCWP |            |

|   5 |      PX BLOCK ITERATOR |          |    10M|   793   (0)| 00:00:01 |  Q1,
00 | PCWC |            |

|   6 |       TABLE ACCESS FULL| T1       |    10M|   793   (0)| 00:00:01 |  Q1,
00 | PCWP |            |

--------------------------------------------------------------------------------
------------------------


Note
-----
   - dynamic sampling used for this statement (level=2)
   - Degree of Parallelism is 60 because of hint


Statistics
----------------------------------------------------------
        430  recursive calls
          0  db block gets
     281608  consistent gets
     158184  physical reads
       3328  redo size
        425  bytes sent via SQL*Net to client
        419  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
         21  sorts (memory)
          0  sorts (disk)
          1  rows processed

SQL> SELECT inst_id,sid, event, seq#,p1,p2,p3, wait_time FROM gv$session_wait WHERE upper(event) like ('PX%') ORDER BY 1;

   INST_ID        SID EVENT                                                                  SEQ#         P1         P2         P3  WAIT_TIME
---------- ---------- ---------------------------------------------------------------- ---------- ---------- ---------- ---------- ----------
         1         43 PX Deq: Execution Msg                                                    61  268566527          2 1113060496          0
         1         53 PX Deq: Execution Msg                                                    71  268566527          2 1011415624          0
         1         54 PX Deq: Parse Reply                                                   28202        200          1          0         -1
         1         55 PX Deq: Execution Msg                                                    64  268566527          1 1011418240          0
         1         57 PX Deq: Execution Msg                                                    88  268566527          1 1113048740          0
         1         58 PX Deq: Execution Msg                                                    53  268566527          1 1113061632          0
         1         62 PX Deq: Execution Msg                                                    66  268566527          3 1011420904          0
         1         64 PX Deq: Execution Msg                                                    58  268566527          1 1011407468          0
         1         66 PX Deq: Execution Msg                                                    75  268566527          2 1113061124          0
         1         67 PX Deq: Execution Msg                                                     2  268566527          1 1113079488         -1
         1         68 PX Deq: Execution Msg                                                    76  268566527          2 1011417732          0
         1         69 PX Deq: Execution Msg                                                    56  268566527          3 1011420424          0
         1         76 PX Deq: Execution Msg                                                    70  268566527          1 1011408860          0
         1         79 PX Deq: Execute Reply                                                   672        200          1          0          0
         1         80 PX Deq: Execution Msg                                                    75  268566527          1 1011419944          0
         1         81 PX Deq: Execution Msg                                                    75  268566527          1 1011409340          0
         1         82 PX Deq: Execution Msg                                                    63  268566527          1 1113054620          0
         1         83 PX Deq: Execution Msg                                                    62  268566527          2 1011407948          0
         1         85 PX Deq: Execution Msg                                                    65  268566527          3 1113049700          0
         1         86 PX Deq: Execution Msg                                                    54  268566527          2 1113047780          0
         1         88 PX Deq: Execution Msg                                                    65  268566527          3 1113059480          0
         1         90 PX Deq: Execution Msg                                                    83  268566527          2 1113049220          0
         1         91 PX Deq: Execution Msg                                                    65  268566527          1 1113052640          0
         1        101 PX Deq: Execution Msg                                                    69  268566527          2 1113053600          0
         1        102 PX Deq: Execution Msg                                                    56  268566527          2 1113056540          0
         1        103 PX Deq: Execution Msg                                                    70  268566527          2 1113044840          0
         1        104 PX Deq: Execution Msg                                                    70  268566527          2 1113046760          0
 
28 rows selected.

可以看到在设置parallel_instance_group=’rac1’后,并行子进程只能在实例rac1上运行了。

3.如果连接的服务名运行在两个实例上,比如:srvctl add service -d rac -s rac -r rac1,rac2那么,并行查询的并行子进程将会运行在两个实例上,不管你所连接的是那个实例。

SQL> conn sys/system@rac as sysdba

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
rac2

SQL> show parameter parallel_instance_group

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
parallel_instance_group              string
SQL> show parameter instance_groups

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_groups                      string

SQL> show parameter parallel_degree_policy

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
parallel_degree_policy               string      auto
SQL> set timing on
SQL> set autotrace on
SQL> select /*+ parallel(t1,60) */ count(*) from t1;

  COUNT(*)
----------
  11121536

Elapsed: 00:00:41.25

Execution Plan
----------------------------------------------------------
Plan hash value: 3110199320

--------------------------------------------------------------------------------
------------------------

| Id  | Operation              | Name     | Rows  | Cost (%CPU)| Time     |    T
Q  |IN-OUT| PQ Distrib |

--------------------------------------------------------------------------------
------------------------

|   0 | SELECT STATEMENT       |          |     1 |   793   (0)| 00:00:01 |
   |      |            |

|   1 |  SORT AGGREGATE        |          |     1 |            |          |
   |      |            |

|   2 |   PX COORDINATOR       |          |       |            |          |
   |      |            |

|   3 |    PX SEND QC (RANDOM) | :TQ10000 |     1 |            |          |  Q1,
00 | P->S | QC (RAND)  |

|   4 |     SORT AGGREGATE     |          |     1 |            |          |  Q1,
00 | PCWP |            |

|   5 |      PX BLOCK ITERATOR |          |    10M|   793   (0)| 00:00:01 |  Q1,
00 | PCWC |            |

|   6 |       TABLE ACCESS FULL| T1       |    10M|   793   (0)| 00:00:01 |  Q1,
00 | PCWP |            |

--------------------------------------------------------------------------------
------------------------


Note
-----
   - dynamic sampling used for this statement (level=2)
   - Degree of Parallelism is 60 because of hint


Statistics
----------------------------------------------------------
        430  recursive calls
          0  db block gets
     281608  consistent gets
     158184  physical reads
       3328  redo size
        425  bytes sent via SQL*Net to client
        419  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
         21  sorts (memory)
          0  sorts (disk)
          1  rows processed

SQL> SELECT inst_id,sid, event, seq#,p1,p2,p3, wait_time FROM gv$session_wait WHERE upper(event) like ('PX%') ORDER BY 1;
   INST_ID        SID EVENT                                                                  SEQ#         P1         P2         P3  WAIT_TIME
---------- ---------- ---------------------------------------------------------------- ---------- ---------- ---------- ---------- ----------
         1         29 PX Deq: Execution Msg                                                    43  268566527          1 1113052640          0
         1         33 PX Deq: Execute Reply                                                 60924        200          1          0          0
         1        104 PX Deq: Execution Msg                                                    51  268566527          1 1113063216          0
         1        103 PX Deq: Execution Msg                                                    48  268566527          1 1011409820          0
         1        101 PX Deq: Execution Msg                                                    53  268566527          1 1113042688          0
         1        100 PX Deq: Execution Msg                                                    53  268566527          1 1011414604          0
         1         99 PX Deq: Execution Msg                                                    54  268566527          1 1113050660          0
         1         91 PX Deq: Execution Msg                                                    59  268566527          1 1113054620          0
         1         90 PX Deq: Execution Msg                                                    47  268566527          1 1011408860          0
         1         88 PX Deq: Execution Msg                                                    60  268566527          1 1113043256          0
         1         87 PX Deq: Execution Msg                                                    45  268566527          1 1113046760          0
         1         86 PX Deq: Execution Msg                                                    52  268566527          1 1113065936          0
         1         85 PX Deq: Execution Msg                                                    45  268566527          1 1113062708          0
         1         84 PX Deq: Execution Msg                                                    59  268566527          1 1011409340          0
         1         83 PX Deq: Execution Msg                                                    45  268566527          1 1113043764          0
         1         82 PX Deq: Execution Msg                                                    46  268566527          1 1113059480          0
         1         81 PX Deq: Execution Msg                                                    52  268566527          1 1113064800          0
         1         80 PX Deq: Execution Msg                                                    43  268566527          1 1113066504          0
         1         76 PX Deq: Execution Msg                                                    61  268566527          1 1113056540          0
         1         69 PX Deq: Execution Msg                                                    48  268566527          1 1113067012          0
         1         68 PX Deq: Execution Msg                                                    48  268566527          1 1113049700          0
         1         66 PX Deq: Execution Msg                                                    61  268566527          1 1011415624          0
         1         64 PX Deq: Execution Msg                                                     2  268566527          1 1113068028         -1
         1         62 PX Deq: Execution Msg                                                    39  268566527          1 1113067520          0
         1         59 PX Deq: Execution Msg                                                    49  268566527          1 1113044840          0
         1         58 PX Deq: Execution Msg                                                    47  268566527          1 1113048740          0
         1         57 PX Deq: Execution Msg                                                    50  268566527          1 1113064232          0
         1         54 PX Deq: Execute Reply                                                 11610        200          1          0          0
         1         53 PX Deq: Execution Msg                                                    52  268566527          1 1113065368          0
         1         43 PX Deq: Execution Msg                                                    42  268566527          1 1113047780          0
         2         80 PX Deq: Execution Msg                                                   133  268566527          2 1112541100          0
         2         83 PX Deq: Execution Msg                                                   119  268566527          2 1112529160          0
         2         78 PX Deq: Execution Msg                                                   107  268566527          2 1112534620          0
         2         77 PX Deq: Execution Msg                                                   144  268566527          2 1112535100          0
         2         76 PX Deq: Execution Msg                                                   146  268566527          2 1112540140          0
         2         74 PX Deq: Execution Msg                                                   118  268566527          2 1112530660          0
         2         73 PX Deq: Execution Msg                                                   150  268566527          2 1112536660          0
         2         72 PX Deq: Execution Msg                                                   125  268566527          2 1112531140          0
         2         71 PX Deq: Execution Msg                                                   157  268566527          2 1112533660          0
         2         70 PX Deq: Execution Msg                                                   146  268566527          2 1112530180          0
         2         69 PX Deq: Execution Msg                                                   135  268566527          2 1112532640          0
         2         67 PX Deq: Execution Msg                                                   128  268566527          2 1112556120          0
         2         66 PX Deq: Execution Msg                                                   135  268566527          2 1112532100          0
         2         65 PX Deq: Execution Msg                                                   124  268566527          2 1112555640          0
         2         63 PX Deq: Execution Msg                                                   126  268566527          2 1112528620          0
         2         62 PX Deq: Execution Msg                                                   183  268566527          2 1112537140          0
         2         60 PX Deq: Execution Msg                                                   182  268566527          2 1112541580          0
         2         59 PX Deq: Execution Msg                                                   103  268566527          2 1112535580          0
         2         58 PX Deq: Execution Msg                                                   160  268566527          2 1112539600          0
         2         57 PX Deq: Execution Msg                                                   164  268566527          2 1112538580          0
         2         56 PX Deq: Execution Msg                                                   124  268566527          2 1112527528          0
         2         53 PX Deq: Execution Msg                                                   145  268566527          2 1112539060          0
         2         49 PX Deq: Execution Msg                                                   140  268566527          2 1112538100          0
         2         37 PX Deq: Execution Msg                                                   112  268566527          2 1112537620          0
         2         36 PX Deq: Execution Msg                                                   153  268566527          1 1112536120          0
         2         34 PX Deq: Execution Msg                                                    14  268566527          2 1112531620         -1
         2         81 PX Deq: Execution Msg                                                   157  268566527          2 1112533180          0
         2         79 PX Deq: Execution Msg                                                   128  268566527          2 1112557244          0

58 rows selected.

从上面的信息可以看到通过通用服务名rac虽然连接到的实例是rac2,在执行并行查询时并行子进程在实例rac1与rac2上运行,并不是只在rac2实例上运行。

4.如果所连接的实例已经设置了instance_groups,那么也可以设置parallel_instance_group来进行限制,就像oracle 10g rac一样。

实例rac1:

SQL> alter system set instance_groups='rac','rac1' scope=spfile sid='rac1';

System altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.

Total System Global Area  669581312 bytes
Fixed Size                  1366724 bytes
Variable Size             306185532 bytes
Database Buffers          356515840 bytes
Redo Buffers                5513216 bytes
Database mounted.
Database opened.


SQL> show parameter instance_groups

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_groups                      string      rac, rac1
SQL> show parameter parallel_instance_group

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
parallel_instance_group              string

将parallel_instance_group设置为rac,并行子进程可能会在实例rac1与rac2上运行

SQL> alter session set parallel_instance_group='rac'; 

Session altered.

SQL> show parameter parallel_instance_group

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
parallel_instance_group              string      rac
SQL> set autotrace on
SQL> select /*+ parallel(t1,60) */ count(*) from t1;

  COUNT(*)
----------
  11121536


Execution Plan
----------------------------------------------------------
Plan hash value: 3110199320

--------------------------------------------------------------------------------
------------------------

| Id  | Operation              | Name     | Rows  | Cost (%CPU)| Time     |    T
Q  |IN-OUT| PQ Distrib |

--------------------------------------------------------------------------------
------------------------

|   0 | SELECT STATEMENT       |          |     1 |   793   (0)| 00:00:01 |
   |      |            |

|   1 |  SORT AGGREGATE        |          |     1 |            |          |
   |      |            |

|   2 |   PX COORDINATOR       |          |       |            |          |
   |      |            |

|   3 |    PX SEND QC (RANDOM) | :TQ10000 |     1 |            |          |  Q1,
00 | P->S | QC (RAND)  |

|   4 |     SORT AGGREGATE     |          |     1 |            |          |  Q1,
00 | PCWP |            |

|   5 |      PX BLOCK ITERATOR |          |    10M|   793   (0)| 00:00:01 |  Q1,
00 | PCWC |            |

|   6 |       TABLE ACCESS FULL| T1       |    10M|   793   (0)| 00:00:01 |  Q1,
00 | PCWP |            |

--------------------------------------------------------------------------------
------------------------


Note
-----
   - dynamic sampling used for this statement (level=5)
   - Degree of Parallelism is 60 because of hint


Statistics
----------------------------------------------------------
        250  recursive calls
          4  db block gets
     162870  consistent gets
     158172  physical reads
          0  redo size
        425  bytes sent via SQL*Net to client
        419  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed


SQL> SELECT inst_id,sid, event, seq#,p1,p2,p3, wait_time FROM gv$session_wait WHERE upper(event) like ('PX%') ORDER BY 1;
   INST_ID        SID EVENT                                                                  SEQ#         P1         P2         P3  WAIT_TIME
---------- ---------- ---------------------------------------------------------------- ---------- ---------- ---------- ---------- ----------
         1          1 PX Deq: Execute Reply                                                 11283        200          1          0          0
         1         35 PX Deq: Execution Msg                                                    45  268566527          1 1113085912          0
         1         86 PX Deq: Execution Msg                                                    36  268566527          1 1039760268          0
         1         85 PX Deq: Execution Msg                                                    42  268566527          1 1039763628          0
         1         84 PX Deq: Execution Msg                                                    40  268566527          1 1039764108          0
         1         83 PX Deq: Execution Msg                                                    49  268566527          2 1039764588          0
         1         81 PX Deq: Execution Msg                                                    42  268566527          1 1113034840          0
         1         80 PX Deq: Execution Msg                                                    33  268566527          1 1113035320          0
         1         78 PX Deq: Execution Msg                                                    37  268566527          1 1113036280          0
         1         77 PX Deq: Execution Msg                                                    54  268566527          1 1113058080          0
         1         75 PX Deq: Execution Msg                                                     2  268566527          1 1039758828         -1
         1         74 PX Deq: Execution Msg                                                    50  268566527          2 1113088316          0
         1         73 PX Deq: Execution Msg                                                    54  268566527          1 1113037780          0
         1         72 PX Deq: Execution Msg                                                    50  268566527          1 1113062540          0
         1         70 PX Deq: Execution Msg                                                    46  268566527          1 1113063500          0
         1         69 PX Deq: Execution Msg                                                    54  268566527          1 1113038740          0
         1         68 PX Deq: Execution Msg                                                    60  268566527          1 1113060560          0
         1         66 PX Deq: Execution Msg                                                    43  268566527          2 1113061520          0
         1         65 PX Deq: Execution Msg                                                    56  268566527          1 1113039760          0
         1         63 PX Deq: Execution Msg                                                    64  268566527          1 1113040780          0
         1         62 PX Deq: Execution Msg                                                    59  268566527          1 1113040240          0
         1         61 PX Deq: Execution Msg                                                    69  268566527          1 1113059600          0
         1         60 PX Deq: Execution Msg                                                    70  268566527          2 1113057120          0
         1         58 PX Deq: Execution Msg                                                    46  268566527          2 1113041260          0
         1         50 PX Deq: Execute Reply                                                  5402        200          1          0          0
         1         36 PX Deq: Execution Msg                                                    41  268566527          1 1113037300          0
         2         29 PX Deq: Execution Msg                                                   175  268566527          2 1113084304          0
         2         79 PX Deq: Execution Msg                                                    99  268566527          2 1113067788          0
         2         77 PX Deq: Execution Msg                                                   123  268566527          2 1113068868          0
         2         76 PX Deq: Execution Msg                                                   119  268566527          2 1113069348          0
         2         72 PX Deq: Execution Msg                                                   146  268566527          2 1113071268          0
         2         71 PX Deq: Execution Msg                                                   131  268566527          2 1113071868          0
         2         70 PX Deq: Execution Msg                                                   105  268566527          2 1113072348          0
         2         69 PX Deq: Execution Msg                                                   147  268566527          2 1113072828          0
         2         68 PX Deq: Execution Msg                                                   109  268566527          2 1113073308          0
         2         63 PX Deq: Execution Msg                                                   155  268566527          2 1113087304          0
         2         62 PX Deq: Execution Msg                                                   129  268566527          2 1113074268          0
         2         61 PX Deq: Execution Msg                                                   113  268566527          2 1113096428          0
         2         59 PX Deq: Execution Msg                                                   149  268566527          2 1113087784          0
         2         58 PX Deq: Execution Msg                                                   134  268566527          2 1113085264          0
         2         57 PX Deq: Execution Msg                                                   155  268566527          2 1113084784          0
         2         56 PX Deq: Execution Msg                                                   156  268566527          2 1113082384          0
         2         54 PX Deq: Execution Msg                                                   167  268566527          2 1113081784          0
         2         53 PX Deq: Execution Msg                                                   147  268566527          2 1113085864          0
         2         49 PX Deq: Execution Msg                                                   144  268566527          2 1113083344          0
         2         48 PX Deq: Execution Msg                                                   167  268566527          2 1113095304          0
         2         47 PX Deq: Execution Msg                                                   128  268566527          2 1113083824          0
         2         44 PX Deq: Execution Msg                                                    14  268566527          2 1113067308         -1
         2         37 PX Deq: Execution Msg                                                   151  268566527          2 1113086344          0
         2         36 PX Deq: Execution Msg                                                   148  268566527          2 1113082864          0
         2         35 PX Deq: Execution Msg                                                   133  268566527          2 1113094824          0
         2         78 PX Deq: Execution Msg                                                   102  268566527          2 1113068388          0

52 rows selected.

从上面的信息可以看到当instance_groups设置为’rac’,’rac1’,且parallel_instance_group设置为’rac’时,在实例rac1上执行并行查询时并行子进程能在rac1与rac2实例上运行。

将parallel_instance_group设置为rac1时,并行子进程就只能在rac1实例上运行

SQL> alter session set parallel_instance_group='rac1';

Session altered.

SQL> show parameter parallel_instance_group 

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
parallel_instance_group              string      rac1

SQL> select /*+ parallel(t1,60) */ count(*) from t1;

  COUNT(*)
----------
  11121536


Execution Plan
----------------------------------------------------------
Plan hash value: 3110199320

--------------------------------------------------------------------------------
------------------------

| Id  | Operation              | Name     | Rows  | Cost (%CPU)| Time     |    T
Q  |IN-OUT| PQ Distrib |

--------------------------------------------------------------------------------
------------------------

|   0 | SELECT STATEMENT       |          |     1 |   793   (0)| 00:00:01 |
   |      |            |

|   1 |  SORT AGGREGATE        |          |     1 |            |          |
   |      |            |

|   2 |   PX COORDINATOR       |          |       |            |          |
   |      |            |

|   3 |    PX SEND QC (RANDOM) | :TQ10000 |     1 |            |          |  Q1,
00 | P->S | QC (RAND)  |

|   4 |     SORT AGGREGATE     |          |     1 |            |          |  Q1,
00 | PCWP |            |

|   5 |      PX BLOCK ITERATOR |          |    10M|   793   (0)| 00:00:01 |  Q1,
00 | PCWC |            |

|   6 |       TABLE ACCESS FULL| T1       |    10M|   793   (0)| 00:00:01 |  Q1,
00 | PCWP |            |

--------------------------------------------------------------------------------
------------------------


Note
-----
   - dynamic sampling used for this statement (level=5)
   - Degree of Parallelism is 60 because of hint


Statistics
----------------------------------------------------------
        140  recursive calls
          0  db block gets
     161150  consistent gets
     158026  physical reads
          0  redo size
        425  bytes sent via SQL*Net to client
        419  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed

SQL> SELECT inst_id,sid, event, seq#,p1,p2,p3, wait_time FROM gv$session_wait WHERE upper(event) like ('PX%') ORDER BY 1;

   INST_ID        SID EVENT                                                                  SEQ#         P1         P2         P3  WAIT_TIME
---------- ---------- ---------------------------------------------------------------- ---------- ---------- ---------- ---------- ----------
         1          1 PX Deq: Execute Reply                                                 12755        200          1          0          0
         1         34 PX Deq: Execution Msg                                                    61  268566527          1 1113057120          0
         1         35 PX Deq: Execution Msg                                                    75  268566527          1 1113075080          0
         1         36 PX Deq: Execution Msg                                                    56  268566527          1 1113058640          0
         1         47 PX Deq: Execution Msg                                                    39  268566527          1 1113071544          0
         1         50 PX Deq: Execute Reply                                                  8426        200          1          0          0
         1         58 PX Deq: Execution Msg                                                    63  268566527          1 1113036280          0
         1         60 PX Deq: Execution Msg                                                    67  268566527          1 1113087836          0
         1         61 PX Deq: Execution Msg                                                    70  268566527          1 1113078440          0
         1         62 PX Deq: Execution Msg                                                    51  268566527          1 1113085912          0
         1         63 PX Deq: Execution Msg                                                    64  268566527          1 1039759788          0
         1         64 PX Deq: Execution Msg                                                    87  268566527          1 1113077960          0
         1         65 PX Deq: Execution Msg                                                    51  268566527          1 1113088316          0
         1         67 PX Deq: Execution Msg                                                    58  268566527          1 1113062540          0
         1         68 PX Deq: Execution Msg                                                    67  268566527          1 1113077000          0
         1         69 PX Deq: Execution Msg                                                    50  268566527          1 1113063500          0
         1         70 PX Deq: Execution Msg                                                    55  268566527          1 1113076520          0
         1         72 PX Deq: Execution Msg                                                    63  268566527          1 1113076040          0
         1         73 PX Deq: Execution Msg                                                    60  268566527          1 1113061520          0
         1         74 PX Deq: Execution Msg                                                    64  268566527          1 1113075560          0
         1         75 PX Deq: Execution Msg                                                    75  268566527          1 1113072052          0
         1         76 PX Deq: Execution Msg                                                    45  268566527          1 1039764108          0
         1         78 PX Deq: Execution Msg                                                    48  268566527          1 1113074060          0
         1         79 PX Deq: Execution Msg                                                    53  268566527          1 1113073520          0
         1         80 PX Deq: Execution Msg                                                    73  268566527          1 1113058080          0
         1         81 PX Deq: Execution Msg                                                    55  268566527          1 1113073040          0
         1         82 PX Deq: Execution Msg                                                    64  268566527          1 1039759308          0
         1         83 PX Deq: Execution Msg                                                    63  268566527          1 1113072560          0
         1         84 PX Deq: Execution Msg                                                    58  268566527          1 1039758348          0
         1         86 PX Deq: Execution Msg                                                    55  268566527          1 1113059600          0
         1         87 PX Deq: Execution Msg                                                    79  268566527          1 1113074540          0
         1         88 PX Deq: Execution Msg                                                    35  268566527          1 1113035320          0
         1         89 PX Deq: Execution Msg                                                    38  268566527          1 1113070976          0
         1         92 PX Deq: Execution Msg                                                    38  268566527          1 1039753980          0
         1         93 PX Deq: Execution Msg                                                    38  268566527          1 1113069840          0
         1         94 PX Deq: Execution Msg                                                    54  268566527          1 1039753500          0
         1         95 PX Deq: Execution Msg                                                    51  268566527          1 1113069332          0
         1         96 PX Deq: Execution Msg                                                    49  268566527          1 1039753020          0
         1         98 PX Deq: Execution Msg                                                     2  268566527          1 1113063980         -1

40 rows selected.

从上面的信息可以看到当instance_groups设置为’rac’,’rac1’,且parallel_instance_group设置为’rac1’时,在实例rac1上执行并行查询时并行子进程只能在rac1上运行。

parallel_instance_group
在Oracle 10g中 parallel_instance_group的参数值必须是instance_groups的参数列表之一。在11g中这个列表已经扩展包含了所有当前被启用的服务。因此,parallel_instance_group在11g中它的值可以在instance_groups的参数值中找到数据库当前已经启用的服务名之一

parallel_force_local
在11gr2中,parallel_force_local控制着Oracle RAC环境中的并行执行。缺省情况下, 并行执行的并行子进程可以在任何RAC节点或所有节点上运行。通过设置parallel_force_lcoal为true,并行子进程将会受限制,因此它们只能在与查询协调者(QC)所在实例上执行。

SQL> alter session set parallel_force_local=true;

Session altered.

SQL> show parameter parallel_force_local

NAME TYPE VALUE
———————————— ———– ——————————
parallel_force_local boolean TRUE

SQL> select /*+ parallel(t1,60) */ count(*) from t1;

COUNT(*)
———-
11121536

Execution Plan
———————————————————-
Plan hash value: 3110199320

——————————————————————————–
————————

| Id | Operation | Name | Rows | Cost (%CPU)| Time | T
Q |IN-OUT| PQ Distrib |

——————————————————————————–
————————

| 0 | SELECT STATEMENT | | 1 | 793 (0)| 00:00:01 |
| | |

| 1 | SORT AGGREGATE | | 1 | | |
| | |

| 2 | PX COORDINATOR | | | | |
| | |

| 3 | PX SEND QC (RANDOM) | :TQ10000 | 1 | | | Q1,
00 | P->S | QC (RAND) |

| 4 | SORT AGGREGATE | | 1 | | | Q1,
00 | PCWP | |

| 5 | PX BLOCK ITERATOR | | 10M| 793 (0)| 00:00:01 | Q1,
00 | PCWC | |

| 6 | TABLE ACCESS FULL| T1 | 10M| 793 (0)| 00:00:01 | Q1,
00 | PCWP | |

——————————————————————————–
————————

Note
—–
– dynamic sampling used for this statement (level=5)
– Degree of Parallelism is 60 because of hint

Statistics
———————————————————-
140 recursive calls
0 db block gets
161150 consistent gets
158026 physical reads
0 redo size
425 bytes sent via SQL*Net to client
419 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed

SQL> SELECT inst_id,sid, event, seq#,p1,p2,p3, wait_time FROM gv$session_wait WHERE upper(event) like (‘PX%’) ORDER BY 1;

INST_ID SID EVENT SEQ# P1 P2 P3 WAIT_TIME
———- ———- —————————————————————- ———- ———- ———- ———- ———-
1 1 PX Deq: Execute Reply 12755 200 1 0 0
1 34 PX Deq: Execution Msg 61 268566527 1 1113057120 0
1 35 PX Deq: Execution Msg 75 268566527 1 1113075080 0
1 36 PX Deq: Execution Msg 56 268566527 1 1113058640 0
1 47 PX Deq: Execution Msg 39 268566527 1 1113071544 0
1 50 PX Deq: Execute Reply 8426 200 1 0 0
1 58 PX Deq: Execution Msg 63 268566527 1 1113036280 0
1 60 PX Deq: Execution Msg 67 268566527 1 1113087836 0
1 61 PX Deq: Execution Msg 70 268566527 1 1113078440 0
1 62 PX Deq: Execution Msg 51 268566527 1 1113085912 0
1 63 PX Deq: Execution Msg 64 268566527 1 1039759788 0
1 64 PX Deq: Execution Msg 87 268566527 1 1113077960 0
1 65 PX Deq: Execution Msg 51 268566527 1 1113088316 0
1 67 PX Deq: Execution Msg 58 268566527 1 1113062540 0
1 68 PX Deq: Execution Msg 67 268566527 1 1113077000 0
1 69 PX Deq: Execution Msg 50 268566527 1 1113063500 0
1 70 PX Deq: Execution Msg 55 268566527 1 1113076520 0
1 72 PX Deq: Execution Msg 63 268566527 1 1113076040 0
1 73 PX Deq: Execution Msg 60 268566527 1 1113061520 0
1 74 PX Deq: Execution Msg 64 268566527 1 1113075560 0
1 75 PX Deq: Execution Msg 75 268566527 1 1113072052 0
1 76 PX Deq: Execution Msg 45 268566527 1 1039764108 0
1 78 PX Deq: Execution Msg 48 268566527 1 1113074060 0
1 79 PX Deq: Execution Msg 53 268566527 1 1113073520 0
1 80 PX Deq: Execution Msg 73 268566527 1 1113058080 0
1 81 PX Deq: Execution Msg 55 268566527 1 1113073040 0
1 82 PX Deq: Execution Msg 64 268566527 1 1039759308 0
1 83 PX Deq: Execution Msg 63 268566527 1 1113072560 0
1 84 PX Deq: Execution Msg 58 268566527 1 1039758348 0
1 86 PX Deq: Execution Msg 55 268566527 1 1113059600 0
1 87 PX Deq: Execution Msg 79 268566527 1 1113074540 0
1 88 PX Deq: Execution Msg 35 268566527 1 1113035320 0
1 89 PX Deq: Execution Msg 38 268566527 1 1113070976 0
1 92 PX Deq: Execution Msg 38 268566527 1 1039753980 0
1 93 PX Deq: Execution Msg 38 268566527 1 1113069840 0
1 94 PX Deq: Execution Msg 54 268566527 1 1039753500 0
1 95 PX Deq: Execution Msg 51 268566527 1 1113069332 0
1 96 PX Deq: Execution Msg 49 268566527 1 1039753020 0
1 98 PX Deq: Execution Msg 2 268566527 1 1113063980 -1

使用parallel_force_local要并使用instance_groups与parallel_instance_group参数来进行限制要方便很多。

Oracle 10g RAC跨实例控制并行

在Oracle 10g RAC中的并行执行由两个参数:instance_groups和parallel_instance_group来控制。并且这两个参数必须同时使用才能生效。

instance_groups可以设置多个参数值,但它是静态参数,parallel_instance_groups可以在系统级别和会话级别运态进行修改。

在Oracle 10g RAC中,为了让并行执行可以在设置了parallel_instance_group参数的会话中执行,那么parallel_instance_group的参数值必须是该实例instance_groups参数列表中的一个。

例如,两节点的Oracle 10g RAC,在spfile文件中有以下设置
myrac1.instance_groups=’jyrac’,’jyrac1′
myrac2.instance_groups=’jyrac’,’jyrac2′
myrac1.parallel_instance_group=’jyrac1’#节点1的并行执行只能在节点1上运行
myrac2.parallel_instance_group=’jyrac2’#节点2的并行执行只能在节点2上运行

SQL> alter system set instance_groups='jyrac','jyrac1' scope=spfile sid='jyrac1';

System altered.

SQL> alter system set instance_groups='jyrac','jyrac2' scope=spfile sid='jyrac2';

SQL> alter system set parallel_instance_group='jyrac1' scope=spfile sid='jyrac1';

System altered.

SQL> alter system set parallel_instance_group='jyrac2' scope=spfile sid='jyrac2';

System altered.

上面的设置意味着在任何节点上启动的并行只能在该节点上执行。

SQL> show parameter instance_group

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_groups                      string      jyrac, jyrac1
parallel_instance_group              string      jyrac1

SQL>set autotrace on

SQL> select /*+ parallel(t1,20) */ count(*) from t1;

  COUNT(*)
----------
  25962496


Execution Plan
----------------------------------------------------------
Plan hash value: 3110199320

--------------------------------------------------------------------------------------------------------
| Id  | Operation              | Name     | Rows  | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
--------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT       |          |     1 |  4320   (1)| 00:00:52 |        |      |            |
|   1 |  SORT AGGREGATE        |          |     1 |            |          |        |      |            |
|   2 |   PX COORDINATOR       |          |       |            |          |        |      |            |
|   3 |    PX SEND QC (RANDOM) | :TQ10000 |     1 |            |          |  Q1,00 | P->S | QC (RAND)  |
|   4 |     SORT AGGREGATE     |          |     1 |            |          |  Q1,00 | PCWP |            |
|   5 |      PX BLOCK ITERATOR |          |    27M|  4320   (1)| 00:00:52 |  Q1,00 | PCWC |            |
|   6 |       TABLE ACCESS FULL| T1       |    27M|  4320   (1)| 00:00:52 |  Q1,00 | PCWP |            |
--------------------------------------------------------------------------------------------------------

Note
-----
   - dynamic sampling used for this statement


Statistics
----------------------------------------------------------
         45  recursive calls
          0  db block gets
     532872  consistent gets
     355028  physical reads
       2132  redo size
        414  bytes sent via SQL*Net to client
        400  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          1  sorts (memory)
          0  sorts (disk)
          1  rows processed

SQL>SELECT inst_id,sid, event, seq#,p1,p2,p3, wait_time FROM gv$session_wait WHERE upper(event) like ('PX%') ORDER BY 1;

   INST_ID        SID EVENT                                                                  SEQ#         P1         P2         P3  WAIT_TIME
---------- ---------- ---------------------------------------------------------------- ---------- ---------- ---------- ---------- ----------
         1        124 PX Deq: Execution Msg                                                     1  268566527          1          0         -1
         1        126 PX Deq: Execution Msg                                                  8409  268566527          1          0         11
         1        127 PX Deq: Execution Msg                                                  7775  268566527          1          0          0
         1        128 PX Deq: Execution Msg                                                  8462  268566527          1          0          0
         1        129 PX Deq: Execute Reply                                                  3151        200          1          0          0
         1        134 PX Deq: Execution Msg                                                  9208  268566527          1          0          0
         1        136 PX Deq: Execution Msg                                                  9136  268566527          1          0         20
         1        140 PX Deq: Execution Msg                                                  8348  268566527          1          0          0
         1        153 PX Deq: Signal ACK                                                    59131         10          3          0          0

从上面的信息可以看到确实在实例jyrac1上执行的并行查询并行子进程只在jyrac1实例上运行

SQL> show parameter instance_group

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_groups                      string      jyrac, jyrac2
parallel_instance_group              string      jyrac2

SQL> select /*+ parallel(t1,20) */ count(*) from t1;

  COUNT(*)
----------
  25962496


Execution Plan
----------------------------------------------------------
Plan hash value: 3110199320

--------------------------------------------------------------------------------------------------------
| Id  | Operation              | Name     | Rows  | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
--------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT       |          |     1 |  4320   (1)| 00:00:52 |        |      |            |
|   1 |  SORT AGGREGATE        |          |     1 |            |          |        |      |            |
|   2 |   PX COORDINATOR       |          |       |            |          |        |      |            |
|   3 |    PX SEND QC (RANDOM) | :TQ10000 |     1 |            |          |  Q1,00 | P->S | QC (RAND)  |
|   4 |     SORT AGGREGATE     |          |     1 |            |          |  Q1,00 | PCWP |            |
|   5 |      PX BLOCK ITERATOR |          |    27M|  4320   (1)| 00:00:52 |  Q1,00 | PCWC |            |
|   6 |       TABLE ACCESS FULL| T1       |    27M|  4320   (1)| 00:00:52 |  Q1,00 | PCWP |            |
--------------------------------------------------------------------------------------------------------

Note
-----
   - dynamic sampling used for this statement


Statistics
----------------------------------------------------------
         60  recursive calls
          0  db block gets
     533765  consistent gets
     354821  physical reads
          0  redo size
        414  bytes sent via SQL*Net to client
        400  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          1  sorts (memory)
          0  sorts (disk)
          1  rows processed

SQL>SELECT inst_id,sid, event, seq#,p1,p2,p3, wait_time FROM gv$session_wait WHERE upper(event) like ('PX%') ORDER BY 1;

   INST_ID        SID EVENT                                                                  SEQ#         P1         P2         P3  WAIT_TIME
---------- ---------- ---------------------------------------------------------------- ---------- ---------- ---------- ---------- ----------
         2        120 PX Deq: Execution Msg                                                     1  268632063          1          0          0
         2        121 PX Deq: reap credit                                                      13          0          0          0         -1
         2        122 PX Deq: Execution Msg                                                     1  268632063          1          0          0
         2        129 PX Deq: Execution Msg                                                     1  268632063          1          0          0
         2        153 PX Deq: Join ACK                                                       3664  268566529          8          0          0
         2        131 PX Deq: Execution Msg                                                     1  268632063          1          0          0
         2        132 PX Deq: Execution Msg                                                     1  268632063          1          0          0
         2        133 PX Deq: Execution Msg                                                     1  268632063          1          0          0
         2        135 PX Deq: Execution Msg                                                     1  268632063          1          0          0
         2        139 PX Deq: Execution Msg                                                     1  268632063          1          0          0
         2        140 PX Deq: Execution Msg                                                     1  268632063          1          0          0
         2        141 PX Deq: Execution Msg                                                     1  268632063          1          0          0
         2        147 PX Deq: Execution Msg                                                     1  268632063          1          0          0
         2        119 PX Deq: Execution Msg                                                     1  268632063          1          0          0
         2        118 PX Deq: Execution Msg                                                     1  268632063          1          0          0
         2        130 PX Deq: Execution Msg                                                     1  268632063          1          0          0

从上面的信息可以看到确实在实例jyrac2上执行的并行查询并行子进程只在jyrac2实例上运行

可以根据需要使用相同的实例组来完成不同的需求
myrac1.instance_groups=’jyrac’,’jyrac1′
myrac2.instance_groups=’jyrac’,’jyrac2′
myrac1.parallel_instance_group=’jyrac1’#节点1的并行执行只能在节点1上运行
myrac2.parallel_instance_group=’jyrac1’#节点2的并行执行只能在节点1上运行
myrac1.parallel_instance_group=’jyrac’#节点1的并行执行能在所有节点上运行

将实例jyrac1的parallel_instance_group设置为’jyrac1’来测试节点1的并行执行是否只能在节点1上运行

SQL> show parameter instance_group

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_groups                      string      jyrac, jyrac1
parallel_instance_group              string      jyrac1

SQL>set autotrace on

SQL> select /*+ parallel(t1,20) */ count(*) from t1;

  COUNT(*)
----------
  25962496


Execution Plan
----------------------------------------------------------
Plan hash value: 3110199320

--------------------------------------------------------------------------------------------------------
| Id  | Operation              | Name     | Rows  | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
--------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT       |          |     1 |  4320   (1)| 00:00:52 |        |      |            |
|   1 |  SORT AGGREGATE        |          |     1 |            |          |        |      |            |
|   2 |   PX COORDINATOR       |          |       |            |          |        |      |            |
|   3 |    PX SEND QC (RANDOM) | :TQ10000 |     1 |            |          |  Q1,00 | P->S | QC (RAND)  |
|   4 |     SORT AGGREGATE     |          |     1 |            |          |  Q1,00 | PCWP |            |
|   5 |      PX BLOCK ITERATOR |          |    27M|  4320   (1)| 00:00:52 |  Q1,00 | PCWC |            |
|   6 |       TABLE ACCESS FULL| T1       |    27M|  4320   (1)| 00:00:52 |  Q1,00 | PCWP |            |
--------------------------------------------------------------------------------------------------------

Note
-----
   - dynamic sampling used for this statement


Statistics
----------------------------------------------------------
         45  recursive calls
          0  db block gets
     532872  consistent gets
     355028  physical reads
       2132  redo size
        414  bytes sent via SQL*Net to client
        400  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          1  sorts (memory)
          0  sorts (disk)
          1  rows processed

SQL>SELECT inst_id,sid, event, seq#,p1,p2,p3, wait_time FROM gv$session_wait WHERE upper(event) like ('PX%') ORDER BY 1;

   INST_ID        SID EVENT                                                                  SEQ#         P1         P2         P3  WAIT_TIME
---------- ---------- ---------------------------------------------------------------- ---------- ---------- ---------- ---------- ----------
         1        124 PX Deq: Execution Msg                                                     1  268566527          1          0         -1
         1        126 PX Deq: Execution Msg                                                  8409  268566527          1          0         11
         1        127 PX Deq: Execution Msg                                                  7775  268566527          1          0          0
         1        128 PX Deq: Execution Msg                                                  8462  268566527          1          0          0
         1        129 PX Deq: Execute Reply                                                  3151        200          1          0          0
         1        134 PX Deq: Execution Msg                                                  9208  268566527          1          0          0
         1        136 PX Deq: Execution Msg                                                  9136  268566527          1          0         20
         1        140 PX Deq: Execution Msg                                                  8348  268566527          1          0          0
         1        153 PX Deq: Signal ACK                                                    59131         10          3          0          0

从上面的信息可以看到确实在实例jyrac1上执行的并行查询并行子进程只在jyrac1实例上运行将实例jyrac2的parallel_instance_group设置为’jyrac1’来测试节点2的并行执行是否只能在节点1上运行

SQL> alter session set parallel_instance_group='jyrac1';

Session altered.

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
jyrac2

SQL> show parameter instance_group

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_groups                      string      jyrac, jyrac2
parallel_instance_group              string      jyrac1



SQL> select /*+ parallel(t1,20) */ count(*) from t1;

  COUNT(*)
----------
  25962496


Execution Plan
----------------------------------------------------------
Plan hash value: 3110199320

--------------------------------------------------------------------------------------------------------
| Id  | Operation              | Name     | Rows  | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
--------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT       |          |     1 |  4320   (1)| 00:00:52 |        |      |            |
|   1 |  SORT AGGREGATE        |          |     1 |            |          |        |      |            |
|   2 |   PX COORDINATOR       |          |       |            |          |        |      |            |
|   3 |    PX SEND QC (RANDOM) | :TQ10000 |     1 |            |          |  Q1,00 | P->S | QC (RAND)  |
|   4 |     SORT AGGREGATE     |          |     1 |            |          |  Q1,00 | PCWP |            |
|   5 |      PX BLOCK ITERATOR |          |    27M|  4320   (1)| 00:00:52 |  Q1,00 | PCWC |            |
|   6 |       TABLE ACCESS FULL| T1       |    27M|  4320   (1)| 00:00:52 |  Q1,00 | PCWP |            |
--------------------------------------------------------------------------------------------------------

Note
-----
   - dynamic sampling used for this statement


Statistics
----------------------------------------------------------
         21  recursive calls
          0  db block gets
     532751  consistent gets
     354823  physical reads
          0  redo size
        414  bytes sent via SQL*Net to client
        400  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          1  sorts (memory)
          0  sorts (disk)
          1  rows processed

SQL> SELECT inst_id,sid, event, seq#,p1,p2,p3, wait_time FROM gv$session_wait WHERE upper(event) like ('PX%') ORDER BY 1;
   INST_ID        SID EVENT                                                                  SEQ#         P1         P2         P3  WAIT_TIME
---------- ---------- ---------------------------------------------------------------- ---------- ---------- ---------- ---------- ----------
         1        125 PX Deq: Execution Msg                                                  8662  268632063          2  699436536          0
         1        126 PX Deq: Execution Msg                                                  9290  268632063          2  699434348          0
         1        127 PX Deq: Execution Msg                                                  8000  268632063          2  699433976          0
         1        129 PX Deq: Execute Reply                                                  7722        200          1          0          0
         1        136 PX Deq: Execution Msg                                                     1  268566527          1          0         -1
         1        148 PX Deq: Execution Msg                                                  8697  268632063          2  699439808          0
         1        137 PX Deq: Execution Msg                                                  8719  268632063          3  699432860          0
         1        140 PX Deq: Execution Msg                                                  8660  268632063          2  699433604          0

从上面的信息可以看到在实例jyrac2执行并行查询的并行子进程确实在jyrac1实例上运行的。

将实例jyrac1的parallel_instance_group设置为jyrac,来测试在jyrac1实例上执行并行查询的并行子进程将会在实例jyrac1,jyrac2上运行

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
jyrac1

SQL> alter session set parallel_instance_group='jyrac';

Session altered.

SQL> show parameter instance_group

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_groups                      string      jyrac, jyrac1
parallel_instance_group              string      jyrac


SQL> select /*+ parallel(t1,20) */ count(*) from t1;

  COUNT(*)
----------
  25962496


Execution Plan
----------------------------------------------------------
Plan hash value: 3110199320

--------------------------------------------------------------------------------------------------------
| Id  | Operation              | Name     | Rows  | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
--------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT       |          |     1 |  4320   (1)| 00:00:52 |        |      |            |
|   1 |  SORT AGGREGATE        |          |     1 |            |          |        |      |            |
|   2 |   PX COORDINATOR       |          |       |            |          |        |      |            |
|   3 |    PX SEND QC (RANDOM) | :TQ10000 |     1 |            |          |  Q1,00 | P->S | QC (RAND)  |
|   4 |     SORT AGGREGATE     |          |     1 |            |          |  Q1,00 | PCWP |            |
|   5 |      PX BLOCK ITERATOR |          |    27M|  4320   (1)| 00:00:52 |  Q1,00 | PCWC |            |
|   6 |       TABLE ACCESS FULL| T1       |    27M|  4320   (1)| 00:00:52 |  Q1,00 | PCWP |            |
--------------------------------------------------------------------------------------------------------

Note
-----
   - dynamic sampling used for this statement


Statistics
----------------------------------------------------------
         59  recursive calls
          0  db block gets
     533297  consistent gets
     354823  physical reads
          0  redo size
        414  bytes sent via SQL*Net to client
        400  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          1  sorts (memory)
          0  sorts (disk)
          1  rows processed

SQL> SELECT inst_id,sid, event, seq#,p1,p2,p3, wait_time FROM gv$session_wait WHERE upper(event) like ('PX%') ORDER BY 1;

   INST_ID        SID EVENT                                                                  SEQ#         P1         P2         P3  WAIT_TIME
---------- ---------- ---------------------------------------------------------------- ---------- ---------- ---------- ---------- ----------
         1        125 PX Deq: Execution Msg                                                  4678  268566527          1          0          0
         1        126 PX Deq: Execution Msg                                                  4637  268566527          1          0          0
         1        128 PX Deq: Execution Msg                                                  4658  268566527          1          0          0
         1        129 PX Deq: Execute Reply                                                 10795        200          1          0          0
         1        130 PX Deq: Execution Msg                                                     1  268566527          1          0         -1
         1        140 PX Deq: Execution Msg                                                  4627  268566527          1          0          0
         1        148 PX Deq: Execution Msg                                                  4653  268566527          1          0          0
         1        153 PX Deq: Execute Reply                                                 59889        200          1          0          0
         2        122 PX Deq: Execution Msg                                                  3675  268566527          2  699422552          0
         2        124 PX Deq: Execution Msg                                                  3709  268566527          2  699424100          0
         2        126 PX Deq: Execution Msg                                                  4066  268566527          2  699426332          0
         2        135 PX Deq: reap credit                                                      13          0          0          0         -1
         2        139 PX Deq: Execution Msg                                                  4375  268566527          2  699420320          0
         2        141 PX Deq: Execution Msg                                                  4004  268566527          2  699423356          0

从上面的信息可以看到在jyrac1实例上执行并行查询的并行子进程确实在实例jyrac1,jyrac2上运行

Oracle 11.2中控制并行的新参数

在Oracle 11.2中引入了几个新的并行查询参数。对于数据仓库应用来说经常利用并行处理来快速有效地处理信息,尤其是查询非常大的表或加入了复杂的算式更应该使用并行查询。在Oracle之前的版本中,我们不得不或多或秒的来决定自动并行度。决定一个最佳并行度是非常困难的。真实最佳并行度依赖于数据块在磁盘上的物理位置以及服务器的CPU数量(cpu_count),为了解决并行查询的这些问题
在Oracle11.2中引入了以下新的并行查询参数
1.parallel_degree_policy
parallel_degree_policy参数可以被设置为manual,auto或limited在Oracle11.1中parallel_degree_policy缺省设置为manual(禁用了automatic degree of parallelism,statement queuing与in-memory parallel execution)


SQL> show parameter parallel_degree_policy;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
parallel_degree_policy               string      manual
SQL> set autotrace on   
SQL> select count(*) from t1;

  COUNT(*)
----------
  22040576


Execution Plan
----------------------------------------------------------
Plan hash value: 3724264953

-------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Cost (%CPU)| Time     |
-------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |     1 | 84998   (1)| 00:00:06 |
|   1 |  SORT AGGREGATE    |      |     1 |            |          |
|   2 |   TABLE ACCESS FULL| T1   |    21M| 84998   (1)| 00:00:06 |
-------------------------------------------------------------------

Note
-----
   - dynamic sampling used for this statement (level=2)


Statistics
----------------------------------------------------------
         22  recursive calls
          0  db block gets
     469904  consistent gets
     313229  physical reads
          0  redo size
        425  bytes sent via SQL*Net to client
        415  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          2  sorts (memory)
          0  sorts (disk)
          1  rows processed

但我们可以手动指定并行度

SQL> show parameter parallel_degree_policy

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
parallel_degree_policy               string      manual
SQL> set autotrace on
SQL> select /*+ parallel */ count(*) from t1;

  COUNT(*)
----------
  22040576


Execution Plan
----------------------------------------------------------
Plan hash value: 3110199320

--------------------------------------------------------------------------------------------------------
| Id  | Operation              | Name     | Rows  | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
--------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT       |          |     1 | 47183   (1)| 00:00:04 |        |      |            |
|   1 |  SORT AGGREGATE        |          |     1 |            |          |        |      |            |
|   2 |   PX COORDINATOR       |          |       |            |          |        |      |            |
|   3 |    PX SEND QC (RANDOM) | :TQ10000 |     1 |            |          |  Q1,00 | P->S | QC (RAND)  |
|   4 |     SORT AGGREGATE     |          |     1 |            |          |  Q1,00 | PCWP |            |
|   5 |      PX BLOCK ITERATOR |          |    21M| 47183   (1)| 00:00:04 |  Q1,00 | PCWC |            |
|   6 |       TABLE ACCESS FULL| T1       |    21M| 47183   (1)| 00:00:04 |  Q1,00 | PCWP |            |
--------------------------------------------------------------------------------------------------------

Note
-----
   - dynamic sampling used for this statement (level=5)
   - automatic DOP: Computed Degree of Parallelism is 2


Statistics
----------------------------------------------------------
         20  recursive calls
          4  db block gets
     470138  consistent gets
     313225  physical reads
          0  redo size
        425  bytes sent via SQL*Net to client
        415  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed

parallel_degree_policy=auto就会启用以下新功能:
并行度(DOP)将会基于SQL语句中的操作类型和表的大小来自动计算。例如对大表排序的并行度(DOP)可能比对小表操作的并行度高。

如果请求或请求的并行度(DOP)因为并行服务进程正处于繁忙状态而不能获得满足,那么Oracle直到有足够的并行子进程可用之前将不会执行语句,而不是降低并行度或串行执行SQL语句。在11gr2之前的版本中,当没有足够的并行进程服务进程满足所请求的并行度(DOP)时,可以会出现以下三种情况中的一种:
SQL语句将会降低并行度(DOP)来以并行方式执行
SQL语句以串行方式来执行
如果parallel_min_percent被设置将收到”ORA-12827:insufficient parallel query slaves available”

Oracle并行子进程可能使用buffered IO而不是直接IO。例如”in-memory parallel execution”

SQL> show parameter parallel_degree_policy

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
parallel_degree_policy               string      AUTO

SQL> select degree,instances from user_tables where table_name = 'T1';

DEGREE               INSTANCES
-------------------- --------------------
         1                    1

Elapsed: 00:00:00.00
SQL> set autotrace on
SQL> select count(*) from t1;

  COUNT(*)
----------
  22040576

Elapsed: 00:00:18.50

Execution Plan
----------------------------------------------------------
Plan hash value: 3110199320

--------------------------------------------------------------------------------------------------------
| Id  | Operation              | Name     | Rows  | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
--------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT       |          |     1 | 47183   (1)| 00:00:04 |        |      |            |
|   1 |  SORT AGGREGATE        |          |     1 |            |          |        |      |            |
|   2 |   PX COORDINATOR       |          |       |            |          |        |      |            |
|   3 |    PX SEND QC (RANDOM) | :TQ10000 |     1 |            |          |  Q1,00 | P->S | QC (RAND)  |
|   4 |     SORT AGGREGATE     |          |     1 |            |          |  Q1,00 | PCWP |            |
|   5 |      PX BLOCK ITERATOR |          |    21M| 47183   (1)| 00:00:04 |  Q1,00 | PCWC |            |
|   6 |       TABLE ACCESS FULL| T1       |    21M| 47183   (1)| 00:00:04 |  Q1,00 | PCWP |            |
--------------------------------------------------------------------------------------------------------

Note
-----
   - dynamic sampling used for this statement (level=2)
   - automatic DOP: Computed Degree of Parallelism is 2


Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
     469841  consistent gets
     313226  physical reads
          0  redo size
        425  bytes sent via SQL*Net to client
        415  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed

parallel_degree_policy设置为limited
对某些语句启用自动并行度,但statement queuing与in-memory parallel execution被禁用。只会对访问使用parallel子句来设置DEFAULT并行度的表或索引应用自动并行度。

SQL> select degree,instances from user_tables where table_name = 'T1';

DEGREE               INSTANCES
-------------------- --------------------
         1                    1

SQL> show parameter parallel_degree_policy 

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
parallel_degree_policy               string      LIMITED
SQL> set autotrace on;
SQL> select count(*) from t1;

  COUNT(*)
----------
  22040576


Execution Plan
----------------------------------------------------------
Plan hash value: 3724264953

-------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Cost (%CPU)| Time     |
-------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |     1 | 84998   (1)| 00:00:06 |
|   1 |  SORT AGGREGATE    |      |     1 |            |          |
|   2 |   TABLE ACCESS FULL| T1   |    21M| 84998   (1)| 00:00:06 |
-------------------------------------------------------------------

Note
-----
   - dynamic sampling used for this statement (level=2)


Statistics
----------------------------------------------------------
          5  recursive calls
          0  db block gets
     469898  consistent gets
     313399  physical reads
          0  redo size
        425  bytes sent via SQL*Net to client
        415  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed

因为表的并行度是1,而不是default,现在使用parallel子句来修改表t1的并行度

SQL> alter table t1 parallel;

Table altered.

SQL> select degree,instances from user_tables where table_name = 'T1';

DEGREE               INSTANCES
-------------------- --------------------
   DEFAULT              DEFAULT

SQL> set autotrace on
SQL> select count(*) from t1;

  COUNT(*)
----------
  22040576


Execution Plan
----------------------------------------------------------
Plan hash value: 3110199320

--------------------------------------------------------------------------------------------------------
| Id  | Operation              | Name     | Rows  | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
--------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT       |          |     1 | 47183   (1)| 00:00:04 |        |      |            |
|   1 |  SORT AGGREGATE        |          |     1 |            |          |        |      |            |
|   2 |   PX COORDINATOR       |          |       |            |          |        |      |            |
|   3 |    PX SEND QC (RANDOM) | :TQ10000 |     1 |            |          |  Q1,00 | P->S | QC (RAND)  |
|   4 |     SORT AGGREGATE     |          |     1 |            |          |  Q1,00 | PCWP |            |
|   5 |      PX BLOCK ITERATOR |          |    21M| 47183   (1)| 00:00:04 |  Q1,00 | PCWC |            |
|   6 |       TABLE ACCESS FULL| T1       |    21M| 47183   (1)| 00:00:04 |  Q1,00 | PCWP |            |
--------------------------------------------------------------------------------------------------------

Note
-----
   - dynamic sampling used for this statement (level=5)
   - automatic DOP: Computed Degree of Parallelism is 2


Statistics
----------------------------------------------------------
         83  recursive calls
          0  db block gets
     470167  consistent gets
     313413  physical reads
          0  redo size
        425  bytes sent via SQL*Net to client
        415  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          6  sorts (memory)
          0  sorts (disk)
          1  rows processed



2.parallel_min_time_threshold
parallel_min_time_threshold参数用来指定SQL语句是否并行执行一个阈值,也就是当优化器根据统计信息所估算的执行时间如果大于这个参数值就是使用并行,如果估算的执行时间小于这个参数值就会串行执行。这个参数值缺省值是10秒。并且自动并行度只要在parallel_degree_policy参数被设置为auto或limited时才会生效。从下面的信息可以看到到语句的执行时间小于10秒时,优化器以是串行而不是并行方式来执行的

SQL> show parameter parallel_degree_policy

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
parallel_degree_policy               string      AUTO
SQL> set autotrace on
SQL> select count(*) from t1;

  COUNT(*)
----------
   2755072

Elapsed: 00:00:02.66

Execution Plan
----------------------------------------------------------
Plan hash value: 3724264953

-------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Cost (%CPU)| Time     |
-------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |     1 | 10627   (1)| 00:00:01 |
|   1 |  SORT AGGREGATE    |      |     1 |            |          |
|   2 |   TABLE ACCESS FULL| T1   |  2569K| 10627   (1)| 00:00:01 |
-------------------------------------------------------------------

Note
-----
   - dynamic sampling used for this statement (level=2)
   - automatic DOP: Computed Degree of Parallelism is 1 because of parallel threshold


Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
      57150  consistent gets
      39162  physical reads
          0  redo size
        425  bytes sent via SQL*Net to client
        415  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed

再次增加表t1的数据记录

SQL> insert into t1 select * from t1;

5510144 rows created.


SQL> commit;

Commit complete.



SQL> alter system flush buffer_cache;

System altered.

SQL> set autotrace on
SQL> select count(*) from t1;

  COUNT(*)
----------
  11020288

Elapsed: 00:00:09.05

Execution Plan
----------------------------------------------------------
Plan hash value: 3724264953

-------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Cost (%CPU)| Time     |
-------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |     1 | 42507   (1)| 00:00:03 |
|   1 |  SORT AGGREGATE    |      |     1 |            |          |
|   2 |   TABLE ACCESS FULL| T1   |    11M| 42507   (1)| 00:00:03 |
-------------------------------------------------------------------

Note
-----
   - dynamic sampling used for this statement (level=2)
   - automatic DOP: Computed Degree of Parallelism is 1


Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
     223549  consistent gets
     156619  physical reads
          0  redo size
        425  bytes sent via SQL*Net to client
        415  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed

可以看到执行时间为9.05秒,Oracle使用串行执行,继续向表t1增加记录

SQL> insert into t1 select * from t1;

11020288 rows created.


SQL> commit;

Commit complete.

SQL> alter system flush buffer_cache;

System altered.

SQL> show parameter parallel_degree_policy 

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
parallel_degree_policy               string      AUTO
SQL> select * from V$IO_CALIBRATION_STATUS;

STATUS        CALIBRATION_TIME
------------- ---------------------------------------------------------------------------
READY         13-APR-16 10.12.58.413 PM

Elapsed: 00:00:00.08
SQL> set autotrace on
SQL> select count(*) from t1;

  COUNT(*)
----------
  22040576

Elapsed: 00:00:18.50

Execution Plan
----------------------------------------------------------
Plan hash value: 3110199320

--------------------------------------------------------------------------------------------------------
| Id  | Operation              | Name     | Rows  | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
--------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT       |          |     1 | 47183   (1)| 00:00:04 |        |      |            |
|   1 |  SORT AGGREGATE        |          |     1 |            |          |        |      |            |
|   2 |   PX COORDINATOR       |          |       |            |          |        |      |            |
|   3 |    PX SEND QC (RANDOM) | :TQ10000 |     1 |            |          |  Q1,00 | P->S | QC (RAND)  |
|   4 |     SORT AGGREGATE     |          |     1 |            |          |  Q1,00 | PCWP |            |
|   5 |      PX BLOCK ITERATOR |          |    21M| 47183   (1)| 00:00:04 |  Q1,00 | PCWC |            |
|   6 |       TABLE ACCESS FULL| T1       |    21M| 47183   (1)| 00:00:04 |  Q1,00 | PCWP |            |
--------------------------------------------------------------------------------------------------------

Note
-----
   - dynamic sampling used for this statement (level=2)
   - automatic DOP: Computed Degree of Parallelism is 2


Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
     469841  consistent gets
     313226  physical reads
          0  redo size
        425  bytes sent via SQL*Net to client
        415  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed

现在可以看到当parallel_degree_policy=auto,parallel_min_time_threshold=auto时,sql执行时间超长10秒时就会使用自动并行。

3.parallel_degree_limit
使用自动并行度时,Oracle会自动决定是否以并行方式来执行SQL语句以及所使用的并行度。优化根据语句所请求的资源来决定一个语句的并行度。然而优化器所使用的并行度是受限制的以防止并行进程击垮系统。也就是是系统中所能使用的并行度的上限为parallel_degree_limit参数值。它有三个参数值可以选择:
CPU
最大并行度由系统中的CPU数量来限制。其计算公式为parallel_degree_limit=parallel_thread_per_cpu*cpu_count
当然,你也可以将parallel_degree_limit的值设置为一个具体的值,以达到明确控制实际并行度的目的。

IO
优化器能使用的最大并行度由系统的I/O能力来限制。这个值等于系统总吞吐量除以每个进程的最大I/O带宽。但在Oracle 11.2中为了将parallel_degree_limit设置为IO必须执行dbms_resource_manager.calibrate_io过程来收集系统的I/O统计信息。这个过程将会计算系统的总吞吐量与每个进程的最大IO带宽。

具体数字
当自动并行度被激活时,指定一个SQL语句所能使用的最大并行度。这个参数只有当parallel_degree_policy设置为auto或limited时才生效。

4.parallel_force_local
parallel_force_local参数控制RAC环境中的并行执行。缺省情况下,优化器可以从RAC中的任何节点或所有节点中选择并行执行SQL语句的并行进程。当parallel_force_local设置为true时,那么并行进程就只能是与查询协调者(执行sql语句的节点)在同一个RAC节点中,也就是说并行进程是不能跨节点的.

dbca -silent创建rac数据库

刚好有一个网友问我,dbca -silent是否能创建rac数据库,是否能启用归档,下面是测试过程
一.先删除已经存在的rac数据库jyrac

ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576      5120     4892                0            4892              0             N  BACKUPDG/
MOUNTED  EXTERN  N         512   4096  1048576      5120     4724                0            4724              0             Y  CRSDG/
MOUNTED  EXTERN  N         512   4096  1048576     10240        2                0               2              0             N  DATADG/
ASMCMD> ls -lt
Type           Redund  Striped  Time             Sys  Name
                                                 Y    TEMPFILE/
                                                 Y    PARAMETERFILE/
                                                 Y    ONLINELOG/
                                                 Y    DATAFILE/
                                                 Y    CONTROLFILE/
                                                 N    spfilejyrac.ora => +DATADG/JYRAC/PARAMETERFILE/spfile.268.864825131

[oracle@jyrac1 ~]$ dbca -silent -deleteDatabase -sourceDB jyrac -sysDBAUserName sys -sysDBAPassword system
Connecting to database
9% complete
14% complete
19% complete
23% complete
28% complete
33% complete
38% complete
47% complete
Updating network configuration files
48% complete
52% complete
Deleting instances and datafiles
66% complete
80% complete
95% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/jyrac.log" for further details.
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576      5120     4892                0            4892              0             N  BACKUPDG/
MOUNTED  EXTERN  N         512   4096  1048576      5120     4724                0            4724              0             Y  CRSDG/
MOUNTED  EXTERN  N         512   4096  1048576     10240    10138                0           10138              0             N  DATADG/
[root@jyrac1 jyrac]# ps -ef | grep pmon
grid      4185     1  0 Jan26 ?        00:01:59 asm_pmon_+ASM1
root     32023 26194  0 16:57 pts/3    00:00:00 grep pmon

[grid@jyrac2 ~]$ ps -ef | grep pmon
grid      4144     1  0 Jan26 ?        00:02:03 asm_pmon_+ASM2
grid     30617 22435  0 16:57 pts/1    00:00:00 grep pmon

说明rac数据库jyrac确实已经删除了,下面以dbca -silent模式来创建rac数据库jyrac

二.使用dbca -silent来创建rac数据库jyrac,并使用-initParams参数设置归档目录,使用-nodeinfo来指定rac节点,但-nodeinfo参数在dbca的帮助信息中并没有显示。

[oracle11@oracle11g ~]$ dbca -help
dbca  [-silent | -progressOnly | -customCreate] {  }  | { [ [options] ] -responseFile   } [-continueOnNonFatalErrors ]
Please refer to the manual for details.
You can enter one of the following command:

Create a database by specifying the following parameters:
        -createDatabase
                -templateName 
                [-cloneTemplate]
                -gdbName 
                [-sid ]
                [-sysPassword ]
                [-systemPassword ]
                [-emConfiguration 
                        -dbsnmpPassword 
                        -sysmanPassword 
                        [-hostUserName 
                         -hostUserPassword 
                         -backupSchedule ]
                        [-centralAgent ]]
                [-disableSecurityConfiguration 
                [-datafileDestination  |  -datafileNames ]
                [-redoLogFileSize ]
                [-recoveryAreaDestination ]
                [-datafileJarLocation  ]
                [-storageType < FS | ASM >
                        [-asmsnmpPassword     ]
                         -diskGroupName   
                         -recoveryGroupName       
                [-characterSet ]
                [-nationalCharacterSet  ]
                [-registerWithDirService 
                        -dirServiceUserName    
                        -dirServicePassword    
                        -walletPassword    ]
                [-listeners  ]
                [-variablesFile   ]]
                [-variables  ]
                [-initParams ]
                [-sampleSchema   ]
                [-memoryPercentage ]
                [-automaticMemoryManagement ]
                [-totalMemory ]
                [-databaseType ]]

Configure a database by specifying the following parameters:
        -configureDatabase
                -sourceDB    
                [-sysDBAUserName     
                 -sysDBAPassword     ]
                [-registerWithDirService|-unregisterWithDirService|-regenerateDBPassword 
                        -dirServiceUserName    
                        -dirServicePassword    
                        -walletPassword    ]
                [-disableSecurityConfiguration 
                [-enableSecurityConfiguration 
                [-emConfiguration 
                        -dbsnmpPassword 
                        -sysmanPassword 
                        [-hostUserName 
                         -hostUserPassword 
                         -backupSchedule ]
                        [-centralAgent ]]


Create a template from an existing database by specifying the following parameters:
        -createTemplateFromDB
                -sourceDB    ::>
                -templateName      
                -sysDBAUserName     
                -sysDBAPassword     
                [-maintainFileLocations ]


Create a clone template from an existing database by specifying the following parameters:
        -createCloneTemplate
                -sourceSID    
                -templateName      
                [-sysDBAUserName     
                 -sysDBAPassword     ]
                [-maintainFileLocations ]
                [-datafileJarLocation       ]

Generate scripts to create database by specifying the following parameters:
        -generateScripts
                -templateName 
                -gdbName 
                [-scriptDest       ]

Delete a database by specifying the following parameters:
        -deleteDatabase
                -sourceDB    
                [-sysDBAUserName     
                 -sysDBAPassword     ]
Query for help by specifying the following options: -h | -help

下面创建rac数据库jyrac,使用-initParams参数设置了归档目录为+backupdg/,节点为jyrac1,jyrac2

[oracle@jyrac1 ~]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname jyrac  -sid jyrac -datafileDestination 'datadg/' -redoLogFileSize 50 -recoveryAreaDestination 'datadg/' -storageType ASM -asmsnmpPassword system  -diskGroupName 'datadg' -responseFile NO_VALUE -characterset ZHS16GBK -nationalCharacterSet AL16UTF16 -sampleSchema true -automaticMemoryManagement true -totalMemory 500 -initParams log_archive_dest_1='location=+backupdg/' -nodeinfo jyrac1,jyrac2
Enter SYS user password:

Enter SYSTEM user password:

Copying database files
1% complete
3% complete
9% complete
15% complete
21% complete
27% complete
30% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
44% complete
45% complete
48% complete
50% complete
Creating cluster database views
52% complete
70% complete
Completing Database Creation
73% complete
76% complete
85% complete
94% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/jyrac/jyrac.log" for further details.

三.检查数据库状态

[root@jyrac1 ~]# ps -ef | grep pmon
grid      4185     1  0 Jan26 ?        00:01:59 asm_pmon_+ASM1
oracle    6545     1  0 17:33 ?        00:00:00 ora_pmon_jyrac1
root      7059  6061  0 17:36 pts/4    00:00:00 grep pmon
[grid@jyrac2 ~]$  ps -ef | grep pmon
grid      4144     1  0 Jan26 ?        00:02:03 asm_pmon_+ASM2
oracle    6320     1  0 17:34 ?        00:00:00 ora_pmon_jyrac2
grid      6756 22435  0 17:36 pts/1    00:00:00 grep pmon

[grid@jyrac2 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.BACKUPDG.dg
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.CRSDG.dg
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.DATADG.dg
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.LISTENER.lsnr
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.asm
               ONLINE  ONLINE       jyrac1                   Started
               ONLINE  ONLINE       jyrac2                   Started
ora.gsd
               OFFLINE OFFLINE      jyrac1
               OFFLINE OFFLINE      jyrac2
ora.net1.network
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.ons
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.registry.acfs
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       jyrac2
ora.cvu
      1        ONLINE  ONLINE       jyrac2
ora.jyrac.db
      1        ONLINE  ONLINE       jyrac1                   Open
      2        ONLINE  ONLINE       jyrac2                   Open
ora.jyrac1.vip
      1        ONLINE  ONLINE       jyrac1
ora.jyrac2.vip
      1        ONLINE  ONLINE       jyrac2
ora.oc4j
      1        ONLINE  ONLINE       jyrac2
ora.scan1.vip
      1        ONLINE  ONLINE       jyrac2


[grid@jyrac2 ~]$ srvctl status database -d jyrac
Instance jyrac1 is running on node jyrac1
Instance jyrac2 is running on node jyrac2

[grid@jyrac2 ~]$ srvctl config database -d jyrac
Database unique name: jyrac
Database name: jyrac
Oracle home: /u01/app/oracle/product/11.2.0/db
Oracle user: oracle
Spfile: +DATADG/jyrac/spfilejyrac.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: jyrac
Database instances: jyrac1,jyrac2
Disk Groups: DATADG
Mount point paths:
Services:
Type: RAC
Database is administrator managed

[grid@jyrac2 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 17-APR-2015 17:39:01

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                26-JAN-2015 10:48:15
Uptime                    81 days 6 hr. 50 min. 46 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/product/11.2.0/crs/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/jyrac2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.154)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "jyrac" has 1 instance(s).
  Instance "jyrac2", status READY, has 1 handler(s) for this service...
Service "jyracXDB" has 1 instance(s).
  Instance "jyrac2", status READY, has 1 handler(s) for this service...
The command completed successfully

[grid@jyrac2 ~]$ lsnrctl status listener_scan1

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 17-APR-2015 17:39:33

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_SCAN1
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                26-JAN-2015 10:48:10
Uptime                    81 days 6 hr. 51 min. 23 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/product/11.2.0/crs/network/admin/listener.ora
Listener Log File         /u01/app/product/11.2.0/crs/log/diag/tnslsnr/jyrac2/listener_scan1/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.159)(PORT=1521)))
Services Summary...
Service "jyrac" has 2 instance(s).
  Instance "jyrac1", status READY, has 1 handler(s) for this service...
  Instance "jyrac2", status READY, has 1 handler(s) for this service...
Service "jyracXDB" has 2 instance(s).
  Instance "jyrac1", status READY, has 1 handler(s) for this service...
  Instance "jyrac2", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@jyrac1 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 17-APR-2015 17:39:08

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                26-JAN-2015 10:48:32
Uptime                    81 days 6 hr. 50 min. 36 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/product/11.2.0/crs/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/jyrac1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.153)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "DBUA4235414" has 1 instance(s).
  Instance "DBUA4235414", status BLOCKED, has 1 handler(s) for this service...
Service "jyrac" has 1 instance(s).
  Instance "jyrac1", status READY, has 1 handler(s) for this service...
Service "jyracXDB" has 1 instance(s).
  Instance "jyrac1", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@jyrac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Apr 17 17:40:53 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
jyrac1

SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            +BACKUPDG
Oldest online log sequence     4
Current log sequence           5

[oracle@jyrac2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Apr 17 17:40:35 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
jyrac2

SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            +BACKUPDG
Oldest online log sequence     1
Current log sequence           1

数据库虽然指定了归档目录,但是没有启动归档。

四.使用dbca -silent方式创建rac数据库的使用示例,更详细信息请阅读Real Application Clusters Installation Guide

Using DBCA Noninteractive (Silent) Configuration for Oracle RAC

You can perform a noninteractive, or “silent” configuration of Oracle RAC using DBCA. To perform a silent configuration, you must have completed an Oracle Clusterware installation, run the root.sh script from the Oracle Database or Oracle ASM homes, and defined the Oracle home and ASM home directory environment variables.

The following command syntax creates an ASM instance and one disk group:

# su oracle -c “$ORA_ASM_HOME/bin/dbca -silent -configureASM -gdbName NO -sid NO -emConfiguration NONE -diskList ASM_Disks -diskGroupName ASM_Group_Name -datafileJarLocation $ORACLE_HOME/assistants/dbca/templates -nodeinfo $NODE1,$NODE2 -obfuscatedPasswords false -asmSysPassword My_ASM_password -redundancy ASM_redundancy”

In the preceding syntax example:

ASM_Disks represent disk addresses, such as /dev/sda1,/dev/sdb1
ASM_Group_Name represents the name of an ASM disk group
ASM_ Redundancy represents an ASM disk redundancy setting, such as ‘NORMAL’.
My_ASM_password represents the ASM SYS user password.
The following command syntax creates an Oracle RAC database on an existing ASM disk group, where the cluster nodes are node1 and node2, and where the disk group name is ASMgrp1, the passwords are my_password, and the ASM SYS password is My_ASM_Password:

# su oracle -c “$ORACLE_HOME/bin/dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbName $DBNAME -sid $SID -sysPassword my_password -systemPassword my_password -sysmanPassword my_password -dbsnmpPassword my_password -emConfiguration LOCAL -storageType ASM -diskGroupName ASMgrp1 -datafileJarLocation $ORACLE_HOME/assistants/dbca/templates -nodeinfo node1,node2 -characterset WE8ISO8859P1 -obfuscatedPasswords false -sampleSchema false -asmSysPassword My_ASM_password”

dbca -silent方式可以创建rac数据库,并指定归档目录,但没有选项设置归档,还是需要执行alter database archivelog来启动归档。网友lhrbest后面通过修改创建数据库的模板文件(创建数据库的模板文件存储在$ORACLE_HOME/assistants/dbca/templates目录中)中的参数 <archivelogmode>false</archivelogmode>,将false修改为true就可以完成归档,下面是通用目的数据库模板文件
[oracle@jyrac1 templates]$ cat General_Purpose.dbc
…省略…
<archivelogmode>false</archivelogmode&gt
…省略…

下面对General_Purpose.dbc文件创建一份副本并启用归档

[oracle@jyrac1 templates]$ cp General_Purpose.dbc General_Purpose_archivelog.dbc
[oracle@jyrac1 templates]$ vi General_Purpose_archivelog.dbc
…省略…
<archivelogmode>true</archivelogmode&gt
…省略…

再次删除rac数据库jyrac

[oracle@jyrac2 ~]$ dbca -silent -deleteDatabase -sourceDB jyrac -sysDBAUserName sys -sysDBAPassword system
Connecting to database
9% complete
14% complete
19% complete
23% complete
28% complete
33% complete
38% complete
47% complete
Updating network configuration files
48% complete
52% complete
Deleting instances and datafiles
66% complete
80% complete
95% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/jyrac.log" for further details.
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576      5120     4892                0            4892              0             N  BACKUPDG/
MOUNTED  EXTERN  N         512   4096  1048576      5120     4724                0            4724              0             Y  CRSDG/
MOUNTED  EXTERN  N         512   4096  1048576     10240    10138                0           10138              0             N  DATADG/

[root@jyrac1 jyrac]# ps -ef | grep pmon
grid      4185     1  0 Jan26 ?        00:01:59 asm_pmon_+ASM1
root     32023 26194  0 16:57 pts/3    00:00:00 grep pmon

[grid@jyrac2 ~]$ ps -ef | grep pmon
grid      4144     1  0 Jan26 ?        00:02:03 asm_pmon_+ASM2
grid     30617 22435  0 16:57 pts/1    00:00:00 grep pmon

使用新创建的模板文件来创建数据库:

[oracle@jyrac1 templates]$ dbca -silent -createDatabase -templateName General_Purpose_archivelog.dbc -gdbname jyrac  -sid jyrac -datafileDestination 'datadg/' -redoLogFileSize 50 -recoveryAreaDestination 'datadg/' -storageType ASM -asmsnmpPassword system  -diskGroupName 'datadg' -responseFile NO_VALUE -characterset ZHS16GBK -nationalCharacterSet AL16UTF16 -sampleSchema true -automaticMemoryManagement true -totalMemory 500 -initParams log_archive_dest_1='location=+backupdg/' -nodeinfo jyrac1,jyrac2
Enter SYS user password:

Enter SYSTEM user password:

Copying database files
1% complete
3% complete
9% complete
15% complete
21% complete
27% complete
30% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
44% complete
45% complete
48% complete
50% complete
Creating cluster database views
52% complete
70% complete
Completing Database Creation
73% complete
76% complete
85% complete
94% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/jyrac/jyrac0.log" for further details.

检查数据库状态:

[grid@jyrac1 ~]$ ps -ef | grep pmon
grid      4185     1  0 Jan26 ?        00:02:02 asm_pmon_+ASM1
oracle   18015     1  0 18:06 ?        00:00:00 ora_pmon_jyrac1
grid     18377 18077  0 18:08 pts/4    00:00:00 grep pmon

[grid@jyrac2 ~]$ ps -ef | grep pmon
grid      4144     1  0 Jan26 ?        00:02:06 asm_pmon_+ASM2
oracle    8184     1  0 18:07 ?        00:00:00 ora_pmon_jyrac2
grid      8398  7717  0 18:08 pts/2    00:00:00 grep pmon
[grid@jyrac2 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.BACKUPDG.dg
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.CRSDG.dg
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.DATADG.dg
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.LISTENER.lsnr
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.asm
               ONLINE  ONLINE       jyrac1                   Started
               ONLINE  ONLINE       jyrac2                   Started
ora.gsd
               OFFLINE OFFLINE      jyrac1
               OFFLINE OFFLINE      jyrac2
ora.net1.network
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.ons
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.registry.acfs
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       jyrac2
ora.cvu
      1        ONLINE  ONLINE       jyrac2
ora.jyrac.db
      1        ONLINE  ONLINE       jyrac1                   Open
      2        ONLINE  ONLINE       jyrac2                   Open
ora.jyrac1.vip
      1        ONLINE  ONLINE       jyrac1
ora.jyrac2.vip
      1        ONLINE  ONLINE       jyrac2
ora.oc4j
      1        ONLINE  ONLINE       jyrac2
ora.scan1.vip
      1        ONLINE  ONLINE       jyrac2
[grid@jyrac2 ~]$ srvctl status database -d jyrac
Instance jyrac1 is running on node jyrac1
Instance jyrac2 is running on node jyrac2

[grid@jyrac2 ~]$ srvctl config database -d jyrac
Database unique name: jyrac
Database name: jyrac
Oracle home: /u01/app/oracle/product/11.2.0/db
Oracle user: oracle
Spfile: +DATADG/jyrac/spfilejyrac.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: jyrac
Database instances: jyrac1,jyrac2
Disk Groups: DATADG
Mount point paths:
Services:
Type: RAC
Database is administrator managed
[grid@jyrac1 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-APR-2015 18:09:58

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                26-JAN-2015 10:48:32
Uptime                    83 days 7 hr. 21 min. 25 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/product/11.2.0/crs/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/jyrac1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.153)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "DBUA4235414" has 1 instance(s).
  Instance "DBUA4235414", status BLOCKED, has 1 handler(s) for this service...
Service "jyrac" has 1 instance(s).
  Instance "jyrac1", status READY, has 1 handler(s) for this service...
Service "jyracXDB" has 1 instance(s).
  Instance "jyrac1", status READY, has 1 handler(s) for this service...
The command completed successfully

Database is administrator managed

[grid@jyrac2 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-APR-2015 18:09:54

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                26-JAN-2015 10:48:15
Uptime                    83 days 7 hr. 21 min. 40 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/product/11.2.0/crs/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/jyrac2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.154)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "jyrac" has 1 instance(s).
  Instance "jyrac2", status READY, has 1 handler(s) for this service...
Service "jyracXDB" has 1 instance(s).
  Instance "jyrac2", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@jyrac2 ~]$ lsnrctl status listener_scan1

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-APR-2015 18:10:43

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_SCAN1
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                26-JAN-2015 10:48:10
Uptime                    83 days 7 hr. 22 min. 33 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/product/11.2.0/crs/network/admin/listener.ora
Listener Log File         /u01/app/product/11.2.0/crs/log/diag/tnslsnr/jyrac2/listener_scan1/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.159)(PORT=1521)))
Services Summary...
Service "jyrac" has 2 instance(s).
  Instance "jyrac1", status READY, has 1 handler(s) for this service...
  Instance "jyrac2", status READY, has 1 handler(s) for this service...
Service "jyracXDB" has 2 instance(s).
  Instance "jyrac1", status READY, has 1 handler(s) for this service...
  Instance "jyrac2", status READY, has 1 handler(s) for this service...
The command completed successfully

检查归档设置:

[oracle@jyrac1 templates]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Sun Apr 19 18:11:17 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            +BACKUPDG
Oldest online log sequence     4
Next log sequence to archive   5
Current log sequence           5

SQL> alter system switch logfile;

System altered.

[oracle@jyrac2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Sun Apr 19 18:11:51 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            +BACKUPDG
Oldest online log sequence     1
Next log sequence to archive   2
Current log sequence           2
SQL> alter system switch logfile;

System altered.
ASMCMD> pwd
+backupdg/jyrac/archivelog/2015_04_19
ASMCMD> ls -lt
Type        Redund  Striped  Time             Sys  Name
ARCHIVELOG  UNPROT  COARSE   APR 19 18:00:00  Y    thread_2_seq_2.306.877457527
ARCHIVELOG  UNPROT  COARSE   APR 19 18:00:00  Y    thread_2_seq_1.307.877457191
ARCHIVELOG  UNPROT  COARSE   APR 19 18:00:00  Y    thread_1_seq_5.312.877457503

可以看到确实启用了归档,在执行alter system switch logfile命令后两个实例都生成了归档重做日志,使用模板来创建数据库,还是需要仔细阅读模板文件中的参数,这里谢谢网友lhrbest,dbca- silent是可以创建rac数据库,可以通过-initParams参数设置归档目录,通过修改创建数据库的模板文件中archivelogmode参数启用归档。

Oracle性能优化之虚拟索引

虚拟索引是定义在数据字典中的伪索引,但没有相关的索引段。虚拟索引的目的是模拟索引的存–而不用真实的创建一个完整索引。这允许开发者创建虚拟索引来查看相关执行计划而不用等到真实创建完索引才能查看索引对执行计划的影响,并且不会增加存储空间的使用。如果我们观察到优化器生成了一个昂贵的执行计划并且SQL调整指导建议我们对某些的某列创建索引,但在生产数据库环境中创建索引与测试并不总是可以操作。我们需要确保创建的索引将不会对数据库中的其它查询产生负面影响,因此可以使用虚拟索引。

下面举例进行说明
1.创建一个测试表test

SQL> create table test as select * from dba_objects;

Table created.

2.从表test查询object_name等于standard的记录

SQL> select * from test where object_name='STANDARD';

OWNER
------------------------------
OBJECT_NAME
--------------------------------------------------------------------------------
SUBOBJECT_NAME                  OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE
------------------------------ ---------- -------------- -------------------
CREATED      LAST_DDL_TIM TIMESTAMP           STATUS  T G S
------------ ------------ ------------------- ------- - - -
SYS
STANDARD
                                      888                PACKAGE
19-APR-10    19-APR-10    2003-04-18:00:00:00 VALID   N N N


OWNER
------------------------------
OBJECT_NAME
--------------------------------------------------------------------------------
SUBOBJECT_NAME                  OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE
------------------------------ ---------- -------------- -------------------
CREATED      LAST_DDL_TIM TIMESTAMP           STATUS  T G S
------------ ------------ ------------------- ------- - - -
SYS
STANDARD
                                      889                PACKAGE BODY
19-APR-10    19-APR-10    2010-04-19:10:22:58 VALID   N N N

3.查询上面查询的执行计划

SQL> set autotrace traceonly explain
SQL> select * from test where object_name='STANDARD';

Execution Plan
----------------------------------------------------------
Plan hash value: 1357081020

--------------------------------------------------------------------------
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |      |     8 |  1416 |   155   (1)| 00:00:02 |
|*  1 |  TABLE ACCESS FULL| TEST |     8 |  1416 |   155   (1)| 00:00:02 |
--------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - filter("OBJECT_NAME"='STANDARD')

Note
-----
   - dynamic sampling used for this statement

4.在表test的object_name列上创建一个虚拟索引

SQL> create index test_index on test(object_name) nosegment;

Index created.

为了创建虚拟索引必须在create index语句中指定nosegment子句,并且不会创建索引段。

5.来验证虚拟索引不会创建索引段

SQL> set autotrace off
SQL> select index_name from dba_indexes where table_name = 'TEST' and index_name = 'TEST_INDEX';

no rows selected

SQL> col OBJECT_NAME format a20;
SQL> select object_name, object_type from dba_objects where object_name = 'TEST_INDEX';

OBJECT_NAME          OBJECT_TYPE
-------------------- -------------------
TEST_INDEX           INDEX

从上面的结果可以看到索引对象已经创建,但没有创建索引段。

6.重新执行sql查看创建的虚拟索引是否被使用

SQL> set autotrace traceonly explain
SQL> select * from test where object_name='STANDARD';

Execution Plan
----------------------------------------------------------
Plan hash value: 1357081020

--------------------------------------------------------------------------
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |      |     8 |  1416 |   155   (1)| 00:00:02 |
|*  1 |  TABLE ACCESS FULL| TEST |     8 |  1416 |   155   (1)| 00:00:02 |
--------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - filter("OBJECT_NAME"='STANDARD')

Note
-----
   - dynamic sampling used for this statement

从上面的执行计划可以清楚地看到创建的虚拟索引并没有被使用

7.为了能使用所创建的虚拟索引,需要将_USE_NOSEGMENT_INDEXES设置为true

SQL> alter session set "_USE_NOSEGMENT_INDEXES" = true;

Session altered.

8.重新执行sql查看创建的虚拟索引是否被使用

SQL> set long 900
SQL> set linesize 900
SQL> select * from test where object_name='STANDARD';

Execution Plan
----------------------------------------------------------
Plan hash value: 2627321457

------------------------------------------------------------------------------------------
| Id  | Operation                   | Name       | Rows  | Bytes | Cost (%CPU)| Time     |
------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |            |     8 |  1416 |     5   (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| TEST       |     8 |  1416 |     5   (0)| 00:00:01 |
|*  2 |   INDEX RANGE SCAN          | TEST_INDEX |   238 |       |     1   (0)| 00:00:01 |
------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access("OBJECT_NAME"='STANDARD')

Note
-----
   - dynamic sampling used for this statement

从上面的执行计划可以看到当设置隐含参数_USE_NOSEGMENT_INDEXES后,优化器将会使用创建的虚拟索引。在使用虚拟索引需要注意,我们可以分析虚拟索引,但不能重建虚拟索引,如果重建虚拟索引会收到ORA-8114: “User attempted to alter a fake index”错误提示,可以删除虚拟索引。

Oracle 11gr2中的自动并行度

在Oracle 11.2.0.2中只有I/O统计数据被收集才能使用自动并行度。当parallel_degree_policy被设置为auto时,Oracle数据库将会基于执行计划中操作的成本和硬件特性来判断是否使用并行,当在语句级别使用parallel或parallel(auto)暗示不管parallel_degree_policy设置为何值都会使用自动并行。

IO Calibration
硬件特性包括IO Calibration统计数据,因此这些统计数据必须被收集否则Oracle数据库将不会使用自动并行这个功能。下面的执行计划是在没有收集IO Calibration统计数据时生成的,在执行计划的note部分可以看到”skipped because of IO calibrate statistics are missing”这样的信息

SQL> set long 900
SQL> set linesize 900
SQL> set autotrace traceonly explain
SQL> select /*+ parallel */ * from emp;

Execution Plan
----------------------------------------------------------
Plan hash value: 2873591275

--------------------------------------------------------------------------------------------------------------
| Id  | Operation            | Name     | Rows  | Bytes | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
--------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT     |          |    14 |  1218 |     2   (0)| 00:00:01 |        |      |            |
|   1 |  PX COORDINATOR      |          |       |       |            |          |        |      |            |
|   2 |   PX SEND QC (RANDOM)| :TQ10000 |    14 |  1218 |     2   (0)| 00:00:01 |  Q1,00 | P->S | QC (RAND)  |
|   3 |    PX BLOCK ITERATOR |          |    14 |  1218 |     2   (0)| 00:00:01 |  Q1,00 | PCWC |            |
|   4 |     TABLE ACCESS FULL| EMP      |    14 |  1218 |     2   (0)| 00:00:01 |  Q1,00 | PCWP |            |
--------------------------------------------------------------------------------------------------------------

Note
-----
   - dynamic sampling used for this statement (level=2)
   - automatic DOP: skipped because of IO calibrate statistics are missing


Oracle提供了PL/SQL包dbms_resource_manager.calibrate_io来收集IO Calibration的统计数据。收集IO Calibration统计数据的持续时间由num_disks变量与RAC中节点数决定的。

SQL> select * from V$IO_CALIBRATION_STATUS;

STATUS        CALIBRATION_TIME
------------- ---------------------------------------------------------------------------
NOT AVAILABLE

SET SERVEROUTPUT ON
DECLARE
   lat INTEGER;
   iops INTEGER;
   mbps INTEGER;
BEGIN
    --DBMS_RESOURCE_MANAGER.CALIBRATE_IO(, ,iops, mbps, lat);
    DBMS_RESOURCE_MANAGER.CALIBRATE_IO (1, 10, iops, mbps, lat);
   DBMS_OUTPUT.PUT_LINE ('max_iops = ' || iops);
   DBMS_OUTPUT.PUT_LINE ('latency = ' || lat);
   dbms_output.put_line('max_mbps = ' || mbps);
END;
/

注意DBMS_RESOURCE_MANAGER.CALIBRATE_IO的前两个参数分别为num_disks,max_latency是输入变量,并且有三个输出变量。

num_disks:为了获得最精确的结果,最好提供数据库所使用的真实物理磁盘数。如果是使用ASM来管理数据库文件,那么就是指存储数据的磁盘组,那么只有存储数据的磁盘组中的物理磁盘作为num_disks变量值,不包含FRA磁盘组中的物理磁盘。

latency:对数据库块IO操作允许的最大延迟


SQL> set long 900
SQL> set linesize 900
SQL> SET SERVEROUTPUT ON
DECLARE
SQL>   2     lat INTEGER;
  3     iops INTEGER;
  4     mbps INTEGER;
  5  BEGIN
  6      --DBMS_RESOURCE_MANAGER.CALIBRATE_IO(, ,iops, mbps, lat);
  7      DBMS_RESOURCE_MANAGER.CALIBRATE_IO (1, 10, iops, mbps, lat);
  8     DBMS_OUTPUT.PUT_LINE ('max_iops = ' || iops);
  9     DBMS_OUTPUT.PUT_LINE ('latency = ' || lat);
 10     dbms_output.put_line('max_mbps = ' || mbps);
 11  END;
 12  /
max_iops = 390
latency = 9
max_mbps = 112

PL/SQL procedure successfully completed.

为了验证是否IO Calibration统计信息收集成功,在执行dbms_resource_manager.calibrate_io后查询v$io_calibration_status

SQL> select * from V$IO_CALIBRATION_STATUS;

STATUS        CALIBRATION_TIME
------------- ---------------------------------------------------------------------------
READY         13-APR-16 10.12.58.413 PM

再次执行看是否能使用自动并行度

SQL> set autotrace traceonly explain
SQL> select /*+ parallel */ * from emp;

Execution Plan
----------------------------------------------------------
Plan hash value: 2873591275

--------------------------------------------------------------------------------------------------------------
| Id  | Operation            | Name     | Rows  | Bytes | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
--------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT     |          |    14 |   532 |     2   (0)| 00:00:01 |        |      |            |
|   1 |  PX COORDINATOR      |          |       |       |            |          |        |      |            |
|   2 |   PX SEND QC (RANDOM)| :TQ10000 |    14 |   532 |     2   (0)| 00:00:01 |  Q1,00 | P->S | QC (RAND)  |
|   3 |    PX BLOCK ITERATOR |          |    14 |   532 |     2   (0)| 00:00:01 |  Q1,00 | PCWC |            |
|   4 |     TABLE ACCESS FULL| EMP      |    14 |   532 |     2   (0)| 00:00:01 |  Q1,00 | PCWP |            |
--------------------------------------------------------------------------------------------------------------

Note
-----
   - automatic DOP: Computed Degree of Parallelism is 2

可以看到在收集IO Calibration统计信息后,执行计划使用自动并行度。

当使用自动并行度,可以还需要调整一些调整参数。parallel_servers_target参数应该总是比parallel_max_servers参数值小,parallel_servers_target总是处于parallel_max_servers的75%到50%。如果开始看到大量并行度下降,那么应该使用这两个参灵敏的差距增大。

使用rman增量备份来更新传输表空间

要使用rman增量备份来更新传输表空间需要了解传输表空间与rman的增量备份。这里主要介绍使用增量备份来更新传输表空间,就不介绍传输表空间与rman增量备份。下面是使用rman增量备份来更新传输表空间的操作。目标主机是weblogic29,原主机是weblogic28。
1.在两台数据库服务器上配置NFS
配置/etc/exports
nfs允许挂载的目录及权限需在文件/etc/exports中进行定义。例如,我们要将数据文件所在目录
/u01/app/oracle/oradata/jytest/与/backup目录共享出来,那么我们需要编辑/etc/exports文件,追加两行

/u01/app/oracle/oradata/jytest/ *(rw,sync)
/backup/ *(rw,sync)
[root@weblogic29 oracle]# vi /etc/exports
/u01/app/oracle/oradata/jytest/ *(rw,sync)
/backup/ *(rw,sync)

启动nfs服务

[root@weblogic29 oracle]# service portmap start
Starting portmap: [ OK ]
[root@weblogic29 oracle]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]

在客户端主机上挂载共享目录

[root@weblogic28 ~]# service portmap start
Starting portmap: [ OK ]

[root@weblogic28 ~]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]

在客户端使用showmount -e IP 查看nfs主机共享情况:

[root@weblogic28 ~]# showmount -e 10.138.130.29
Export list for 10.138.130.29:
/backup *
/u01/app/oracle/oradata/jytest *

在客户端建立NFS文件夹并执行mount挂载命令:

[root@weblogic28 ~]# mkdir /jytest_data
[root@weblogic28 ~]# mkdir /backup
[root@weblogic28 ~]# chown -R oracle:oinstall /jytest_data
[root@weblogic28 ~]# chown -R oracle:oinstall /backup
[root@weblogic28 ~]# chmod -R 777 /jytest_data
[root@weblogic28 ~]# chmod -R 777 /backup

[root@weblogic28 ~]# mount -t nfs 10.138.130.29:/u01/app/oracle/oradata/jytest /jytest_data
[root@weblogic28 ~]# mount -t nfs 10.138.130.29:/backup /backup

[root@weblogic28 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 240G 158G 71G 70% /
/dev/sda1 190M 12M 169M 7% /boot
tmpfs 16G 0 16G 0% /dev/shm
10.138.130.29:/u01/app/oracle/oradata/jytest
240G 22G 206G 10% /jytest_data
10.138.130.29:/backup
240G 22G 206G 10% /backup


2.在源数据库中创建一个表空间jytest与用户jytest

SQL> create tablespace jytest datafile '/u01/app/oracle/oradata/jytest/jytest01.dbf' size 5M autoextend off extent management local segment space management auto;

Tablespace created.

SQL> create user jytest identified by "jytest" default tablespace jytest temporary tablespace temp;

User created.

SQL> grant connect,dba,resource to jytest;

Grant succeeded.

SQL> conn jytest/jytest
Connected.
SQL> create table t1 as select * from dba_tables;

Table created.

SQL> select count(*) from t1;

COUNT(*)
----------
1607
SQL> insert into t1 select * from t1;

1607 rows created.

SQL> insert into t1 select * from t1;

3214 rows created.

SQL> insert into t1 select * from t1;

6428 rows created.

SQL> commit;

Commit complete.

3.将原数据库的jytest表空间设置为只读模式

SQL> alter tablespace jytest read only;

Tablespace altered.

4.对原数据库中的表空间jytest使用rman生成镜像副本并存储在NFS所挂载的/jytest_data目录中

[oracle@weblogic28 ~]$ rman target/

Recovery Manager: Release 10.2.0.5.0 - Production on Wed Apr 13 12:36:05 2016

Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database: JYTEST (DBID=3911337604)

RMAN> run
2> {
3> allocate channel c1 type disk format '/jytest_data/jytest01.dbf';
4> backup incremental level 1 tag "INCR_JYTEST" for recover of copy with tag "INCR_JYTEST" tablespace jytest;
5> }

using target database control file instead of recovery catalog
allocated channel: c1
channel c1: sid=157 devtype=DISK

Starting backup at 13-APR-16
WARNING: TAG INCR_JYTEST option is ignored; backups will be tagged with INCR_JYTEST
no parent backup or copy of datafile 8 found
channel c1: starting datafile copy
input datafile fno=00008 name=/u01/app/oracle/oradata/jytest/jytest01.dbf
output filename=/jytest_data/jytest01.dbf tag=INCR_JYTEST recid=2 stamp=909059896
channel c1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 13-APR-16
released channel: c1

虽然这里使用的是incremental level 1,因为这里不存在表空间数据文件jytest01.dbf的0级增量副本,因此会创建一个0级增量副本文件。

SQL> alter tablespace jytest read write;

Tablespace altered.

5.将表空间jytest附加到目标数据库

SQL> create or replace directory test_dump as '/backup/';

Directory created.

SQL> grant read,write on directory test_dump to public;

Grant succeeded.
'
SQL> create public database link dblink_jytest
2 connect to jytest identified by "jytest"
3 using '(DESCRIPTION =
4 (ADDRESS = (PROTOCOL = TCP)(HOST = 10.138.130.28)(PORT = 1521))
5 (CONNECT_DATA =
6 (SERVICE_NAME = jytest)
7 )
8 )';

Database link created.
SQL> select count(*) from t1@dblink_jytest;

COUNT(*)
----------
12856
[oracle@weblogic29 jytest]$ impdp jytest/jytest directory=test_dump network_link=dblink_jytest transport_tablespaces=jytest transport_full_check=n transport_datafiles=\'/u01/app/oracle/oradata/jytest/jytest01.dbf\'

Import: Release 10.2.0.5.0 - 64bit Production on Wednesday, 13 April, 2016 14:47:43

Copyright (c) 2003, 2007, Oracle. All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "JYTEST"."SYS_IMPORT_TRANSPORTABLE_01": jytest/******** directory=test_dump network_link=dblink_jytest transport_tablespaces=jytest transport_full_check=n transport_datafiles='/u01/app/oracle/oradata/jytest/jytest01.dbf'
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Job "JYTEST"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at 14:47:48
SQL> show parameter compatible

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
compatible string 10.2.0.3.0
SQL> select count(*) from jytest.t1;

COUNT(*)
----------
12856

6.将表空间jytest从目标数据库中删除,但保留数据文件

SQL> drop tablespace jytest including contents;

Tablespace dropped.

7.将原数据库中的表空间jytest联机,继续向表t1插入记录

SQL> alter tablespace jytest read write;

Tablespace altered.
SQL> insert into t1 select * from t1;
insert into t1 select * from t1
*
ERROR at line 1:
ORA-01653: unable to extend table JYTEST.T1 by 128 in tablespace JYTEST

由于表空间jytest没有空间了,如是向表这僮jytest增加一个数据文件jytest02.dbf来增加表空间

SQL> alter tablespace jytest add datafile '/u01/app/oracle/oradata/jytest/jytest02.dbf' size 5M;

Tablespace altered.

SQL> insert into t1 select * from t1;

12856 rows created.

SQL> commit;

Commit complete.

SQL> select count(*) from t1;

COUNT(*)
----------
25712

8.如果自上次增量备份以后原数据库表空间jytest增加了新的数据文件,因此执行以下命令来为新增加的数据文件创建镜像副本。

SQL> alter tablespace jytest read only;

Tablespace altered.
SQL> select file#,name from v$datafile;

FILE# NAME
---------- -------------------------------------------------------------------------
1 /u01/app/oracle/oradata/jytest/system01.dbf
2 /u01/app/oracle/oradata/jytest/undotbs01.dbf
3 /u01/app/oracle/oradata/jytest/sysaux01.dbf
4 /u01/app/oracle/oradata/jytest/users01.dbf
5 /u01/app/oracle/oradata/jytest/example01.dbf
6 /u01/app/oracle/oradata/jytest/tspitr01.dbf
7 /u01/app/oracle/oradata/jytest/test01.dbf
8 /u01/app/oracle/oradata/jytest/jytest01.dbf
9 /u01/app/oracle/oradata/jytest/jytest02.dbf

9 rows selected.
RMAN> run
2> {
3> allocate channel c1 type disk format '/jytest_data/jytest02.dbf';
4> backup incremental level 1 tag "INCR_JYTEST" for recover of copy with tag "INCR_JYTEST" datafile 9;
5> }

allocated channel: c1
channel c1: sid=141 devtype=DISK

Starting backup at 13-APR-16
WARNING: TAG INCR_JYTEST option is ignored; backups will be tagged with INCR_JYTEST
no parent backup or copy of datafile 9 found
channel c1: starting datafile copy
input datafile fno=00009 name=/u01/app/oracle/oradata/jytest/jytest02.dbf
output filename=/jytest_data/jytest02.dbf tag=INCR_JYTEST recid=4 stamp=909069392
channel c1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 13-APR-16
released channel: c1

9.对原数据库执行RMAN增量备份并使用目标数据库文件目录中的数据文件与其合并,因些创建一组
新的数据文件

RMAN> run
2> {
3> allocate channel c1 type disk format '/jytest_data/jytest01_%t.dbf';
4> allocate channel c2 type disk format '/jytest_data/jytest02_%t.dbf';
5> backup incremental level 1 tag "INCR_JYTEST" for recover of copy with tag "INCR_JYTEST" tablespace jytest;
6> recover copy of tablespace jytest with tag "INCR_JYTEST";
7> }

allocated channel: c1
channel c1: sid=141 devtype=DISK

allocated channel: c2
channel c2: sid=139 devtype=DISK

Starting backup at 13-APR-16
WARNING: TAG INCR_JYTEST option is ignored; backups will be tagged with INCR_JYTEST
channel c1: starting incremental level 1 datafile backupset
channel c1: specifying datafile(s) in backupset
input datafile fno=00008 name=/u01/app/oracle/oradata/jytest/jytest01.dbf
channel c1: starting piece 1 at 13-APR-16
channel c2: starting incremental level 1 datafile backupset
channel c2: specifying datafile(s) in backupset
input datafile fno=00009 name=/u01/app/oracle/oradata/jytest/jytest02.dbf
skipping datafile 00009 because it has not changed
channel c2: backup cancelled because all files were skipped
channel c1: finished piece 1 at 13-APR-16
piece handle=/jytest_data/jytest01_909069660.dbf tag=INCR_JYTEST comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 13-APR-16

Starting recover at 13-APR-16
channel c1: starting incremental datafile backupset restore
channel c1: specifying datafile copies to recover
recovering datafile copy fno=00008 name=/jytest_data/jytest01.dbf
channel c1: reading from backup piece /jytest_data/jytest01_909069660.dbf
channel c1: restored backup piece 1
piece handle=/jytest_data/jytest01_909069660.dbf tag=INCR_JYTEST
channel c1: restore complete, elapsed time: 00:00:02
Finished recover at 13-APR-16
released channel: c1
released channel: c2

10.将表空间jytest重新附加到目标数据库中

[oracle@weblogic29 jytest]$ impdp jytest/jytest directory=test_dump network_link=dblink_jytest transport_tablespaces=jytest transport_full_check=n transport_datafiles=\'/u01/app/oracle/oradata/jytest/jytest01.dbf\',\'/u01/app/oracle/oradata/jytest/jytest02.dbf\'

Import: Release 10.2.0.5.0 - 64bit Production on Wednesday, 13 April, 2016 15:50:37

Copyright (c) 2003, 2007, Oracle. All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "JYTEST"."SYS_IMPORT_TRANSPORTABLE_01": jytest/******** directory=test_dump network_link=dblink_jytest transport_tablespaces=jytest transport_full_check=n transport_datafiles='/u01/app/oracle/oradata/jytest/jytest01.dbf','/u01/app/oracle/oradata/jytest/jytest02.dbf'
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Job "JYTEST"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at 15:50:42

SQL> select count(*) from jytest.t1;

COUNT(*)
----------
25712

SQL> alter tablespace jytest read write;

Tablespace altered.

与原数据库中表t1记录数一样,说明增量更新传输表空间成功。

总结:使用增量备份来前更新数据文件要比复制整个数据文件所花的时间少。这里使用了NFS来执行数据文件的传输避免了使用ftp等方式传输文件,使用impdp network_link避免了导入和导出元数据与传输元数据这也能节省了时间。

如何提高datapump操作性能

当执行datapump导出和导入时都想尽一切办法来提高性能,这里介绍一些可以显著提高DataPump性能的相关DataPump与数据库参数
一.影响DataPump相关的DataPump参数
access_method
在某些情况下由Data Pump API所选择的方法不能快速的访问你的数据集。在这种情况下除了显式地设置该参数来测试每一种访问方法之外你是无法知道那种访问方法更高效的。该参数有两种选项direct_path与external_table

cluster=n
在RAC环境中可以显著提供高Data Pump API基本操作的速度。注意这个参数只对Data Pump API操作起作用,在RAC环境中,建议将该参数设置为n。而如果将parallel_force_local设置为true所带来的影响不仅仅只针对Data Pump API操作

data_options=disable_append_hint
它只是impdp参数,在非常特殊的情况下,可以安全的使用并且可能减少导入数据的时间。只有满足以下所有条件时才使用data_options=disable_append_hint参数。
1.导入操作将向已经存在的表,分区或子分区导入数据
2.将被导入的已经存在的对象数非常少(比如是10或者更小)
3.当执行导入操作时其它会话对于这些被导入的对象只执行select语句。
data_options=disable_append_hint参数只有在11.2.0.1与更高版本中才可以使用。只有在要锁定由其它会话所释放对象花费很长时间的情况下使用data_option=disable_append_hint才能节省时间。

estimate
estimate参数有两个相互排斥的选项,一个是blocks,另一个是statistics.在执行导出操作时使用blocks方法来评估数据集大小比使用statistics方法消耗的时间更长。但是使用blocks方法评估的数据集大小要比使用statistics方法评估的数据集大小要精确些。如果导出文件的评估大小不是最主要关注的事,建议使用estimate=statistics。

exclude=comment
在某些情况下,终端用户不需要列和对象类型对应的注释,如果忽略这些数据,DataPump操作将会减少执行时间。

exclude=statistics
如果不需要使用排斥的include参数,那么排除和导出统计信息将会缩短整个导出操作的时间。dbms_stats.gather_database_stats过程将在数据导入到目标数据库后来生成统计信息。DataPump操作当由DataPump引擎和任何其它的RDBMS会话并行执行对小表生成统计信息时可能会hang且无限期。对于运行时间超过1小时或更长时间的DataPump操作,可以考虑禁用数据库的自动统计信息收集任务为了临时禁用11g的自动统计信息收集任务因此DataPump操作不会与该任务产生竞争,以sys用户执行以下命令:
exec dbms_auto_task_admin.diable(client_name=>’auto optimizer stats collection’,
operation=>null,window_name=>null);
在DataPump操作完成之后重新启动统计信息收集任务:
exec DBMS_AUTO_TASK_ADMIN.ENABLE(client_name => ‘auto optimizer stats collection’, operation => NULL, window_name => NULL);

为了临时禁用10g的自动统计信息收集任务因此DataPump操作不会与该任务产生竞争,以sys用户执行以下命令:
exec sys.dbms_scheduler.disable (‘GATHER_STATS_JOB’);
在DataPump操作完成之后重新启动统计信息收集任务:
exec sys.dbms_scheduler.enable (‘GATHER_STATS_JOB’);

network_link
使用这个参数将会有效限制DataPump API的并行度,除非你的网络吞吐量和网络带宽比本地设备更好,使用network_link将会比使用导出文件慢很多。对于DataPump API性能来说,因为它倾向于比dump文件操作要慢很多,只建议network_link作为最后一招来使用。可以考虑使用移动或共享设备来存储dump文件来代替network_link来执行数据的迁移。

parallel
如果有多个CPU使用并且没有使用CPU绑定或磁盘I/O绑定或内存绑定且在dumpfile参数中没有使用多个dump文件,那么并行执行将会对性能产生正面影响。如果parallel参数设置为N,N>1,那么为了更好的使用并行执行建议dumpfile参数应该设置为不比parallel参数小。

需要注意的是,parallel参数是DataPump API可以使用的并发Data Pump工作进程的上限,但DataPump API可能使用的DataPump工作进程数要比这个参数指定的少,依赖于主机环境中的瓶颈,parallel参数指定的值小于可用CPU个数时Data Pump API基本操作可能会更快。

query
使用query参数会显著增加任何DataPump API基本操作的负载,这种开销与被查询表的数据量成正比。

remap_*
使用任何remap_*参数会显著增加任何DataPump API基本操作的负载,这种开销与被查询表的数据量成正比。

二.影响DataPump操作性能的相关数据库参数
aq_tm_processes=0
当这个参数被显式设置为0,可能对高级队列操作产生负面影响,进而对使用高级队列的DataPump基本操作产生负面影响。可以复原这个参数或者设置一个大于0的值

deferred_segment_creation=true
只适用于导入操作,这将会消除为空表分配空间所花费的时间。对于导出操作设置这个参数将不会对性能产生显著的影响。这个参数在11.2.0.2或更高版本中非常有用。

filesystemio_option=…
在特定情况下数据库实例将会对ACFS文件系统执行写操作,指定Data Pump API执行的写操作类型性质作为导出操作的一部分,NONE以外的其它参数值都可能造成导出操作变慢。

NLS_CHARACTERSET=… and NLS_NCHAR_CHARACTERSET=…
当源数据库与目标数据库之间这两个参数存在差异时,在任何时候执行导入操作时对于指定的分区表都不能使用多个DataPump工作进程来创建分区表和填充。在有些情况下,只有一个DataPump工作进程可以对表数据执行操作,这将会对表获得排他锁来阻止任何其它DataPump工作进程对相同的表执行操作。当分区表不存在排他锁时可以使用多个DataPump工作进程同时操作来显著提高对分区表导入数据的性能。

NLS_COMP=… and NLS_SORT=…
在一些罕见的情况下,数据库的这两个参数被设置为了binary这将显著提高DataPump API基本操作的速度。对于你的环境是否将这两个参数设置为binary能提高性能需要进行测试。在会话登录后在会话级别设置这两个参数可以通过以下的登录触发器来实现。
CREATE OR REPLACE TRIGGER sys.expdp_nls_session_settings AFTER LOGON ON DATABASE
DECLARE
V_MODULE VARCHAR2(60);
BEGIN
SELECT SYS_CONTEXT (‘USERENV’, ‘MODULE’) INTO V_MODULE FROM DUAL;
IF UPPER(V_MODULE) LIKE ‘UDE%’
THEN
BEGIN
EXECUTE IMMEDIATE ‘ALTER SESSION SET NLS_COMP=”BINARY”’;
EXECUTE IMMEDIATE ‘ALTER SESSION SET NLS_SORT=”BINARY”’;
END;
END IF;
END;
/

parallel_force_local=true
在RAC环境中可以显著提高DataPump API基本操作的性能并且避免并行DML操作的bug。但这个参数只能对11.2.0.2或更高版本使用。

streams_pool_size
为了避免bug 17365043 ‘STREAMS AQ: ENQUEUE BLOCKED ON LOW MEMORY WHEN REDUCING STREAMS_POOL_SIZE’
建议将streams_pool_size设置以下查询所返回的结果值
select ‘ALTER SYSTEM SET STREAMS_POOL_SIZE=’||(max(to_number(trim(c.ksppstvl)))+67108864)||’ SCOPE=SPFILE;’
from sys.x$ksppi a, sys.x$ksppcv b, sys.x$ksppsv c
where a.indx = b.indx and a.indx = c.indx and lower(a.ksppinm) in (‘__streams_pool_size’,’streams_pool_size’);

_memory_broker_stat_interval=999
如果在你的缓慢DataPump环境中resize操作消耗了大量时间,那么设置这个参数将会减少resize操作的频率,进而在一个指定时间跨度内减少resize操作延迟其它操作的所花的时间。这是因为DataPump API依赖大量的流功能来帮助导出和导入操作。建议将这个参数设置为999,如果streams_pool_size参数已经被显式设置并且频繁的出现resize操作。

三.表DDL级别影响DataPump性能的相关参数
network_link+securefiles
network_link参数当移动包含有lob列的表,且lob是为了使用securefiles将会使移动操作非常缓慢,当使用network_link参数移动包含用了使用securefiles而有lob列的表时会生成大量undo数据。原因是分布式事务分配请求被限制为跨数据库链路一次只有一个数据块,这意味着大数据集传输将会产生更多的传输。

securefiles(不使用network_link)
使用securefiles存储格式来存储LOB列数据允许包含lob列的表使用并行执行导出和导入
使用basicfiles存储格式来存储LOB列数据不允许包含lob列的表使用并行执行导出和导入

四.表DML级别影响DataPump性能的相关参数
在DataPump操作和另一个访问数据库对象的会话之间产生竞争(通常是对表,行数据的锁)
DataPump引擎在执行导出操作时将会等待由其它会话将其持有的行锁与表锁先释放,再执行相关表的导出和导入。DataPump引擎在执行导出操作时将会等待由其它会话所持有的行锁与表锁先释放再执行导出操作而典型导出工具不会等待。因此导出一张正在被频繁更新的表要比导出一个当前没有被更新的表要慢

百倍性能提升:谓词条件(a||b) vs (a,b)

某系统维护人员在执行一查询需要1个多小时才能执行完成,根本不能满足业务需求,通过应用系统日志找到了该SQL:

DEBUG: 2016-04-05 12:18:48,203: com.powerise.hygeia.framework.jdbclogger.PreparedStatementWrapper: 
exec : 2456844ms at com.powerise.hygeia.biz.medicare.entity.EnLiquidateDetailInfo.getLiquidatePersonInfo(EnLiquidateDetailInfo.java:2319)
select rowno, hos_serial, reg_flag,
       nvl((SELECT distinct t.policy_value
              FROM fc_biz_policy t
             WHERE t.policy_code = 'can_clinic_flag'
               and t.valid_flag = '1'
               and t.center_id = '430701'), (SELECT distinct t.policy_value
                FROM fc_biz_policy t
               WHERE t.policy_code =
                     'can_clinic_flag'
                 and t.valid_flag = '1'
                 and t.center_id = '0')) AS can_clinic_flag,
       decode(DISEASE_TYPE, 'A', '病种单纯', 'B', '严重', 'C', '严重并发', 'D', '危重', '') DISEASE_TYPE,
       hospital_id, hospital_name, serial_no, biz_type, case_id, biz_stat,
       name, sex, pers_type, begin_date, end_date, fin_date, finish_date,
       reg_date, in_days, indi_id, insr_code, fin_staff, fin_man, corp_id,
       idcard, district_code, office_grade,center_id,
       (select t.special_code
           from bs_corp_pres t
          where t.indi_id = w.indi_id) as special_code, corp_name, disease,
       in_area_name, in_dept_name,
       decode(apply_content, '126', '转外住院', '127', '转外复查', '普通住院') as apply_content,
       in_bed, bed_type, patient_id, remark, pos_code, reimburse_flag,
       fin_disease, ic_no, treatment_type,
       decode(reg_info || treatment_type, 'WD3120', '普通住院(转外住院)', 'WD2120', '普通住院(异地住院)', '1120', '普通住院(转诊转院)', 'F120', '普通住院(非首诊就诊)', 'WD1120', '普通住院(异地安置)', 'C120', '普通住院(首诊就诊)', (select treatment_name
                   from bs_treat_type
                  where treatment_type =
                        w.treatment_type
                    and center_id =
                        w.center_id)) as treatment_name,
       nvl(pay_money_jd, 0) as pay_money_jd,
       nvl(pay_money_xzf, 0) as pay_money_xzf, nvl(fees, 0) as fees,
       foregift, nvl(pay_money_allself, 0) as pay_money_allself,
       nvl(pay_money_self, 0) as pay_money_self,
       nvl(pay_money_E00self, 0) as pay_money_E00self,
       nvl(pay_money_Z00self, 0) as pay_money_Z00self,
       nvl(pay_money_S00self, 0) as pay_money_S00self,
       nvl(pay_money_S01self, 0) as pay_money_S01self,
       nvl(pay_money_S01self, 0) as pay_money_S01self,
       nvl(pay_money_C000self, 0) as pay_money_C000self,
       nvl(pay_money_C001self, 0) as pay_money_C001self,
       nvl(pay_money_C004self, 0) as pay_money_C004self,
       nvl(pay_money_C006self, 0) as pay_money_C006self,
       nvl(pay_money_C007self, 0) as pay_money_C007self,
       nvl(pay_money_C007003self, 0) as pay_money_C007003self,
       nvl(tc_money, 0) as tc_money, nvl(tc_money_xe, 0) as tc_money_xe,
       nvl(hosp_pay, 0) as hosp_pay, nvl(hosp_prise, 0) as hosp_prise,
       nvl(jmtc_money, 0) as jmtc_money, nvl(yw_money, 0) as yw_money,
       nvl(jmyw_money, 0) as jmyw_money, nvl(acct_money, 0) as acct_money,
       nvl(lx_money, 0) as lx_money, nvl(sy_money, 0) as sy_money,
       nvl(fund_money, 0) as fund_money, nvl(fund_301,0) fund_301 ,nvl(fund_003,0) fund_003 ,nvl(qfx, 0) as qfx,
       nvl(hosp_zf, 0) as hosp_zf, nvl(center_zf, 0) as center_zf,
       nvl(yw_fund_money, 0) as yw_fund_money,
       nvl(bc_fund_money, 0) as bc_fund_money, nvl(db_money, 0) as db_money,
       nvl(YWSH_DB_MONEY, 0) as YWSH_DB_MONEY,
       nvl(offi_money, 0) as offi_money, reg_man,
       nvl(zhaogu_pay, 0) as zhaogu_pay, w.area_code, PAY_MONEY_DNZF,
       medi_pay, medi_zfy, nvl(DB_MONEY_JUMIN, 0) as db_money_jumin
  from (select rownum rowno, b.hos_serial, b.reg_flag, b.disease_type,
                a.hospital_id, a.hospital_name, b.serial_no, b.biz_type,
                b.case_id, g.biz_stat, b.name, (select bs.sex_name from bs_sex bs where bs.sex =b.sex) sex,
                (select pp.pers_name from bs_person_type pp where pp.pers_type = b.pers_type_detail and pp.center_id = b.center_id) as pers_type,
                to_char(b.begin_date, 'yyyy-mm-dd') begin_date,
                to_char(b.end_date, 'yyyy-mm-dd') end_date,
                to_char(b.fin_date, 'yyyy-mm-dd hh24:mi:ss') fin_date,
                to_char(b.fin_date, 'yyyy-mm-dd hh24:mi:ss') finish_date,
                b.indi_id, t.insr_code, b.fin_staff, b.fin_man, b.corp_id,
                b.idcard,
                to_char(b.reg_date, 'yyyy-mm-dd hh24:mi:ss') reg_date,
                nvl(b.in_days, 0) in_days, b.district_code, b.center_id,
                b.office_grade, b.corp_name, b.in_disease,
                (select t.disease
                    from bs_disease t
                   where t.center_id = nvl(h.catalog_center, h.center_id)
                     and b.in_disease = t.icd) as disease, b.in_area_name,
                b.in_dept_name, b.in_bed, b.bed_type, b.patient_id,
                translate(b.remark, chr(13), '') remark, b.pos_code,
                b.reimburse_flag,
                (select q.disease
                    from bs_disease q
                   where q.center_id = nvl(h.catalog_center, h.center_id)
                     and b.fin_disease = q.icd) as fin_disease, 0 as foregift,
                b.ic_no, b.treatment_type,
                (select t.apply_content
                    from mt_apply t
                   where t.serial_apply = b.serial_apply) as apply_content,
                b.reg_man, street.QYBM as area_code, T.FEES, T.PAY_MONEY_JD,
                T.FUND_MONEY, T.FUND_301, T.FUND_003,T.QFX, T.HOSP_ZF, T.CENTER_ZF, T.YW_FUND_MONEY,
                T.BC_FUND_MONEY, T.PAY_MONEY_ALLSELF, T.PAY_MONEY_SELF,
                T.PAY_MONEY_E00SELF, T.PAY_MONEY_Z00SELF, T.PAY_MONEY_S00SELF,
                T.PAY_MONEY_S01SELF, T.PAY_MONEY_S02SELF, T.PAY_MONEY_C000SELF,
                T.PAY_MONEY_C001SELF, T.PAY_MONEY_C004SELF,
                T.PAY_MONEY_C006SELF, T.PAY_MONEY_C007SELF,
                T.PAY_MONEY_C007003SELF,
                (T.DB_MONEY - t.YWSH_DB_MONEY) as DB_MONEY, t.YWSH_DB_MONEY,
                T.TC_MONEY, T.TC_MONEY_XE, t.hosp_pay, t.hosp_prise,
                T.JMTC_MONEY, T.YW_MONEY, T.JMYW_MONEY, T.ACCT_MONEY,
                T.LX_MONEY, T.SY_MONEY, T.OFFI_MONEY, T.ZHAOGU_PAY,
                T.PAY_MONEY_XZF, PAY_MONEY_DNZF, medi_pay, medi_zfy,
                b.REG_INFO, T.DB_MONEY_JUMIN as DB_MONEY_JUMIN
           from bs_hospital a, bs_biztype g, mt_biz_fin b, bs_center h,
                bs_insured j,
                (select corp.CORP_ID, corp.AREA_CODE, st.QYBM
                    from bs_corp corp
                   inner join bs_country_street st
                      on corp.AREA_CODE = st.QYBM) street,
                (SELECT B.hospital_id, B.serial_no, B.indi_id,
                         (select max(insr_code)
                             from bs_insured a
                            where a.indi_id = B.indi_id) insr_code,
                         SUM(c.real_pay) AS FEES,
                         SUM(DECODE(c.POLICY_ITEM_CODE, 'C000', c.REAL_PAY, 'C001', c.REAL_PAY, 'C002', c.REAL_PAY, 'C003', c.REAL_PAY, 'C004', c.REAL_PAY, 'C005', c.REAL_PAY, 'C006', c.REAL_PAY, 'C007', c.REAL_PAY, 0)) AS PAY_MONEY_JD,
                         SUM(DECODE(c.FUND_ID, '001', c.REAL_PAY, '511', c.REAL_PAY, '202', c.REAL_PAY, '801', c.REAL_PAY, 0)) AS FUND_MONEY,
                         SUM(DECODE(c.FUND_ID, '301', c.REAL_PAY,  0)) AS FUND_301,
                         SUM(DECODE(c.FUND_ID, '003', c.REAL_PAY,  0)) AS FUND_003,
                         SUM(DECODE(c.FUND_ID, '901', c.REAL_PAY, '802', c.REAL_PAY, 0)) AS YW_FUND_MONEY,
                         SUM(DECODE(c.FUND_ID, '306', c.REAL_PAY, 0)) AS BC_FUND_MONEY,
                         SUM(DECODE(c.POLICY_ITEM_CODE, 'S01', c.REAL_PAY, 'S02', c.REAL_PAY, 0)) AS QFX,
                         SUM(DECODE(c.FUND_ID, '996', c.REAL_PAY, 0)) AS HOSP_ZF,
                         SUM(DECODE(c.FUND_ID, '998', c.REAL_PAY, 0)) AS CENTER_ZF,
                         SUM(DECODE(c.label_flag || c.FUND_ID, '101003', c.REAL_PAY, '101999', c.REAL_PAY, 0)) AS PAY_MONEY_ALLSELF,
                         SUM(DECODE(c.label_flag || c.FUND_ID, '102003', c.REAL_PAY, '102999', c.REAL_PAY, 0)) AS PAY_MONEY_SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'E00003', c.REAL_PAY, 'E00999', c.REAL_PAY, 0)) AS PAY_MONEY_E00SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'Z00003', c.REAL_PAY, 'Z00999', c.REAL_PAY, 0)) AS PAY_MONEY_Z00SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'S00003', c.REAL_PAY, 'S00999', c.REAL_PAY, 0)) AS PAY_MONEY_S00SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'S01003', c.REAL_PAY, 'S01999', c.REAL_PAY, 0)) AS PAY_MONEY_S01SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'S02003', c.REAL_PAY, 'S02999', c.REAL_PAY, 0)) AS PAY_MONEY_S02SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'C000003', c.REAL_PAY, 'C000999', c.REAL_PAY, 0)) AS PAY_MONEY_C000SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'C001003', c.REAL_PAY, 'C001999', c.REAL_PAY, 'C002003', c.REAL_PAY, 'C002999', c.REAL_PAY, 'C003003', c.REAL_PAY, 'C003999', c.REAL_PAY, 0)) AS PAY_MONEY_C001SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'C004003', c.REAL_PAY, 'C004999', c.REAL_PAY, 'C005003', c.REAL_PAY, 'C005999', c.REAL_PAY, 0)) AS PAY_MONEY_C004SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'C006003', c.REAL_PAY, 'C006999', c.REAL_PAY, 'C007003', c.REAL_PAY, 'C007999', c.REAL_PAY, 0)) AS PAY_MONEY_C006SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'C007999', c.REAL_PAY, 0)) AS PAY_MONEY_C007SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'C007003', c.REAL_PAY, 0)) AS PAY_MONEY_C007003SELF,
                         SUM(DECODE(c.FUND_ID, '201', c.REAL_PAY, 0)) AS DB_MONEY,
                         0 AS YWSH_DB_MONEY,
                         SUM(DECODE(c.FUND_ID, '001', c.REAL_PAY, '801', c.REAL_PAY, 0)) AS TC_MONEY,
                         case
                           when nvl(sum(decode(c.fund_id, '996', nvl(c.real_pay, 0), 0)), 0) >= 0 then
                            nvl(sum(decode(c.fund_id, '996', nvl(c.real_pay, 0), 0)), 0)
                           else
                            0
                         end hosp_pay,
                         case
                           when nvl(sum(decode(c.fund_id, '996', nvl(c.real_pay, 0), 0)), 0) >= 0 then
                            0
                           else
                            -nvl(sum(decode(c.fund_id, '996', nvl(c.real_pay, 0), 0)), 0)
                         end hosp_prise,
                         SUM(DECODE(c.FUND_ID, '001', c.REAL_PAY, '801', c.REAL_PAY, 0)) AS TC_MONEY_XE,
                         SUM(DECODE(c.FUND_ID, '801', c.REAL_PAY, 0)) AS JMTC_MONEY,
                         SUM(DECODE(c.FUND_ID, '901', c.REAL_PAY, '802', c.REAL_PAY, 0)) AS YW_MONEY,
                         SUM(DECODE(c.FUND_ID, '802', c.REAL_PAY, 0)) AS JMYW_MONEY,
                         SUM(DECODE(c.FUND_ID, '003', c.REAL_PAY, 0)) AS ACCT_MONEY,
                         SUM(DECODE(c.FUND_ID, '202', c.REAL_PAY, 0)) AS LX_MONEY,
                         SUM(DECODE(c.FUND_ID, '511', c.REAL_PAY, 0)) AS SY_MONEY,
                         SUM(DECODE(c.FUND_ID, '301', c.REAL_PAY, 0)) AS OFFI_MONEY,
                         SUM(DECODE(c.FUND_ID, '401', c.REAL_PAY, 0)) AS ZHAOGU_PAY,
                         SUM(DECODE(c.FUND_ID, '999', c.REAL_PAY, 0)) AS PAY_MONEY_XZF,
                         SUM((CASE
                               WHEN C.POLICY_ITEM_CODE IN
                                    ('C000', 'C001', 'C002', 'C003', 'C004') AND
                                    (C.fund_id = '999' OR C.fund_id = '003') THEN
                                C.REAL_PAY
                               ELSE
                                0
                             END)) AS PAY_MONEY_DNZF,
                         (select nvl(nvl(sum(ss.all_self_money), 0) +
                                       nvl(sum(ss.part_self_money), 0), 0) as not_fund
                             from mt_fee_stat_fin ss
                            where ss.hospital_id = b.hospital_id
                              and ss.serial_no = b.serial_no
                              and ss.valid_flag = '1'
                              and ss.stat_type in ('001', '002', '003')) as medi_pay,
                         (select nvl(sum(ss.money), 0) as medi_zfy
                             from mt_fee_stat_fin ss
                            where ss.hospital_id = b.hospital_id
                              and ss.serial_no = b.serial_no
                              and ss.valid_flag = '1'
                              and ss.stat_type in ('001', '002', '003')) as medi_zfy,
                         SUM(DECODE(c.FUND_ID, '803', c.REAL_PAY, 0)) AS DB_MONEY_JUMIN
                    FROM MT_BIZ_FIN B, MT_PAY_RECORD_FIN C, BS_BIZTYPE G,
                         BS_INSURED J
                   WHERE B.HOSPITAL_ID = C.HOSPITAL_ID
                     AND B.SERIAL_NO = C.SERIAL_NO
                     AND B.CENTER_ID = G.CENTER_ID
                     AND B.BIZ_TYPE = G.BIZ_TYPE
                     AND B.VALID_FLAG = '1'
                     AND C.VALID_FLAG = '1'
                     and b.indi_id = j.indi_id
                     and b.hospital_id || b.serial_no in
                         (select hospital_id || serial_no
                            from pm_account_biz
                           where month_decl_sn in
                                 (select rela_decl_sn
                                    from pm_bill
                                   where outpay_bill_no = '23') and ((biz_flag = '18' and biz_type = '12') or biz_type <>'12' ))
                   GROUP BY b.hospital_id, b.serial_no, b.indi_id) T
          where a.hospital_id = b.hospital_id
            and b.center_id = g.center_id
            and b.biz_type = g.biz_type
            and b.center_id = h.center_id(+)
            and b.valid_flag = '1'
            and b.indi_id = j.indi_id
            and b.CORP_ID = street.CORP_ID(+)
            AND B.HOSPITAL_ID = T.HOSPITAL_ID
            AND B.SERIAL_NO = T.SERIAL_NO
          order by rowno) w

从上面的信息可以看到执行花费了2456844ms。从awr报告可以看到主要等待事件也是属于I/O
11

13

从sql报告来看
14

2

执行sql调整任务

SQL> @C:\oracle\product\10.2.0\client_1\rdbms\admin\sqltrpt.sql
Cannot SET TAB
Cannot SET LONGCHUNKSIZE
 
15 Most expensive SQL in the cursor cache
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
newl
---------

 
SQL_ID           ELAPSED SQL_TEXT_FRAGMENT
------------- ---------- -------------------------------------------------------
arb763ht1q5j0 17462.1402 select hospital_id,         serial_no,         serial_f
2m613a70mtp33 14098.6959 call usp_pay_account_declare(:1,:2,:3,:4,:5,:6,:7,:8,:9
ah4mrap4wpyk3 11941.5544 INSERT INTO BS_CATALOG_MATCH (CENTER_ID, SERIAL_MATCH,
fj88hvyfjf7u3 7571.78878 insert into mt_biz_fin(  hospital_id, serial_no, fee_ba
17janqkjd2bx3 7172.00961 select hospital_id,          serial_no,          fee_ba
0skcw15cj8kg7 5772.45381 select rowno, hos_serial, reg_flag,        nvl((SELECT
691vbnfyxyvr3 5277.95397 update bs_mdi_indi_acc   set last_balance = last_balanc
83h4yucvjnyap 5228.42888 UPDATE PM_ACCOUNT_BIZ A SET A.YEAR_PAY_TYPE = A.FINAL_P
37j74mj2t6d3g 5055.72843 insert into mt_biz_scene_fin(hospital_id, serial_no, fe
dfrc1yjumpkgb 3495.65936 insert into mt_pay_record_fin(hospital_id, serial_no, f
07q1m7pybb7sn 3450.10698 insert into BS_HOSP_LOGIN_LOGFIN select * from BS_HOSP_
35ckgb9fcpbpd 3349.30750 select  nvl(sum(decode(a.total_type,'C0000',nvl(a.sum_y
1urbbnr5sc8u3  3010.5935 select a.biz_type,a.special_code,a.indi_id, a.reimburse
bp5ppsp50z4cg 2728.77444 insert into bs_icfee (serial_ic, card_no,  card_type, i
6agr1962w3wfw 2667.30935 insert into bs_biztotal_record (id,indi_id,hospital_id,
newl
---------

 
15 Most expensive SQL in the workload repository
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
SQL_ID           ELAPSED SQL_TEXT_FRAGMENT
------------- ---------- --------------------------------------------------------------------------------
41w2uhn9uukx2 46992.5939  BEGIN    SYS.KUPW$WORKER.MAIN('SYS_EXPORT_SCHEMA_08',
0skcw15cj8kg7 40589.7354 select rowno, hos_serial, reg_flag,        nvl((SELECT
d2nqy2m0d6k02 25714.3942 select rowno, hos_serial, reg_flag,        nvl((SELECT
57vdxh1xps2r7 21134.4932  BEGIN    SYS.KUPW$WORKER.MAIN('SYS_EXPORT_SCHEMA_03',
dbknuva8j82f6 9400.07834 DECLARE job BINARY_INTEGER := :job; next_date DATE := :
b6usrg82hwsa3 7914.57973 call dbms_stats.gather_database_stats_job_proc (  )
ga24g7vg22nh5 5493.49117 select  distinct a.busi_bill_sn,a.audit_flag,a.make_bil
5vagsa3xhxduu 5212.08508 BEGIN usp_kettle_exec_proc ( :1,  :2,  :3,  :4,  :5); E
arb763ht1q5j0 4786.13909 select hospital_id,         serial_no,         serial_f
gdbumbxg088f2 4220.72077 select zf.district_code,zf.center_id , sum(zf.zzf) as "
4c3s78cg7qgaw 3534.64534 INSERT INTO ZXJ_YLJ_QS (ND, CENTER_ID, DISTRICT_CODE, R
2m613a70mtp33 3491.63022 call usp_pay_account_declare(:1,:2,:3,:4,:5,:6,:7,:8,:9
datjs0356h3n4 3351.04771 select w.hospital_id,t.hospital_name,sum(mzrc) mzrc,sum
9su2cmt6gg3rf 3336.44954 INSERT INTO ZXJ_YLJ_QS (ND, CENTER_ID, DISTRICT_CODE, R
g2xvxhuqb3mm7 3323.54692 select tab_pay.zj_code as corp_five_no,tab_pay.corp_id,
newl
---------

 
Specify the Sql id
~~~~~~~~~~~~~~~~~~
Sql Id specified: 0skcw15cj8kg7
 
Tune the sql
~~~~~~~~~~~~
err
---------
0
task_name
---------
TASK_39762
err
---------
0
GENERAL INFORMATION SECTION
-------------------------------------------------------------------------------
Tuning Task Name                  : TASK_39762
Tuning Task Owner                 : INSUR_CHANGDE
Scope                             : COMPREHENSIVE
Time Limit(seconds)               : 1800
Completion Status                 : COMPLETED
Started at                        : 04/05/2016 16:22:22
Completed at                      : 04/05/2016 16:32:24
Number of SQL Profile Findings    : 1
 
-------------------------------------------------------------------------------
Schema Name: INSUR_CHANGDE
SQL ID     : 0skcw15cj8kg7
SQL Text   : select rowno, hos_serial, reg_flag,
                    nvl((SELECT distinct t.policy_value
                           FROM fc_biz_policy t
                          WHERE t.policy_code = 'can_clinic_flag'
                            and t.valid_flag = '1'
                            and t.center_id = '430701'), (SELECT distinct
             t.policy_value
                             FROM fc_biz_policy t
                            WHERE t.policy_code =
                                  'can_clinic_flag'
                              and t.valid_flag = '1'
                              and t.center_id = '0')) AS can_clinic_flag,
                    decode(DISEASE_TYPE, 'A', '病种单纯', 'B', '严重', 'C', '严重并发',
             'D', '危重', '') DISEASE_TYPE,
                    hospital_id, hospital_name, serial_no, biz_type, case_id,
             biz_stat,
                    name, sex, pers_type, begin_date, end_date, fin_date,
             finish_date,
                    reg_date, in_days, indi_id, insr_code, fin_staff,
             fin_man, corp_id,
                    idcard, district_code, office_grade,center_id,
                    (select t.special_code
                        from bs_corp_pres t
                       where t.indi_id = w.indi_id) as special_code,
             corp_name, disease,
                    in_area_name, in_dept_name,
                    decode(apply_content, '126', '转外住院', '127', '转外复查',
             '普通住院') as apply_content,
                    in_bed, bed_type, patient_id, remark, pos_code,
             reimburse_flag,
                    fin_disease, ic_no, treatment_type,
                    decode(reg_info || treatment_type, 'WD3120',
             '普通住院(转外住院)', 'WD2120', '普通住院(异地住院)', '1120', '普通住院(转诊转院)',
             'F120', '普通住院(非首诊就诊)', 'WD1120', '普通住院(异地安置)', 'C120',
             '普通住院(首诊就诊)', (select treatment_name
                                from bs_treat_type
                               where treatment_type =
                                     w.treatment_type
                                 and center_id =
                                     w.center_id)) as treatment_name,
                    nvl(pay_money_jd, 0) as pay_money_jd,
                    nvl(pay_money_xzf, 0) as pay_money_xzf, nvl(fees, 0) as
             fees,
                    foregift, nvl(pay_money_allself, 0) as pay_money_allself,
                    nvl(pay_money_self, 0) as pay_money_self,
                    nvl(pay_money_E00self, 0) as pay_money_E00self,
                    nvl(pay_money_Z00self, 0) as pay_money_Z00self,
                    nvl(pay_money_S00self, 0) as pay_money_S00self,
                    nvl(pay_money_S01self, 0) as pay_money_S01self,
                    nvl(pay_money_S01self, 0) as pay_money_S01self,
                    nvl(pay_money_C000self, 0) as pay_money_C000self,
                    nvl(pay_money_C001self, 0) as pay_money_C001self,
                    nvl(pay_money_C004self, 0) as pay_money_C004self,
                    nvl(pay_money_C006self, 0) as pay_money_C006self,
                    nvl(pay_money_C007self, 0) as pay_money_C007self,
                    nvl(pay_money_C007003self, 0) as pay_money_C007003self,
                    nvl(tc_money, 0) as tc_money, nvl(tc_money_xe, 0) as
             tc_money_xe,
                    nvl(hosp_pay, 0) as hosp_pay, nvl(hosp_prise, 0) as
             hosp_prise,
                    nvl(jmtc_money, 0) as jmtc_money, nvl(yw_money, 0) as
             yw_money,
                    nvl(jmyw_money, 0) as jmyw_money, nvl(acct_money, 0) as
             acct_money,
                    nvl(lx_money, 0) as lx_money, nvl(sy_money, 0) as
             sy_money,
                    nvl(fund_money, 0) as fund_money, nvl(fund_301,0)
             fund_301 ,nvl(fund_003,0) fund_003 ,nvl(qfx, 0) as qfx,
                    nvl(hosp_zf, 0) as hosp_zf, nvl(center_zf, 0) as
             center_zf,
                    nvl(yw_fund_money, 0) as yw_fund_money,
                    nvl(bc_fund_money, 0) as bc_fund_money, nvl(db_money, 0)
             as db_money,
                    nvl(YWSH_DB_MONEY, 0) as YWSH_DB_MONEY,
                    nvl(offi_money, 0) as offi_money, reg_man,
                    nvl(zhaogu_pay, 0) as zhaogu_pay, w.area_code,
             PAY_MONEY_DNZF,
                    medi_pay, medi_zfy, nvl(DB_MONEY_JUMIN, 0) as
             db_money_jumin
               from (select rownum rowno, b.hos_serial, b.reg_flag,
             b.disease_type,
                             a.hospital_id, a.hospital_name, b.serial_no,
             b.biz_type,
                             b.case_id, g.biz_stat, b.name, (select
             bs.sex_name from bs_sex bs where bs.sex =b.sex) sex,
                             (select pp.pers_name from bs_person_type pp
             where pp.pers_type = b.pers_type_detail and pp.center_id =
             b.center_id) as pers_type,
                             to_char(b.begin_date, 'yyyy-mm-dd') begin_date,
                             to_char(b.end_date, 'yyyy-mm-dd') end_date,
                             to_char(b.fin_date, 'yyyy-mm-dd hh24:mi:ss')
             fin_date,
                             to_char(b.fin_date, 'yyyy-mm-dd hh24:mi:ss')
             finish_date,
                             b.indi_id, t.insr_code, b.fin_staff, b.fin_man,
             b.corp_id,
                             b.idcard,
                             to_char(b.reg_date, 'yyyy-mm-dd hh24:mi:ss')
             reg_date,
                             nvl(b.in_days, 0) in_days, b.district_code,
             b.center_id,
                             b.office_grade, b.corp_name, b.in_disease,
                             (select t.disease
                                 from bs_disease t
                                where t.center_id = nvl(h.catalog_center,
             h.center_id)
                                  and b.in_disease = t.icd) as disease,
             b.in_area_name,
                             b.in_dept_name, b.in_bed, b.bed_type,
             b.patient_id,
                             translate(b.remark, chr(13), '') remark,
             b.pos_code,
                             b.reimburse_flag,
                             (select q.disease
                                 from bs_disease q
                                where q.center_id = nvl(h.catalog_center,
             h.center_id)
                                  and b.fin_disease = q.icd) as fin_disease,
             0 as foregift,
                             b.ic_no, b.treatment_type,
                             (select t.apply_content
                                 from mt_apply t
                                where t.serial_apply = b.serial_apply) as
             apply_content,
                             b.reg_man, street.QYBM as area_code, T.FEES,
             T.PAY_MONEY_JD,
                             T.FUND_MONEY, T.FUND_301, T.FUND_003,T.QFX,
             T.HOSP_ZF, T.CENTER_ZF, T.YW_FUND_MONEY,
                             T.BC_FUND_MONEY, T.PAY_MONEY_ALLSELF,
             T.PAY_MONEY_SELF,
                             T.PAY_MONEY_E00SELF, T.PAY_MONEY_Z00SELF,
             T.PAY_MONEY_S00SELF,
                             T.PAY_MONEY_S01SELF, T.PAY_MONEY_S02SELF,
             T.PAY_MONEY_C000SELF,
                             T.PAY_MONEY_C001SELF, T.PAY_MONEY_C004SELF,
                             T.PAY_MONEY_C006SELF, T.PAY_MONEY_C007SELF,
                             T.PAY_MONEY_C007003SELF,
                             (T.DB_MONEY - t.YWSH_DB_MONEY) as DB_MONEY,
             t.YWSH_DB_MONEY,
                             T.TC_MONEY, T.TC_MONEY_XE, t.hosp_pay,
             t.hosp_prise,
                             T.JMTC_MONEY, T.YW_MONEY, T.JMYW_MONEY,
             T.ACCT_MONEY,
                             T.LX_MONEY, T.SY_MONEY, T.OFFI_MONEY,
             T.ZHAOGU_PAY,
                             T.PAY_MONEY_XZF, PAY_MONEY_DNZF, medi_pay,
             medi_zfy,
                             b.REG_INFO, T.DB_MONEY_JUMIN as DB_MONEY_JUMIN
                        from bs_hospital a, bs_biztype g, mt_biz_fin b,
             bs_center h,
                             bs_insured j,
                             (select corp.CORP_ID, corp.AREA_CODE, st.QYBM
                                 from bs_corp corp
                                inner join bs_country_street st
                                   on corp.AREA_CODE = st.QYBM) street,
                             (SELECT B.hospital_id, B.serial_no, B.indi_id,
                                      (select max(insr_code)
                                          from bs_insured a
                                         where a.indi_id = B.indi_id)
             insr_code,
                                      SUM(c.real_pay) AS FEES,
                                      SUM(DECODE(c.POLICY_ITEM_CODE, 'C000',
             c.REAL_PAY, 'C001', c.REAL_PAY, 'C002', c.REAL_PAY, 'C003',
             c.REAL_PAY, 'C004', c.REAL_PAY, 'C005', c.REAL_PAY, 'C006',
             c.REAL_PAY, 'C007', c.REAL_PAY, 0)) AS PAY_MONEY_JD,
                                      SUM(DECODE(c.FUND_ID, '001',
             c.REAL_PAY, '511', c.REAL_PAY, '202', c.REAL_PAY, '801',
             c.REAL_PAY, 0)) AS FUND_MONEY,
                                      SUM(DECODE(c.FUND_ID, '301',
             c.REAL_PAY,  0)) AS FUND_301,
                                      SUM(DECODE(c.FUND_ID, '003',
             c.REAL_PAY,  0)) AS FUND_003,
                                      SUM(DECODE(c.FUND_ID, '901',
             c.REAL_PAY, '802', c.REAL_PAY, 0)) AS YW_FUND_MONEY,
                                      SUM(DECODE(c.FUND_ID, '306',
             c.REAL_PAY, 0)) AS BC_FUND_MONEY,
                                      SUM(DECODE(c.POLICY_ITEM_CODE, 'S01',
             c.REAL_PAY, 'S02', c.REAL_PAY, 0)) AS QFX,
                                      SUM(DECODE(c.FUND_ID, '996',
             c.REAL_PAY, 0)) AS HOSP_ZF,
                                      SUM(DECODE(c.FUND_ID, '998',
             c.REAL_PAY, 0)) AS CENTER_ZF,
                                      SUM(DECODE(c.label_flag || c.FUND_ID,
             '101003', c.REAL_PAY, '101999', c.REAL_PAY, 0)) AS
             PAY_MONEY_ALLSELF,
                                      SUM(DECODE(c.label_flag || c.FUND_ID,
             '102003', c.REAL_PAY, '102999', c.REAL_PAY, 0)) AS
             PAY_MONEY_SELF,
                                      SUM(DECODE(c.policy_item_code ||
             c.FUND_ID, 'E00003', c.REAL_PAY, 'E00999', c.REAL_PAY, 0)) AS
             PAY_MONEY_E00SELF,
                                      SUM(DECODE(c.policy_item_code ||
             c.FUND_ID, 'Z00003', c.REAL_PAY, 'Z00999', c.REAL_PAY, 0)) AS
             PAY_MONEY_Z00SELF,
                                      SUM(DECODE(c.policy_item_code ||
             c.FUND_ID, 'S00003', c.REAL_PAY, 'S00999', c.REAL_PAY, 0)) AS
             PAY_MONEY_S00SELF,
                                      SUM(DECODE(c.policy_item_code ||
             c.FUND_ID, 'S01003', c.REAL_PAY, 'S01999', c.REAL_PAY, 0)) AS
             PAY_MONEY_S01SELF,
                                      SUM(DECODE(c.policy_item_code ||
             c.FUND_ID, 'S02003', c.REAL_PAY, 'S02999', c.REAL_PAY, 0)) AS
             PAY_MONEY_S02SELF,
                                      SUM(DECODE(c.policy_item_code ||
             c.FUND_ID, 'C000003', c.REAL_PAY, 'C000999', c.REAL_PAY, 0)) AS
             PAY_MONEY_C000SELF,
                                      SUM(DECODE(c.policy_item_code ||
             c.FUND_ID, 'C001003', c.REAL_PAY, 'C001999', c.REAL_PAY,
             'C002003', c.REAL_PAY, 'C002999', c.REAL_PAY, 'C003003',
             c.REAL_PAY, 'C003999', c.REAL_PAY, 0)) AS PAY_MONEY_C001SELF,
                                      SUM(DECODE(c.policy_item_code ||
             c.FUND_ID, 'C004003', c.REAL_PAY, 'C004999', c.REAL_PAY,
             'C005003', c.REAL_PAY, 'C005999', c.REAL_PAY, 0)) AS
             PAY_MONEY_C004SELF,
                                      SUM(DECODE(c.policy_item_code ||
             c.FUND_ID, 'C006003', c.REAL_PAY, 'C006999', c.REAL_PAY,
             'C007003', c.REAL_PAY, 'C007999', c.REAL_PAY, 0)) AS
             PAY_MONEY_C006SELF,
                                      SUM(DECODE(c.policy_item_code ||
             c.FUND_ID, 'C007999', c.REAL_PAY, 0)) AS PAY_MONEY_C007SELF,
                                      SUM(DECODE(c.policy_item_code ||
             c.FUND_ID, 'C007003', c.REAL_PAY, 0)) AS PAY_MONEY_C007003SELF,
                                      SUM(DECODE(c.FUND_ID, '201',
             c.REAL_PAY, 0)) AS DB_MONEY,
                                      0 AS YWSH_DB_MONEY,
                                      SUM(DECODE(c.FUND_ID, '001',
             c.REAL_PAY, '801', c.REAL_PAY, 0)) AS TC_MONEY,
                                      case
                                        when nvl(sum(decode(c.fund_id, '996',
             nvl(c.real_pay, 0), 0)), 0) >= 0 then
                                         nvl(sum(decode(c.fund_id, '996',
             nvl(c.real_pay, 0), 0)), 0)
                                        else
                                         0
                                      end hosp_pay,
                                      case
                                        when nvl(sum(decode(c.fund_id, '996',
             nvl(c.real_pay, 0), 0)), 0) >= 0 then
                                         0
                                        else
                                         -nvl(sum(decode(c.fund_id, '996',
             nvl(c.real_pay, 0), 0)), 0)
                                      end hosp_prise,
                                      SUM(DECODE(c.FUND_ID, '001',
             c.REAL_PAY, '801', c.REAL_PAY, 0)) AS TC_MONEY_XE,
                                      SUM(DECODE(c.FUND_ID, '801',
             c.REAL_PAY, 0)) AS JMTC_MONEY,
                                      SUM(DECODE(c.FUND_ID, '901',
             c.REAL_PAY, '802', c.REAL_PAY, 0)) AS YW_MONEY,
                                      SUM(DECODE(c.FUND_ID, '802',
             c.REAL_PAY, 0)) AS JMYW_MONEY,
                                      SUM(DECODE(c.FUND_ID, '003',
             c.REAL_PAY, 0)) AS ACCT_MONEY,
                                      SUM(DECODE(c.FUND_ID, '202',
             c.REAL_PAY, 0)) AS LX_MONEY,
                                      SUM(DECODE(c.FUND_ID, '511',
             c.REAL_PAY, 0)) AS SY_MONEY,
                                      SUM(DECODE(c.FUND_ID, '301',
             c.REAL_PAY, 0)) AS OFFI_MONEY,
                                      SUM(DECODE(c.FUND_ID, '401',
             c.REAL_PAY, 0)) AS ZHAOGU_PAY,
                                      SUM(DECODE(c.FUND_ID, '999',
             c.REAL_PAY, 0)) AS PAY_MONEY_XZF,
                                      SUM((CASE
                                            WHEN C.POLICY_ITEM_CODE IN
                                                 ('C000', 'C001', 'C002',
             'C003', 'C004') AND
                                                 (C.fund_id = '999' OR
             C.fund_id = '003') THEN
                                             C.REAL_PAY
                                            ELSE
                                             0
                                          END)) AS PAY_MONEY_DNZF,
                                      (select nvl(nvl(sum(ss.all_self_money),
             0) +
 
             nvl(sum(ss.part_self_money), 0), 0) as not_fund
                                          from mt_fee_stat_fin ss
                                         where ss.hospital_id = b.hospital_id
                                           and ss.serial_no = b.serial_no
                                           and ss.valid_flag = '1'
                                           and ss.stat_type in ('001', '002',
             '003')) as medi_pay,
                                      (select nvl(sum(ss.money), 0) as
             medi_zfy
                                          from mt_fee_stat_fin ss
                                         where ss.hospital_id = b.hospital_id
                                           and ss.serial_no = b.serial_no
                                           and ss.valid_flag = '1'
                                           and ss.stat_type in ('001', '002',
             '003')) as medi_zfy,
                                      SUM(DECODE(c.FUND_ID, '803',
             c.REAL_PAY, 0)) AS DB_MONEY_JUMIN
                                 FROM MT_BIZ_FIN B, MT_PAY_RECORD_FIN C,
             BS_BIZTYPE G,
                                      BS_INSURED J
                                WHERE B.HOSPITAL_ID = C.HOSPITAL_ID
                                  AND B.SERIAL_NO = C.SERIAL_NO
                                  AND B.CENTER_ID = G.CENTER_ID
                                  AND B.BIZ_TYPE = G.BIZ_TYPE
                                  AND B.VALID_FLAG = '1'
                                  AND C.VALID_FLAG = '1'
                                  and b.indi_id = j.indi_id
                                  and b.hospital_id || b.serial_no in
                                      (select hospital_id || serial_no
                                         from pm_account_biz
                                        where month_decl_sn in
                                              (select rela_decl_sn
                                                 from pm_bill
                                                where outpay_bill_no = '23')
             and ((biz_flag = '18' and biz_type = '12') or biz_type <>'12' ))
                                GROUP BY b.hospital_id, b.serial_no,
             b.indi_id) T
                       where a.hospital_id = b.hospital_id
                         and b.center_id = g.center_id
                         and b.biz_type = g.biz_type
                         and b.center_id = h.center_id(+)
                         and b.valid_flag = '1'
                         and b.indi_id = j.indi_id
                         and b.CORP_ID = street.CORP_ID(+)
                         AND B.HOSPITAL_ID = T.HOSPITAL_ID
                         AND B.SERIAL_NO = T.SERIAL_NO
                       order by rowno) w
 
-------------------------------------------------------------------------------
FINDINGS SECTION (1 finding)
-------------------------------------------------------------------------------
 
1- SQL Profile Finding (see explain plans section below)
--------------------------------------------------------
  A potentially better execution plan was found for this statement.
 
  Recommendation (estimated benefit: 99.99%)
  ------------------------------------------
  - Consider accepting the recommended SQL profile.
    execute dbms_sqltune.accept_sql_profile(task_name => 'TASK_39762',
            replace => TRUE);
 
-------------------------------------------------------------------------------
EXPLAIN PLANS SECTION
-------------------------------------------------------------------------------

调整前的执行计划

1- Original With Adjusted Cost
------------------------------
Plan hash value: 462538689
 
-------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                                  | Name                     | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
-------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                           |                          |   648G|   923T|       |    18G  (2)|999:59:59 |
|   1 |  HASH UNIQUE                               |                          |     1 |    31 |       |     2  (50)| 00:00:01 |
|*  2 |   TABLE ACCESS BY INDEX ROWID              | FC_BIZ_POLICY            |     1 |    31 |       |     1   (0)| 00:00:01 |
|*  3 |    INDEX RANGE SCAN                        | PK_FC_BIZ_POLICY         |     1 |       |       |     1   (0)| 00:00:01 |
|   4 |    HASH UNIQUE                             |                          |     1 |    31 |       |     2  (50)| 00:00:01 |
|*  5 |     TABLE ACCESS BY INDEX ROWID            | FC_BIZ_POLICY            |     1 |    31 |       |     1   (0)| 00:00:01 |
|*  6 |      INDEX RANGE SCAN                      | PK_FC_BIZ_POLICY         |     1 |       |       |     1   (0)| 00:00:01 |
|   7 |  TABLE ACCESS BY INDEX ROWID               | BS_SEX                   |     1 |     6 |       |     1   (0)| 00:00:01 |
|*  8 |   INDEX UNIQUE SCAN                        | PK_BS_SEX                |     1 |       |       |     1   (0)| 00:00:01 |
|   9 |  TABLE ACCESS BY INDEX ROWID               | BS_PERSON_TYPE           |     1 |    18 |       |     1   (0)| 00:00:01 |
|* 10 |   INDEX UNIQUE SCAN                        | PK_BS_PERSON_TYPE        |     1 |       |       |     1   (0)| 00:00:01 |
|  11 |  SORT AGGREGATE                            |                          |     1 |    18 |       |            |          |
|  12 |   TABLE ACCESS BY INDEX ROWID              | BS_INSURED               |     1 |    18 |       |     1   (0)| 00:00:01 |
|* 13 |    INDEX UNIQUE SCAN                       | PK_BS_INSURED            |     1 |       |       |     1   (0)| 00:00:01 |
|  14 |  TABLE ACCESS BY INDEX ROWID               | BS_CORP_PRES             |     1 |     8 |       |     1   (0)| 00:00:01 |
|* 15 |   INDEX RANGE SCAN                         | INDEX_BS_CORP_PRES_INDI  |     1 |       |       |     1   (0)| 00:00:01 |
|  16 |  TABLE ACCESS BY INDEX ROWID               | BS_DISEASE               |     1 |    33 |       |     1   (0)| 00:00:01 |
|* 17 |   INDEX RANGE SCAN                         | INX_BS_DISEASE_01        |     1 |       |       |     1   (0)| 00:00:01 |
|  18 |  TABLE ACCESS BY INDEX ROWID               | MT_APPLY                 |     1 |     9 |       |     1   (0)| 00:00:01 |
|* 19 |   INDEX UNIQUE SCAN                        | PK_MT_APPLY              |     1 |       |       |     1   (0)| 00:00:01 |
|  20 |  TABLE ACCESS BY INDEX ROWID               | BS_DISEASE               |     1 |    33 |       |     1   (0)| 00:00:01 |
|* 21 |   INDEX RANGE SCAN                         | INX_BS_DISEASE_01        |     1 |       |       |     1   (0)| 00:00:01 |
|  22 |  TABLE ACCESS BY INDEX ROWID               | BS_TREAT_TYPE            |     1 |    23 |       |     1   (0)| 00:00:01 |
|* 23 |   INDEX UNIQUE SCAN                        | PK_BS_TREAT_TYPE         |     1 |       |       |     1   (0)| 00:00:01 |
|  24 |  SORT AGGREGATE                            |                          |     1 |    34 |       |            |          |
|* 25 |   TABLE ACCESS BY INDEX ROWID              | MT_FEE_STAT_FIN          |     1 |    34 |       |     1   (0)| 00:00:01 |
|* 26 |    INDEX RANGE SCAN                        | PK_MT_FEE_STAT_FIN       |     1 |       |       |     1   (0)| 00:00:01 |
|  27 |  SORT AGGREGATE                            |                          |     1 |    31 |       |            |          |
|* 28 |   TABLE ACCESS BY INDEX ROWID              | MT_FEE_STAT_FIN          |     1 |    31 |       |     1   (0)| 00:00:01 |
|* 29 |    INDEX RANGE SCAN                        | PK_MT_FEE_STAT_FIN       |     1 |       |       |     1   (0)| 00:00:01 |
|  30 |  VIEW                                      |                          |   648G|   923T|       |    18G  (2)|999:59:59 |
|  31 |   SORT ORDER BY                            |                          |   648G|   516T|  1072T|    18G  (2)|999:59:59 |
|  32 |    COUNT                                   |                          |       |       |       |            |          |
|* 33 |     HASH JOIN RIGHT OUTER                  |                          |   648G|   516T|       |  9061M  (2)|999:59:59 |
|  34 |      VIEW                                  |                          |     1 |    12 |       |   117   (2)| 00:00:02 |
|* 35 |       HASH JOIN                            |                          |     1 |    18 |       |   117   (2)| 00:00:02 |
|  36 |        TABLE ACCESS FULL                   | BS_COUNTRY_STREET        |     1 |     7 |       |     2   (0)| 00:00:01 |
|* 37 |        TABLE ACCESS FULL                   | BS_CORP                  |  9523 |   102K|       |   114   (1)| 00:00:02 |
|* 38 |      HASH JOIN                             |                          |   648G|   509T|       |  9058M  (2)|999:59:59 |
|  39 |       TABLE ACCESS FULL                    | BS_BIZTYPE               |    97 |  1164 |       |     3   (0)| 00:00:01 |
|* 40 |       HASH JOIN RIGHT OUTER                |                          |   648G|   502T|       |  9054M  (2)|999:59:59 |
|  41 |        TABLE ACCESS FULL                   | BS_CENTER                |    12 |   168 |       |     3   (0)| 00:00:01 |
|  42 |        MERGE JOIN                          |                          |   648G|   493T|       |  9051M  (2)|999:59:59 |
|  43 |         NESTED LOOPS                       |                          |   809G|   592T|       |  9051M  (2)|999:59:59 |
|  44 |          MERGE JOIN                        |                          |   808G|   587T|       |  9042M  (2)|999:59:59 |
|  45 |           SORT JOIN                        |                          |   819G|   427T|       |  9040M  (2)|999:59:59 |
|  46 |            VIEW                            |                          |   819G|   427T|       |  9040M  (2)|999:59:59 |
|  47 |             HASH GROUP BY                  |                          |   819G|    93T|   200T|  9040M  (2)|999:59:59 |
|* 48 |              HASH JOIN                     |                          |   819G|    93T|   114M|  5209K (86)| 17:21:55 |
|  49 |               VIEW                         | VW_NSO_1                 |  3750K|    71M|       | 41283   (1)| 00:08:16 |
|  50 |                HASH UNIQUE                 |                          |  3750K|   146M|   404M| 41283   (1)| 00:08:16 |
|* 51 |                 TABLE ACCESS BY INDEX ROWID| PM_ACCOUNT_BIZ           |   205 |  6560 |       |     9   (0)| 00:00:01 |
|  52 |                  NESTED LOOPS              |                          |  3750K|   146M|       |  1405   (2)| 00:00:17 |
|* 53 |                   TABLE ACCESS FULL        | PM_BILL                  |    31 |   279 |       |  1119   (2)| 00:00:14 |
|* 54 |                   INDEX RANGE SCAN         | IDX_PM_ACCOUNT_BIZ_MONTH |   213 |       |       |     1   (0)| 00:00:01 |
|  55 |               NESTED LOOPS                 |                          |    21M|  2208M|       |   598K  (2)| 01:59:45 |
|* 56 |                HASH JOIN                   |                          |    21M|  2080M|       |   598K  (1)| 01:59:42 |
|  57 |                 INDEX FULL SCAN            | PK_BS_BIZTYPE            |    97 |   970 |       |     1   (0)| 00:00:01 |
|* 58 |                 HASH JOIN                  |                          |    21M|  1872M|  1089M|   598K  (1)| 01:59:40 |
|* 59 |                  TABLE ACCESS FULL         | MT_BIZ_FIN               |    21M|   838M|       |   209K  (2)| 00:41:54 |
|* 60 |                  TABLE ACCESS FULL         | MT_PAY_RECORD_FIN        |    62M|  3003M|       |   149K  (2)| 00:29:52 |
|* 61 |                INDEX UNIQUE SCAN           | PK_BS_INSURED            |     1 |     6 |       |     1   (0)| 00:00:01 |
|* 62 |           SORT JOIN                        |                          |    21M|  4715M|    12G|  1282K  (1)| 04:16:26 |
|* 63 |            TABLE ACCESS FULL               | MT_BIZ_FIN               |    21M|  4715M|       |   209K  (2)| 00:41:57 |
|* 64 |          INDEX UNIQUE SCAN                 | PK_BS_INSURED            |     1 |     6 |       |     1   (0)| 00:00:01 |
|* 65 |         SORT JOIN                          |                          |  1325 | 43725 |       |     3  (34)| 00:00:01 |
|  66 |          INDEX FULL SCAN                   | IDX_BS_HOSPITAL_NAME     |  1325 | 43725 |       |     2   (0)| 00:00:01 |
-------------------------------------------------------------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
 
   2 - filter("T"."VALID_FLAG"='1')
   3 - access("T"."POLICY_CODE"='can_clinic_flag' AND "T"."CENTER_ID"='430701')
       filter("T"."CENTER_ID"='430701')
   5 - filter("T"."VALID_FLAG"='1')
   6 - access("T"."POLICY_CODE"='can_clinic_flag' AND "T"."CENTER_ID"='0')
       filter("T"."CENTER_ID"='0')
   8 - access("BS"."SEX"=TO_NUMBER(:B1))
  10 - access("PP"."PERS_TYPE"=TO_NUMBER(:B1) AND "PP"."CENTER_ID"=:B2)
  13 - access("A"."INDI_ID"=:B1)
  15 - access("T"."INDI_ID"=:B1)
  17 - access("T"."CENTER_ID"=NVL(:B1,:B2) AND "T"."ICD"=:B3)
  19 - access("T"."SERIAL_APPLY"=:B1)
  21 - access("Q"."CENTER_ID"=NVL(:B1,:B2) AND "Q"."ICD"=:B3)
  23 - access("TREATMENT_TYPE"=:B1 AND "CENTER_ID"=:B2)
  25 - filter("SS"."VALID_FLAG"='1')
  26 - access("SS"."HOSPITAL_ID"=:B1 AND "SS"."SERIAL_NO"=:B2)
       filter("SS"."STAT_TYPE"='001' OR "SS"."STAT_TYPE"='002' OR "SS"."STAT_TYPE"='003')
  28 - filter("SS"."VALID_FLAG"='1')
  29 - access("SS"."HOSPITAL_ID"=:B1 AND "SS"."SERIAL_NO"=:B2)
       filter("SS"."STAT_TYPE"='001' OR "SS"."STAT_TYPE"='002' OR "SS"."STAT_TYPE"='003')
  33 - access("B"."CORP_ID"="STREET"."CORP_ID"(+))
  35 - access("CORP"."AREA_CODE"="ST"."QYBM")
  37 - filter("CORP"."AREA_CODE" IS NOT NULL)
  38 - access("B"."CENTER_ID"="G"."CENTER_ID" AND "B"."BIZ_TYPE"="G"."BIZ_TYPE")
  40 - access("B"."CENTER_ID"="H"."CENTER_ID"(+))
  48 - access("$nso_col_1"="B"."HOSPITAL_ID"||"B"."SERIAL_NO")
  51 - filter("BIZ_TYPE"<>'12' OR "BIZ_FLAG"=18 AND "BIZ_TYPE"='12')
  53 - filter("OUTPAY_BILL_NO"=23)
  54 - access("MONTH_DECL_SN"="RELA_DECL_SN")
  56 - access("B"."CENTER_ID"="G"."CENTER_ID" AND "B"."BIZ_TYPE"="G"."BIZ_TYPE")
  58 - access("B"."HOSPITAL_ID"="C"."HOSPITAL_ID" AND "B"."SERIAL_NO"="C"."SERIAL_NO")
  59 - filter("B"."VALID_FLAG"='1')
  60 - filter("C"."VALID_FLAG"='1')
  61 - access("B"."INDI_ID"="J"."INDI_ID")
  62 - access("B"."HOSPITAL_ID"="T"."HOSPITAL_ID" AND "B"."SERIAL_NO"="T"."SERIAL_NO")
       filter("B"."SERIAL_NO"="T"."SERIAL_NO" AND "B"."HOSPITAL_ID"="T"."HOSPITAL_ID")
  63 - filter("B"."VALID_FLAG"='1')
  64 - access("B"."INDI_ID"="J"."INDI_ID")
  65 - access("A"."HOSPITAL_ID"="B"."HOSPITAL_ID")
       filter("A"."HOSPITAL_ID"="B"."HOSPITAL_ID")

使用调整任务生成的sql profile优化后的执行计划

2- Using SQL Profile
--------------------
Plan hash value: 3772053484
 
----------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                                     | Name                     | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
----------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                              |                          | 20043 |    29M|       |   309K  (1)| 01:01:52 |
|   1 |  HASH UNIQUE                                  |                          |     1 |    31 |       |     2  (50)| 00:00:01 |
|*  2 |   TABLE ACCESS BY INDEX ROWID                 | FC_BIZ_POLICY            |     1 |    31 |       |     1   (0)| 00:00:01 |
|*  3 |    INDEX RANGE SCAN                           | PK_FC_BIZ_POLICY         |     1 |       |       |     1   (0)| 00:00:01 |
|   4 |    HASH UNIQUE                                |                          |     1 |    31 |       |     2  (50)| 00:00:01 |
|*  5 |     TABLE ACCESS BY INDEX ROWID               | FC_BIZ_POLICY            |     1 |    31 |       |     1   (0)| 00:00:01 |
|*  6 |      INDEX RANGE SCAN                         | PK_FC_BIZ_POLICY         |     1 |       |       |     1   (0)| 00:00:01 |
|   7 |  TABLE ACCESS BY INDEX ROWID                  | BS_SEX                   |     1 |     6 |       |     1   (0)| 00:00:01 |
|*  8 |   INDEX UNIQUE SCAN                           | PK_BS_SEX                |     1 |       |       |     1   (0)| 00:00:01 |
|   9 |  TABLE ACCESS BY INDEX ROWID                  | BS_PERSON_TYPE           |     1 |    18 |       |     1   (0)| 00:00:01 |
|* 10 |   INDEX UNIQUE SCAN                           | PK_BS_PERSON_TYPE        |     1 |       |       |     1   (0)| 00:00:01 |
|  11 |  SORT AGGREGATE                               |                          |     1 |    18 |       |            |          |
|  12 |   TABLE ACCESS BY INDEX ROWID                 | BS_INSURED               |     1 |    18 |       |     1   (0)| 00:00:01 |
|* 13 |    INDEX UNIQUE SCAN                          | PK_BS_INSURED            |     1 |       |       |     1   (0)| 00:00:01 |
|  14 |  TABLE ACCESS BY INDEX ROWID                  | BS_CORP_PRES             |     1 |     8 |       |     1   (0)| 00:00:01 |
|* 15 |   INDEX RANGE SCAN                            | INDEX_BS_CORP_PRES_INDI  |     1 |       |       |     1   (0)| 00:00:01 |
|  16 |  TABLE ACCESS BY INDEX ROWID                  | BS_DISEASE               |     1 |    33 |       |     1   (0)| 00:00:01 |
|* 17 |   INDEX RANGE SCAN                            | INX_BS_DISEASE_01        |     1 |       |       |     1   (0)| 00:00:01 |
|  18 |  TABLE ACCESS BY INDEX ROWID                  | MT_APPLY                 |     1 |     9 |       |     1   (0)| 00:00:01 |
|* 19 |   INDEX UNIQUE SCAN                           | PK_MT_APPLY              |     1 |       |       |     1   (0)| 00:00:01 |
|  20 |  TABLE ACCESS BY INDEX ROWID                  | BS_DISEASE               |     1 |    33 |       |     1   (0)| 00:00:01 |
|* 21 |   INDEX RANGE SCAN                            | INX_BS_DISEASE_01        |     1 |       |       |     1   (0)| 00:00:01 |
|  22 |  TABLE ACCESS BY INDEX ROWID                  | BS_TREAT_TYPE            |     1 |    23 |       |     1   (0)| 00:00:01 |
|* 23 |   INDEX UNIQUE SCAN                           | PK_BS_TREAT_TYPE         |     1 |       |       |     1   (0)| 00:00:01 |
|  24 |  SORT AGGREGATE                               |                          |     1 |    34 |       |            |          |
|* 25 |   TABLE ACCESS BY INDEX ROWID                 | MT_FEE_STAT_FIN          |     1 |    34 |       |     1   (0)| 00:00:01 |
|* 26 |    INDEX RANGE SCAN                           | PK_MT_FEE_STAT_FIN       |     1 |       |       |     1   (0)| 00:00:01 |
|  27 |  SORT AGGREGATE                               |                          |     1 |    31 |       |            |          |
|* 28 |   TABLE ACCESS BY INDEX ROWID                 | MT_FEE_STAT_FIN          |     1 |    31 |       |     1   (0)| 00:00:01 |
|* 29 |    INDEX RANGE SCAN                           | PK_MT_FEE_STAT_FIN       |     1 |       |       |     1   (0)| 00:00:01 |
|  30 |  VIEW                                         |                          | 20043 |    29M|       |   309K  (1)| 01:01:52 |
|  31 |   SORT ORDER BY                               |                          | 20043 |    16M|    34M|   309K  (1)| 01:01:52 |
|  32 |    COUNT                                      |                          |       |       |       |            |          |
|  33 |     NESTED LOOPS                              |                          | 20043 |    16M|       |   305K  (1)| 01:01:08 |
|* 34 |      HASH JOIN                                |                          | 20011 |    16M|       |   305K  (1)| 01:01:07 |
|  35 |       TABLE ACCESS FULL                       | BS_BIZTYPE               |    97 |  1164 |       |     3   (0)| 00:00:01 |
|* 36 |       HASH JOIN RIGHT OUTER                   |                          | 20011 |    16M|       |   305K  (1)| 01:01:07 |
|  37 |        TABLE ACCESS FULL                      | BS_CENTER                |    12 |   168 |       |     3   (0)| 00:00:01 |
|* 38 |        HASH JOIN RIGHT OUTER                  |                          | 20011 |    16M|       |   305K  (1)| 01:01:07 |
|  39 |         VIEW                                  |                          |     1 |    12 |       |   117   (2)| 00:00:02 |
|* 40 |          HASH JOIN                            |                          |     1 |    18 |       |   117   (2)| 00:00:02 |
|  41 |           TABLE ACCESS FULL                   | BS_COUNTRY_STREET        |     1 |     7 |       |     2   (0)| 00:00:01 |
|* 42 |           TABLE ACCESS FULL                   | BS_CORP                  |  9523 |   102K|       |   114   (1)| 00:00:02 |
|* 43 |         HASH JOIN                             |                          | 20011 |    15M|       |   305K  (1)| 01:01:06 |
|  44 |          INDEX FULL SCAN                      | IDX_BS_HOSPITAL_NAME     |  1325 | 43725 |       |     2   (0)| 00:00:01 |
|* 45 |          TABLE ACCESS BY INDEX ROWID          | MT_BIZ_FIN               |     1 |   225 |       |     1   (0)| 00:00:01 |
|  46 |           NESTED LOOPS                        |                          | 25021 |    19M|       |   305K  (1)| 01:01:06 |
|  47 |            VIEW                               |                          | 25349 |    13M|       |   295K  (1)| 00:59:04 |
|  48 |             HASH GROUP BY                     |                          | 25349 |  1460K|       |   295K  (1)| 00:59:04 |
|  49 |              VIEW                             |                          | 25349 |  1460K|       |   295K  (1)| 00:59:04 |
|  50 |               HASH UNIQUE                     |                          | 25349 |  4876K|    10M|   295K  (1)| 00:59:04 |
|  51 |                NESTED LOOPS                   |                          | 25349 |  4876K|       |   294K  (1)| 00:58:51 |
|  52 |                 NESTED LOOPS                  |                          | 25309 |  4424K|       |   294K  (1)| 00:58:51 |
|  53 |                  NESTED LOOPS                 |                          | 25309 |  3880K|       |   294K  (1)| 00:58:51 |
|* 54 |                   HASH JOIN                   |                          | 25502 |  2365K|   189M|   289K  (1)| 00:57:50 |
|* 55 |                    TABLE ACCESS BY INDEX ROWID| PM_ACCOUNT_BIZ           |   205 |  6560 |       |     9   (0)| 00:00:01 |
|  56 |                     NESTED LOOPS              |                          |  3750K|   146M|       |  1405   (2)| 00:00:17 |
|* 57 |                      TABLE ACCESS FULL        | PM_BILL                  |    31 |   279 |       |  1119   (2)| 00:00:14 |
|* 58 |                      INDEX RANGE SCAN         | IDX_PM_ACCOUNT_BIZ_MONTH |   213 |       |       |     1   (0)| 00:00:01 |
|* 59 |                    TABLE ACCESS FULL          | MT_BIZ_FIN               |    21M|  1131M|       |   209K  (2)| 00:41:54 |
|* 60 |                   TABLE ACCESS BY INDEX ROWID | MT_PAY_RECORD_FIN        |     1 |    62 |       |     1   (0)| 00:00:01 |
|* 61 |                    INDEX RANGE SCAN           | IDX$$_429C0002           |     1 |       |       |     1   (0)| 00:00:01 |
|* 62 |                  INDEX UNIQUE SCAN            | PK_BS_BIZTYPE            |     1 |    22 |       |     1   (0)| 00:00:01 |
|* 63 |                 INDEX UNIQUE SCAN             | PK_BS_INSURED            |     1 |    18 |       |     1   (0)| 00:00:01 |
|* 64 |            INDEX RANGE SCAN                   | PK_MT_BIZ_FIN            |     1 |       |       |     1   (0)| 00:00:01 |
|* 65 |      INDEX UNIQUE SCAN                        | PK_BS_INSURED            |     1 |     6 |       |     1   (0)| 00:00:01 |
----------------------------------------------------------------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
 
   2 - filter("T"."VALID_FLAG"='1')
   3 - access("T"."POLICY_CODE"='can_clinic_flag' AND "T"."CENTER_ID"='430701')
       filter("T"."CENTER_ID"='430701')
   5 - filter("T"."VALID_FLAG"='1')
   6 - access("T"."POLICY_CODE"='can_clinic_flag' AND "T"."CENTER_ID"='0')
       filter("T"."CENTER_ID"='0')
   8 - access("BS"."SEX"=TO_NUMBER(:B1))
  10 - access("PP"."PERS_TYPE"=TO_NUMBER(:B1) AND "PP"."CENTER_ID"=:B2)
  13 - access("A"."INDI_ID"=:B1)
  15 - access("T"."INDI_ID"=:B1)
  17 - access("T"."CENTER_ID"=NVL(:B1,:B2) AND "T"."ICD"=:B3)
  19 - access("T"."SERIAL_APPLY"=:B1)
  21 - access("Q"."CENTER_ID"=NVL(:B1,:B2) AND "Q"."ICD"=:B3)
  23 - access("TREATMENT_TYPE"=:B1 AND "CENTER_ID"=:B2)
  25 - filter("SS"."VALID_FLAG"='1')
  26 - access("SS"."HOSPITAL_ID"=:B1 AND "SS"."SERIAL_NO"=:B2)
       filter("SS"."STAT_TYPE"='001' OR "SS"."STAT_TYPE"='002' OR "SS"."STAT_TYPE"='003')
  28 - filter("SS"."VALID_FLAG"='1')
  29 - access("SS"."HOSPITAL_ID"=:B1 AND "SS"."SERIAL_NO"=:B2)
       filter("SS"."STAT_TYPE"='001' OR "SS"."STAT_TYPE"='002' OR "SS"."STAT_TYPE"='003')
  34 - access("B"."CENTER_ID"="G"."CENTER_ID" AND "B"."BIZ_TYPE"="G"."BIZ_TYPE")
  36 - access("B"."CENTER_ID"="H"."CENTER_ID"(+))
  38 - access("B"."CORP_ID"="STREET"."CORP_ID"(+))
  40 - access("CORP"."AREA_CODE"="ST"."QYBM")
  42 - filter("CORP"."AREA_CODE" IS NOT NULL)
  43 - access("A"."HOSPITAL_ID"="B"."HOSPITAL_ID")
  45 - filter("B"."VALID_FLAG"='1')
  54 - access("B"."HOSPITAL_ID"||"B"."SERIAL_NO"="HOSPITAL_ID"||"SERIAL_NO")
  55 - filter("BIZ_TYPE"<>'12' OR "BIZ_FLAG"=18 AND "BIZ_TYPE"='12')
  57 - filter("OUTPAY_BILL_NO"=23)
  58 - access("MONTH_DECL_SN"="RELA_DECL_SN")
  59 - filter("B"."VALID_FLAG"='1')
  60 - filter("C"."VALID_FLAG"='1')
  61 - access("B"."HOSPITAL_ID"="C"."HOSPITAL_ID" AND "B"."SERIAL_NO"="C"."SERIAL_NO")
  62 - access("B"."CENTER_ID"="G"."CENTER_ID" AND "B"."BIZ_TYPE"="G"."BIZ_TYPE")
  63 - access("B"."INDI_ID"="J"."INDI_ID")
  64 - access("B"."HOSPITAL_ID"="T"."HOSPITAL_ID" AND "B"."SERIAL_NO"="T"."SERIAL_NO")
  65 - access("B"."INDI_ID"="J"."INDI_ID")
 
-------------------------------------------------------------------------------
 
task_name
---------
TASK_39762
err
---------
0
err
---------
0

接受调整优化生成的sql profile

SQL> execute dbms_sqltune.accept_sql_profile(task_name => 'TASK_39762',replace => TRUE);
 
PL/SQL procedure successfully completed

SQL> select * from dba_sql_profiles where sql_text like 'select rowno, hos_serial, reg_flag,%';
 
NAME                           CATEGORY    SIGNATURE SQL_TEXT                              CREATED     LAST_MODIFIED DESCRIPTION   TYPE      STATUS   FORCE_MATCHING
------------------------------ ---------- ---------- ------------------------------------- ----------- ------------- ------------- --------- -------- --------------
SYS_SQLPROF_0154fb8617518000   DEFAULT    9.22119799 select rowno, hos_serial, reg_flag,   2016/4/5 16: 2016/4/5 16:31               MANUAL    ENABLED  NO
             

重新执行该SQL需要几分钟才能执行完成
4
查看其执行计划

SQL> set long 900
SQL> set linesize 900
SQL> select * from table(dbms_xplan.display_cursor('010tbjyy9cztf',null,'ALL ALLSTATS'));

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  010tbjyy9cztf, child number 0
-------------------------------------
select rowno, hos_serial, reg_flag,        nvl((SELECT distinct t.policy_value               FROM fc_biz_policy t              WHERE t.policy_code =
'can_clinic_flag'                and t.valid_flag = '1'                and t.center_id = '430701'), (SELECT distinct t.policy_value
FROM fc_biz_policy t                WHERE t.policy_code =                      'can_clinic_flag'                  and t.valid_flag = '1'
    and t.center_id = '0')) AS can_clinic_flag,        decode(DISEASE_TYPE, 'A', '病种单纯', 'B', '严重', 'C', '严重并发', 'D', '危重', '') DISEASE_TYPE,
hospital_id, hospital_name, serial_no, biz_type, case_id, biz_stat,        name, sex, pers_type, begin_date, end_date, fin_date, finish_date,
reg_date, in_days, indi_id, insr_code, fin_staff, fin_man, corp_id,        idcard, district_code, office_grade,center_id,        (select
t.special_code            from bs_corp_pres t           where t.indi_id = w.indi_id) as special_code, corp

Plan hash value: 3772053484



--------------------------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                                     | Name                     | E-Rows |E-Bytes|E-Temp | Cost (%CPU)| E-Time   |  OMem |  1Mem |  O/1/M   |
--------------------------------------------------------------------------------------------------------------------------------------------------------------
|   1 |  HASH UNIQUE                                  |                          |      1 |    31 |       |     2  (50)| 00:00:01 |  1307K|  1307K|          |
|*  2 |   TABLE ACCESS BY INDEX ROWID                 | FC_BIZ_POLICY            |      1 |    31 |       |     1   (0)| 00:00:01 |       |       |          |
|*  3 |    INDEX RANGE SCAN                           | PK_FC_BIZ_POLICY         |      1 |       |       |     1   (0)| 00:00:01 |       |       |          |
|   4 |    HASH UNIQUE                                |                          |      1 |    31 |       |     2  (50)| 00:00:01 |  1307K|  1307K|          |
|*  5 |     TABLE ACCESS BY INDEX ROWID               | FC_BIZ_POLICY            |      1 |    31 |       |     1   (0)| 00:00:01 |       |       |          |
|*  6 |      INDEX RANGE SCAN                         | PK_FC_BIZ_POLICY         |      1 |       |       |     1   (0)| 00:00:01 |       |       |          |
|   7 |  TABLE ACCESS BY INDEX ROWID                  | BS_SEX                   |      1 |     6 |       |     1   (0)| 00:00:01 |       |       |          |
|*  8 |   INDEX UNIQUE SCAN                           | PK_BS_SEX                |      1 |       |       |     1   (0)| 00:00:01 |       |       |          |
|   9 |  TABLE ACCESS BY INDEX ROWID                  | BS_PERSON_TYPE           |      1 |    18 |       |     1   (0)| 00:00:01 |       |       |          |
|* 10 |   INDEX UNIQUE SCAN                           | PK_BS_PERSON_TYPE        |      1 |       |       |     1   (0)| 00:00:01 |       |       |          |
|  11 |  SORT AGGREGATE                               |                          |      1 |    18 |       |            |          |       |       |          |
|  12 |   TABLE ACCESS BY INDEX ROWID                 | BS_INSURED               |      1 |    18 |       |     1   (0)| 00:00:01 |       |       |          |
|* 13 |    INDEX UNIQUE SCAN                          | PK_BS_INSURED            |      1 |       |       |     1   (0)| 00:00:01 |       |       |          |
|  14 |  TABLE ACCESS BY INDEX ROWID                  | BS_CORP_PRES             |      1 |     8 |       |     1   (0)| 00:00:01 |       |       |          |
|* 15 |   INDEX RANGE SCAN                            | INDEX_BS_CORP_PRES_INDI  |      1 |       |       |     1   (0)| 00:00:01 |       |       |          |
|  16 |  TABLE ACCESS BY INDEX ROWID                  | BS_DISEASE               |      1 |    33 |       |     1   (0)| 00:00:01 |       |       |          |
|* 17 |   INDEX RANGE SCAN                            | INX_BS_DISEASE_01        |      1 |       |       |     1   (0)| 00:00:01 |       |       |          |
|  18 |  TABLE ACCESS BY INDEX ROWID                  | MT_APPLY                 |      1 |     9 |       |     1   (0)| 00:00:01 |       |       |          |
|* 19 |   INDEX UNIQUE SCAN                           | PK_MT_APPLY              |      1 |       |       |     1   (0)| 00:00:01 |       |       |          |
|  20 |  TABLE ACCESS BY INDEX ROWID                  | BS_DISEASE               |      1 |    33 |       |     1   (0)| 00:00:01 |       |       |          |
|* 21 |   INDEX RANGE SCAN                            | INX_BS_DISEASE_01        |      1 |       |       |     1   (0)| 00:00:01 |       |       |          |
|  22 |  TABLE ACCESS BY INDEX ROWID                  | BS_TREAT_TYPE            |      1 |    23 |       |     1   (0)| 00:00:01 |       |       |          |
|* 23 |   INDEX UNIQUE SCAN                           | PK_BS_TREAT_TYPE         |      1 |       |       |     1   (0)| 00:00:01 |       |       |          |
|  24 |  SORT AGGREGATE                               |                          |      1 |    34 |       |            |          |       |       |          |
|* 25 |   TABLE ACCESS BY INDEX ROWID                 | MT_FEE_STAT_FIN          |      1 |    34 |       |     1   (0)| 00:00:01 |       |       |          |
|* 26 |    INDEX RANGE SCAN                           | PK_MT_FEE_STAT_FIN       |      1 |       |       |     1   (0)| 00:00:01 |       |       |          |
|  27 |  SORT AGGREGATE                               |                          |      1 |    31 |       |            |          |       |       |          |
|* 28 |   TABLE ACCESS BY INDEX ROWID                 | MT_FEE_STAT_FIN          |      1 |    31 |       |     1   (0)| 00:00:01 |       |       |          |
|* 29 |    INDEX RANGE SCAN                           | PK_MT_FEE_STAT_FIN       |      1 |       |       |     1   (0)| 00:00:01 |       |       |          |
|  30 |  VIEW                                         |                          |  20043 |    29M|       |   309K  (1)| 01:01:52 |       |       |          |
|  31 |   SORT ORDER BY                               |                          |  20043 |    16M|    34M|   309K  (1)| 01:01:52 |    18M|  1609K|          |
|  32 |    COUNT                                      |                          |        |       |       |            |          |       |       |          |
|  33 |     NESTED LOOPS                              |                          |  20043 |    16M|       |   305K  (1)| 01:01:08 |       |       |          |
|* 34 |      HASH JOIN                                |                          |  20011 |    16M|       |   305K  (1)| 01:01:07 |  1000K|  1000K|          |
|  35 |       TABLE ACCESS FULL                       | BS_BIZTYPE               |     97 |  1164 |       |     3   (0)| 00:00:01 |       |       |          |
|* 36 |       HASH JOIN RIGHT OUTER                   |                          |  20011 |    16M|       |   305K  (1)| 01:01:07 |  1000K|  1000K|          |
|  37 |        TABLE ACCESS FULL                      | BS_CENTER                |     12 |   168 |       |     3   (0)| 00:00:01 |       |       |          |
|* 38 |        HASH JOIN RIGHT OUTER                  |                          |  20011 |    16M|       |   305K  (1)| 01:01:07 |  1023K|  1023K|          |
|  39 |         VIEW                                  |                          |      1 |    12 |       |   117   (2)| 00:00:02 |       |       |          |
|* 40 |          HASH JOIN                            |                          |      1 |    18 |       |   117   (2)| 00:00:02 |  1133K|  1133K|     1/0/0|
|  41 |           TABLE ACCESS FULL                   | BS_COUNTRY_STREET        |      1 |     7 |       |     2   (0)| 00:00:01 |       |       |          |
|* 42 |           TABLE ACCESS FULL                   | BS_CORP                  |   9523 |   102K|       |   114   (1)| 00:00:02 |       |       |          |
|* 43 |         HASH JOIN                             |                          |  20011 |    15M|       |   305K  (1)| 01:01:06 |   876K|   876K|          |
|  44 |          INDEX FULL SCAN                      | IDX_BS_HOSPITAL_NAME     |   1325 | 43725 |       |     2   (0)| 00:00:01 |       |       |          |
|* 45 |          TABLE ACCESS BY INDEX ROWID          | MT_BIZ_FIN               |      1 |   225 |       |     1   (0)| 00:00:01 |       |       |          |
|  46 |           NESTED LOOPS                        |                          |  25021 |    19M|       |   305K  (1)| 01:01:06 |       |       |          |
|  47 |            VIEW                               |                          |  25349 |    13M|       |   295K  (1)| 00:59:04 |       |       |          |
|  48 |             HASH GROUP BY                     |                          |  25349 |  1460K|       |   295K  (1)| 00:59:04 |  5134K|  1981K|          |
|  49 |              VIEW                             |                          |  25349 |  1460K|       |   295K  (1)| 00:59:04 |       |       |          |
|  50 |               HASH UNIQUE                     |                          |  25349 |  4876K|    10M|   295K  (1)| 00:59:04 |    32M|  3975K|          |
|  51 |                NESTED LOOPS                   |                          |  25349 |  4876K|       |   294K  (1)| 00:58:51 |       |       |          |
|  52 |                 NESTED LOOPS                  |                          |  25309 |  4424K|       |   294K  (1)| 00:58:51 |       |       |          |
|  53 |                  NESTED LOOPS                 |                          |  25309 |  3880K|       |   294K  (1)| 00:58:51 |       |       |          |
|* 54 |                   HASH JOIN                   |                          |  25502 |  2365K|   189M|   289K  (1)| 00:57:50 |  1314K|  1168K|     1/0/0|
|* 55 |                    TABLE ACCESS BY INDEX ROWID| PM_ACCOUNT_BIZ           |    205 |  6560 |       |     9   (0)| 00:00:01 |       |       |          |
|  56 |                     NESTED LOOPS              |                          |   3750K|   146M|       |  1405   (2)| 00:00:17 |       |       |          |
|* 57 |                      TABLE ACCESS FULL        | PM_BILL                  |     31 |   279 |       |  1119   (2)| 00:00:14 |       |       |          |
|* 58 |                      INDEX RANGE SCAN         | IDX_PM_ACCOUNT_BIZ_MONTH |    213 |       |       |     1   (0)| 00:00:01 |       |       |          |
|* 59 |                    TABLE ACCESS FULL          | MT_BIZ_FIN               |     21M|  1131M|       |   209K  (2)| 00:41:54 |       |       |          |
|* 60 |                   TABLE ACCESS BY INDEX ROWID | MT_PAY_RECORD_FIN        |      1 |    62 |       |     1   (0)| 00:00:01 |       |       |          |
|* 61 |                    INDEX RANGE SCAN           | IDX$$_429C0002           |      1 |       |       |     1   (0)| 00:00:01 |       |       |          |
|* 62 |                  INDEX UNIQUE SCAN            | PK_BS_BIZTYPE            |      1 |    22 |       |     1   (0)| 00:00:01 |       |       |          |
|* 63 |                 INDEX UNIQUE SCAN             | PK_BS_INSURED            |      1 |    18 |       |     1   (0)| 00:00:01 |       |       |          |
|* 64 |            INDEX RANGE SCAN                   | PK_MT_BIZ_FIN            |      1 |       |       |     1   (0)| 00:00:01 |       |       |          |
|* 65 |      INDEX UNIQUE SCAN                        | PK_BS_INSURED            |      1 |     6 |       |     1   (0)| 00:00:01 |       |       |          |
--------------------------------------------------------------------------------------------------------------------------------------------------------------

Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------

   1 - SEL$2
   2 - SEL$2        / T@SEL$2
   3 - SEL$2        / T@SEL$2
   4 - SEL$3
   5 - SEL$3        / T@SEL$3
   6 - SEL$3        / T@SEL$3
   7 - SEL$7        / BS@SEL$7
   8 - SEL$7        / BS@SEL$7
   9 - SEL$8        / PP@SEL$8
  10 - SEL$8        / PP@SEL$8
  11 - SEL$15
  12 - SEL$15       / A@SEL$15
  13 - SEL$15       / A@SEL$15
  14 - SEL$4        / T@SEL$4
  15 - SEL$4        / T@SEL$4
  16 - SEL$9        / T@SEL$9
  17 - SEL$9        / T@SEL$9
  18 - SEL$11       / T@SEL$11
  19 - SEL$11       / T@SEL$11
  20 - SEL$10       / Q@SEL$10
  21 - SEL$10       / Q@SEL$10
  22 - SEL$5        / BS_TREAT_TYPE@SEL$5
  23 - SEL$5        / BS_TREAT_TYPE@SEL$5
  24 - SEL$16
  25 - SEL$16       / SS@SEL$16
 26 - SEL$16       / SS@SEL$16
  27 - SEL$17
  28 - SEL$17       / SS@SEL$17
  29 - SEL$17       / SS@SEL$17
  30 - SEL$6        / W@SEL$1
  31 - SEL$6
  35 - SEL$6        / G@SEL$6
  37 - SEL$6        / H@SEL$6
  39 - SEL$8F7BCF6F / STREET@SEL$6
  40 - SEL$8F7BCF6F
  41 - SEL$8F7BCF6F / ST@SEL$12
  42 - SEL$8F7BCF6F / CORP@SEL$12
  44 - SEL$6        / A@SEL$6
  45 - SEL$6        / B@SEL$6
  47 - SEL$6C11BF2C / T@SEL$6
  48 - SEL$6C11BF2C
  49 - SEL$93984FCC / $vm_view@SEL$6C11BF2C
  50 - SEL$93984FCC
  55 - SEL$93984FCC / PM_ACCOUNT_BIZ@SEL$18
  57 - SEL$93984FCC / PM_BILL@SEL$19
  58 - SEL$93984FCC / PM_ACCOUNT_BIZ@SEL$18
  59 - SEL$93984FCC / B@SEL$14
  60 - SEL$93984FCC / C@SEL$14
  61 - SEL$93984FCC / C@SEL$14
  62 - SEL$93984FCC / G@SEL$14
  63 - SEL$93984FCC / J@SEL$14
  64 - SEL$6        / B@SEL$6
  65 - SEL$6        / J@SEL$6

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - filter("T"."VALID_FLAG"='1')
   3 - access("T"."POLICY_CODE"='can_clinic_flag' AND "T"."CENTER_ID"='430701')
       filter("T"."CENTER_ID"='430701')
   5 - filter("T"."VALID_FLAG"='1')
   6 - access("T"."POLICY_CODE"='can_clinic_flag' AND "T"."CENTER_ID"='0')
       filter("T"."CENTER_ID"='0')
   8 - access("BS"."SEX"=TO_NUMBER(:B1))
  10 - access("PP"."PERS_TYPE"=TO_NUMBER(:B1) AND "PP"."CENTER_ID"=:B2)
  13 - access("A"."INDI_ID"=:B1)
  15 - access("T"."INDI_ID"=:B1)
  17 - access("T"."CENTER_ID"=NVL(:B1,:B2) AND "T"."ICD"=:B3)
  19 - access("T"."SERIAL_APPLY"=:B1)
  21 - access("Q"."CENTER_ID"=NVL(:B1,:B2) AND "Q"."ICD"=:B3)
  23 - access("TREATMENT_TYPE"=:B1 AND "CENTER_ID"=:B2)
  25 - filter("SS"."VALID_FLAG"='1')
  26 - access("SS"."HOSPITAL_ID"=:B1 AND "SS"."SERIAL_NO"=:B2)
       filter(("SS"."STAT_TYPE"='001' OR "SS"."STAT_TYPE"='002' OR "SS"."STAT_TYPE"='003'))
  28 - filter("SS"."VALID_FLAG"='1')
  29 - access("SS"."HOSPITAL_ID"=:B1 AND "SS"."SERIAL_NO"=:B2)
       filter(("SS"."STAT_TYPE"='001' OR "SS"."STAT_TYPE"='002' OR "SS"."STAT_TYPE"='003'))
  34 - access("B"."CENTER_ID"="G"."CENTER_ID" AND "B"."BIZ_TYPE"="G"."BIZ_TYPE")
  36 - access("B"."CENTER_ID"="H"."CENTER_ID")
  38 - access("B"."CORP_ID"="STREET"."CORP_ID")
  40 - access("CORP"."AREA_CODE"="ST"."QYBM")
  42 - filter("CORP"."AREA_CODE" IS NOT NULL)
  43 - access("A"."HOSPITAL_ID"="B"."HOSPITAL_ID")
  45 - filter("B"."VALID_FLAG"='1')
  54 - access("B"."HOSPITAL_ID"||"B"."SERIAL_NO"="HOSPITAL_ID"||"SERIAL_NO")
  55 - filter(("BIZ_TYPE"<>'12' OR ("BIZ_FLAG"=18 AND "BIZ_TYPE"='12')))
  57 - filter("OUTPAY_BILL_NO"=23)
  58 - access("MONTH_DECL_SN"="RELA_DECL_SN")
  59 - filter("B"."VALID_FLAG"='1')
  60 - filter("C"."VALID_FLAG"='1')
  61 - access("B"."HOSPITAL_ID"="C"."HOSPITAL_ID" AND "B"."SERIAL_NO"="C"."SERIAL_NO")
  62 - access("B"."CENTER_ID"="G"."CENTER_ID" AND "B"."BIZ_TYPE"="G"."BIZ_TYPE")
  63 - access("B"."INDI_ID"="J"."INDI_ID")
  64 - access("B"."HOSPITAL_ID"="T"."HOSPITAL_ID" AND "B"."SERIAL_NO"="T"."SERIAL_NO")
  65 - access("B"."INDI_ID"="J"."INDI_ID")

Column Projection Information (identified by operation id):
-----------------------------------------------------------

   1 - "T"."POLICY_VALUE"[VARCHAR2,200]
   2 - "T"."POLICY_VALUE"[VARCHAR2,200]
   3 - "T".ROWID[ROWID,10]
   4 - "T"."POLICY_VALUE"[VARCHAR2,200]
   5 - "T"."POLICY_VALUE"[VARCHAR2,200]
   6 - "T".ROWID[ROWID,10]
   7 - "BS".ROWID[ROWID,10], "BS"."SEX_NAME"[VARCHAR2,5]
   8 - "BS".ROWID[ROWID,10]
   9 - "PP".ROWID[ROWID,10], "PP"."PERS_NAME"[VARCHAR2,20]
  10 - "PP".ROWID[ROWID,10]
  11 - (#keys=0) MAX("INSR_CODE")[30]
  12 - "INSR_CODE"[VARCHAR2,30]
  13 - "A".ROWID[ROWID,10]
  14 - "T".ROWID[ROWID,10], "T"."SPECIAL_CODE"[NUMBER,22]
  15 - "T".ROWID[ROWID,10]
  16 - "T".ROWID[ROWID,10], "T"."DISEASE"[VARCHAR2,100]
  17 - "T".ROWID[ROWID,10]
  18 - "T".ROWID[ROWID,10], "T"."APPLY_CONTENT"[VARCHAR2,3]
  19 - "T".ROWID[ROWID,10]
  20 - "Q".ROWID[ROWID,10], "Q"."DISEASE"[VARCHAR2,100]
  21 - "Q".ROWID[ROWID,10]
  22 - "BS_TREAT_TYPE".ROWID[ROWID,10], "TREATMENT_NAME"[VARCHAR2,50]
  23 - "BS_TREAT_TYPE".ROWID[ROWID,10]
  24 - (#keys=0) SUM("SS"."PART_SELF_MONEY")[22], SUM("SS"."ALL_SELF_MONEY")[22]
  25 - "SS"."PART_SELF_MONEY"[NUMBER,22], "SS"."ALL_SELF_MONEY"[NUMBER,22]
  26 - "SS".ROWID[ROWID,10]
  27 - (#keys=0) SUM("SS"."MONEY")[22]
  28 - "SS"."MONEY"[NUMBER,22]
  29 - "SS".ROWID[ROWID,10]
  30 - "ROWNO"[NUMBER,22], "HOS_SERIAL"[VARCHAR2,30], "REG_FLAG"[CHARACTER,1], "DISEASE_TYPE"[CHARACTER,1], "HOSPITAL_ID"[VARCHAR2,20],
       "HOSPITAL_NAME"[VARCHAR2,70], "SERIAL_NO"[VARCHAR2,16], "BIZ_TYPE"[VARCHAR2,2], "CASE_ID"[NUMBER,22], "BIZ_STAT"[VARCHAR2,2], "NAME"[VARCHAR2,20],
       "SEX"[VARCHAR2,5], "PERS_TYPE"[VARCHAR2,20], "BEGIN_DATE"[VARCHAR2,10], "END_DATE"[VARCHAR2,10], "FIN_DATE"[VARCHAR2,19], "FINISH_DATE"[VARCHAR2,19],
       "INDI_ID"[NUMBER,22], "INSR_CODE"[VARCHAR2,30], "FIN_STAFF"[VARCHAR2,10], "FIN_MAN"[VARCHAR2,30], "CORP_ID"[NUMBER,22], "IDCARD"[VARCHAR2,25],
       "REG_DATE"[VARCHAR2,19], "IN_DAYS"[NUMBER,22], "DISTRICT_CODE"[VARCHAR2,6], "CENTER_ID"[VARCHAR2,10], "OFFICE_GRADE"[VARCHAR2,3],
       "CORP_NAME"[VARCHAR2,70], "DISEASE"[VARCHAR2,100], "IN_AREA_NAME"[VARCHAR2,20], "IN_DEPT_NAME"[VARCHAR2,20], "IN_BED"[VARCHAR2,10],
       "BED_TYPE"[CHARACTER,1], "PATIENT_ID"[VARCHAR2,20], "REMARK"[VARCHAR2,1000], "POS_CODE"[VARCHAR2,10], "REIMBURSE_FLAG"[CHARACTER,1],
       "FIN_DISEASE"[VARCHAR2,100], "FOREGIFT"[NUMBER,1], "IC_NO"[VARCHAR2,25], "TREATMENT_TYPE"[VARCHAR2,3], "APPLY_CONTENT"[VARCHAR2,3],
       "REG_MAN"[VARCHAR2,20], "W"."AREA_CODE"[VARCHAR2,10], "FEES"[NUMBER,22], "PAY_MONEY_JD"[NUMBER,22], "FUND_MONEY"[NUMBER,22], "FUND_301"[NUMBER,22],
       "FUND_003"[NUMBER,22], "QFX"[NUMBER,22], "HOSP_ZF"[NUMBER,22], "CENTER_ZF"[NUMBER,22], "YW_FUND_MONEY"[NUMBER,22], "BC_FUND_MONEY"[NUMBER,22],
       "PAY_MONEY_ALLSELF"[NUMBER,22], "PAY_MONEY_SELF"[NUMBER,22], "PAY_MONEY_E00SELF"[NUMBER,22], "PAY_MONEY_Z00SELF"[NUMBER,22],
       "PAY_MONEY_S00SELF"[NUMBER,22], "PAY_MONEY_S01SELF"[NUMBER,22], "PAY_MONEY_C000SELF"[NUMBER,22], "PAY_MONEY_C001SELF"[NUMBER,22],
       "PAY_MONEY_C004SELF"[NUMBER,22], "PAY_MONEY_C006SELF"[NUMBER,22], "PAY_MONEY_C007SELF"[NUMBER,22], "PAY_MONEY_C007003SELF"[NUMBER,22],
       "DB_MONEY"[NUMBER,22], "YWSH_DB_MONEY"[NUMBER,1], "TC_MONEY"[NUMBER,22], "TC_MONEY_XE"[NUMBER,22], "HOSP_PAY"[NUMBER,22], "HOSP_PRISE"[NUMBER,22],
       "JMTC_MONEY"[NUMBER,22], "YW_MONEY"[NUMBER,22], "JMYW_MONEY"[NUMBER,22], "ACCT_MONEY"[NUMBER,22], "LX_MONEY"[NUMBER,22], "SY_MONEY"[NUMBER,22],
       "OFFI_MONEY"[NUMBER,22], "ZHAOGU_PAY"[NUMBER,22], "PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22], "MEDI_PAY"[NUMBER,22],
       "MEDI_ZFY"[NUMBER,22], "REG_INFO"[VARCHAR2,10], "DB_MONEY_JUMIN"[NUMBER,22]
  31 - (#keys=1) ROWNUM[22], "T"."DB_MONEY_JUMIN"[NUMBER,22], "B"."HOS_SERIAL"[VARCHAR2,30], "B"."REG_FLAG"[CHARACTER,1],
      "B"."DISEASE_TYPE"[CHARACTER,1], "A"."HOSPITAL_ID"[VARCHAR2,20], "A"."HOSPITAL_NAME"[VARCHAR2,70], "B"."SERIAL_NO"[VARCHAR2,16],
       "B"."BIZ_TYPE"[VARCHAR2,2], "B"."CASE_ID"[NUMBER,22], "G"."BIZ_STAT"[VARCHAR2,2], "B"."NAME"[VARCHAR2,20], [5], [20],
       TO_CHAR(INTERNAL_FUNCTION("B"."BEGIN_DATE"),'yyyy-mm-dd')[10], TO_CHAR(INTERNAL_FUNCTION("B"."END_DATE"),'yyyy-mm-dd')[10],
       TO_CHAR(INTERNAL_FUNCTION("B"."FIN_DATE"),'yyyy-mm-dd hh24:mi:ss')[19], TO_CHAR(INTERNAL_FUNCTION("B"."FIN_DATE"),'yyyy-mm-dd hh24:mi:ss')[19],
       "B"."INDI_ID"[NUMBER,22], "T"."INSR_CODE"[VARCHAR2,30], "B"."FIN_STAFF"[VARCHAR2,10], "B"."FIN_MAN"[VARCHAR2,30], "B"."CORP_ID"[NUMBER,22],
       "B"."IDCARD"[VARCHAR2,25], TO_CHAR(INTERNAL_FUNCTION("B"."REG_DATE"),'yyyy-mm-dd hh24:mi:ss')[19], NVL("B"."IN_DAYS",0)[22],
       "B"."DISTRICT_CODE"[VARCHAR2,6], "B"."CENTER_ID"[VARCHAR2,10], "B"."OFFICE_GRADE"[VARCHAR2,3], "B"."CORP_NAME"[VARCHAR2,70],
       "B"."IN_DISEASE"[VARCHAR2,20], [100], "B"."IN_AREA_NAME"[VARCHAR2,20], "B"."IN_DEPT_NAME"[VARCHAR2,20], "B"."IN_BED"[VARCHAR2,10],
','')[1000], "B"."POS_CODE"[VARCHAR2,10],PATIENT_ID"[VARCHAR2,20], TRANSLATE("B"."REMARK",'
       "B"."REIMBURSE_FLAG"[CHARACTER,1], [100], 0[1], "B"."IC_NO"[VARCHAR2,25], "B"."TREATMENT_TYPE"[VARCHAR2,3], [3], "B"."REG_MAN"[VARCHAR2,20],
       "STREET"."QYBM"[VARCHAR2,10], "T"."FEES"[NUMBER,22], "T"."PAY_MONEY_JD"[NUMBER,22], "T"."FUND_MONEY"[NUMBER,22], "T"."FUND_301"[NUMBER,22],
      "T"."FUND_003"[NUMBER,22], "T"."QFX"[NUMBER,22], "T"."HOSP_ZF"[NUMBER,22], "T"."CENTER_ZF"[NUMBER,22], "T"."YW_FUND_MONEY"[NUMBER,22],
       "T"."BC_FUND_MONEY"[NUMBER,22], "T"."PAY_MONEY_ALLSELF"[NUMBER,22], "T"."PAY_MONEY_SELF"[NUMBER,22], "T"."PAY_MONEY_E00SELF"[NUMBER,22],
       "T"."PAY_MONEY_Z00SELF"[NUMBER,22], "T"."PAY_MONEY_S00SELF"[NUMBER,22], "T"."PAY_MONEY_S01SELF"[NUMBER,22], "T"."PAY_MONEY_C000SELF"[NUMBER,22],
       "T"."PAY_MONEY_C001SELF"[NUMBER,22], "T"."PAY_MONEY_C004SELF"[NUMBER,22], "T"."PAY_MONEY_C006SELF"[NUMBER,22], "T"."PAY_MONEY_C007SELF"[NUMBER,22],
       "T"."PAY_MONEY_C007003SELF"[NUMBER,22], "T"."DB_MONEY"-"T"."YWSH_DB_MONEY"[22], "T"."YWSH_DB_MONEY"[NUMBER,1], "T"."TC_MONEY"[NUMBER,22],
       "T"."TC_MONEY_XE"[NUMBER,22], "T"."HOSP_PAY"[NUMBER,22], "T"."HOSP_PRISE"[NUMBER,22], "T"."JMTC_MONEY"[NUMBER,22], "T"."YW_MONEY"[NUMBER,22],
       "T"."JMYW_MONEY"[NUMBER,22], "T"."ACCT_MONEY"[NUMBER,22], "T"."LX_MONEY"[NUMBER,22], "T"."SY_MONEY"[NUMBER,22], "T"."OFFI_MONEY"[NUMBER,22],
       "T"."ZHAOGU_PAY"[NUMBER,22], "T"."PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22], "MEDI_PAY"[NUMBER,22], "MEDI_ZFY"[NUMBER,22],
       "B"."REG_INFO"[VARCHAR2,10]
  32 - "B"."CENTER_ID"[VARCHAR2,10], "B"."BIZ_TYPE"[VARCHAR2,2], "G"."BIZ_STAT"[VARCHAR2,2], "H"."CENTER_ID"[VARCHAR2,10],
       "B"."PERS_TYPE_DETAIL"[VARCHAR2,3], "H"."CATALOG_CENTER"[VARCHAR2,10], "B"."CORP_ID"[NUMBER,22], "STREET"."QYBM"[VARCHAR2,10],
       "A"."HOSPITAL_ID"[VARCHAR2,20], "A"."HOSPITAL_NAME"[VARCHAR2,70], "T"."INSR_CODE"[VARCHAR2,30], "T"."FEES"[NUMBER,22], "T"."PAY_MONEY_JD"[NUMBER,22],
       "T"."FUND_MONEY"[NUMBER,22], "T"."FUND_301"[NUMBER,22], "T"."FUND_003"[NUMBER,22], "T"."YW_FUND_MONEY"[NUMBER,22], "T"."BC_FUND_MONEY"[NUMBER,22],
       "T"."QFX"[NUMBER,22], "T"."HOSP_ZF"[NUMBER,22], "T"."CENTER_ZF"[NUMBER,22], "T"."PAY_MONEY_ALLSELF"[NUMBER,22], "T"."PAY_MONEY_SELF"[NUMBER,22],
       "T"."PAY_MONEY_E00SELF"[NUMBER,22], "T"."PAY_MONEY_Z00SELF"[NUMBER,22], "T"."PAY_MONEY_S00SELF"[NUMBER,22], "T"."PAY_MONEY_S01SELF"[NUMBER,22],
       "T"."PAY_MONEY_C000SELF"[NUMBER,22], "T"."PAY_MONEY_C001SELF"[NUMBER,22], "T"."PAY_MONEY_C004SELF"[NUMBER,22], "T"."PAY_MONEY_C006SELF"[NUMBER,22],
       "T"."PAY_MONEY_C007SELF"[NUMBER,22], "T"."PAY_MONEY_C007003SELF"[NUMBER,22], "T"."DB_MONEY"[NUMBER,22], "T"."YWSH_DB_MONEY"[NUMBER,1],
       "T"."TC_MONEY"[NUMBER,22], "T"."HOSP_PAY"[NUMBER,22], "T"."HOSP_PRISE"[NUMBER,22], "T"."TC_MONEY_XE"[NUMBER,22], "T"."JMTC_MONEY"[NUMBER,22],
       "T"."YW_MONEY"[NUMBER,22], "T"."JMYW_MONEY"[NUMBER,22], "T"."ACCT_MONEY"[NUMBER,22], "T"."LX_MONEY"[NUMBER,22], "T"."SY_MONEY"[NUMBER,22],
       "T"."OFFI_MONEY"[NUMBER,22], "T"."ZHAOGU_PAY"[NUMBER,22], "T"."PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22], "MEDI_PAY"[NUMBER,22],
       "MEDI_ZFY"[NUMBER,22], "T"."DB_MONEY_JUMIN"[NUMBER,22], "B"."DISEASE_TYPE"[CHARACTER,1], "B"."SERIAL_NO"[VARCHAR2,16], "B"."CASE_ID"[NUMBER,22],
       "B"."DISTRICT_CODE"[VARCHAR2,6], "B"."INDI_ID"[NUMBER,22], "B"."NAME"[VARCHAR2,20], "B"."SEX"[CHARACTER,1], "B"."OFFICE_GRADE"[VARCHAR2,3],
       "B"."IDCARD"[VARCHAR2,25], "B"."IC_NO"[VARCHAR2,25], "B"."HOS_SERIAL"[VARCHAR2,30], "B"."CORP_NAME"[VARCHAR2,70], "B"."TREATMENT_TYPE"[VARCHAR2,3],
       "B"."SERIAL_APPLY"[NUMBER,22], "B"."REG_DATE"[DATE,7], "B"."REG_MAN"[VARCHAR2,20], "B"."REG_FLAG"[CHARACTER,1], "B"."BEGIN_DATE"[DATE,7],
       "B"."REG_INFO"[VARCHAR2,10], "B"."IN_DEPT_NAME"[VARCHAR2,20], "B"."IN_AREA_NAME"[VARCHAR2,20], "B"."IN_BED"[VARCHAR2,10],
       "B"."BED_TYPE"[CHARACTER,1], "B"."PATIENT_ID"[VARCHAR2,20], "B"."IN_DISEASE"[VARCHAR2,20], "B"."IN_DAYS"[NUMBER,22], "B"."FIN_DISEASE"[VARCHAR2,20],
       "B"."END_DATE"[DATE,7], "B"."REIMBURSE_FLAG"[CHARACTER,1], "B"."POS_CODE"[VARCHAR2,10], "B"."REMARK"[VARCHAR2,500], "B"."FIN_DATE"[DATE,7],
       "B"."FIN_STAFF"[VARCHAR2,10], "B"."FIN_MAN"[VARCHAR2,30], ROWNUM[4]
  33 - "B"."CENTER_ID"[VARCHAR2,10], "B"."BIZ_TYPE"[VARCHAR2,2], "G"."BIZ_STAT"[VARCHAR2,2], "H"."CENTER_ID"[VARCHAR2,10],
       "B"."PERS_TYPE_DETAIL"[VARCHAR2,3], "H"."CATALOG_CENTER"[VARCHAR2,10], "B"."CORP_ID"[NUMBER,22], "STREET"."QYBM"[VARCHAR2,10],
       "A"."HOSPITAL_ID"[VARCHAR2,20], "A"."HOSPITAL_NAME"[VARCHAR2,70], "T"."INSR_CODE"[VARCHAR2,30], "T"."FEES"[NUMBER,22], "T"."PAY_MONEY_JD"[NUMBER,22],
       "T"."FUND_MONEY"[NUMBER,22], "T"."FUND_301"[NUMBER,22], "T"."FUND_003"[NUMBER,22], "T"."YW_FUND_MONEY"[NUMBER,22], "T"."BC_FUND_MONEY"[NUMBER,22],
       "T"."QFX"[NUMBER,22], "T"."HOSP_ZF"[NUMBER,22], "T"."CENTER_ZF"[NUMBER,22], "T"."PAY_MONEY_ALLSELF"[NUMBER,22], "T"."PAY_MONEY_SELF"[NUMBER,22],
      "T"."PAY_MONEY_E00SELF"[NUMBER,22], "T"."PAY_MONEY_Z00SELF"[NUMBER,22], "T"."PAY_MONEY_S00SELF"[NUMBER,22], "T"."PAY_MONEY_S01SELF"[NUMBER,22],
       "T"."PAY_MONEY_C000SELF"[NUMBER,22], "T"."PAY_MONEY_C001SELF"[NUMBER,22], "T"."PAY_MONEY_C004SELF"[NUMBER,22], "T"."PAY_MONEY_C006SELF"[NUMBER,22],
       "T"."PAY_MONEY_C007SELF"[NUMBER,22], "T"."PAY_MONEY_C007003SELF"[NUMBER,22], "T"."DB_MONEY"[NUMBER,22], "T"."YWSH_DB_MONEY"[NUMBER,1],
       "T"."TC_MONEY"[NUMBER,22], "T"."HOSP_PAY"[NUMBER,22], "T"."HOSP_PRISE"[NUMBER,22], "T"."TC_MONEY_XE"[NUMBER,22], "T"."JMTC_MONEY"[NUMBER,22],
       "T"."YW_MONEY"[NUMBER,22], "T"."JMYW_MONEY"[NUMBER,22], "T"."ACCT_MONEY"[NUMBER,22], "T"."LX_MONEY"[NUMBER,22], "T"."SY_MONEY"[NUMBER,22],
       "T"."OFFI_MONEY"[NUMBER,22], "T"."ZHAOGU_PAY"[NUMBER,22], "T"."PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22], "MEDI_PAY"[NUMBER,22],
       "MEDI_ZFY"[NUMBER,22], "T"."DB_MONEY_JUMIN"[NUMBER,22], "B"."DISEASE_TYPE"[CHARACTER,1], "B"."SERIAL_NO"[VARCHAR2,16], "B"."CASE_ID"[NUMBER,22],
       "B"."DISTRICT_CODE"[VARCHAR2,6], "B"."INDI_ID"[NUMBER,22], "B"."NAME"[VARCHAR2,20], "B"."SEX"[CHARACTER,1], "B"."OFFICE_GRADE"[VARCHAR2,3],
       "B"."IDCARD"[VARCHAR2,25], "B"."IC_NO"[VARCHAR2,25], "B"."HOS_SERIAL"[VARCHAR2,30], "B"."CORP_NAME"[VARCHAR2,70], "B"."TREATMENT_TYPE"[VARCHAR2,3],
       "B"."SERIAL_APPLY"[NUMBER,22], "B"."REG_DATE"[DATE,7], "B"."REG_MAN"[VARCHAR2,20], "B"."REG_FLAG"[CHARACTER,1], "B"."BEGIN_DATE"[DATE,7],
       "B"."REG_INFO"[VARCHAR2,10], "B"."IN_DEPT_NAME"[VARCHAR2,20], "B"."IN_AREA_NAME"[VARCHAR2,20], "B"."IN_BED"[VARCHAR2,10],
      "B"."BED_TYPE"[CHARACTER,1], "B"."PATIENT_ID"[VARCHAR2,20], "B"."IN_DISEASE"[VARCHAR2,20], "B"."IN_DAYS"[NUMBER,22], "B"."FIN_DISEASE"[VARCHAR2,20],
       "B"."END_DATE"[DATE,7], "B"."REIMBURSE_FLAG"[CHARACTER,1], "B"."POS_CODE"[VARCHAR2,10], "B"."REMARK"[VARCHAR2,500], "B"."FIN_DATE"[DATE,7],
       "B"."FIN_STAFF"[VARCHAR2,10], "B"."FIN_MAN"[VARCHAR2,30]
  34 - (#keys=2) "B"."CENTER_ID"[VARCHAR2,10], "B"."BIZ_TYPE"[VARCHAR2,2], "G"."BIZ_STAT"[VARCHAR2,2], "H"."CENTER_ID"[VARCHAR2,10],
       "B"."PERS_TYPE_DETAIL"[VARCHAR2,3], "H"."CATALOG_CENTER"[VARCHAR2,10], "B"."CORP_ID"[NUMBER,22], "STREET"."QYBM"[VARCHAR2,10],
       "A"."HOSPITAL_ID"[VARCHAR2,20], "A"."HOSPITAL_NAME"[VARCHAR2,70], "T"."INSR_CODE"[VARCHAR2,30], "T"."FEES"[NUMBER,22], "T"."PAY_MONEY_JD"[NUMBER,22],
       "T"."FUND_MONEY"[NUMBER,22], "T"."FUND_301"[NUMBER,22], "T"."FUND_003"[NUMBER,22], "T"."YW_FUND_MONEY"[NUMBER,22], "T"."BC_FUND_MONEY"[NUMBER,22],
       "T"."QFX"[NUMBER,22], "T"."HOSP_ZF"[NUMBER,22], "T"."CENTER_ZF"[NUMBER,22], "T"."PAY_MONEY_ALLSELF"[NUMBER,22], "T"."PAY_MONEY_SELF"[NUMBER,22],
       "T"."PAY_MONEY_E00SELF"[NUMBER,22], "T"."PAY_MONEY_Z00SELF"[NUMBER,22], "T"."PAY_MONEY_S00SELF"[NUMBER,22], "T"."PAY_MONEY_S01SELF"[NUMBER,22],
       "T"."PAY_MONEY_C000SELF"[NUMBER,22], "T"."PAY_MONEY_C001SELF"[NUMBER,22], "T"."PAY_MONEY_C004SELF"[NUMBER,22], "T"."PAY_MONEY_C006SELF"[NUMBER,22],
       "T"."PAY_MONEY_C007SELF"[NUMBER,22], "T"."PAY_MONEY_C007003SELF"[NUMBER,22], "T"."DB_MONEY"[NUMBER,22], "T"."YWSH_DB_MONEY"[NUMBER,1],
       "T"."TC_MONEY"[NUMBER,22], "T"."HOSP_PAY"[NUMBER,22], "T"."HOSP_PRISE"[NUMBER,22], "T"."TC_MONEY_XE"[NUMBER,22], "T"."JMTC_MONEY"[NUMBER,22],
       "T"."YW_MONEY"[NUMBER,22], "T"."JMYW_MONEY"[NUMBER,22], "T"."ACCT_MONEY"[NUMBER,22], "T"."LX_MONEY"[NUMBER,22], "T"."SY_MONEY"[NUMBER,22],
       "T"."OFFI_MONEY"[NUMBER,22], "T"."ZHAOGU_PAY"[NUMBER,22], "T"."PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22], "MEDI_PAY"[NUMBER,22],
       "MEDI_ZFY"[NUMBER,22], "T"."DB_MONEY_JUMIN"[NUMBER,22], "B"."DISEASE_TYPE"[CHARACTER,1], "B"."SERIAL_NO"[VARCHAR2,16], "B"."CASE_ID"[NUMBER,22],
       "B"."DISTRICT_CODE"[VARCHAR2,6], "B"."INDI_ID"[NUMBER,22], "B"."NAME"[VARCHAR2,20], "B"."SEX"[CHARACTER,1], "B"."OFFICE_GRADE"[VARCHAR2,3],
       "B"."IDCARD"[VARCHAR2,25], "B"."IC_NO"[VARCHAR2,25], "B"."HOS_SERIAL"[VARCHAR2,30], "B"."CORP_NAME"[VARCHAR2,70], "B"."TREATMENT_TYPE"[VARCHAR2,3],
       "B"."SERIAL_APPLY"[NUMBER,22], "B"."REG_DATE"[DATE,7], "B"."REG_MAN"[VARCHAR2,20], "B"."REG_FLAG"[CHARACTER,1], "B"."BEGIN_DATE"[DATE,7],
       "B"."REG_INFO"[VARCHAR2,10], "B"."IN_DEPT_NAME"[VARCHAR2,20], "B"."IN_AREA_NAME"[VARCHAR2,20], "B"."IN_BED"[VARCHAR2,10],
       "B"."BED_TYPE"[CHARACTER,1], "B"."PATIENT_ID"[VARCHAR2,20], "B"."IN_DISEASE"[VARCHAR2,20], "B"."IN_DAYS"[NUMBER,22], "B"."FIN_DISEASE"[VARCHAR2,20],
       "B"."END_DATE"[DATE,7], "B"."REIMBURSE_FLAG"[CHARACTER,1], "B"."POS_CODE"[VARCHAR2,10], "B"."REMARK"[VARCHAR2,500], "B"."FIN_DATE"[DATE,7],
       "B"."FIN_STAFF"[VARCHAR2,10], "B"."FIN_MAN"[VARCHAR2,30]
  35 - "G"."CENTER_ID"[VARCHAR2,10], "G"."BIZ_TYPE"[CHARACTER,2], "G"."BIZ_STAT"[VARCHAR2,2]
  36 - (#keys=1) "H"."CENTER_ID"[VARCHAR2,10], "B"."CENTER_ID"[VARCHAR2,10], "H"."CATALOG_CENTER"[VARCHAR2,10], "B"."CORP_ID"[NUMBER,22],
       "STREET"."QYBM"[VARCHAR2,10], "A"."HOSPITAL_ID"[VARCHAR2,20], "A"."HOSPITAL_NAME"[VARCHAR2,70], "T"."INSR_CODE"[VARCHAR2,30], "T"."FEES"[NUMBER,22],
       "T"."PAY_MONEY_JD"[NUMBER,22], "T"."FUND_MONEY"[NUMBER,22], "T"."FUND_301"[NUMBER,22], "T"."FUND_003"[NUMBER,22], "T"."YW_FUND_MONEY"[NUMBER,22],
       "T"."BC_FUND_MONEY"[NUMBER,22], "T"."QFX"[NUMBER,22], "T"."HOSP_ZF"[NUMBER,22], "T"."CENTER_ZF"[NUMBER,22], "T"."PAY_MONEY_ALLSELF"[NUMBER,22],
       "T"."PAY_MONEY_SELF"[NUMBER,22], "T"."PAY_MONEY_E00SELF"[NUMBER,22], "T"."PAY_MONEY_Z00SELF"[NUMBER,22], "T"."PAY_MONEY_S00SELF"[NUMBER,22],
       "T"."PAY_MONEY_S01SELF"[NUMBER,22], "T"."PAY_MONEY_C000SELF"[NUMBER,22], "T"."PAY_MONEY_C001SELF"[NUMBER,22], "T"."PAY_MONEY_C004SELF"[NUMBER,22],
       "T"."PAY_MONEY_C006SELF"[NUMBER,22], "T"."PAY_MONEY_C007SELF"[NUMBER,22], "T"."PAY_MONEY_C007003SELF"[NUMBER,22], "T"."DB_MONEY"[NUMBER,22],
       "T"."YWSH_DB_MONEY"[NUMBER,1], "T"."TC_MONEY"[NUMBER,22], "T"."HOSP_PAY"[NUMBER,22], "T"."HOSP_PRISE"[NUMBER,22], "T"."TC_MONEY_XE"[NUMBER,22],
       "T"."JMTC_MONEY"[NUMBER,22], "T"."YW_MONEY"[NUMBER,22], "T"."JMYW_MONEY"[NUMBER,22], "T"."ACCT_MONEY"[NUMBER,22], "T"."LX_MONEY"[NUMBER,22],
       "T"."SY_MONEY"[NUMBER,22], "T"."OFFI_MONEY"[NUMBER,22], "T"."ZHAOGU_PAY"[NUMBER,22], "T"."PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22],
       "MEDI_PAY"[NUMBER,22], "MEDI_ZFY"[NUMBER,22], "T"."DB_MONEY_JUMIN"[NUMBER,22], "B"."DISEASE_TYPE"[CHARACTER,1], "B"."SERIAL_NO"[VARCHAR2,16],
       "B"."CASE_ID"[NUMBER,22], "B"."BIZ_TYPE"[VARCHAR2,2], "B"."DISTRICT_CODE"[VARCHAR2,6], "B"."INDI_ID"[NUMBER,22], "B"."NAME"[VARCHAR2,20],
       "B"."SEX"[CHARACTER,1], "B"."OFFICE_GRADE"[VARCHAR2,3], "B"."IDCARD"[VARCHAR2,25], "B"."IC_NO"[VARCHAR2,25], "B"."HOS_SERIAL"[VARCHAR2,30],
       "B"."CORP_NAME"[VARCHAR2,70], "B"."TREATMENT_TYPE"[VARCHAR2,3], "B"."SERIAL_APPLY"[NUMBER,22], "B"."REG_DATE"[DATE,7], "B"."REG_MAN"[VARCHAR2,20],
       "B"."REG_FLAG"[CHARACTER,1], "B"."BEGIN_DATE"[DATE,7], "B"."REG_INFO"[VARCHAR2,10], "B"."IN_DEPT_NAME"[VARCHAR2,20], "B"."IN_AREA_NAME"[VARCHAR2,20],
       "B"."IN_BED"[VARCHAR2,10], "B"."BED_TYPE"[CHARACTER,1], "B"."PATIENT_ID"[VARCHAR2,20], "B"."IN_DISEASE"[VARCHAR2,20], "B"."IN_DAYS"[NUMBER,22],
       "B"."FIN_DISEASE"[VARCHAR2,20], "B"."END_DATE"[DATE,7], "B"."REIMBURSE_FLAG"[CHARACTER,1], "B"."POS_CODE"[VARCHAR2,10], "B"."REMARK"[VARCHAR2,500],
       "B"."FIN_DATE"[DATE,7], "B"."FIN_STAFF"[VARCHAR2,10], "B"."FIN_MAN"[VARCHAR2,30], "B"."PERS_TYPE_DETAIL"[VARCHAR2,3]
  37 - "H"."CENTER_ID"[VARCHAR2,10], "H"."CATALOG_CENTER"[VARCHAR2,10]
  38 - (#keys=1) "B"."CORP_ID"[NUMBER,22], "STREET"."QYBM"[VARCHAR2,10], "A"."HOSPITAL_ID"[VARCHAR2,20], "A"."HOSPITAL_NAME"[VARCHAR2,70],
       "T"."INSR_CODE"[VARCHAR2,30], "T"."FEES"[NUMBER,22], "T"."PAY_MONEY_JD"[NUMBER,22], "T"."FUND_MONEY"[NUMBER,22], "T"."FUND_301"[NUMBER,22],
      "T"."FUND_003"[NUMBER,22], "T"."YW_FUND_MONEY"[NUMBER,22], "T"."BC_FUND_MONEY"[NUMBER,22], "T"."QFX"[NUMBER,22], "T"."HOSP_ZF"[NUMBER,22],
       "T"."CENTER_ZF"[NUMBER,22], "T"."PAY_MONEY_ALLSELF"[NUMBER,22], "T"."PAY_MONEY_SELF"[NUMBER,22], "T"."PAY_MONEY_E00SELF"[NUMBER,22],
       "T"."PAY_MONEY_Z00SELF"[NUMBER,22], "T"."PAY_MONEY_S00SELF"[NUMBER,22], "T"."PAY_MONEY_S01SELF"[NUMBER,22], "T"."PAY_MONEY_C000SELF"[NUMBER,22],
       "T"."PAY_MONEY_C001SELF"[NUMBER,22], "T"."PAY_MONEY_C004SELF"[NUMBER,22], "T"."PAY_MONEY_C006SELF"[NUMBER,22], "T"."PAY_MONEY_C007SELF"[NUMBER,22],
       "T"."PAY_MONEY_C007003SELF"[NUMBER,22], "T"."DB_MONEY"[NUMBER,22], "T"."YWSH_DB_MONEY"[NUMBER,1], "T"."TC_MONEY"[NUMBER,22],
       "T"."HOSP_PAY"[NUMBER,22], "T"."HOSP_PRISE"[NUMBER,22], "T"."TC_MONEY_XE"[NUMBER,22], "T"."JMTC_MONEY"[NUMBER,22], "T"."YW_MONEY"[NUMBER,22],
       "T"."JMYW_MONEY"[NUMBER,22], "T"."ACCT_MONEY"[NUMBER,22], "T"."LX_MONEY"[NUMBER,22], "T"."SY_MONEY"[NUMBER,22], "T"."OFFI_MONEY"[NUMBER,22],
       "T"."ZHAOGU_PAY"[NUMBER,22], "T"."PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22], "MEDI_PAY"[NUMBER,22], "MEDI_ZFY"[NUMBER,22],
       "T"."DB_MONEY_JUMIN"[NUMBER,22], "B"."DISEASE_TYPE"[CHARACTER,1], "B"."SERIAL_NO"[VARCHAR2,16], "B"."CASE_ID"[NUMBER,22], "B"."BIZ_TYPE"[VARCHAR2,2],
       "B"."DISTRICT_CODE"[VARCHAR2,6], "B"."INDI_ID"[NUMBER,22], "B"."NAME"[VARCHAR2,20], "B"."SEX"[CHARACTER,1], "B"."OFFICE_GRADE"[VARCHAR2,3],
       "B"."IDCARD"[VARCHAR2,25], "B"."IC_NO"[VARCHAR2,25], "B"."HOS_SERIAL"[VARCHAR2,30], "B"."CORP_NAME"[VARCHAR2,70], "B"."TREATMENT_TYPE"[VARCHAR2,3],
       "B"."SERIAL_APPLY"[NUMBER,22], "B"."REG_DATE"[DATE,7], "B"."REG_MAN"[VARCHAR2,20], "B"."REG_FLAG"[CHARACTER,1], "B"."BEGIN_DATE"[DATE,7],
       "B"."REG_INFO"[VARCHAR2,10], "B"."IN_DEPT_NAME"[VARCHAR2,20], "B"."IN_AREA_NAME"[VARCHAR2,20], "B"."IN_BED"[VARCHAR2,10],
       "B"."BED_TYPE"[CHARACTER,1], "B"."PATIENT_ID"[VARCHAR2,20], "B"."IN_DISEASE"[VARCHAR2,20], "B"."IN_DAYS"[NUMBER,22], "B"."FIN_DISEASE"[VARCHAR2,20],
       "B"."END_DATE"[DATE,7], "B"."REIMBURSE_FLAG"[CHARACTER,1], "B"."POS_CODE"[VARCHAR2,10], "B"."REMARK"[VARCHAR2,500], "B"."FIN_DATE"[DATE,7],
       "B"."FIN_STAFF"[VARCHAR2,10], "B"."FIN_MAN"[VARCHAR2,30], "B"."CENTER_ID"[VARCHAR2,10], "B"."PERS_TYPE_DETAIL"[VARCHAR2,3]
  39 - "STREET"."CORP_ID"[NUMBER,22], "STREET"."QYBM"[VARCHAR2,10]
  40 - (#keys=1) "ST"."QYBM"[VARCHAR2,10], "CORP"."CORP_ID"[NUMBER,22]
  41 - "ST"."QYBM"[VARCHAR2,10]
  42 - "CORP"."CORP_ID"[NUMBER,22], "CORP"."AREA_CODE"[VARCHAR2,20]
  43 - (#keys=1) "A"."HOSPITAL_ID"[VARCHAR2,20], "A"."HOSPITAL_NAME"[VARCHAR2,70], "T"."INSR_CODE"[VARCHAR2,30], "T"."FEES"[NUMBER,22],
       "T"."PAY_MONEY_JD"[NUMBER,22], "T"."FUND_MONEY"[NUMBER,22], "T"."FUND_301"[NUMBER,22], "T"."FUND_003"[NUMBER,22], "T"."YW_FUND_MONEY"[NUMBER,22],
       "T"."BC_FUND_MONEY"[NUMBER,22], "T"."QFX"[NUMBER,22], "T"."HOSP_ZF"[NUMBER,22], "T"."CENTER_ZF"[NUMBER,22], "T"."PAY_MONEY_ALLSELF"[NUMBER,22],
       "T"."PAY_MONEY_SELF"[NUMBER,22], "T"."PAY_MONEY_E00SELF"[NUMBER,22], "T"."PAY_MONEY_Z00SELF"[NUMBER,22], "T"."PAY_MONEY_S00SELF"[NUMBER,22],
       "T"."PAY_MONEY_S01SELF"[NUMBER,22], "T"."PAY_MONEY_C000SELF"[NUMBER,22], "T"."PAY_MONEY_C001SELF"[NUMBER,22], "T"."PAY_MONEY_C004SELF"[NUMBER,22],
       "T"."PAY_MONEY_C006SELF"[NUMBER,22], "T"."PAY_MONEY_C007SELF"[NUMBER,22], "T"."PAY_MONEY_C007003SELF"[NUMBER,22], "T"."DB_MONEY"[NUMBER,22],
       "T"."YWSH_DB_MONEY"[NUMBER,1], "T"."TC_MONEY"[NUMBER,22], "T"."HOSP_PAY"[NUMBER,22], "T"."HOSP_PRISE"[NUMBER,22], "T"."TC_MONEY_XE"[NUMBER,22],
       "T"."JMTC_MONEY"[NUMBER,22], "T"."YW_MONEY"[NUMBER,22], "T"."JMYW_MONEY"[NUMBER,22], "T"."ACCT_MONEY"[NUMBER,22], "T"."LX_MONEY"[NUMBER,22],
       "T"."SY_MONEY"[NUMBER,22], "T"."OFFI_MONEY"[NUMBER,22], "T"."ZHAOGU_PAY"[NUMBER,22], "T"."PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22],
       "MEDI_PAY"[NUMBER,22], "MEDI_ZFY"[NUMBER,22], "T"."DB_MONEY_JUMIN"[NUMBER,22], "B"."DISEASE_TYPE"[CHARACTER,1], "B"."SERIAL_NO"[VARCHAR2,16],
       "B"."CASE_ID"[NUMBER,22], "B"."BIZ_TYPE"[VARCHAR2,2], "B"."DISTRICT_CODE"[VARCHAR2,6], "B"."INDI_ID"[NUMBER,22], "B"."NAME"[VARCHAR2,20],
       "B"."SEX"[CHARACTER,1], "B"."OFFICE_GRADE"[VARCHAR2,3], "B"."IDCARD"[VARCHAR2,25], "B"."IC_NO"[VARCHAR2,25], "B"."CORP_ID"[NUMBER,22],
       "B"."CORP_NAME"[VARCHAR2,70], "B"."TREATMENT_TYPE"[VARCHAR2,3], "B"."SERIAL_APPLY"[NUMBER,22], "B"."REG_DATE"[DATE,7], "B"."REG_MAN"[VARCHAR2,20],
       "B"."REG_FLAG"[CHARACTER,1], "B"."BEGIN_DATE"[DATE,7], "B"."REG_INFO"[VARCHAR2,10], "B"."IN_DEPT_NAME"[VARCHAR2,20], "B"."IN_AREA_NAME"[VARCHAR2,20],
       "B"."IN_BED"[VARCHAR2,10], "B"."BED_TYPE"[CHARACTER,1], "B"."PATIENT_ID"[VARCHAR2,20], "B"."IN_DISEASE"[VARCHAR2,20], "B"."IN_DAYS"[NUMBER,22],
       "B"."FIN_DISEASE"[VARCHAR2,20], "B"."END_DATE"[DATE,7], "B"."REIMBURSE_FLAG"[CHARACTER,1], "B"."POS_CODE"[VARCHAR2,10], "B"."REMARK"[VARCHAR2,500],
       "B"."FIN_DATE"[DATE,7], "B"."FIN_STAFF"[VARCHAR2,10], "B"."FIN_MAN"[VARCHAR2,30], "B"."CENTER_ID"[VARCHAR2,10], "B"."PERS_TYPE_DETAIL"[VARCHAR2,3],
       "B"."HOS_SERIAL"[VARCHAR2,30]
  44 - "A"."HOSPITAL_ID"[VARCHAR2,20], "A"."HOSPITAL_NAME"[VARCHAR2,70]
  45 - "B"."HOSPITAL_ID"[VARCHAR2,20], "B"."SERIAL_NO"[VARCHAR2,16], "B"."CASE_ID"[NUMBER,22], "B"."BIZ_TYPE"[VARCHAR2,2],
       "B"."DISTRICT_CODE"[VARCHAR2,6], "B"."INDI_ID"[NUMBER,22], "B"."NAME"[VARCHAR2,20], "B"."SEX"[CHARACTER,1], "B"."OFFICE_GRADE"[VARCHAR2,3],
       "B"."IDCARD"[VARCHAR2,25], "B"."IC_NO"[VARCHAR2,25], "B"."CORP_ID"[NUMBER,22], "B"."CORP_NAME"[VARCHAR2,70], "B"."TREATMENT_TYPE"[VARCHAR2,3],
       "B"."SERIAL_APPLY"[NUMBER,22], "B"."REG_DATE"[DATE,7], "B"."REG_MAN"[VARCHAR2,20], "B"."REG_FLAG"[CHARACTER,1], "B"."BEGIN_DATE"[DATE,7],
       "B"."REG_INFO"[VARCHAR2,10], "B"."IN_DEPT_NAME"[VARCHAR2,20], "B"."IN_AREA_NAME"[VARCHAR2,20], "B"."IN_BED"[VARCHAR2,10],
       "B"."BED_TYPE"[CHARACTER,1], "B"."PATIENT_ID"[VARCHAR2,20], "B"."IN_DISEASE"[VARCHAR2,20], "B"."IN_DAYS"[NUMBER,22], "B"."FIN_DISEASE"[VARCHAR2,20],
       "B"."END_DATE"[DATE,7], "B"."REIMBURSE_FLAG"[CHARACTER,1], "B"."POS_CODE"[VARCHAR2,10], "B"."REMARK"[VARCHAR2,500], "B"."FIN_DATE"[DATE,7],
       "B"."FIN_STAFF"[VARCHAR2,10], "B"."FIN_MAN"[VARCHAR2,30], "B"."CENTER_ID"[VARCHAR2,10], "B"."PERS_TYPE_DETAIL"[VARCHAR2,3],
       "B"."HOS_SERIAL"[VARCHAR2,30], "B"."DISEASE_TYPE"[CHARACTER,1]
  46 - "T"."INSR_CODE"[VARCHAR2,30], "T"."FEES"[NUMBER,22], "T"."PAY_MONEY_JD"[NUMBER,22], "T"."FUND_MONEY"[NUMBER,22], "T"."FUND_301"[NUMBER,22],
       "T"."FUND_003"[NUMBER,22], "T"."YW_FUND_MONEY"[NUMBER,22], "T"."BC_FUND_MONEY"[NUMBER,22], "T"."QFX"[NUMBER,22], "T"."HOSP_ZF"[NUMBER,22],
       "T"."CENTER_ZF"[NUMBER,22], "T"."PAY_MONEY_ALLSELF"[NUMBER,22], "T"."PAY_MONEY_SELF"[NUMBER,22], "T"."PAY_MONEY_E00SELF"[NUMBER,22],
       "T"."PAY_MONEY_Z00SELF"[NUMBER,22], "T"."PAY_MONEY_S00SELF"[NUMBER,22], "T"."PAY_MONEY_S01SELF"[NUMBER,22], "T"."PAY_MONEY_C000SELF"[NUMBER,22],
       "T"."PAY_MONEY_C001SELF"[NUMBER,22], "T"."PAY_MONEY_C004SELF"[NUMBER,22], "T"."PAY_MONEY_C006SELF"[NUMBER,22], "T"."PAY_MONEY_C007SELF"[NUMBER,22],
       "T"."PAY_MONEY_C007003SELF"[NUMBER,22], "T"."DB_MONEY"[NUMBER,22], "T"."YWSH_DB_MONEY"[NUMBER,1], "T"."TC_MONEY"[NUMBER,22],
       "T"."HOSP_PAY"[NUMBER,22], "T"."HOSP_PRISE"[NUMBER,22], "T"."TC_MONEY_XE"[NUMBER,22], "T"."JMTC_MONEY"[NUMBER,22], "T"."YW_MONEY"[NUMBER,22],
       "T"."JMYW_MONEY"[NUMBER,22], "T"."ACCT_MONEY"[NUMBER,22], "T"."LX_MONEY"[NUMBER,22], "T"."SY_MONEY"[NUMBER,22], "T"."OFFI_MONEY"[NUMBER,22],
       "T"."ZHAOGU_PAY"[NUMBER,22], "T"."PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22], "MEDI_PAY"[NUMBER,22], "MEDI_ZFY"[NUMBER,22],
       "T"."DB_MONEY_JUMIN"[NUMBER,22], "SYS_ALIAS_10".ROWID[ROWID,10], "B"."HOSPITAL_ID"[VARCHAR2,20], "B"."SERIAL_NO"[VARCHAR2,16]
  47 - "T"."HOSPITAL_ID"[VARCHAR2,20], "T"."SERIAL_NO"[VARCHAR2,16], "T"."INSR_CODE"[VARCHAR2,30], "T"."FEES"[NUMBER,22],
       "T"."PAY_MONEY_JD"[NUMBER,22], "T"."FUND_MONEY"[NUMBER,22], "T"."FUND_301"[NUMBER,22], "T"."FUND_003"[NUMBER,22], "T"."YW_FUND_MONEY"[NUMBER,22],
       "T"."BC_FUND_MONEY"[NUMBER,22], "T"."QFX"[NUMBER,22], "T"."HOSP_ZF"[NUMBER,22], "T"."CENTER_ZF"[NUMBER,22], "T"."PAY_MONEY_ALLSELF"[NUMBER,22],
       "T"."PAY_MONEY_SELF"[NUMBER,22], "T"."PAY_MONEY_E00SELF"[NUMBER,22], "T"."PAY_MONEY_Z00SELF"[NUMBER,22], "T"."PAY_MONEY_S00SELF"[NUMBER,22],
       "T"."PAY_MONEY_S01SELF"[NUMBER,22], "T"."PAY_MONEY_C000SELF"[NUMBER,22], "T"."PAY_MONEY_C001SELF"[NUMBER,22], "T"."PAY_MONEY_C004SELF"[NUMBER,22],
       "T"."PAY_MONEY_C006SELF"[NUMBER,22], "T"."PAY_MONEY_C007SELF"[NUMBER,22], "T"."PAY_MONEY_C007003SELF"[NUMBER,22], "T"."DB_MONEY"[NUMBER,22],
       "T"."YWSH_DB_MONEY"[NUMBER,1], "T"."TC_MONEY"[NUMBER,22], "T"."HOSP_PAY"[NUMBER,22], "T"."HOSP_PRISE"[NUMBER,22], "T"."TC_MONEY_XE"[NUMBER,22],
       "T"."JMTC_MONEY"[NUMBER,22], "T"."YW_MONEY"[NUMBER,22], "T"."JMYW_MONEY"[NUMBER,22], "T"."ACCT_MONEY"[NUMBER,22], "T"."LX_MONEY"[NUMBER,22],
       "T"."SY_MONEY"[NUMBER,22], "T"."OFFI_MONEY"[NUMBER,22], "T"."ZHAOGU_PAY"[NUMBER,22], "T"."PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22],
       "MEDI_PAY"[NUMBER,22], "MEDI_ZFY"[NUMBER,22], "T"."DB_MONEY_JUMIN"[NUMBER,22]
  48 - "$vm_col_8"[VARCHAR2,20], "$vm_col_9"[VARCHAR2,16], "$vm_col_7"[NUMBER,22], SUM(DECODE("$vm_col_5",'803',"$vm_col_4",0))[22], SUM(CASE  WHEN
       (("$vm_col_3"='C000' OR "$vm_col_3"='C001' OR "$vm_col_3"='C002' OR "$vm_col_3"='C003' OR "$vm_col_3"='C004') AND ("$vm_col_5"='999' OR
       "$vm_col_5"='003')) THEN "$vm_col_4" ELSE 0 END )[22], SUM(DECODE("$vm_col_5",'999',"$vm_col_4",0))[22],
       SUM(DECODE("$vm_col_5",'401',"$vm_col_4",0))[22], SUM(DECODE("$vm_col_5",'301',"$vm_col_4",0))[22], SUM(DECODE("$vm_col_5",'511',"$vm_col_4",0))[22],
       SUM(DECODE("$vm_col_5",'202',"$vm_col_4",0))[22], SUM(DECODE("$vm_col_5",'003',"$vm_col_4",0))[22], SUM(DECODE("$vm_col_5",'802',"$vm_col_4",0))[22],
       SUM(DECODE("$vm_col_5",'901',"$vm_col_4",'802',"$vm_col_4",0))[22], SUM(DECODE("$vm_col_5",'801',"$vm_col_4",0))[22],
       SUM(DECODE("$vm_col_5",'001',"$vm_col_4",'801',"$vm_col_4",0))[22], SUM(DECODE("$vm_col_5",'996',NVL("$vm_col_4",0),0))[22],
       SUM(DECODE("$vm_col_5",'201',"$vm_col_4",0))[22], SUM(DECODE("$vm_col_3"||"$vm_col_5",'C007003',"$vm_col_4",0))[22],
       SUM(DECODE("$vm_col_3"||"$vm_col_5",'C007999',"$vm_col_4",0))[22], SUM(DECODE("$vm_col_3"||"$vm_col_5",'C006003',"$vm_col_4",'C006999',"$vm_col_4",'C0
       07003',"$vm_col_4",'C007999',"$vm_col_4",0))[22], SUM(DECODE("$vm_col_3"||"$vm_col_5",'C004003',"$vm_col_4",'C004999',"$vm_col_4",'C005003',"$vm_col_4
       ",'C005999',"$vm_col_4",0))[22], SUM(DECODE("$vm_col_3"||"$vm_col_5",'C001003',"$vm_col_4",'C001999',"$vm_col_4",'C002003',"$vm_col_4",'C002999',"$vm_
       col_4",'C003003',"$vm_col_4",'C003999',"$vm_col_4",0))[22], SUM(DECODE("$vm_col_3"||"$vm_col_5",'C000003',"$vm_col_4",'C000999',"$vm_col_4",0))[22],
       SUM(DECODE("$vm_col_3"||"$vm_col_5",'S02003',"$vm_col_4",'S02999',"$vm_col_4",0))[22],
       SUM(DECODE("$vm_col_3"||"$vm_col_5",'S01003',"$vm_col_4",'S01999',"$vm_col_4",0))[22],
       SUM(DECODE("$vm_col_3"||"$vm_col_5",'S00003',"$vm_col_4",'S00999',"$vm_col_4",0))[22],
       SUM(DECODE("$vm_col_3"||"$vm_col_5",'Z00003',"$vm_col_4",'Z00999',"$vm_col_4",0))[22],
       SUM(DECODE("$vm_col_3"||"$vm_col_5",'E00003',"$vm_col_4",'E00999',"$vm_col_4",0))[22],
       SUM(DECODE("$vm_col_2"||"$vm_col_5",'102003',"$vm_col_4",'102999',"$vm_col_4",0))[22],
       SUM(DECODE("$vm_col_2"||"$vm_col_5",'101003',"$vm_col_4",'101999',"$vm_col_4",0))[22], SUM(DECODE("$vm_col_5",'998',"$vm_col_4",0))[22],
       SUM(DECODE("$vm_col_5",'996',"$vm_col_4",0))[22], SUM(DECODE("$vm_col_3",'S01',"$vm_col_4",'S02',"$vm_col_4",0))[22],
       SUM(DECODE("$vm_col_5",'306',"$vm_col_4",0))[22], SUM(DECODE("$vm_col_5",'001',"$vm_col_4",'511',"$vm_col_4",'202',"$vm_col_4",'801',"$vm_col_4",0))[2
       2], SUM(DECODE("$vm_col_3",'C000',"$vm_col_4",'C001',"$vm_col_4",'C002',"$vm_col_4",'C003',"$vm_col_4",'C004',"$vm_col_4",'C005',"$vm_col_4",'C006',"$
       vm_col_4",'C007',"$vm_col_4",0))[22], SUM("$vm_col_4")[22]
  49 - "$vm_col_8"[VARCHAR2,20], "$vm_col_9"[VARCHAR2,16], "$vm_col_7"[NUMBER,22], "$vm_col_2"[VARCHAR2,3], "$vm_col_3"[VARCHAR2,20],
       "$vm_col_4"[NUMBER,22], "$vm_col_5"[VARCHAR2,3]
  50 - "B"."HOSPITAL_ID"[VARCHAR2,20], "B"."SERIAL_NO"[VARCHAR2,16], "B"."INDI_ID"[NUMBER,22], ROWID[ROWID,10], ROWID[ROWID,10], ROWID[ROWID,10],
       ROWID[ROWID,10], "HOSPITAL_ID"||"SERIAL_NO"[36], "C"."LABEL_FLAG"[VARCHAR2,3], "C"."POLICY_ITEM_CODE"[VARCHAR2,20], "C"."REAL_PAY"[NUMBER,22],
       "C"."FUND_ID"[VARCHAR2,3], "FINISH_FLAG"[CHARACTER,1]
  51 - "HOSPITAL_ID"[VARCHAR2,20], "SERIAL_NO"[VARCHAR2,16], ROWID[ROWID,10], "B"."HOSPITAL_ID"[VARCHAR2,20], "B"."SERIAL_NO"[VARCHAR2,16],
       "B"."INDI_ID"[NUMBER,22], "FINISH_FLAG"[CHARACTER,1], ROWID[ROWID,10], "C"."POLICY_ITEM_CODE"[VARCHAR2,20], "C"."FUND_ID"[VARCHAR2,3],
       "C"."REAL_PAY"[NUMBER,22], "C"."LABEL_FLAG"[VARCHAR2,3], ROWID[ROWID,10], ROWID[ROWID,10]
  52 - "HOSPITAL_ID"[VARCHAR2,20], "SERIAL_NO"[VARCHAR2,16], ROWID[ROWID,10], "B"."HOSPITAL_ID"[VARCHAR2,20], "B"."SERIAL_NO"[VARCHAR2,16],
       "B"."INDI_ID"[NUMBER,22], "FINISH_FLAG"[CHARACTER,1], ROWID[ROWID,10], "C"."POLICY_ITEM_CODE"[VARCHAR2,20], "C"."FUND_ID"[VARCHAR2,3],
       "C"."REAL_PAY"[NUMBER,22], "C"."LABEL_FLAG"[VARCHAR2,3], ROWID[ROWID,10]
  53 - "HOSPITAL_ID"[VARCHAR2,20], "SERIAL_NO"[VARCHAR2,16], ROWID[ROWID,10], "B"."HOSPITAL_ID"[VARCHAR2,20], "B"."SERIAL_NO"[VARCHAR2,16],
       "B"."BIZ_TYPE"[VARCHAR2,2], "B"."INDI_ID"[NUMBER,22], "FINISH_FLAG"[CHARACTER,1], "B"."CENTER_ID"[VARCHAR2,10], ROWID[ROWID,10],
       "C"."POLICY_ITEM_CODE"[VARCHAR2,20], "C"."FUND_ID"[VARCHAR2,3], "C"."REAL_PAY"[NUMBER,22], "C"."LABEL_FLAG"[VARCHAR2,3]
  54 - (#keys=1) "HOSPITAL_ID"[VARCHAR2,20], "SERIAL_NO"[VARCHAR2,16], ROWID[ROWID,10], "B"."HOSPITAL_ID"[VARCHAR2,20], "B"."SERIAL_NO"[VARCHAR2,16],
       "B"."BIZ_TYPE"[VARCHAR2,2], "B"."INDI_ID"[NUMBER,22], "FINISH_FLAG"[CHARACTER,1], "B"."CENTER_ID"[VARCHAR2,10]
  55 - "HOSPITAL_ID"[VARCHAR2,20], "SERIAL_NO"[VARCHAR2,16]
  56 - "PM_ACCOUNT_BIZ".ROWID[ROWID,10]
  57 - "RELA_DECL_SN"[NUMBER,22]
  58 - "PM_ACCOUNT_BIZ".ROWID[ROWID,10]
  59 - ROWID[ROWID,10], "B"."HOSPITAL_ID"[VARCHAR2,20], "B"."SERIAL_NO"[VARCHAR2,16], "B"."BIZ_TYPE"[VARCHAR2,2], "B"."INDI_ID"[NUMBER,22],
       "FINISH_FLAG"[CHARACTER,1], "B"."CENTER_ID"[VARCHAR2,10]
  60 - ROWID[ROWID,10], "C"."POLICY_ITEM_CODE"[VARCHAR2,20], "C"."FUND_ID"[VARCHAR2,3], "C"."REAL_PAY"[NUMBER,22], "C"."LABEL_FLAG"[VARCHAR2,3]
  61 - ROWID[ROWID,10]
  62 - ROWID[ROWID,10]
  63 - ROWID[ROWID,10]
  64 - "SYS_ALIAS_10".ROWID[ROWID,10], "B"."HOSPITAL_ID"[VARCHAR2,20], "B"."SERIAL_NO"[VARCHAR2,16]

Note
-----
   - SQL profile "SYS_SQLPROF_0154fb8617518000" used for this statement
   - Warning: basic plan statistics not available. These are only collected when:
       * hint 'gather_plan_statistics' is used for the statement or
       * parameter 'statistics_level' is set to 'ALL', at session or system level


456 rows selected.

8

9

10

使用sql profile后执行时间是几分种,执行计划如上图所示,消耗时间的操作是对表mt_biz_fin执行全表扫描,该表的记录数是21M,访问该表的谓词条件用到了该表的hostpital_id与serial_no,而它们是该表的复合主键的前导列,而谓词条件写成了
b.hospital_id||b.serial_no in() 这就没有办法用到主键索引,应该用(b.hosptial_id,b.serial_no) in()。删除sql profile:

SQL> execute dbms_sqltune.drop_sql_profile(name => 'SYS_SQLPROF_0154fb8617518000');
 
PL/SQL procedure successfully completed

SQL> select * from dba_sql_profiles where sql_text like 'select rowno, hos_serial, reg_flag,%';
 
NAME                           CATEGORY                        SIGNATURE SQL_TEXT          CREATED     LAST_MODIFIED DESCRIPTION   TYPE      STATUS   FORCE_MATCHING
------------------------------ ------------------------------ ---------- ----------------- ----------- ------------- ------------- --------- -------- --------------

将谓词条件b.hospital_id||b.serial_no in()修改为(b.hosptial_id,b.serial_no) in()。修改后的sql如下所示:

select /*+ jy_20160405_01 */ rowno, hos_serial, reg_flag,
       nvl((SELECT distinct t.policy_value
              FROM fc_biz_policy t
             WHERE t.policy_code = 'can_clinic_flag'
               and t.valid_flag = '1'
               and t.center_id = '430701'), (SELECT distinct t.policy_value
                FROM fc_biz_policy t
               WHERE t.policy_code =
                     'can_clinic_flag'
                 and t.valid_flag = '1'
                 and t.center_id = '0')) AS can_clinic_flag,
       decode(DISEASE_TYPE, 'A', '病种单纯', 'B', '严重', 'C', '严重并发', 'D', '危重', '') DISEASE_TYPE,
       hospital_id, hospital_name, serial_no, biz_type, case_id, biz_stat,
       name, sex, pers_type, begin_date, end_date, fin_date, finish_date,
       reg_date, in_days, indi_id, insr_code, fin_staff, fin_man, corp_id,
       idcard, district_code, office_grade,center_id,
       (select t.special_code
           from bs_corp_pres t
          where t.indi_id = w.indi_id) as special_code, corp_name, disease,
       in_area_name, in_dept_name,
       decode(apply_content, '126', '转外住院', '127', '转外复查', '普通住院') as apply_content,
       in_bed, bed_type, patient_id, remark, pos_code, reimburse_flag,
       fin_disease, ic_no, treatment_type,
       decode(reg_info || treatment_type, 'WD3120', '普通住院(转外住院)', 'WD2120', '普通住院(异地住院)', '1120', '普通住院(转诊转院)', 'F120', '普通住院(非首诊就诊)', 'WD1120', '普通住院(异地安置)', 'C120', '普通住院(首诊就诊)', (select treatment_name
                   from bs_treat_type
                  where treatment_type =
                        w.treatment_type
                    and center_id =
                        w.center_id)) as treatment_name,
       nvl(pay_money_jd, 0) as pay_money_jd,
       nvl(pay_money_xzf, 0) as pay_money_xzf, nvl(fees, 0) as fees,
       foregift, nvl(pay_money_allself, 0) as pay_money_allself,
       nvl(pay_money_self, 0) as pay_money_self,
       nvl(pay_money_E00self, 0) as pay_money_E00self,
       nvl(pay_money_Z00self, 0) as pay_money_Z00self,
       nvl(pay_money_S00self, 0) as pay_money_S00self,
       nvl(pay_money_S01self, 0) as pay_money_S01self,
       nvl(pay_money_S01self, 0) as pay_money_S01self,
       nvl(pay_money_C000self, 0) as pay_money_C000self,
       nvl(pay_money_C001self, 0) as pay_money_C001self,
       nvl(pay_money_C004self, 0) as pay_money_C004self,
       nvl(pay_money_C006self, 0) as pay_money_C006self,
       nvl(pay_money_C007self, 0) as pay_money_C007self,
       nvl(pay_money_C007003self, 0) as pay_money_C007003self,
       nvl(tc_money, 0) as tc_money, nvl(tc_money_xe, 0) as tc_money_xe,
       nvl(hosp_pay, 0) as hosp_pay, nvl(hosp_prise, 0) as hosp_prise,
       nvl(jmtc_money, 0) as jmtc_money, nvl(yw_money, 0) as yw_money,
       nvl(jmyw_money, 0) as jmyw_money, nvl(acct_money, 0) as acct_money,
       nvl(lx_money, 0) as lx_money, nvl(sy_money, 0) as sy_money,
       nvl(fund_money, 0) as fund_money, nvl(fund_301,0) fund_301 ,nvl(fund_003,0) fund_003 ,nvl(qfx, 0) as qfx,
       nvl(hosp_zf, 0) as hosp_zf, nvl(center_zf, 0) as center_zf,
       nvl(yw_fund_money, 0) as yw_fund_money,
       nvl(bc_fund_money, 0) as bc_fund_money, nvl(db_money, 0) as db_money,
       nvl(YWSH_DB_MONEY, 0) as YWSH_DB_MONEY,
       nvl(offi_money, 0) as offi_money, reg_man,
       nvl(zhaogu_pay, 0) as zhaogu_pay, w.area_code, PAY_MONEY_DNZF,
       medi_pay, medi_zfy, nvl(DB_MONEY_JUMIN, 0) as db_money_jumin
  from (select rownum rowno, b.hos_serial, b.reg_flag, b.disease_type,
                a.hospital_id, a.hospital_name, b.serial_no, b.biz_type,
                b.case_id, g.biz_stat, b.name, (select bs.sex_name from bs_sex bs where bs.sex =b.sex) sex,
                (select pp.pers_name from bs_person_type pp where pp.pers_type = b.pers_type_detail and pp.center_id = b.center_id) as pers_type,
                to_char(b.begin_date, 'yyyy-mm-dd') begin_date,
                to_char(b.end_date, 'yyyy-mm-dd') end_date,
                to_char(b.fin_date, 'yyyy-mm-dd hh24:mi:ss') fin_date,
                to_char(b.fin_date, 'yyyy-mm-dd hh24:mi:ss') finish_date,
                b.indi_id, t.insr_code, b.fin_staff, b.fin_man, b.corp_id,
                b.idcard,
                to_char(b.reg_date, 'yyyy-mm-dd hh24:mi:ss') reg_date,
                nvl(b.in_days, 0) in_days, b.district_code, b.center_id,
                b.office_grade, b.corp_name, b.in_disease,
                (select t.disease
                    from bs_disease t
                   where t.center_id = nvl(h.catalog_center, h.center_id)
                     and b.in_disease = t.icd) as disease, b.in_area_name,
                b.in_dept_name, b.in_bed, b.bed_type, b.patient_id,
                translate(b.remark, chr(13), '') remark, b.pos_code,
                b.reimburse_flag,
                (select q.disease
                    from bs_disease q
                   where q.center_id = nvl(h.catalog_center, h.center_id)
                     and b.fin_disease = q.icd) as fin_disease, 0 as foregift,
                b.ic_no, b.treatment_type,
                (select t.apply_content
                    from mt_apply t
                   where t.serial_apply = b.serial_apply) as apply_content,
                b.reg_man, street.QYBM as area_code, T.FEES, T.PAY_MONEY_JD,
                T.FUND_MONEY, T.FUND_301, T.FUND_003,T.QFX, T.HOSP_ZF, T.CENTER_ZF, T.YW_FUND_MONEY,
                T.BC_FUND_MONEY, T.PAY_MONEY_ALLSELF, T.PAY_MONEY_SELF,
                T.PAY_MONEY_E00SELF, T.PAY_MONEY_Z00SELF, T.PAY_MONEY_S00SELF,
                T.PAY_MONEY_S01SELF, T.PAY_MONEY_S02SELF, T.PAY_MONEY_C000SELF,
                T.PAY_MONEY_C001SELF, T.PAY_MONEY_C004SELF,
                T.PAY_MONEY_C006SELF, T.PAY_MONEY_C007SELF,
                T.PAY_MONEY_C007003SELF,
                (T.DB_MONEY - t.YWSH_DB_MONEY) as DB_MONEY, t.YWSH_DB_MONEY,
                T.TC_MONEY, T.TC_MONEY_XE, t.hosp_pay, t.hosp_prise,
                T.JMTC_MONEY, T.YW_MONEY, T.JMYW_MONEY, T.ACCT_MONEY,
                T.LX_MONEY, T.SY_MONEY, T.OFFI_MONEY, T.ZHAOGU_PAY,
                T.PAY_MONEY_XZF, PAY_MONEY_DNZF, medi_pay, medi_zfy,
                b.REG_INFO, T.DB_MONEY_JUMIN as DB_MONEY_JUMIN
           from bs_hospital a, bs_biztype g, mt_biz_fin b, bs_center h,
                bs_insured j,
                (select corp.CORP_ID, corp.AREA_CODE, st.QYBM
                    from bs_corp corp
                   inner join bs_country_street st
                      on corp.AREA_CODE = st.QYBM) street,
                (SELECT B.hospital_id, B.serial_no, B.indi_id,
                         (select max(insr_code)
                             from bs_insured a
                            where a.indi_id = B.indi_id) insr_code,
                         SUM(c.real_pay) AS FEES,
                         SUM(DECODE(c.POLICY_ITEM_CODE, 'C000', c.REAL_PAY, 'C001', c.REAL_PAY, 'C002', c.REAL_PAY, 'C003', c.REAL_PAY, 'C004', c.REAL_PAY, 'C005', c.REAL_PAY, 'C006', c.REAL_PAY, 'C007', c.REAL_PAY, 0)) AS PAY_MONEY_JD,
                         SUM(DECODE(c.FUND_ID, '001', c.REAL_PAY, '511', c.REAL_PAY, '202', c.REAL_PAY, '801', c.REAL_PAY, 0)) AS FUND_MONEY,
                         SUM(DECODE(c.FUND_ID, '301', c.REAL_PAY,  0)) AS FUND_301,
                         SUM(DECODE(c.FUND_ID, '003', c.REAL_PAY,  0)) AS FUND_003,
                         SUM(DECODE(c.FUND_ID, '901', c.REAL_PAY, '802', c.REAL_PAY, 0)) AS YW_FUND_MONEY,
                         SUM(DECODE(c.FUND_ID, '306', c.REAL_PAY, 0)) AS BC_FUND_MONEY,
                         SUM(DECODE(c.POLICY_ITEM_CODE, 'S01', c.REAL_PAY, 'S02', c.REAL_PAY, 0)) AS QFX,
                         SUM(DECODE(c.FUND_ID, '996', c.REAL_PAY, 0)) AS HOSP_ZF,
                         SUM(DECODE(c.FUND_ID, '998', c.REAL_PAY, 0)) AS CENTER_ZF,
                         SUM(DECODE(c.label_flag || c.FUND_ID, '101003', c.REAL_PAY, '101999', c.REAL_PAY, 0)) AS PAY_MONEY_ALLSELF,
                         SUM(DECODE(c.label_flag || c.FUND_ID, '102003', c.REAL_PAY, '102999', c.REAL_PAY, 0)) AS PAY_MONEY_SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'E00003', c.REAL_PAY, 'E00999', c.REAL_PAY, 0)) AS PAY_MONEY_E00SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'Z00003', c.REAL_PAY, 'Z00999', c.REAL_PAY, 0)) AS PAY_MONEY_Z00SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'S00003', c.REAL_PAY, 'S00999', c.REAL_PAY, 0)) AS PAY_MONEY_S00SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'S01003', c.REAL_PAY, 'S01999', c.REAL_PAY, 0)) AS PAY_MONEY_S01SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'S02003', c.REAL_PAY, 'S02999', c.REAL_PAY, 0)) AS PAY_MONEY_S02SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'C000003', c.REAL_PAY, 'C000999', c.REAL_PAY, 0)) AS PAY_MONEY_C000SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'C001003', c.REAL_PAY, 'C001999', c.REAL_PAY, 'C002003', c.REAL_PAY, 'C002999', c.REAL_PAY, 'C003003', c.REAL_PAY, 'C003999', c.REAL_PAY, 0)) AS PAY_MONEY_C001SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'C004003', c.REAL_PAY, 'C004999', c.REAL_PAY, 'C005003', c.REAL_PAY, 'C005999', c.REAL_PAY, 0)) AS PAY_MONEY_C004SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'C006003', c.REAL_PAY, 'C006999', c.REAL_PAY, 'C007003', c.REAL_PAY, 'C007999', c.REAL_PAY, 0)) AS PAY_MONEY_C006SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'C007999', c.REAL_PAY, 0)) AS PAY_MONEY_C007SELF,
                         SUM(DECODE(c.policy_item_code || c.FUND_ID, 'C007003', c.REAL_PAY, 0)) AS PAY_MONEY_C007003SELF,
                         SUM(DECODE(c.FUND_ID, '201', c.REAL_PAY, 0)) AS DB_MONEY,
                         0 AS YWSH_DB_MONEY,
                         SUM(DECODE(c.FUND_ID, '001', c.REAL_PAY, '801', c.REAL_PAY, 0)) AS TC_MONEY,
                         case
                           when nvl(sum(decode(c.fund_id, '996', nvl(c.real_pay, 0), 0)), 0) >= 0 then
                            nvl(sum(decode(c.fund_id, '996', nvl(c.real_pay, 0), 0)), 0)
                           else
                            0
                         end hosp_pay,
                         case
                           when nvl(sum(decode(c.fund_id, '996', nvl(c.real_pay, 0), 0)), 0) >= 0 then
                            0
                           else
                            -nvl(sum(decode(c.fund_id, '996', nvl(c.real_pay, 0), 0)), 0)
                         end hosp_prise,
                         SUM(DECODE(c.FUND_ID, '001', c.REAL_PAY, '801', c.REAL_PAY, 0)) AS TC_MONEY_XE,
                         SUM(DECODE(c.FUND_ID, '801', c.REAL_PAY, 0)) AS JMTC_MONEY,
                         SUM(DECODE(c.FUND_ID, '901', c.REAL_PAY, '802', c.REAL_PAY, 0)) AS YW_MONEY,
                         SUM(DECODE(c.FUND_ID, '802', c.REAL_PAY, 0)) AS JMYW_MONEY,
                         SUM(DECODE(c.FUND_ID, '003', c.REAL_PAY, 0)) AS ACCT_MONEY,
                         SUM(DECODE(c.FUND_ID, '202', c.REAL_PAY, 0)) AS LX_MONEY,
                         SUM(DECODE(c.FUND_ID, '511', c.REAL_PAY, 0)) AS SY_MONEY,
                         SUM(DECODE(c.FUND_ID, '301', c.REAL_PAY, 0)) AS OFFI_MONEY,
                         SUM(DECODE(c.FUND_ID, '401', c.REAL_PAY, 0)) AS ZHAOGU_PAY,
                         SUM(DECODE(c.FUND_ID, '999', c.REAL_PAY, 0)) AS PAY_MONEY_XZF,
                         SUM((CASE
                               WHEN C.POLICY_ITEM_CODE IN
                                    ('C000', 'C001', 'C002', 'C003', 'C004') AND
                                    (C.fund_id = '999' OR C.fund_id = '003') THEN
                                C.REAL_PAY
                               ELSE
                                0
                             END)) AS PAY_MONEY_DNZF,
                         (select nvl(nvl(sum(ss.all_self_money), 0) +
                                       nvl(sum(ss.part_self_money), 0), 0) as not_fund
                             from mt_fee_stat_fin ss
                            where ss.hospital_id = b.hospital_id
                              and ss.serial_no = b.serial_no
                              and ss.valid_flag = '1'
                              and ss.stat_type in ('001', '002', '003')) as medi_pay,
                         (select nvl(sum(ss.money), 0) as medi_zfy
                             from mt_fee_stat_fin ss
                            where ss.hospital_id = b.hospital_id
                              and ss.serial_no = b.serial_no
                              and ss.valid_flag = '1'
                              and ss.stat_type in ('001', '002', '003')) as medi_zfy,
                         SUM(DECODE(c.FUND_ID, '803', c.REAL_PAY, 0)) AS DB_MONEY_JUMIN
                    FROM MT_BIZ_FIN B, MT_PAY_RECORD_FIN C, BS_BIZTYPE G,
                         BS_INSURED J
                   WHERE B.HOSPITAL_ID = C.HOSPITAL_ID
                     AND B.SERIAL_NO = C.SERIAL_NO
                     AND B.CENTER_ID = G.CENTER_ID
                     AND B.BIZ_TYPE = G.BIZ_TYPE
                     AND B.VALID_FLAG = '1'
                     AND C.VALID_FLAG = '1'
                     and b.indi_id = j.indi_id
                     and (b.hospital_id,b.serial_no) in
                         (select hospital_id,serial_no
                            from pm_account_biz
                           where month_decl_sn in
                                 (select rela_decl_sn
                                    from pm_bill
                                   where outpay_bill_no = '23') and ((biz_flag = '18' and biz_type = '12') or biz_type <>'12' ))
                   GROUP BY b.hospital_id, b.serial_no, b.indi_id) T
          where a.hospital_id = b.hospital_id
            and b.center_id = g.center_id
            and b.biz_type = g.biz_type
            and b.center_id = h.center_id(+)
            and b.valid_flag = '1'
            and b.indi_id = j.indi_id
            and b.CORP_ID = street.CORP_ID(+)
            AND B.HOSPITAL_ID = T.HOSPITAL_ID
            AND B.SERIAL_NO = T.SERIAL_NO
          order by rowno) w

修改后的sql执行时间在10秒以内:
20160405_jy

20160405_jy_2

查看其执行计划:

SQL> select * from table(dbms_xplan.display_cursor('3vgjr2kwtyncm',null,'ALL ALLSTATS'));

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  3vgjr2kwtyncm, child number 0
-------------------------------------
select /*+ jy_20160405_01 */ rowno, hos_serial, reg_flag,        nvl((SELECT distinct t.policy_value               FROM fc_biz_policy t
WHERE t.policy_code = 'can_clinic_flag'                and t.valid_flag = '1'                and t.center_id = '430701'), (SELECT distinct
t.policy_value                 FROM fc_biz_policy t                WHERE t.policy_code =                      'can_clinic_flag'                  and
t.valid_flag = '1'                  and t.center_id = '0')) AS can_clinic_flag,        decode(DISEASE_TYPE, 'A', '病种单纯', 'B', '严重', 'C', '严重并发', 'D',
'危重', '') DISEASE_TYPE,        hospital_id, hospital_name, serial_no, biz_type, case_id, biz_stat,        name, sex, pers_type, begin_date, end_date,
fin_date, finish_date,        reg_date, in_days, indi_id, insr_code, fin_staff, fin_man, corp_id,        idcard, district_code, office_grade,center_id,
      (select t.special_code            from bs_corp_pres t           where t.indi_id = w.indi_id)

Plan hash value: 3988998535
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                                      | Name                     | E-Rows |E-Bytes| Cost (%CPU)| E-Time   |  OMem |  1Mem |  O/1/M   | Max-Tmp |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
|   1 |  HASH UNIQUE                                   |                          |      1 |    31 |     2  (50)| 00:00:01 |  1307K|  1307K|     1/0/0|         |
|*  2 |   TABLE ACCESS BY INDEX ROWID                  | FC_BIZ_POLICY            |      1 |    31 |     1   (0)| 00:00:01 |       |       |          |         |
|*  3 |    INDEX RANGE SCAN                            | PK_FC_BIZ_POLICY         |      1 |       |     1   (0)| 00:00:01 |       |       |          |         |
|   4 |    HASH UNIQUE                                 |                          |      1 |    31 |     2  (50)| 00:00:01 |  1594K|  1594K|     1/0/0|         |
|*  5 |     TABLE ACCESS BY INDEX ROWID                | FC_BIZ_POLICY            |      1 |    31 |     1   (0)| 00:00:01 |       |       |          |         |
|*  6 |      INDEX RANGE SCAN                          | PK_FC_BIZ_POLICY         |      1 |       |     1   (0)| 00:00:01 |       |       |          |         |
|   7 |  TABLE ACCESS BY INDEX ROWID                   | BS_SEX                   |      1 |     6 |     1   (0)| 00:00:01 |       |       |          |         |
|*  8 |   INDEX UNIQUE SCAN                            | PK_BS_SEX                |      1 |       |     1   (0)| 00:00:01 |       |       |          |         |
|   9 |  TABLE ACCESS BY INDEX ROWID                   | BS_PERSON_TYPE           |      1 |    18 |     1   (0)| 00:00:01 |       |       |          |         |
|* 10 |   INDEX UNIQUE SCAN                            | PK_BS_PERSON_TYPE        |      1 |       |     1   (0)| 00:00:01 |       |       |          |         |
|  11 |  SORT AGGREGATE                                |                          |      1 |    18 |            |          |       |       |          |         |
|  12 |   TABLE ACCESS BY INDEX ROWID                  | BS_INSURED               |      1 |    18 |     1   (0)| 00:00:01 |       |       |          |         |
|* 13 |    INDEX UNIQUE SCAN                           | PK_BS_INSURED            |      1 |       |     1   (0)| 00:00:01 |       |       |          |         |
|  14 |  TABLE ACCESS BY INDEX ROWID                   | BS_CORP_PRES             |      1 |     8 |     1   (0)| 00:00:01 |       |       |          |         |
|* 15 |   INDEX RANGE SCAN                             | INDEX_BS_CORP_PRES_INDI  |      1 |       |     1   (0)| 00:00:01 |       |       |          |         |
|  16 |  TABLE ACCESS BY INDEX ROWID                   | BS_DISEASE               |      1 |    33 |     1   (0)| 00:00:01 |       |       |          |         |
|* 17 |   INDEX RANGE SCAN                             | INX_BS_DISEASE_01        |      1 |       |     1   (0)| 00:00:01 |       |       |          |         |
|  18 |  TABLE ACCESS BY INDEX ROWID                   | MT_APPLY                 |      1 |     9 |     1   (0)| 00:00:01 |       |       |          |         |
|* 19 |   INDEX UNIQUE SCAN                            | PK_MT_APPLY              |      1 |       |     1   (0)| 00:00:01 |       |       |          |         |
|  20 |  TABLE ACCESS BY INDEX ROWID                   | BS_DISEASE               |      1 |    33 |     1   (0)| 00:00:01 |       |       |          |         |
|* 21 |   INDEX RANGE SCAN                             | INX_BS_DISEASE_01        |      1 |       |     1   (0)| 00:00:01 |       |       |          |         |
|  22 |  TABLE ACCESS BY INDEX ROWID                   | BS_TREAT_TYPE            |      1 |    23 |     1   (0)| 00:00:01 |       |       |          |         |
|* 23 |   INDEX UNIQUE SCAN                            | PK_BS_TREAT_TYPE         |      1 |       |     1   (0)| 00:00:01 |       |       |          |         |
|  24 |  SORT AGGREGATE                                |                          |      1 |    34 |            |          |       |       |          |         |
|* 25 |   TABLE ACCESS BY INDEX ROWID                  | MT_FEE_STAT_FIN          |      1 |    34 |     1   (0)| 00:00:01 |       |       |          |         |
|* 26 |    INDEX RANGE SCAN                            | PK_MT_FEE_STAT_FIN       |      1 |       |     1   (0)| 00:00:01 |       |       |          |         |
|  27 |  SORT AGGREGATE                                |                          |      1 |    31 |            |          |       |       |          |         |
|* 28 |   TABLE ACCESS BY INDEX ROWID                  | MT_FEE_STAT_FIN          |      1 |    31 |     1   (0)| 00:00:01 |       |       |          |         |
|* 29 |    INDEX RANGE SCAN                            | PK_MT_FEE_STAT_FIN       |      1 |       |     1   (0)| 00:00:01 |       |       |          |         |
|  30 |  VIEW                                          |                          |    504 |   771K|  1923   (2)| 00:00:24 |       |       |          |         |
|  31 |   SORT ORDER BY                                |                          |    504 |   431K|  1923   (2)| 00:00:24 |  5935K|   992K|     1/0/0|         |
|  32 |    COUNT                                       |                          |        |       |            |          |       |       |          |         |
|  33 |     NESTED LOOPS                               |                          |    504 |   431K|  1922   (2)| 00:00:24 |       |       |          |         |
|* 34 |      HASH JOIN                                 |                          |    504 |   428K|  1921   (2)| 00:00:24 |  1095K|  1095K|     2/0/0|         |
|  35 |       TABLE ACCESS FULL                        | BS_BIZTYPE               |     97 |  1164 |     3   (0)| 00:00:01 |       |       |          |         |
|* 36 |       HASH JOIN RIGHT OUTER                    |                          |    504 |   422K|  1918   (2)| 00:00:24 |  1078K|  1078K|     2/0/0|         |
|  37 |        TABLE ACCESS FULL                       | BS_CENTER                |     12 |   168 |     3   (0)| 00:00:01 |       |       |          |         |
|* 38 |        HASH JOIN RIGHT OUTER                   |                          |    504 |   415K|  1914   (1)| 00:00:23 |  1593K|  1593K|     2/0/0|         |
|  39 |         VIEW                                   |                          |      1 |    12 |   117   (2)| 00:00:02 |       |       |          |         |
|* 40 |          HASH JOIN                             |                          |      1 |    18 |   117   (2)| 00:00:02 |  1133K|  1133K|     2/0/0|         |
|  41 |           TABLE ACCESS FULL                    | BS_COUNTRY_STREET        |      1 |     7 |     2   (0)| 00:00:01 |       |       |          |         |
|* 42 |           TABLE ACCESS FULL                    | BS_CORP                  |   9523 |   102K|   114   (1)| 00:00:02 |       |       |          |         |
|* 43 |         HASH JOIN                              |                          |    504 |   409K|  1797   (1)| 00:00:22 |   915K|   915K|     2/0/0|         |
|  44 |          INDEX FULL SCAN                       | IDX_BS_HOSPITAL_NAME     |   1325 | 43725 |     2   (0)| 00:00:01 |       |       |          |         |
|* 45 |          TABLE ACCESS BY INDEX ROWID           | MT_BIZ_FIN               |      1 |   225 |     1   (0)| 00:00:01 |       |       |          |         |
|  46 |           NESTED LOOPS                         |                          |    630 |   491K|  1794   (1)| 00:00:22 |       |       |          |         |
|  47 |            VIEW                                |                          |    638 |   357K|  1539   (2)| 00:00:19 |       |       |          |         |
|  48 |             HASH GROUP BY                      |                          |    638 | 37642 |  1539   (2)| 00:00:19 |    10M|  1830K|          |   17408 |
|  49 |              VIEW                              |                          |    638 | 37642 |  1539   (2)| 00:00:19 |       |       |          |         |
|  50 |               HASH UNIQUE                      |                          |    638 |   122K|  1539   (2)| 00:00:19 |    32M|  3970K|          |   30720 |
|  51 |                NESTED LOOPS                    |                          |    638 |   122K|  1538   (2)| 00:00:19 |       |       |          |         |
|  52 |                 NESTED LOOPS                   |                          |    637 |   111K|  1537   (2)| 00:00:19 |       |       |          |         |
|  53 |                  NESTED LOOPS                  |                          |    637 |    97K|  1536   (2)| 00:00:19 |       |       |          |         |
|  54 |                   NESTED LOOPS                 |                          |    642 | 60990 |  1407   (2)| 00:00:17 |       |       |          |         |
|  55 |                    NESTED LOOPS                |                          |    651 | 26691 |  1147   (2)| 00:00:14 |       |       |          |         |
|* 56 |                     TABLE ACCESS FULL          | PM_BILL                  |      3 |    27 |  1119   (2)| 00:00:14 |       |       |          |         |
|* 57 |                     TABLE ACCESS BY INDEX ROWID| PM_ACCOUNT_BIZ           |    205 |  6560 |     9   (0)| 00:00:01 |       |       |          |         |
|* 58 |                      INDEX RANGE SCAN          | IDX_PM_ACCOUNT_BIZ_MONTH |    213 |       |     1   (0)| 00:00:01 |       |       |          |         |
|* 59 |                    TABLE ACCESS BY INDEX ROWID | MT_BIZ_FIN               |      1 |    54 |     1   (0)| 00:00:01 |       |       |          |         |
|* 60 |                     INDEX RANGE SCAN           | PK_MT_BIZ_FIN            |      1 |       |     1   (0)| 00:00:01 |       |       |          |         |
|* 61 |                   TABLE ACCESS BY INDEX ROWID  | MT_PAY_RECORD_FIN        |      1 |    62 |     1   (0)| 00:00:01 |       |       |          |         |
|* 62 |                    INDEX RANGE SCAN            | IDX$$_429C0002           |      1 |       |     1   (0)| 00:00:01 |       |       |          |         |
|* 63 |                  INDEX UNIQUE SCAN             | PK_BS_BIZTYPE            |      1 |    22 |     1   (0)| 00:00:01 |       |       |          |         |
|* 64 |                 INDEX UNIQUE SCAN              | PK_BS_INSURED            |      1 |    18 |     1   (0)| 00:00:01 |       |       |          |         |
|* 65 |            INDEX RANGE SCAN                    | PK_MT_BIZ_FIN            |      1 |       |     1   (0)| 00:00:01 |       |       |          |         |
|* 66 |      INDEX UNIQUE SCAN                         | PK_BS_INSURED            |      1 |     6 |     1   (0)| 00:00:01 |       |       |          |         |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------

Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------

   1 - SEL$2
   2 - SEL$2        / T@SEL$2
   3 - SEL$2        / T@SEL$2
   4 - SEL$3
   5 - SEL$3        / T@SEL$3
   6 - SEL$3        / T@SEL$3
   7 - SEL$7        / BS@SEL$7
   8 - SEL$7        / BS@SEL$7
   9 - SEL$8        / PP@SEL$8
  10 - SEL$8        / PP@SEL$8
  11 - SEL$15
  12 - SEL$15       / A@SEL$15
  13 - SEL$15       / A@SEL$15
  14 - SEL$4        / T@SEL$4
  15 - SEL$4        / T@SEL$4
  16 - SEL$9        / T@SEL$9
  17 - SEL$9        / T@SEL$9
  18 - SEL$11       / T@SEL$11
  19 - SEL$11       / T@SEL$11
  20 - SEL$10       / Q@SEL$10
  21 - SEL$10       / Q@SEL$10
  22 - SEL$5        / BS_TREAT_TYPE@SEL$5
  23 - SEL$5        / BS_TREAT_TYPE@SEL$5
  24 - SEL$16
  25 - SEL$16       / SS@SEL$16
  26 - SEL$16       / SS@SEL$16
  27 - SEL$17
  28 - SEL$17       / SS@SEL$17
  29 - SEL$17       / SS@SEL$17
  30 - SEL$6        / W@SEL$1
  31 - SEL$6
  35 - SEL$6        / G@SEL$6
  37 - SEL$6        / H@SEL$6
  39 - SEL$8F7BCF6F / STREET@SEL$6
  40 - SEL$8F7BCF6F
  41 - SEL$8F7BCF6F / ST@SEL$12
  42 - SEL$8F7BCF6F / CORP@SEL$12
  44 - SEL$6        / A@SEL$6
  45 - SEL$6        / B@SEL$6
  47 - SEL$6C11BF2C / T@SEL$6
  48 - SEL$6C11BF2C
  49 - SEL$93984FCC / $vm_view@SEL$6C11BF2C
  50 - SEL$93984FCC
  56 - SEL$93984FCC / PM_BILL@SEL$19
  57 - SEL$93984FCC / PM_ACCOUNT_BIZ@SEL$18
  58 - SEL$93984FCC / PM_ACCOUNT_BIZ@SEL$18
  59 - SEL$93984FCC / B@SEL$14
  60 - SEL$93984FCC / B@SEL$14
  61 - SEL$93984FCC / C@SEL$14
  62 - SEL$93984FCC / C@SEL$14
  63 - SEL$93984FCC / G@SEL$14
  64 - SEL$93984FCC / J@SEL$14
  65 - SEL$6        / B@SEL$6
  66 - SEL$6        / J@SEL$6

Predicate Information (identified by operation id):
---------------------------------------------------
   2 - filter("T"."VALID_FLAG"='1')
   3 - access("T"."POLICY_CODE"='can_clinic_flag' AND "T"."CENTER_ID"='430701')
       filter("T"."CENTER_ID"='430701')
   5 - filter("T"."VALID_FLAG"='1')
   6 - access("T"."POLICY_CODE"='can_clinic_flag' AND "T"."CENTER_ID"='0')
       filter("T"."CENTER_ID"='0')
   8 - access("BS"."SEX"=TO_NUMBER(:B1))
  10 - access("PP"."PERS_TYPE"=TO_NUMBER(:B1) AND "PP"."CENTER_ID"=:B2)
  13 - access("A"."INDI_ID"=:B1)
  15 - access("T"."INDI_ID"=:B1)
  17 - access("T"."CENTER_ID"=NVL(:B1,:B2) AND "T"."ICD"=:B3)
  19 - access("T"."SERIAL_APPLY"=:B1)
  21 - access("Q"."CENTER_ID"=NVL(:B1,:B2) AND "Q"."ICD"=:B3)
  23 - access("TREATMENT_TYPE"=:B1 AND "CENTER_ID"=:B2)
  25 - filter("SS"."VALID_FLAG"='1')
  26 - access("SS"."HOSPITAL_ID"=:B1 AND "SS"."SERIAL_NO"=:B2)
       filter(("SS"."STAT_TYPE"='001' OR "SS"."STAT_TYPE"='002' OR "SS"."STAT_TYPE"='003'))
  28 - filter("SS"."VALID_FLAG"='1')
  29 - access("SS"."HOSPITAL_ID"=:B1 AND "SS"."SERIAL_NO"=:B2)
       filter(("SS"."STAT_TYPE"='001' OR "SS"."STAT_TYPE"='002' OR "SS"."STAT_TYPE"='003'))
  34 - access("B"."CENTER_ID"="G"."CENTER_ID" AND "B"."BIZ_TYPE"="G"."BIZ_TYPE")
  36 - access("B"."CENTER_ID"="H"."CENTER_ID")
  38 - access("B"."CORP_ID"="STREET"."CORP_ID")
  40 - access("CORP"."AREA_CODE"="ST"."QYBM")
  42 - filter("CORP"."AREA_CODE" IS NOT NULL)
  43 - access("A"."HOSPITAL_ID"="B"."HOSPITAL_ID")
  45 - filter("B"."VALID_FLAG"='1')
  56 - filter("OUTPAY_BILL_NO"=23)
  57 - filter(("BIZ_TYPE"<>'12' OR ("BIZ_FLAG"=18 AND "BIZ_TYPE"='12')))
  58 - access("MONTH_DECL_SN"="RELA_DECL_SN")
  59 - filter("B"."VALID_FLAG"='1')
  60 - access("B"."HOSPITAL_ID"="HOSPITAL_ID" AND "B"."SERIAL_NO"="SERIAL_NO")
  61 - filter("C"."VALID_FLAG"='1')
  62 - access("B"."HOSPITAL_ID"="C"."HOSPITAL_ID" AND "B"."SERIAL_NO"="C"."SERIAL_NO")
  63 - access("B"."CENTER_ID"="G"."CENTER_ID" AND "B"."BIZ_TYPE"="G"."BIZ_TYPE")
  64 - access("B"."INDI_ID"="J"."INDI_ID")
  65 - access("B"."HOSPITAL_ID"="T"."HOSPITAL_ID" AND "B"."SERIAL_NO"="T"."SERIAL_NO")
  66 - access("B"."INDI_ID"="J"."INDI_ID")

Column Projection Information (identified by operation id):
-----------------------------------------------------------

   1 - "T"."POLICY_VALUE"[VARCHAR2,200]
   2 - "T"."POLICY_VALUE"[VARCHAR2,200]
   3 - "T".ROWID[ROWID,10]
   4 - "T"."POLICY_VALUE"[VARCHAR2,200]
   5 - "T"."POLICY_VALUE"[VARCHAR2,200]
   6 - "T".ROWID[ROWID,10]
   7 - "BS".ROWID[ROWID,10], "BS"."SEX_NAME"[VARCHAR2,5]
   8 - "BS".ROWID[ROWID,10]
   9 - "PP".ROWID[ROWID,10], "PP"."PERS_NAME"[VARCHAR2,20]
  10 - "PP".ROWID[ROWID,10]
  11 - (#keys=0) MAX("INSR_CODE")[30]
  12 - "INSR_CODE"[VARCHAR2,30]
  13 - "A".ROWID[ROWID,10]
  14 - "T".ROWID[ROWID,10], "T"."SPECIAL_CODE"[NUMBER,22]
  15 - "T".ROWID[ROWID,10]
  16 - "T".ROWID[ROWID,10], "T"."DISEASE"[VARCHAR2,100]
  17 - "T".ROWID[ROWID,10]
  18 - "T".ROWID[ROWID,10], "T"."APPLY_CONTENT"[VARCHAR2,3]
  19 - "T".ROWID[ROWID,10]
  20 - "Q".ROWID[ROWID,10], "Q"."DISEASE"[VARCHAR2,100]
  21 - "Q".ROWID[ROWID,10]
  22 - "BS_TREAT_TYPE".ROWID[ROWID,10], "TREATMENT_NAME"[VARCHAR2,50]
  23 - "BS_TREAT_TYPE".ROWID[ROWID,10]
  24 - (#keys=0) SUM("SS"."PART_SELF_MONEY")[22], SUM("SS"."ALL_SELF_MONEY")[22]
  25 - "SS"."PART_SELF_MONEY"[NUMBER,22], "SS"."ALL_SELF_MONEY"[NUMBER,22]
  26 - "SS".ROWID[ROWID,10]
  27 - (#keys=0) SUM("SS"."MONEY")[22]
  28 - "SS"."MONEY"[NUMBER,22]
  29 - "SS".ROWID[ROWID,10]
  30 - "ROWNO"[NUMBER,22], "HOS_SERIAL"[VARCHAR2,30], "REG_FLAG"[CHARACTER,1], "DISEASE_TYPE"[CHARACTER,1], "HOSPITAL_ID"[VARCHAR2,20],
       "HOSPITAL_NAME"[VARCHAR2,70], "SERIAL_NO"[VARCHAR2,16], "BIZ_TYPE"[VARCHAR2,2], "CASE_ID"[NUMBER,22], "BIZ_STAT"[VARCHAR2,2], "NAME"[VARCHAR2,20],
       "SEX"[VARCHAR2,5], "PERS_TYPE"[VARCHAR2,20], "BEGIN_DATE"[VARCHAR2,10], "END_DATE"[VARCHAR2,10], "FIN_DATE"[VARCHAR2,19], "FINISH_DATE"[VARCHAR2,19],
       "INDI_ID"[NUMBER,22], "INSR_CODE"[VARCHAR2,30], "FIN_STAFF"[VARCHAR2,10], "FIN_MAN"[VARCHAR2,30], "CORP_ID"[NUMBER,22], "IDCARD"[VARCHAR2,25],
       "REG_DATE"[VARCHAR2,19], "IN_DAYS"[NUMBER,22], "DISTRICT_CODE"[VARCHAR2,6], "CENTER_ID"[VARCHAR2,10], "OFFICE_GRADE"[VARCHAR2,3],
       "CORP_NAME"[VARCHAR2,70], "DISEASE"[VARCHAR2,100], "IN_AREA_NAME"[VARCHAR2,20], "IN_DEPT_NAME"[VARCHAR2,20], "IN_BED"[VARCHAR2,10],
       "BED_TYPE"[CHARACTER,1], "PATIENT_ID"[VARCHAR2,20], "REMARK"[VARCHAR2,1000], "POS_CODE"[VARCHAR2,10], "REIMBURSE_FLAG"[CHARACTER,1],
       "FIN_DISEASE"[VARCHAR2,100], "FOREGIFT"[NUMBER,1], "IC_NO"[VARCHAR2,25], "TREATMENT_TYPE"[VARCHAR2,3], "APPLY_CONTENT"[VARCHAR2,3],
       "REG_MAN"[VARCHAR2,20], "W"."AREA_CODE"[VARCHAR2,10], "FEES"[NUMBER,22], "PAY_MONEY_JD"[NUMBER,22], "FUND_MONEY"[NUMBER,22], "FUND_301"[NUMBER,22],
       "FUND_003"[NUMBER,22], "QFX"[NUMBER,22], "HOSP_ZF"[NUMBER,22], "CENTER_ZF"[NUMBER,22], "YW_FUND_MONEY"[NUMBER,22], "BC_FUND_MONEY"[NUMBER,22],
       "PAY_MONEY_ALLSELF"[NUMBER,22], "PAY_MONEY_SELF"[NUMBER,22], "PAY_MONEY_E00SELF"[NUMBER,22], "PAY_MONEY_Z00SELF"[NUMBER,22],
       "PAY_MONEY_S00SELF"[NUMBER,22], "PAY_MONEY_S01SELF"[NUMBER,22], "PAY_MONEY_C000SELF"[NUMBER,22], "PAY_MONEY_C001SELF"[NUMBER,22],
       "PAY_MONEY_C004SELF"[NUMBER,22], "PAY_MONEY_C006SELF"[NUMBER,22], "PAY_MONEY_C007SELF"[NUMBER,22], "PAY_MONEY_C007003SELF"[NUMBER,22],
       "DB_MONEY"[NUMBER,22], "YWSH_DB_MONEY"[NUMBER,1], "TC_MONEY"[NUMBER,22], "TC_MONEY_XE"[NUMBER,22], "HOSP_PAY"[NUMBER,22], "HOSP_PRISE"[NUMBER,22],
       "JMTC_MONEY"[NUMBER,22], "YW_MONEY"[NUMBER,22], "JMYW_MONEY"[NUMBER,22], "ACCT_MONEY"[NUMBER,22], "LX_MONEY"[NUMBER,22], "SY_MONEY"[NUMBER,22],
       "OFFI_MONEY"[NUMBER,22], "ZHAOGU_PAY"[NUMBER,22], "PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22], "MEDI_PAY"[NUMBER,22], "MEDI_ZFY"[NUMBER,22],
       "REG_INFO"[VARCHAR2,10], "DB_MONEY_JUMIN"[NUMBER,22]
  31 - (#keys=1) ROWNUM[22], "T"."DB_MONEY_JUMIN"[NUMBER,22], "B"."HOS_SERIAL"[VARCHAR2,30], "B"."REG_FLAG"[CHARACTER,1],
       "B"."DISEASE_TYPE"[CHARACTER,1], "A"."HOSPITAL_ID"[VARCHAR2,20], "A"."HOSPITAL_NAME"[VARCHAR2,70], "B"."SERIAL_NO"[VARCHAR2,16],
       "B"."BIZ_TYPE"[VARCHAR2,2], "B"."CASE_ID"[NUMBER,22], "G"."BIZ_STAT"[VARCHAR2,2], "B"."NAME"[VARCHAR2,20], [5], [20],
       TO_CHAR(INTERNAL_FUNCTION("B"."BEGIN_DATE"),'yyyy-mm-dd')[10], TO_CHAR(INTERNAL_FUNCTION("B"."END_DATE"),'yyyy-mm-dd')[10],
       TO_CHAR(INTERNAL_FUNCTION("B"."FIN_DATE"),'yyyy-mm-dd hh24:mi:ss')[19], TO_CHAR(INTERNAL_FUNCTION("B"."FIN_DATE"),'yyyy-mm-dd hh24:mi:ss')[19],
       "B"."INDI_ID"[NUMBER,22], "T"."INSR_CODE"[VARCHAR2,30], "B"."FIN_STAFF"[VARCHAR2,10], "B"."FIN_MAN"[VARCHAR2,30], "B"."CORP_ID"[NUMBER,22],
       "B"."IDCARD"[VARCHAR2,25], TO_CHAR(INTERNAL_FUNCTION("B"."REG_DATE"),'yyyy-mm-dd hh24:mi:ss')[19], NVL("B"."IN_DAYS",0)[22],
       "B"."DISTRICT_CODE"[VARCHAR2,6], "B"."CENTER_ID"[VARCHAR2,10], "B"."OFFICE_GRADE"[VARCHAR2,3], "B"."CORP_NAME"[VARCHAR2,70],
       "B"."IN_DISEASE"[VARCHAR2,20], [100], "B"."IN_AREA_NAME"[VARCHAR2,20], "B"."IN_DEPT_NAME"[VARCHAR2,20], "B"."IN_BED"[VARCHAR2,10],
','')[1000], "B"."POS_CODE"[VARCHAR2,10],PATIENT_ID"[VARCHAR2,20], TRANSLATE("B"."REMARK",'
       "B"."REIMBURSE_FLAG"[CHARACTER,1], [100], 0[1], "B"."IC_NO"[VARCHAR2,25], "B"."TREATMENT_TYPE"[VARCHAR2,3], [3], "B"."REG_MAN"[VARCHAR2,20],
       "STREET"."QYBM"[VARCHAR2,10], "T"."FEES"[NUMBER,22], "T"."PAY_MONEY_JD"[NUMBER,22], "T"."FUND_MONEY"[NUMBER,22], "T"."FUND_301"[NUMBER,22],
       "T"."FUND_003"[NUMBER,22], "T"."QFX"[NUMBER,22], "T"."HOSP_ZF"[NUMBER,22], "T"."CENTER_ZF"[NUMBER,22], "T"."YW_FUND_MONEY"[NUMBER,22],
       "T"."BC_FUND_MONEY"[NUMBER,22], "T"."PAY_MONEY_ALLSELF"[NUMBER,22], "T"."PAY_MONEY_SELF"[NUMBER,22], "T"."PAY_MONEY_E00SELF"[NUMBER,22],
       "T"."PAY_MONEY_Z00SELF"[NUMBER,22], "T"."PAY_MONEY_S00SELF"[NUMBER,22], "T"."PAY_MONEY_S01SELF"[NUMBER,22], "T"."PAY_MONEY_C000SELF"[NUMBER,22],
       "T"."PAY_MONEY_C001SELF"[NUMBER,22], "T"."PAY_MONEY_C004SELF"[NUMBER,22], "T"."PAY_MONEY_C006SELF"[NUMBER,22], "T"."PAY_MONEY_C007SELF"[NUMBER,22],
       "T"."PAY_MONEY_C007003SELF"[NUMBER,22], "T"."DB_MONEY"-"T"."YWSH_DB_MONEY"[22], "T"."YWSH_DB_MONEY"[NUMBER,1], "T"."TC_MONEY"[NUMBER,22],
       "T"."TC_MONEY_XE"[NUMBER,22], "T"."HOSP_PAY"[NUMBER,22], "T"."HOSP_PRISE"[NUMBER,22], "T"."JMTC_MONEY"[NUMBER,22], "T"."YW_MONEY"[NUMBER,22],
       "T"."JMYW_MONEY"[NUMBER,22], "T"."ACCT_MONEY"[NUMBER,22], "T"."LX_MONEY"[NUMBER,22], "T"."SY_MONEY"[NUMBER,22], "T"."OFFI_MONEY"[NUMBER,22],
       "T"."ZHAOGU_PAY"[NUMBER,22], "T"."PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22], "MEDI_PAY"[NUMBER,22], "MEDI_ZFY"[NUMBER,22],
       "B"."REG_INFO"[VARCHAR2,10]
  32 - "B"."CENTER_ID"[VARCHAR2,10], "B"."BIZ_TYPE"[VARCHAR2,2], "G"."BIZ_STAT"[VARCHAR2,2], "H"."CENTER_ID"[VARCHAR2,10],
       "B"."PERS_TYPE_DETAIL"[VARCHAR2,3], "H"."CATALOG_CENTER"[VARCHAR2,10], "B"."CORP_ID"[NUMBER,22], "STREET"."QYBM"[VARCHAR2,10],
       "A"."HOSPITAL_ID"[VARCHAR2,20], "A"."HOSPITAL_NAME"[VARCHAR2,70], "T"."INSR_CODE"[VARCHAR2,30], "T"."FEES"[NUMBER,22], "T"."PAY_MONEY_JD"[NUMBER,22],
       "T"."FUND_MONEY"[NUMBER,22], "T"."FUND_301"[NUMBER,22], "T"."FUND_003"[NUMBER,22], "T"."YW_FUND_MONEY"[NUMBER,22], "T"."BC_FUND_MONEY"[NUMBER,22],
       "T"."QFX"[NUMBER,22], "T"."HOSP_ZF"[NUMBER,22], "T"."CENTER_ZF"[NUMBER,22], "T"."PAY_MONEY_ALLSELF"[NUMBER,22], "T"."PAY_MONEY_SELF"[NUMBER,22],
       "T"."PAY_MONEY_E00SELF"[NUMBER,22], "T"."PAY_MONEY_Z00SELF"[NUMBER,22], "T"."PAY_MONEY_S00SELF"[NUMBER,22], "T"."PAY_MONEY_S01SELF"[NUMBER,22],
       "T"."PAY_MONEY_C000SELF"[NUMBER,22], "T"."PAY_MONEY_C001SELF"[NUMBER,22], "T"."PAY_MONEY_C004SELF"[NUMBER,22], "T"."PAY_MONEY_C006SELF"[NUMBER,22],
       "T"."PAY_MONEY_C007SELF"[NUMBER,22], "T"."PAY_MONEY_C007003SELF"[NUMBER,22], "T"."DB_MONEY"[NUMBER,22], "T"."YWSH_DB_MONEY"[NUMBER,1],
       "T"."TC_MONEY"[NUMBER,22], "T"."HOSP_PAY"[NUMBER,22], "T"."HOSP_PRISE"[NUMBER,22], "T"."TC_MONEY_XE"[NUMBER,22], "T"."JMTC_MONEY"[NUMBER,22],
       "T"."YW_MONEY"[NUMBER,22], "T"."JMYW_MONEY"[NUMBER,22], "T"."ACCT_MONEY"[NUMBER,22], "T"."LX_MONEY"[NUMBER,22], "T"."SY_MONEY"[NUMBER,22],
       "T"."OFFI_MONEY"[NUMBER,22], "T"."ZHAOGU_PAY"[NUMBER,22], "T"."PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22], "MEDI_PAY"[NUMBER,22],
       "MEDI_ZFY"[NUMBER,22], "T"."DB_MONEY_JUMIN"[NUMBER,22], "B"."DISEASE_TYPE"[CHARACTER,1], "B"."SERIAL_NO"[VARCHAR2,16], "B"."CASE_ID"[NUMBER,22],
       "B"."DISTRICT_CODE"[VARCHAR2,6], "B"."INDI_ID"[NUMBER,22], "B"."NAME"[VARCHAR2,20], "B"."SEX"[CHARACTER,1], "B"."OFFICE_GRADE"[VARCHAR2,3],
       "B"."IDCARD"[VARCHAR2,25], "B"."IC_NO"[VARCHAR2,25], "B"."HOS_SERIAL"[VARCHAR2,30], "B"."CORP_NAME"[VARCHAR2,70], "B"."TREATMENT_TYPE"[VARCHAR2,3],
       "B"."SERIAL_APPLY"[NUMBER,22], "B"."REG_DATE"[DATE,7], "B"."REG_MAN"[VARCHAR2,20], "B"."REG_FLAG"[CHARACTER,1], "B"."BEGIN_DATE"[DATE,7],
       "B"."REG_INFO"[VARCHAR2,10], "B"."IN_DEPT_NAME"[VARCHAR2,20], "B"."IN_AREA_NAME"[VARCHAR2,20], "B"."IN_BED"[VARCHAR2,10], "B"."BED_TYPE"[CHARACTER,1],
       "B"."PATIENT_ID"[VARCHAR2,20], "B"."IN_DISEASE"[VARCHAR2,20], "B"."IN_DAYS"[NUMBER,22], "B"."FIN_DISEASE"[VARCHAR2,20], "B"."END_DATE"[DATE,7],
       "B"."REIMBURSE_FLAG"[CHARACTER,1], "B"."POS_CODE"[VARCHAR2,10], "B"."REMARK"[VARCHAR2,500], "B"."FIN_DATE"[DATE,7], "B"."FIN_STAFF"[VARCHAR2,10],
       "B"."FIN_MAN"[VARCHAR2,30], ROWNUM[4]
  33 - "B"."CENTER_ID"[VARCHAR2,10], "B"."BIZ_TYPE"[VARCHAR2,2], "G"."BIZ_STAT"[VARCHAR2,2], "H"."CENTER_ID"[VARCHAR2,10],
       "B"."PERS_TYPE_DETAIL"[VARCHAR2,3], "H"."CATALOG_CENTER"[VARCHAR2,10], "B"."CORP_ID"[NUMBER,22], "STREET"."QYBM"[VARCHAR2,10],
       "A"."HOSPITAL_ID"[VARCHAR2,20], "A"."HOSPITAL_NAME"[VARCHAR2,70], "T"."INSR_CODE"[VARCHAR2,30], "T"."FEES"[NUMBER,22], "T"."PAY_MONEY_JD"[NUMBER,22],
       "T"."FUND_MONEY"[NUMBER,22], "T"."FUND_301"[NUMBER,22], "T"."FUND_003"[NUMBER,22], "T"."YW_FUND_MONEY"[NUMBER,22], "T"."BC_FUND_MONEY"[NUMBER,22],
       "T"."QFX"[NUMBER,22], "T"."HOSP_ZF"[NUMBER,22], "T"."CENTER_ZF"[NUMBER,22], "T"."PAY_MONEY_ALLSELF"[NUMBER,22], "T"."PAY_MONEY_SELF"[NUMBER,22],
       "T"."PAY_MONEY_E00SELF"[NUMBER,22], "T"."PAY_MONEY_Z00SELF"[NUMBER,22], "T"."PAY_MONEY_S00SELF"[NUMBER,22], "T"."PAY_MONEY_S01SELF"[NUMBER,22],
       "T"."PAY_MONEY_C000SELF"[NUMBER,22], "T"."PAY_MONEY_C001SELF"[NUMBER,22], "T"."PAY_MONEY_C004SELF"[NUMBER,22], "T"."PAY_MONEY_C006SELF"[NUMBER,22],
       "T"."PAY_MONEY_C007SELF"[NUMBER,22], "T"."PAY_MONEY_C007003SELF"[NUMBER,22], "T"."DB_MONEY"[NUMBER,22], "T"."YWSH_DB_MONEY"[NUMBER,1],
       "T"."TC_MONEY"[NUMBER,22], "T"."HOSP_PAY"[NUMBER,22], "T"."HOSP_PRISE"[NUMBER,22], "T"."TC_MONEY_XE"[NUMBER,22], "T"."JMTC_MONEY"[NUMBER,22],
       "T"."YW_MONEY"[NUMBER,22], "T"."JMYW_MONEY"[NUMBER,22], "T"."ACCT_MONEY"[NUMBER,22], "T"."LX_MONEY"[NUMBER,22], "T"."SY_MONEY"[NUMBER,22],
       "T"."OFFI_MONEY"[NUMBER,22], "T"."ZHAOGU_PAY"[NUMBER,22], "T"."PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22], "MEDI_PAY"[NUMBER,22],
       "MEDI_ZFY"[NUMBER,22], "T"."DB_MONEY_JUMIN"[NUMBER,22], "B"."DISEASE_TYPE"[CHARACTER,1], "B"."SERIAL_NO"[VARCHAR2,16], "B"."CASE_ID"[NUMBER,22],
       "B"."DISTRICT_CODE"[VARCHAR2,6], "B"."INDI_ID"[NUMBER,22], "B"."NAME"[VARCHAR2,20], "B"."SEX"[CHARACTER,1], "B"."OFFICE_GRADE"[VARCHAR2,3],
       "B"."IDCARD"[VARCHAR2,25], "B"."IC_NO"[VARCHAR2,25], "B"."HOS_SERIAL"[VARCHAR2,30], "B"."CORP_NAME"[VARCHAR2,70], "B"."TREATMENT_TYPE"[VARCHAR2,3],
       "B"."SERIAL_APPLY"[NUMBER,22], "B"."REG_DATE"[DATE,7], "B"."REG_MAN"[VARCHAR2,20], "B"."REG_FLAG"[CHARACTER,1], "B"."BEGIN_DATE"[DATE,7],
       "B"."REG_INFO"[VARCHAR2,10], "B"."IN_DEPT_NAME"[VARCHAR2,20], "B"."IN_AREA_NAME"[VARCHAR2,20], "B"."IN_BED"[VARCHAR2,10], "B"."BED_TYPE"[CHARACTER,1],
       "B"."PATIENT_ID"[VARCHAR2,20], "B"."IN_DISEASE"[VARCHAR2,20], "B"."IN_DAYS"[NUMBER,22], "B"."FIN_DISEASE"[VARCHAR2,20], "B"."END_DATE"[DATE,7],
       "B"."REIMBURSE_FLAG"[CHARACTER,1], "B"."POS_CODE"[VARCHAR2,10], "B"."REMARK"[VARCHAR2,500], "B"."FIN_DATE"[DATE,7], "B"."FIN_STAFF"[VARCHAR2,10],
       "B"."FIN_MAN"[VARCHAR2,30]
  34 - (#keys=2) "B"."CENTER_ID"[VARCHAR2,10], "B"."BIZ_TYPE"[VARCHAR2,2], "G"."BIZ_STAT"[VARCHAR2,2], "H"."CENTER_ID"[VARCHAR2,10],
       "B"."PERS_TYPE_DETAIL"[VARCHAR2,3], "H"."CATALOG_CENTER"[VARCHAR2,10], "B"."CORP_ID"[NUMBER,22], "STREET"."QYBM"[VARCHAR2,10],
       "A"."HOSPITAL_ID"[VARCHAR2,20], "A"."HOSPITAL_NAME"[VARCHAR2,70], "T"."INSR_CODE"[VARCHAR2,30], "T"."FEES"[NUMBER,22], "T"."PAY_MONEY_JD"[NUMBER,22],
       "T"."FUND_MONEY"[NUMBER,22], "T"."FUND_301"[NUMBER,22], "T"."FUND_003"[NUMBER,22], "T"."YW_FUND_MONEY"[NUMBER,22], "T"."BC_FUND_MONEY"[NUMBER,22],
       "T"."QFX"[NUMBER,22], "T"."HOSP_ZF"[NUMBER,22], "T"."CENTER_ZF"[NUMBER,22], "T"."PAY_MONEY_ALLSELF"[NUMBER,22], "T"."PAY_MONEY_SELF"[NUMBER,22],
       "T"."PAY_MONEY_E00SELF"[NUMBER,22], "T"."PAY_MONEY_Z00SELF"[NUMBER,22], "T"."PAY_MONEY_S00SELF"[NUMBER,22], "T"."PAY_MONEY_S01SELF"[NUMBER,22],
       "T"."PAY_MONEY_C000SELF"[NUMBER,22], "T"."PAY_MONEY_C001SELF"[NUMBER,22], "T"."PAY_MONEY_C004SELF"[NUMBER,22], "T"."PAY_MONEY_C006SELF"[NUMBER,22],
       "T"."PAY_MONEY_C007SELF"[NUMBER,22], "T"."PAY_MONEY_C007003SELF"[NUMBER,22], "T"."DB_MONEY"[NUMBER,22], "T"."YWSH_DB_MONEY"[NUMBER,1],
       "T"."TC_MONEY"[NUMBER,22], "T"."HOSP_PAY"[NUMBER,22], "T"."HOSP_PRISE"[NUMBER,22], "T"."TC_MONEY_XE"[NUMBER,22], "T"."JMTC_MONEY"[NUMBER,22],
       "T"."YW_MONEY"[NUMBER,22], "T"."JMYW_MONEY"[NUMBER,22], "T"."ACCT_MONEY"[NUMBER,22], "T"."LX_MONEY"[NUMBER,22], "T"."SY_MONEY"[NUMBER,22],
       "T"."OFFI_MONEY"[NUMBER,22], "T"."ZHAOGU_PAY"[NUMBER,22], "T"."PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22], "MEDI_PAY"[NUMBER,22],
       "MEDI_ZFY"[NUMBER,22], "T"."DB_MONEY_JUMIN"[NUMBER,22], "B"."DISEASE_TYPE"[CHARACTER,1], "B"."SERIAL_NO"[VARCHAR2,16], "B"."CASE_ID"[NUMBER,22],
       "B"."DISTRICT_CODE"[VARCHAR2,6], "B"."INDI_ID"[NUMBER,22], "B"."NAME"[VARCHAR2,20], "B"."SEX"[CHARACTER,1], "B"."OFFICE_GRADE"[VARCHAR2,3],
       "B"."IDCARD"[VARCHAR2,25], "B"."IC_NO"[VARCHAR2,25], "B"."HOS_SERIAL"[VARCHAR2,30], "B"."CORP_NAME"[VARCHAR2,70], "B"."TREATMENT_TYPE"[VARCHAR2,3],
       "B"."SERIAL_APPLY"[NUMBER,22], "B"."REG_DATE"[DATE,7], "B"."REG_MAN"[VARCHAR2,20], "B"."REG_FLAG"[CHARACTER,1], "B"."BEGIN_DATE"[DATE,7],
       "B"."REG_INFO"[VARCHAR2,10], "B"."IN_DEPT_NAME"[VARCHAR2,20], "B"."IN_AREA_NAME"[VARCHAR2,20], "B"."IN_BED"[VARCHAR2,10], "B"."BED_TYPE"[CHARACTER,1],
       "B"."PATIENT_ID"[VARCHAR2,20], "B"."IN_DISEASE"[VARCHAR2,20], "B"."IN_DAYS"[NUMBER,22], "B"."FIN_DISEASE"[VARCHAR2,20], "B"."END_DATE"[DATE,7],
       "B"."REIMBURSE_FLAG"[CHARACTER,1], "B"."POS_CODE"[VARCHAR2,10], "B"."REMARK"[VARCHAR2,500], "B"."FIN_DATE"[DATE,7], "B"."FIN_STAFF"[VARCHAR2,10],
       "B"."FIN_MAN"[VARCHAR2,30]
  35 - "G"."CENTER_ID"[VARCHAR2,10], "G"."BIZ_TYPE"[CHARACTER,2], "G"."BIZ_STAT"[VARCHAR2,2]
  36 - (#keys=1) "H"."CENTER_ID"[VARCHAR2,10], "B"."CENTER_ID"[VARCHAR2,10], "H"."CATALOG_CENTER"[VARCHAR2,10], "B"."CORP_ID"[NUMBER,22],
       "STREET"."QYBM"[VARCHAR2,10], "A"."HOSPITAL_ID"[VARCHAR2,20], "A"."HOSPITAL_NAME"[VARCHAR2,70], "T"."INSR_CODE"[VARCHAR2,30], "T"."FEES"[NUMBER,22],
       "T"."PAY_MONEY_JD"[NUMBER,22], "T"."FUND_MONEY"[NUMBER,22], "T"."FUND_301"[NUMBER,22], "T"."FUND_003"[NUMBER,22], "T"."YW_FUND_MONEY"[NUMBER,22],
       "T"."BC_FUND_MONEY"[NUMBER,22], "T"."QFX"[NUMBER,22], "T"."HOSP_ZF"[NUMBER,22], "T"."CENTER_ZF"[NUMBER,22], "T"."PAY_MONEY_ALLSELF"[NUMBER,22],
       "T"."PAY_MONEY_SELF"[NUMBER,22], "T"."PAY_MONEY_E00SELF"[NUMBER,22], "T"."PAY_MONEY_Z00SELF"[NUMBER,22], "T"."PAY_MONEY_S00SELF"[NUMBER,22],
       "T"."PAY_MONEY_S01SELF"[NUMBER,22], "T"."PAY_MONEY_C000SELF"[NUMBER,22], "T"."PAY_MONEY_C001SELF"[NUMBER,22], "T"."PAY_MONEY_C004SELF"[NUMBER,22],
       "T"."PAY_MONEY_C006SELF"[NUMBER,22], "T"."PAY_MONEY_C007SELF"[NUMBER,22], "T"."PAY_MONEY_C007003SELF"[NUMBER,22], "T"."DB_MONEY"[NUMBER,22],
       "T"."YWSH_DB_MONEY"[NUMBER,1], "T"."TC_MONEY"[NUMBER,22], "T"."HOSP_PAY"[NUMBER,22], "T"."HOSP_PRISE"[NUMBER,22], "T"."TC_MONEY_XE"[NUMBER,22],
       "T"."JMTC_MONEY"[NUMBER,22], "T"."YW_MONEY"[NUMBER,22], "T"."JMYW_MONEY"[NUMBER,22], "T"."ACCT_MONEY"[NUMBER,22], "T"."LX_MONEY"[NUMBER,22],
       "T"."SY_MONEY"[NUMBER,22], "T"."OFFI_MONEY"[NUMBER,22], "T"."ZHAOGU_PAY"[NUMBER,22], "T"."PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22],
       "MEDI_PAY"[NUMBER,22], "MEDI_ZFY"[NUMBER,22], "T"."DB_MONEY_JUMIN"[NUMBER,22], "B"."DISEASE_TYPE"[CHARACTER,1], "B"."SERIAL_NO"[VARCHAR2,16],
       "B"."CASE_ID"[NUMBER,22], "B"."BIZ_TYPE"[VARCHAR2,2], "B"."DISTRICT_CODE"[VARCHAR2,6], "B"."INDI_ID"[NUMBER,22], "B"."NAME"[VARCHAR2,20],
       "B"."SEX"[CHARACTER,1], "B"."OFFICE_GRADE"[VARCHAR2,3], "B"."IDCARD"[VARCHAR2,25], "B"."IC_NO"[VARCHAR2,25], "B"."HOS_SERIAL"[VARCHAR2,30],
       "B"."CORP_NAME"[VARCHAR2,70], "B"."TREATMENT_TYPE"[VARCHAR2,3], "B"."SERIAL_APPLY"[NUMBER,22], "B"."REG_DATE"[DATE,7], "B"."REG_MAN"[VARCHAR2,20],
       "B"."REG_FLAG"[CHARACTER,1], "B"."BEGIN_DATE"[DATE,7], "B"."REG_INFO"[VARCHAR2,10], "B"."IN_DEPT_NAME"[VARCHAR2,20], "B"."IN_AREA_NAME"[VARCHAR2,20],
       "B"."IN_BED"[VARCHAR2,10], "B"."BED_TYPE"[CHARACTER,1], "B"."PATIENT_ID"[VARCHAR2,20], "B"."IN_DISEASE"[VARCHAR2,20], "B"."IN_DAYS"[NUMBER,22],
       "B"."FIN_DISEASE"[VARCHAR2,20], "B"."END_DATE"[DATE,7], "B"."REIMBURSE_FLAG"[CHARACTER,1], "B"."POS_CODE"[VARCHAR2,10], "B"."REMARK"[VARCHAR2,500],
       "B"."FIN_DATE"[DATE,7], "B"."FIN_STAFF"[VARCHAR2,10], "B"."FIN_MAN"[VARCHAR2,30], "B"."PERS_TYPE_DETAIL"[VARCHAR2,3]
  37 - "H"."CENTER_ID"[VARCHAR2,10], "H"."CATALOG_CENTER"[VARCHAR2,10]
  38 - (#keys=1) "B"."CORP_ID"[NUMBER,22], "STREET"."QYBM"[VARCHAR2,10], "A"."HOSPITAL_ID"[VARCHAR2,20], "A"."HOSPITAL_NAME"[VARCHAR2,70],
       "T"."INSR_CODE"[VARCHAR2,30], "T"."FEES"[NUMBER,22], "T"."PAY_MONEY_JD"[NUMBER,22], "T"."FUND_MONEY"[NUMBER,22], "T"."FUND_301"[NUMBER,22],
       "T"."FUND_003"[NUMBER,22], "T"."YW_FUND_MONEY"[NUMBER,22], "T"."BC_FUND_MONEY"[NUMBER,22], "T"."QFX"[NUMBER,22], "T"."HOSP_ZF"[NUMBER,22],
       "T"."CENTER_ZF"[NUMBER,22], "T"."PAY_MONEY_ALLSELF"[NUMBER,22], "T"."PAY_MONEY_SELF"[NUMBER,22], "T"."PAY_MONEY_E00SELF"[NUMBER,22],
       "T"."PAY_MONEY_Z00SELF"[NUMBER,22], "T"."PAY_MONEY_S00SELF"[NUMBER,22], "T"."PAY_MONEY_S01SELF"[NUMBER,22], "T"."PAY_MONEY_C000SELF"[NUMBER,22],
       "T"."PAY_MONEY_C001SELF"[NUMBER,22], "T"."PAY_MONEY_C004SELF"[NUMBER,22], "T"."PAY_MONEY_C006SELF"[NUMBER,22], "T"."PAY_MONEY_C007SELF"[NUMBER,22],
       "T"."PAY_MONEY_C007003SELF"[NUMBER,22], "T"."DB_MONEY"[NUMBER,22], "T"."YWSH_DB_MONEY"[NUMBER,1], "T"."TC_MONEY"[NUMBER,22], "T"."HOSP_PAY"[NUMBER,22],
       "T"."HOSP_PRISE"[NUMBER,22], "T"."TC_MONEY_XE"[NUMBER,22], "T"."JMTC_MONEY"[NUMBER,22], "T"."YW_MONEY"[NUMBER,22], "T"."JMYW_MONEY"[NUMBER,22],
       "T"."ACCT_MONEY"[NUMBER,22], "T"."LX_MONEY"[NUMBER,22], "T"."SY_MONEY"[NUMBER,22], "T"."OFFI_MONEY"[NUMBER,22], "T"."ZHAOGU_PAY"[NUMBER,22],
       "T"."PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22], "MEDI_PAY"[NUMBER,22], "MEDI_ZFY"[NUMBER,22], "T"."DB_MONEY_JUMIN"[NUMBER,22],
       "B"."DISEASE_TYPE"[CHARACTER,1], "B"."SERIAL_NO"[VARCHAR2,16], "B"."CASE_ID"[NUMBER,22], "B"."BIZ_TYPE"[VARCHAR2,2], "B"."DISTRICT_CODE"[VARCHAR2,6],
       "B"."INDI_ID"[NUMBER,22], "B"."NAME"[VARCHAR2,20], "B"."SEX"[CHARACTER,1], "B"."OFFICE_GRADE"[VARCHAR2,3], "B"."IDCARD"[VARCHAR2,25],
       "B"."IC_NO"[VARCHAR2,25], "B"."HOS_SERIAL"[VARCHAR2,30], "B"."CORP_NAME"[VARCHAR2,70], "B"."TREATMENT_TYPE"[VARCHAR2,3], "B"."SERIAL_APPLY"[NUMBER,22],
       "B"."REG_DATE"[DATE,7], "B"."REG_MAN"[VARCHAR2,20], "B"."REG_FLAG"[CHARACTER,1], "B"."BEGIN_DATE"[DATE,7], "B"."REG_INFO"[VARCHAR2,10],
       "B"."IN_DEPT_NAME"[VARCHAR2,20], "B"."IN_AREA_NAME"[VARCHAR2,20], "B"."IN_BED"[VARCHAR2,10], "B"."BED_TYPE"[CHARACTER,1], "B"."PATIENT_ID"[VARCHAR2,20],
       "B"."IN_DISEASE"[VARCHAR2,20], "B"."IN_DAYS"[NUMBER,22], "B"."FIN_DISEASE"[VARCHAR2,20], "B"."END_DATE"[DATE,7], "B"."REIMBURSE_FLAG"[CHARACTER,1],
       "B"."POS_CODE"[VARCHAR2,10], "B"."REMARK"[VARCHAR2,500], "B"."FIN_DATE"[DATE,7], "B"."FIN_STAFF"[VARCHAR2,10], "B"."FIN_MAN"[VARCHAR2,30],
       "B"."CENTER_ID"[VARCHAR2,10], "B"."PERS_TYPE_DETAIL"[VARCHAR2,3]
  39 - "STREET"."CORP_ID"[NUMBER,22], "STREET"."QYBM"[VARCHAR2,10]
  40 - (#keys=1) "ST"."QYBM"[VARCHAR2,10], "CORP"."CORP_ID"[NUMBER,22]
  41 - "ST"."QYBM"[VARCHAR2,10]
  42 - "CORP"."CORP_ID"[NUMBER,22], "CORP"."AREA_CODE"[VARCHAR2,20]
  43 - (#keys=1) "A"."HOSPITAL_ID"[VARCHAR2,20], "A"."HOSPITAL_NAME"[VARCHAR2,70], "T"."INSR_CODE"[VARCHAR2,30], "T"."FEES"[NUMBER,22],
       "T"."PAY_MONEY_JD"[NUMBER,22], "T"."FUND_MONEY"[NUMBER,22], "T"."FUND_301"[NUMBER,22], "T"."FUND_003"[NUMBER,22], "T"."YW_FUND_MONEY"[NUMBER,22],
       "T"."BC_FUND_MONEY"[NUMBER,22], "T"."QFX"[NUMBER,22], "T"."HOSP_ZF"[NUMBER,22], "T"."CENTER_ZF"[NUMBER,22], "T"."PAY_MONEY_ALLSELF"[NUMBER,22],
       "T"."PAY_MONEY_SELF"[NUMBER,22], "T"."PAY_MONEY_E00SELF"[NUMBER,22], "T"."PAY_MONEY_Z00SELF"[NUMBER,22], "T"."PAY_MONEY_S00SELF"[NUMBER,22],
       "T"."PAY_MONEY_S01SELF"[NUMBER,22], "T"."PAY_MONEY_C000SELF"[NUMBER,22], "T"."PAY_MONEY_C001SELF"[NUMBER,22], "T"."PAY_MONEY_C004SELF"[NUMBER,22],
       "T"."PAY_MONEY_C006SELF"[NUMBER,22], "T"."PAY_MONEY_C007SELF"[NUMBER,22], "T"."PAY_MONEY_C007003SELF"[NUMBER,22], "T"."DB_MONEY"[NUMBER,22],
       "T"."YWSH_DB_MONEY"[NUMBER,1], "T"."TC_MONEY"[NUMBER,22], "T"."HOSP_PAY"[NUMBER,22], "T"."HOSP_PRISE"[NUMBER,22], "T"."TC_MONEY_XE"[NUMBER,22],
       "T"."JMTC_MONEY"[NUMBER,22], "T"."YW_MONEY"[NUMBER,22], "T"."JMYW_MONEY"[NUMBER,22], "T"."ACCT_MONEY"[NUMBER,22], "T"."LX_MONEY"[NUMBER,22],
       "T"."SY_MONEY"[NUMBER,22], "T"."OFFI_MONEY"[NUMBER,22], "T"."ZHAOGU_PAY"[NUMBER,22], "T"."PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22],
       "MEDI_PAY"[NUMBER,22], "MEDI_ZFY"[NUMBER,22], "T"."DB_MONEY_JUMIN"[NUMBER,22], "B"."DISEASE_TYPE"[CHARACTER,1], "B"."SERIAL_NO"[VARCHAR2,16],
       "B"."CASE_ID"[NUMBER,22], "B"."BIZ_TYPE"[VARCHAR2,2], "B"."DISTRICT_CODE"[VARCHAR2,6], "B"."INDI_ID"[NUMBER,22], "B"."NAME"[VARCHAR2,20],
       "B"."SEX"[CHARACTER,1], "B"."OFFICE_GRADE"[VARCHAR2,3], "B"."IDCARD"[VARCHAR2,25], "B"."IC_NO"[VARCHAR2,25], "B"."CORP_ID"[NUMBER,22],
       "B"."CORP_NAME"[VARCHAR2,70], "B"."TREATMENT_TYPE"[VARCHAR2,3], "B"."SERIAL_APPLY"[NUMBER,22], "B"."REG_DATE"[DATE,7], "B"."REG_MAN"[VARCHAR2,20],
       "B"."REG_FLAG"[CHARACTER,1], "B"."BEGIN_DATE"[DATE,7], "B"."REG_INFO"[VARCHAR2,10], "B"."IN_DEPT_NAME"[VARCHAR2,20], "B"."IN_AREA_NAME"[VARCHAR2,20],
       "B"."IN_BED"[VARCHAR2,10], "B"."BED_TYPE"[CHARACTER,1], "B"."PATIENT_ID"[VARCHAR2,20], "B"."IN_DISEASE"[VARCHAR2,20], "B"."IN_DAYS"[NUMBER,22],
       "B"."FIN_DISEASE"[VARCHAR2,20], "B"."END_DATE"[DATE,7], "B"."REIMBURSE_FLAG"[CHARACTER,1], "B"."POS_CODE"[VARCHAR2,10], "B"."REMARK"[VARCHAR2,500],
       "B"."FIN_DATE"[DATE,7], "B"."FIN_STAFF"[VARCHAR2,10], "B"."FIN_MAN"[VARCHAR2,30], "B"."CENTER_ID"[VARCHAR2,10], "B"."PERS_TYPE_DETAIL"[VARCHAR2,3],
       "B"."HOS_SERIAL"[VARCHAR2,30]
  44 - "A"."HOSPITAL_ID"[VARCHAR2,20], "A"."HOSPITAL_NAME"[VARCHAR2,70]
  45 - "B"."HOSPITAL_ID"[VARCHAR2,20], "B"."SERIAL_NO"[VARCHAR2,16], "B"."CASE_ID"[NUMBER,22], "B"."BIZ_TYPE"[VARCHAR2,2],
       "B"."DISTRICT_CODE"[VARCHAR2,6], "B"."INDI_ID"[NUMBER,22], "B"."NAME"[VARCHAR2,20], "B"."SEX"[CHARACTER,1], "B"."OFFICE_GRADE"[VARCHAR2,3],
       "B"."IDCARD"[VARCHAR2,25], "B"."IC_NO"[VARCHAR2,25], "B"."CORP_ID"[NUMBER,22], "B"."CORP_NAME"[VARCHAR2,70], "B"."TREATMENT_TYPE"[VARCHAR2,3],
       "B"."SERIAL_APPLY"[NUMBER,22], "B"."REG_DATE"[DATE,7], "B"."REG_MAN"[VARCHAR2,20], "B"."REG_FLAG"[CHARACTER,1], "B"."BEGIN_DATE"[DATE,7],
       "B"."REG_INFO"[VARCHAR2,10], "B"."IN_DEPT_NAME"[VARCHAR2,20], "B"."IN_AREA_NAME"[VARCHAR2,20], "B"."IN_BED"[VARCHAR2,10], "B"."BED_TYPE"[CHARACTER,1],
       "B"."PATIENT_ID"[VARCHAR2,20], "B"."IN_DISEASE"[VARCHAR2,20], "B"."IN_DAYS"[NUMBER,22], "B"."FIN_DISEASE"[VARCHAR2,20], "B"."END_DATE"[DATE,7],
       "B"."REIMBURSE_FLAG"[CHARACTER,1], "B"."POS_CODE"[VARCHAR2,10], "B"."REMARK"[VARCHAR2,500], "B"."FIN_DATE"[DATE,7], "B"."FIN_STAFF"[VARCHAR2,10],
       "B"."FIN_MAN"[VARCHAR2,30], "B"."CENTER_ID"[VARCHAR2,10], "B"."PERS_TYPE_DETAIL"[VARCHAR2,3], "B"."HOS_SERIAL"[VARCHAR2,30],
       "B"."DISEASE_TYPE"[CHARACTER,1]
  46 - "T"."INSR_CODE"[VARCHAR2,30], "T"."FEES"[NUMBER,22], "T"."PAY_MONEY_JD"[NUMBER,22], "T"."FUND_MONEY"[NUMBER,22], "T"."FUND_301"[NUMBER,22],
       "T"."FUND_003"[NUMBER,22], "T"."YW_FUND_MONEY"[NUMBER,22], "T"."BC_FUND_MONEY"[NUMBER,22], "T"."QFX"[NUMBER,22], "T"."HOSP_ZF"[NUMBER,22],
       "T"."CENTER_ZF"[NUMBER,22], "T"."PAY_MONEY_ALLSELF"[NUMBER,22], "T"."PAY_MONEY_SELF"[NUMBER,22], "T"."PAY_MONEY_E00SELF"[NUMBER,22],
       "T"."PAY_MONEY_Z00SELF"[NUMBER,22], "T"."PAY_MONEY_S00SELF"[NUMBER,22], "T"."PAY_MONEY_S01SELF"[NUMBER,22], "T"."PAY_MONEY_C000SELF"[NUMBER,22],
       "T"."PAY_MONEY_C001SELF"[NUMBER,22], "T"."PAY_MONEY_C004SELF"[NUMBER,22], "T"."PAY_MONEY_C006SELF"[NUMBER,22], "T"."PAY_MONEY_C007SELF"[NUMBER,22],
       "T"."PAY_MONEY_C007003SELF"[NUMBER,22], "T"."DB_MONEY"[NUMBER,22], "T"."YWSH_DB_MONEY"[NUMBER,1], "T"."TC_MONEY"[NUMBER,22], "T"."HOSP_PAY"[NUMBER,22],
       "T"."HOSP_PRISE"[NUMBER,22], "T"."TC_MONEY_XE"[NUMBER,22], "T"."JMTC_MONEY"[NUMBER,22], "T"."YW_MONEY"[NUMBER,22], "T"."JMYW_MONEY"[NUMBER,22],
       "T"."ACCT_MONEY"[NUMBER,22], "T"."LX_MONEY"[NUMBER,22], "T"."SY_MONEY"[NUMBER,22], "T"."OFFI_MONEY"[NUMBER,22], "T"."ZHAOGU_PAY"[NUMBER,22],
       "T"."PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22], "MEDI_PAY"[NUMBER,22], "MEDI_ZFY"[NUMBER,22], "T"."DB_MONEY_JUMIN"[NUMBER,22],
       "SYS_ALIAS_10".ROWID[ROWID,10], "B"."HOSPITAL_ID"[VARCHAR2,20], "B"."SERIAL_NO"[VARCHAR2,16]
  47 - "T"."HOSPITAL_ID"[VARCHAR2,20], "T"."SERIAL_NO"[VARCHAR2,16], "T"."INSR_CODE"[VARCHAR2,30], "T"."FEES"[NUMBER,22], "T"."PAY_MONEY_JD"[NUMBER,22],
       "T"."FUND_MONEY"[NUMBER,22], "T"."FUND_301"[NUMBER,22], "T"."FUND_003"[NUMBER,22], "T"."YW_FUND_MONEY"[NUMBER,22], "T"."BC_FUND_MONEY"[NUMBER,22],
       "T"."QFX"[NUMBER,22], "T"."HOSP_ZF"[NUMBER,22], "T"."CENTER_ZF"[NUMBER,22], "T"."PAY_MONEY_ALLSELF"[NUMBER,22], "T"."PAY_MONEY_SELF"[NUMBER,22],
       "T"."PAY_MONEY_E00SELF"[NUMBER,22], "T"."PAY_MONEY_Z00SELF"[NUMBER,22], "T"."PAY_MONEY_S00SELF"[NUMBER,22], "T"."PAY_MONEY_S01SELF"[NUMBER,22],
       "T"."PAY_MONEY_C000SELF"[NUMBER,22], "T"."PAY_MONEY_C001SELF"[NUMBER,22], "T"."PAY_MONEY_C004SELF"[NUMBER,22], "T"."PAY_MONEY_C006SELF"[NUMBER,22],
       "T"."PAY_MONEY_C007SELF"[NUMBER,22], "T"."PAY_MONEY_C007003SELF"[NUMBER,22], "T"."DB_MONEY"[NUMBER,22], "T"."YWSH_DB_MONEY"[NUMBER,1],
       "T"."TC_MONEY"[NUMBER,22], "T"."HOSP_PAY"[NUMBER,22], "T"."HOSP_PRISE"[NUMBER,22], "T"."TC_MONEY_XE"[NUMBER,22], "T"."JMTC_MONEY"[NUMBER,22],
       "T"."YW_MONEY"[NUMBER,22], "T"."JMYW_MONEY"[NUMBER,22], "T"."ACCT_MONEY"[NUMBER,22], "T"."LX_MONEY"[NUMBER,22], "T"."SY_MONEY"[NUMBER,22],
       "T"."OFFI_MONEY"[NUMBER,22], "T"."ZHAOGU_PAY"[NUMBER,22], "T"."PAY_MONEY_XZF"[NUMBER,22], "PAY_MONEY_DNZF"[NUMBER,22], "MEDI_PAY"[NUMBER,22],
       "MEDI_ZFY"[NUMBER,22], "T"."DB_MONEY_JUMIN"[NUMBER,22]
  48 - "$vm_col_9"[VARCHAR2,20], "$vm_col_10"[VARCHAR2,16], "$vm_col_8"[NUMBER,22], SUM(DECODE("$vm_col_6",'803',"$vm_col_5",0))[22], SUM(CASE  WHEN
       (("$vm_col_4"='C000' OR "$vm_col_4"='C001' OR "$vm_col_4"='C002' OR "$vm_col_4"='C003' OR "$vm_col_4"='C004') AND ("$vm_col_6"='999' OR
       "$vm_col_6"='003')) THEN "$vm_col_5" ELSE 0 END )[22], SUM(DECODE("$vm_col_6",'999',"$vm_col_5",0))[22],
       SUM(DECODE("$vm_col_6",'401',"$vm_col_5",0))[22], SUM(DECODE("$vm_col_6",'301',"$vm_col_5",0))[22], SUM(DECODE("$vm_col_6",'511',"$vm_col_5",0))[22],
       SUM(DECODE("$vm_col_6",'202',"$vm_col_5",0))[22], SUM(DECODE("$vm_col_6",'003',"$vm_col_5",0))[22], SUM(DECODE("$vm_col_6",'802',"$vm_col_5",0))[22],
       SUM(DECODE("$vm_col_6",'901',"$vm_col_5",'802',"$vm_col_5",0))[22], SUM(DECODE("$vm_col_6",'801',"$vm_col_5",0))[22],
       SUM(DECODE("$vm_col_6",'001',"$vm_col_5",'801',"$vm_col_5",0))[22], SUM(DECODE("$vm_col_6",'996',NVL("$vm_col_5",0),0))[22],
       SUM(DECODE("$vm_col_6",'201',"$vm_col_5",0))[22], SUM(DECODE("$vm_col_4"||"$vm_col_6",'C007003',"$vm_col_5",0))[22],
       SUM(DECODE("$vm_col_4"||"$vm_col_6",'C007999',"$vm_col_5",0))[22], SUM(DECODE("$vm_col_4"||"$vm_col_6",'C006003',"$vm_col_5",'C006999',"$vm_col_5",'C0070
       03',"$vm_col_5",'C007999',"$vm_col_5",0))[22], SUM(DECODE("$vm_col_4"||"$vm_col_6",'C004003',"$vm_col_5",'C004999',"$vm_col_5",'C005003',"$vm_col_5",'C00
       5999',"$vm_col_5",0))[22], SUM(DECODE("$vm_col_4"||"$vm_col_6",'C001003',"$vm_col_5",'C001999',"$vm_col_5",'C002003',"$vm_col_5",'C002999',"$vm_col_5",'C
       003003',"$vm_col_5",'C003999',"$vm_col_5",0))[22], SUM(DECODE("$vm_col_4"||"$vm_col_6",'C000003',"$vm_col_5",'C000999',"$vm_col_5",0))[22],
       SUM(DECODE("$vm_col_4"||"$vm_col_6",'S02003',"$vm_col_5",'S02999',"$vm_col_5",0))[22],
       SUM(DECODE("$vm_col_4"||"$vm_col_6",'S01003',"$vm_col_5",'S01999',"$vm_col_5",0))[22],
       SUM(DECODE("$vm_col_4"||"$vm_col_6",'S00003',"$vm_col_5",'S00999',"$vm_col_5",0))[22],
       SUM(DECODE("$vm_col_4"||"$vm_col_6",'Z00003',"$vm_col_5",'Z00999',"$vm_col_5",0))[22],
       SUM(DECODE("$vm_col_4"||"$vm_col_6",'E00003',"$vm_col_5",'E00999',"$vm_col_5",0))[22],
       SUM(DECODE("$vm_col_3"||"$vm_col_6",'102003',"$vm_col_5",'102999',"$vm_col_5",0))[22],
       SUM(DECODE("$vm_col_3"||"$vm_col_6",'101003',"$vm_col_5",'101999',"$vm_col_5",0))[22], SUM(DECODE("$vm_col_6",'998',"$vm_col_5",0))[22],
       SUM(DECODE("$vm_col_6",'996',"$vm_col_5",0))[22], SUM(DECODE("$vm_col_4",'S01',"$vm_col_5",'S02',"$vm_col_5",0))[22],
       SUM(DECODE("$vm_col_6",'306',"$vm_col_5",0))[22], SUM(DECODE("$vm_col_6",'001',"$vm_col_5",'511',"$vm_col_5",'202',"$vm_col_5",'801',"$vm_col_5",0))[22],
        SUM(DECODE("$vm_col_4",'C000',"$vm_col_5",'C001',"$vm_col_5",'C002',"$vm_col_5",'C003',"$vm_col_5",'C004',"$vm_col_5",'C005',"$vm_col_5",'C006',"$vm_col
       _5",'C007',"$vm_col_5",0))[22], SUM("$vm_col_5")[22]
  49 - "$vm_col_9"[VARCHAR2,20], "$vm_col_10"[VARCHAR2,16], "$vm_col_8"[NUMBER,22], "$vm_col_3"[VARCHAR2,3], "$vm_col_4"[VARCHAR2,20],
       "$vm_col_5"[NUMBER,22], "$vm_col_6"[VARCHAR2,3]
  50 - "B"."HOSPITAL_ID"[VARCHAR2,20], "B"."SERIAL_NO"[VARCHAR2,16], "B"."INDI_ID"[NUMBER,22], ROWID[ROWID,10], ROWID[ROWID,10], ROWID[ROWID,10],
       ROWID[ROWID,10], "SERIAL_NO"[VARCHAR2,16], "HOSPITAL_ID"[VARCHAR2,20], "C"."LABEL_FLAG"[VARCHAR2,3], "C"."POLICY_ITEM_CODE"[VARCHAR2,20],
       "C"."REAL_PAY"[NUMBER,22], "C"."FUND_ID"[VARCHAR2,3], "FINISH_FLAG"[CHARACTER,1]
  51 - "HOSPITAL_ID"[VARCHAR2,20], "SERIAL_NO"[VARCHAR2,16], ROWID[ROWID,10], "B"."HOSPITAL_ID"[VARCHAR2,20], "B"."SERIAL_NO"[VARCHAR2,16],
       "B"."INDI_ID"[NUMBER,22], "FINISH_FLAG"[CHARACTER,1], ROWID[ROWID,10], "C"."POLICY_ITEM_CODE"[VARCHAR2,20], "C"."FUND_ID"[VARCHAR2,3],
       "C"."REAL_PAY"[NUMBER,22], "C"."LABEL_FLAG"[VARCHAR2,3], ROWID[ROWID,10], ROWID[ROWID,10]
  52 - "HOSPITAL_ID"[VARCHAR2,20], "SERIAL_NO"[VARCHAR2,16], ROWID[ROWID,10], "B"."HOSPITAL_ID"[VARCHAR2,20], "B"."SERIAL_NO"[VARCHAR2,16],
       "B"."INDI_ID"[NUMBER,22], "FINISH_FLAG"[CHARACTER,1], ROWID[ROWID,10], "C"."POLICY_ITEM_CODE"[VARCHAR2,20], "C"."FUND_ID"[VARCHAR2,3],
       "C"."REAL_PAY"[NUMBER,22], "C"."LABEL_FLAG"[VARCHAR2,3], ROWID[ROWID,10]
  53 - "HOSPITAL_ID"[VARCHAR2,20], "SERIAL_NO"[VARCHAR2,16], ROWID[ROWID,10], "B"."HOSPITAL_ID"[VARCHAR2,20], "B"."SERIAL_NO"[VARCHAR2,16],
       "B"."BIZ_TYPE"[VARCHAR2,2], "B"."INDI_ID"[NUMBER,22], "FINISH_FLAG"[CHARACTER,1], "B"."CENTER_ID"[VARCHAR2,10], ROWID[ROWID,10],
       "C"."POLICY_ITEM_CODE"[VARCHAR2,20], "C"."FUND_ID"[VARCHAR2,3], "C"."REAL_PAY"[NUMBER,22], "C"."LABEL_FLAG"[VARCHAR2,3]
  54 - "HOSPITAL_ID"[VARCHAR2,20], "SERIAL_NO"[VARCHAR2,16], ROWID[ROWID,10], "B"."HOSPITAL_ID"[VARCHAR2,20], "B"."SERIAL_NO"[VARCHAR2,16],
       "B"."BIZ_TYPE"[VARCHAR2,2], "B"."INDI_ID"[NUMBER,22], "FINISH_FLAG"[CHARACTER,1], "B"."CENTER_ID"[VARCHAR2,10]
  55 - "HOSPITAL_ID"[VARCHAR2,20], "SERIAL_NO"[VARCHAR2,16]
  56 - "RELA_DECL_SN"[NUMBER,22]
  57 - "HOSPITAL_ID"[VARCHAR2,20], "SERIAL_NO"[VARCHAR2,16]
  58 - "PM_ACCOUNT_BIZ".ROWID[ROWID,10]
  59 - ROWID[ROWID,10], "B"."HOSPITAL_ID"[VARCHAR2,20], "B"."SERIAL_NO"[VARCHAR2,16], "B"."BIZ_TYPE"[VARCHAR2,2], "B"."INDI_ID"[NUMBER,22],
       "FINISH_FLAG"[CHARACTER,1], "B"."CENTER_ID"[VARCHAR2,10]
  60 - ROWID[ROWID,10], "B"."HOSPITAL_ID"[VARCHAR2,20], "B"."SERIAL_NO"[VARCHAR2,16]
  61 - ROWID[ROWID,10], "C"."POLICY_ITEM_CODE"[VARCHAR2,20], "C"."FUND_ID"[VARCHAR2,3], "C"."REAL_PAY"[NUMBER,22], "C"."LABEL_FLAG"[VARCHAR2,3]
  62 - ROWID[ROWID,10]
  63 - ROWID[ROWID,10]
  64 - ROWID[ROWID,10]
  65 - "SYS_ALIAS_10".ROWID[ROWID,10], "B"."HOSPITAL_ID"[VARCHAR2,20], "B"."SERIAL_NO"[VARCHAR2,16]

Note
-----
   - Warning: basic plan statistics not available. These are only collected when:
       * hint 'gather_plan_statistics' is used for the statement or
       * parameter 'statistics_level' is set to 'ALL', at session or system level


458 rows selected.

修改后执行时间为几秒钟,在业务需求可接受范围内,到此达到了优化目标。引起问题的原因很简单,就是开发人员根本不知道谓词条件where (a||b) in(select a||b from c)与where (a,b) in(select a,b from c)之间的差别,差别在于,如果存在复合索引(a,b..), 那么(a||b)这种写法用不了索引,当表的数据量很大时它与使用索引的写法(a,b)性能差异是巨大的。