在执行 sh_main.sql 一切正常。它甚至创建了模式,但在执行期间它给出了错误
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04027: file name check failed: ext_1v3.log
当 sh_main.sql 填充表时,我收到此错误。在填充表时,它使用 lsh_v3.sql。在此脚本中,它创建一个外部表。
在创建外部表之前,一切都很好,但是在使用外部表 sale1vs.dat 填充时出现问题。
这是日志文件的内容
Session altered.
DROP USER sh CASCADE
*
ERROR at line 1:
ORA-01918: user 'SH' does not exist
User created.
User altered.
User altered.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Connected.
Grant succeeded.
Directory created.
Directory created.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Connected.
Session altered.
Session altered.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Creating constraints ...
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
specify password for SH as parameter 1:
specify path for data files as parameter 2:
specify path for log files as parameter 3:
specify version as parameter 4:
specify connect string as parameter 5:
Looking for indexes that could slow down load ...
no rows selected
loading TIMES using:
C:/App/db_home/demo/schema/sales_history/time_v3.ctl
C:/App/db_home/demo/schema/sales_history/time_v3.dat
%ORACLE_HOME%/demo/schema/logtime_v3.log
loading COUNTRIES using:
C:/App/db_home/demo/schema/sales_history/coun_v3.ctl
C:/App/db_home/demo/schema/sales_history/coun_v3.dat
%ORACLE_HOME%/demo/schema/logcoun_v3.log
loading CUSTOMERS using:
C:/App/db_home/demo/schema/sales_history/cust_v3.ctl
C:/App/db_home/demo/schema/sales_history/cust1v3.dat
%ORACLE_HOME%/demo/schema/logcust1v3.log
loading PRODUCTS using:
C:/App/db_home/demo/schema/sales_history/prod_v3.ctl
C:/App/db_home/demo/schema/sales_history/prod1v3.dat
%ORACLE_HOME%/demo/schema/logprod1v3.log
loading PROMOTIONS using:
C:/App/db_home/demo/schema/sales_history/prom_v3.ctl
C:/App/db_home/demo/schema/sales_history/prom1v3.dat
%ORACLE_HOME%/demo/schema/logprom1v3.log
loading CHANNELS using:
C:/App/db_home/demo/schema/sales_history/chan_v3.ctl
C:/App/db_home/demo/schema/sales_history/chan_v3.dat
%ORACLE_HOME%/demo/schema/logchan_v3.log
loading SALES using:
C:/App/db_home/demo/schema/sales_history/sale_v3.ctl
C:/App/db_home/demo/schema/sales_history/sale1v3.dat
%ORACLE_HOME%/demo/schema/logsale1v3.log
loading COSTS using external table
Table created.
INSERT /*+ append */ INTO costs
*
***ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04027: file name check failed: ext_1v3.log***
loading additonal SALES using:
C:/App/db_home/demo/schema/sales_history/dmsal_v3.ctl
C:/App/db_home/demo/schema/sales_history/dmsal_v3.dat
%ORACLE_HOME%/demo/schema/logdmsal_v3.log
loading SUPPLEMENTARY DEMOGRAPHICS using:
C:/App/db_home/demo/schema/sales_history/dem_v3.ctl
C:/App/db_home/demo/schema/sales_history/dem1v3.dat
%ORACLE_HOME%/demo/schema/logdem1v3.log
Commit complete.
Enabling constraints ...
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Creating additional indexes ...
Index created.
Index created.
Index created.
Index created.
Index created.
Index created.
Index created.
Index created.
Index created.
Index created.
Index created.
Index created.
Index created.
Index created.
Create dimensions ...
Dimension created.
Commit complete.
Dimension created.
Dimension created.
Dimension created.
Dimension created.
Creating MVs as tables ...
View created.
Table created.
Table created.
Index created.
Index created.
Index created.
Index created.
Creating materialized views ...
Materialized view created.
Materialized view created.
Creating comments ...
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
gathering statistics ...
BEGIN dbms_stats.gather_table_stats( ownname => 'SH' , tabname => 'SALES_TRANSACTIONS_EXT' , partname => NULL , estimate_percent => NULL , block_sample => TRUE , method_opt => 'FOR ALL COLUMNS SIZE 1' , degree => NULL , granularity => 'ALL' , cascade => TRUE , stattab => NULL , statid => NULL , statown => NULL ); END;
*
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-06512: at "SYS.DBMS_STATS", line 40751
ORA-06512: at "SYS.DBMS_STATS", line 40035
ORA-06512: at "SYS.DBMS_STATS", line 38912
ORA-06512: at "SYS.DBMS_STATS", line 37089
ORA-06512: at "SYS.DBMS_STATS", line 30296
ORA-29400: data cartridge error
KUP-04027: file name check failed: ext_1v3.log
ORA-06512: at "SYS.DBMS_SQL", line 1735
ORA-06512: at "SYS.DBMS_STATS", line 30213
ORA-06512: at "SYS.DBMS_STATS", line 36821
ORA-06512: at "SYS.DBMS_STATS", line 38738
ORA-06512: at "SYS.DBMS_STATS", line 39738
ORA-06512: at "SYS.DBMS_STATS", line 40183
ORA-06512: at "SYS.DBMS_STATS", line 40732
ORA-06512: at line 1
PL/SQL procedure successfully completed.
我正在使用 Oracle 19c。HR 架构已解锁
这是我使用带有适当可插入容器的 SYS 用户执行的脚本
SH_MAIN.SQL
SET ECHO OFF
PROMPT
PROMPT specify password for SH as parameter 1:
DEFINE pass = &1
PROMPT
PROMPT specify default tablespace for SH as parameter 2:
DEFINE tbs = &2
PROMPT
PROMPT specify temporary tablespace for SH as parameter 3:
DEFINE ttbs = &3
PROMPT
PROMPT specify password for SYS as parameter 4:
DEFINE pass_sys = &4
PROMPT
PROMPT specify directory path for the data files as parameter 5:
DEFINE data_dir = &5
PROMPT
PROMPT writeable directory path for the log files as parameter 6:
DEFINE log_dir = &6
PROMPT
PROMPT specify version as parameter 7:
DEFINE vrs = &7
PROMPT
PROMPT specify connect string as parameter 8:
DEFINE connect_string = &8
PROMPT
DEFINE spool_file = &log_dir.sh_&vrs..log
SPOOL &spool_file
ALTER SESSION SET NLS_LANGUAGE='American';
--
-- Dropping the user with all its objects
--
DROP USER sh CASCADE;
REM =======================================================
REM create user
REM THIS WILL ONLY WORK IF APPROPRIATE TS ARE PRESENT
REM =======================================================
CREATE USER sh IDENTIFIED BY &pass;
ALTER USER sh DEFAULT TABLESPACE &tbs
QUOTA UNLIMITED ON &tbs;
ALTER USER sh TEMPORARY TABLESPACE &ttbs;
GRANT CREATE DIMENSION TO sh;
GRANT QUERY REWRITE TO sh;
GRANT CREATE MATERIALIZED VIEW TO sh;
GRANT CREATE SESSION TO sh;
GRANT CREATE SYNONYM TO sh;
GRANT CREATE TABLE TO sh;
GRANT CREATE VIEW TO sh;
GRANT CREATE SEQUENCE TO sh;
GRANT CREATE CLUSTER TO sh;
GRANT CREATE DATABASE LINK TO sh;
GRANT ALTER SESSION TO sh;
GRANT RESOURCE , UNLIMITED TABLESPACE TO sh;
GRANT select_catalog_role TO sh;
rem ALTER USER sh GRANT CONNECT THROUGH olapsvr;
REM =======================================================
REM grants for sys schema
REM =======================================================
CONNECT sys/&pass_sys@&connect_string AS SYSDBA;
GRANT execute ON sys.dbms_stats TO sh;
REM =======================================================
REM DIRECTORY objects are always owned by SYS
REM for security reasons, SH does not have
REM CREATE ANY DIRECTORY system privilege
REM =======================================================
CREATE OR REPLACE DIRECTORY data_file_dir AS '&data_dir';
CREATE OR REPLACE DIRECTORY log_file_dir AS '&log_dir';
GRANT READ ON DIRECTORY data_file_dir TO sh;
GRANT READ ON DIRECTORY log_file_dir TO sh;
GRANT WRITE ON DIRECTORY log_file_dir TO sh;
GRANT WRITE ON DIRECTORY data_file_dir TO sh;
REM =======================================================
REM create sh schema objects (sales history - star schema)
REM =======================================================
CONNECT sh/&pass@&connect_string
ALTER SESSION SET NLS_LANGUAGE=American;
ALTER SESSION SET NLS_TERRITORY=America;
REM =======================================================
REM Create tables
REM =======================================================
REM CONNECT sh/&pass reconnecting undoes the prior NLS settings
DEFINE vscript = C:/App/db_home/demo/schema/sales_history/csh_&vrs
@&vscript
REM =======================================================
REM Populate tables
REM =======================================================
DEFINE vscript = C:/App/db_home/demo/schema/sales_history/lsh_&vrs
@&vscript &pass &data_dir &log_dir &vrs &connect_string
REM =======================================================
REM Post load operations
REM =======================================================
DEFINE vscript = C:/App/db_home/demo/schema/sales_history/psh_&vrs
@&vscript
spool off
lsh_v3.sql 这个主脚本调用另一个脚本“lsh_v3.sql”来填充表。这是那个脚本
SET FEEDBACK 1
SET NUMWIDTH 10
SET LINESIZE 80
SET TRIMSPOOL ON
SET TAB OFF
SET PAGESIZE 100
SET VERIFY OFF
SET CONCAT '.'
PROMPT
PROMPT specify password for SH as parameter 1:
DEFINE sh_pass = &1
PROMPT
PROMPT specify path for data files as parameter 2:
DEFINE data_path = &2
PROMPT
PROMPT specify path for log files as parameter 3:
DEFINE log_path = &3
PROMPT
PROMPT specify version as parameter 4:
DEFINE vrs = &4
PROMPT
PROMPT specify connect string as parameter 5:
DEFINE connect_string = &5
PROMPT
SET PAGESIZE 0
COLUMN index_name FORMAT A20
PROMPT Looking for indexes that could slow down load ...
SELECT index_name FROM user_indexes;
--
-- TIMES
--
DEFINE ctl_file = &data_path.time_&vrs..ctl
DEFINE dat_file = &data_path.time_&vrs..dat
DEFINE log_file = &log_path.time_&vrs..log
PROMPT
PROMPT loading TIMES using:
PROMPT &ctl_file
PROMPT &dat_file
PROMPT &log_file
HOST sqlldr sh/&sh_pass@&connect_string -
control=&ctl_file data=&dat_file log=&log_file -
direct=yes -
rows=1000
--
-- COUNTRIES
--
DEFINE ctl_file = &data_path.coun_&vrs..ctl
DEFINE dat_file = &data_path.coun_&vrs..dat
DEFINE log_file = &log_path.coun_&vrs..log
PROMPT
PROMPT loading COUNTRIES using:
PROMPT &ctl_file
PROMPT &dat_file
PROMPT &log_file
HOST sqlldr sh/&sh_pass@&connect_string -
control=&ctl_file data=&dat_file log=&log_file -
direct=yes -
rows=1000
--
-- CUSTOMERS
--
DEFINE ctl_file = &data_path.cust_&vrs..ctl
DEFINE dat_file = &data_path.cust1&vrs..dat
DEFINE log_file = &log_path.cust1&vrs..log
PROMPT
PROMPT loading CUSTOMERS using:
PROMPT &ctl_file
PROMPT &dat_file
PROMPT &log_file
HOST sqlldr sh/&sh_pass@&connect_string -
control=&ctl_file data=&dat_file log=&log_file -
direct=yes -
rows=10000
--
-- PRODUCTS
--
DEFINE ctl_file = &data_path.prod_&vrs..ctl
DEFINE dat_file = &data_path.prod1&vrs..dat
DEFINE log_file = &log_path.prod1&vrs..log
PROMPT
PROMPT loading PRODUCTS using:
PROMPT &ctl_file
PROMPT &dat_file
PROMPT &log_file
HOST sqlldr sh/&sh_pass@&connect_string -
control=&ctl_file data=&dat_file log=&log_file -
direct=yes -
rows=10000
--
-- PROMOTIONS
--
DEFINE ctl_file = &data_path.prom_&vrs..ctl
DEFINE dat_file = &data_path.prom1&vrs..dat
DEFINE log_file = &log_path.prom1&vrs..log
PROMPT
PROMPT loading PROMOTIONS using:
PROMPT &ctl_file
PROMPT &dat_file
PROMPT &log_file
HOST sqlldr sh/&sh_pass@&connect_string -
control=&ctl_file data=&dat_file log=&log_file -
direct=yes -
rows=10
--
-- CHANNELS
--
DEFINE ctl_file = &data_path.chan_&vrs..ctl
DEFINE dat_file = &data_path.chan_&vrs..dat
DEFINE log_file = &log_path.chan_&vrs..log
PROMPT
PROMPT loading CHANNELS using:
PROMPT &ctl_file
PROMPT &dat_file
PROMPT &log_file
HOST sqlldr sh/&sh_pass@&connect_string -
control=&ctl_file data=&dat_file log=&log_file -
direct=yes -
rows=10
--
-- SALES
--
DEFINE ctl_file = &data_path.sale_&vrs..ctl
DEFINE dat_file = &data_path.sale1&vrs..dat
DEFINE log_file = &log_path.sale1&vrs..log
PROMPT
PROMPT loading SALES using:
PROMPT &ctl_file
PROMPT &dat_file
PROMPT &log_file
HOST sqlldr sh/&sh_pass@&connect_string -
control=&ctl_file data=&dat_file log=&log_file -
direct=yes -
rows=100000
--
-- COSTS
--
PROMPT
PROMPT loading COSTS using external table
PROMPT
CREATE TABLE sales_transactions_ext
( PROD_ID NUMBER,
CUST_ID NUMBER,
TIME_ID DATE,
CHANNEL_ID NUMBER,
PROMO_ID NUMBER,
QUANTITY_SOLD NUMBER,
AMOUNT_SOLD NUMBER(10,2),
UNIT_COST NUMBER(10,2),
UNIT_PRICE NUMBER(10,2)
)
ORGANIZATION external
(
TYPE oracle_loader
DEFAULT DIRECTORY data_file_dir
ACCESS PARAMETERS
(
RECORDS DELIMITED BY NEWLINE CHARACTERSET US7ASCII
TERRITORY AMERICA
BADFILE log_file_dir:'ext_1v3.bad'
LOGFILE log_file_dir:'ext_1v3.log'
FIELDS TERMINATED BY "|" OPTIONALLY ENCLOSED BY '^' LDRTRIM
MISSING FIELD VALUES ARE NULL
( PROD_ID ,
CUST_ID ,
TIME_ID DATE(10) "YYYY-MM-DD",
CHANNEL_ID ,
PROMO_ID ,
QUANTITY_SOLD ,
AMOUNT_SOLD ,
UNIT_COST ,
UNIT_PRICE
)
)
LOCATION
('sale1v3.dat')
)
REJECT LIMIT UNLIMITED;
--REJECT LIMIT 100;
INSERT /*+ append */ INTO costs
( prod_id,
time_id,
channel_id,
promo_id,
unit_cost,
unit_price )
SELECT
prod_id,
time_id,
channel_id,
promo_id,
AVG(unit_cost),
AVG(amount_sold/quantity_sold)
FROM
sales_transactions_ext
GROUP BY
prod_id,
time_id,
channel_id,
promo_id;
--
-- ODM additional SALES rows
--
DEFINE ctl_file = &data_path.dmsal_&vrs..ctl
DEFINE dat_file = &data_path.dmsal_&vrs..dat
DEFINE log_file = &log_path.dmsal_&vrs..log
PROMPT
PROMPT loading additonal SALES using:
PROMPT &ctl_file
PROMPT &dat_file
PROMPT &log_file
HOST sqlldr sh/&sh_pass@&connect_string -
control=&ctl_file data=&dat_file log=&log_file -
direct=yes -
rows=100
--
-- SUPPLEMENTARY DEMOGRAPHICS
--
DEFINE ctl_file = &data_path.dem_&vrs..ctl
DEFINE dat_file = &data_path.dem1&vrs..dat
DEFINE log_file = &log_path.dem1&vrs..log
PROMPT
PROMPT loading SUPPLEMENTARY DEMOGRAPHICS using:
PROMPT &ctl_file
PROMPT &dat_file
PROMPT &log_file
HOST sqlldr sh/&sh_pass@&connect_string -
control=&ctl_file data=&dat_file log=&log_file -
direct=yes -
rows=10
COMMIT;
我认为导致错误的 lsh_v3.sql 脚本部分是这样的——
PROMPT
PROMPT loading COSTS using external table
PROMPT
CREATE TABLE sales_transactions_ext
( PROD_ID NUMBER,
CUST_ID NUMBER,
TIME_ID DATE,
CHANNEL_ID NUMBER,
PROMO_ID NUMBER,
QUANTITY_SOLD NUMBER,
AMOUNT_SOLD NUMBER(10,2),
UNIT_COST NUMBER(10,2),
UNIT_PRICE NUMBER(10,2)
)
ORGANIZATION external
(
TYPE oracle_loader
DEFAULT DIRECTORY data_file_dir
ACCESS PARAMETERS
(
RECORDS DELIMITED BY NEWLINE CHARACTERSET US7ASCII
TERRITORY AMERICA
BADFILE log_file_dir:'ext_1v3.bad'
LOGFILE log_file_dir:'ext_1v3.log'
FIELDS TERMINATED BY "|" OPTIONALLY ENCLOSED BY '^' LDRTRIM
MISSING FIELD VALUES ARE NULL
( PROD_ID ,
CUST_ID ,
TIME_ID DATE(10) "YYYY-MM-DD",
CHANNEL_ID ,
PROMO_ID ,
QUANTITY_SOLD ,
AMOUNT_SOLD ,
UNIT_COST ,
UNIT_PRICE
)
)
LOCATION
('sale1v3.dat')
)
REJECT LIMIT UNLIMITED;
--REJECT LIMIT 100;
INSERT /*+ append */ INTO costs
( prod_id,
time_id,
channel_id,
promo_id,
unit_cost,
unit_price )
SELECT
prod_id,
time_id,
channel_id,
promo_id,
AVG(unit_cost),
AVG(amount_sold/quantity_sold)
FROM
sales_transactions_ext
GROUP BY
prod_id,
time_id,
channel_id,
promo_id;
直到创建表的东西工作正常,但insert into
语句导致错误。