关于rac的external table
今天有朋友在blog中问了这么一个问题,RAC环境中应用外部表(rac1上),如果把外部表设置并行度,在查询该外部表时是否会报错?,一开始就觉得如果是不是在共享存储,由于另一个节点访问不了directory设置的路径,因此会报错。测试结果也是如此:
在rac1的非共享存储上上创建一个用于测试的平面文件
rac1-> pwd
/export/home/oracle/test_for_external_table_on_rac1
rac1-> ls -l
total 976
-rw-r----- 1 oracle oinstall 988581 Mar 18 23:52 test.log
/export/home/oracle/test_for_external_table_on_rac1
rac1-> ls -l
total 976
-rw-r----- 1 oracle oinstall 988581 Mar 18 23:52 test.log
在rac1上创建外部表:
SQL> create or replace directory bdump_dir as '/export/home/oracle/test_for_external_table_on_rac1';
Directory created.
SQL> CREATE TABLE alert_log
2 (
3 text_line varchar2(255)
4 )
5 ORGANIZATION EXTERNAL
6 (
TYPE ORACLE_LOADER
DEFAULT DIRECTORY bdump_dir
ACCESS PARAMETERS
7 8 9 10 (
11 records delimited by newline
12 fields
13 REJECT ROWS WITH ALL NULL FIELDS
14 )
15 LOCATION
16 (
17 'test.log'
18 )
19 )
20 REJECT LIMIT unlimited
21 /
Table created.
Directory created.
SQL> CREATE TABLE alert_log
2 (
3 text_line varchar2(255)
4 )
5 ORGANIZATION EXTERNAL
6 (
TYPE ORACLE_LOADER
DEFAULT DIRECTORY bdump_dir
ACCESS PARAMETERS
7 8 9 10 (
11 records delimited by newline
12 fields
13 REJECT ROWS WITH ALL NULL FIELDS
14 )
15 LOCATION
16 (
17 'test.log'
18 )
19 )
20 REJECT LIMIT unlimited
21 /
Table created.
在rac1上查询:
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
devdb1
SQL> select count(*) from alert_log;
COUNT(*)
----------
14504
SQL>
INSTANCE_NAME
----------------
devdb1
SQL> select count(*) from alert_log;
COUNT(*)
----------
14504
SQL>
在rac2上查询:
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
devdb2
SQL> select count(*) from alert_log;
select count(*) from alert_log
*
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04063: unable to open log file ALERT_LOG_30747.log
OS error No such file or directory
ORA-06512: at "SYS.ORACLE_LOADER", line 19
SQL>
INSTANCE_NAME
----------------
devdb2
SQL> select count(*) from alert_log;
select count(*) from alert_log
*
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04063: unable to open log file ALERT_LOG_30747.log
OS error No such file or directory
ORA-06512: at "SYS.ORACLE_LOADER", line 19
SQL>
· 【文章发布信息】发表于: 2008-03-19 @ 00:13:21 · ||分类: Study note



CopyRight ©
leon 于 2008-03-19 @ 11:14:21 留言 :
Hi 小荷:
首先感谢你花时间测试我的问题。
再请教一个问题,在rac环境下,不设置外部表的并行度,查询性能很差,有没有什么好的解决办法呢,让外部表只应用rac1上的CPU?
leon 于 2008-03-19 @ 11:18:07 留言 :
或者如何共享存储?用NFS?
小荷 于 2008-03-20 @ 20:55:47 留言 :
re leon:我个人觉得可以把外部表放共享存储上,然后手工选择负载较小的节点登录。或者可以sqlldr把外部表load到数据库里面操作吧。