![]() |
|
在DBA_TABLES字典表中有一个degree字段,这个字段代表并行查询在数据表上的并行度,在RAC环境中,这个参数还和实例有关。
以下生活文档中对于 DEGREE 和 INSTANCES 参数的说明:
DEGREE VARCHAR2(10) Number of threads per instance for scanning the table
INSTANCES VARCHAR2(10) Number of instances across which the table is to be scanned
但是注意,当你使用类似如下查询时,你可能无法获得返回值:
SQL> select table_name from dba_tables where degree='1' or degree='DEFAULT';
no rows selected
我们看一下Degree以及instances的记录方式:
SQL> select degree,length(degree) from dba_tables
2 group by degree;
DEGREE LENGTH(DEGREE)
-------------------- --------------
DEFAULT 10
1 10
SQL>select instances,length(instances) from dba_tables
2 group by instances;
INSTANCES LENGTH(INSTANCES)
-------------------- -----------------
DEFAULT 10
1 10
0 10
Degree和Instances实际上记录了10个字符,左端用空格补齐。
在 dba_tables 的创建语句中,我们可以找到根本原因,以下是这两个字段的定义来源:
lpad(decode(t.degree, 32767, 'DEFAULT', nvl(t.degree,1)),10),
lpad(decode(t.instances, 32767, 'DEFAULT', nvl(t.instances,1)),10),
以上信息来自Oracle10gR2数据库:
SQL> select table_name,owner from dba_tables where degree=' DEFAULT' or instances=' DEFAULT';
TABLE_NAME OWNER
------------------------------ ------------------------------
TEST_EXT2 SYS
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production