datapump导入到OCI自治数据库共享基础设施



尝试使用dbms_datapump从OCI对象存储导入模式

DECLARE
-- replace with your values
exported_schema VARCHAR2(64)  := 'DEMO';
import_schema   VARCHAR2(64)  := 'DEMO'; -- in case you want to remap schema
data_pump_dir   VARCHAR2(64)  := 'DATA_PUMP_DIR';
dump_file_name  VARCHAR2(256) := <object storage url>;
credential_name VARCHAR2(64)  := 'OBJECT_STORE_CRED';
parallel        NUMBER        := 4;

job_handle      NUMBER;
job_name        VARCHAR2(64);
job_status      VARCHAR2(128);
output_message  VARCHAR2(1024);
l_sts  KU$_STATUS;
v_logs ku$_LogEntry;
v_row  PLS_INTEGER;
BEGIN
job_name := dbms_scheduler.generate_job_name('import_');
job_handle := dbms_datapump.open(operation => 'IMPORT', job_mode => 'SCHEMA', job_name => job_name); 
dbms_datapump.add_file(handle => job_handle, filename => dump_file_name, directory => credential_name, filetype => dbms_datapump.ku$_file_type_uridump_file); 
dbms_datapump.add_file(handle => job_handle, filename => import_schema || '_import.log', directory => data_pump_dir, filetype => 3);
--dbms_datapump.metadata_remap(job_handle, 'REMAP_SCHEMA', exported_schema, import_schema);
dbms_datapump.metadata_filter(handle => job_handle, name => 'SCHEMA_EXPR', value => 'IN(''' || exported_schema || ''')');
dbms_datapump.set_parallel(handle => job_handle, degree => parallel);
dbms_datapump.start_job(handle => job_handle, skip_current => 0, abort_step => 0); 
dbms_datapump.wait_for_job(handle => job_handle, job_state => job_status);
output_message := 'Data Pump Import Execution: ''' || job_status || '''';
dbms_output.put_line(output_message);
EXCEPTION
WHEN OTHERS THEN
dbms_datapump.get_status(NULL, 8, 0, job_status, l_sts);
v_logs := l_sts.error;

v_row := v_logs.FIRST;
LOOP
EXIT WHEN v_row IS NULL;
dbms_output.put_line('logLineNumber=' || v_logs(v_row).logLineNumber);
dbms_output.put_line('errorNumber=' || v_logs(v_row).errorNumber);
dbms_output.put_line('LogText=' || v_logs(v_row).LogText);
v_row := v_logs.NEXT(v_row);
END LOOP;
RAISE;
END;
/

出现以下错误

ORA-31623: um job não está associado a esta sessão por meio do handle especificado
ORA-06512: em "SYS.DBMS_DATAPUMP", line 4769
ORA-06512: em "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: em "SYS.DBMS_DATAPUMP", line 4515
ORA-06512: em "SYS.DBMS_DATAPUMP", line 6149
ORA-06512: em line 36
ORA-39001: valor de argumento inválido
ORA-06512: em "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: em "SYS.DBMS_DATAPUMP", line 4951
ORA-06512: em "SYS.DBMS_DATAPUMP", line 5202
ORA-06512: em line 20
Error at Line: 7 Column: 0

我以前使用这个程序来导入schema使用datapump文件,但是它不再工作。

我还尝试使用oracle client 19.17在我的本地机器上使用以下命令

impdp admin/<password>@serviceName credential=OBJECT_STORE_CRED directory=data_pump_dir dumpfile=<object storage url> parallel=2 encryption_pwd_prompt=yes exclude=cluster,indextype,db_link

并得到以下错误

Import: Release 21.0.0.0.0 - Production on Sex Jan 6 16:49:53 2023
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle and/or its affiliates.  All rights reserved.
Conectado a: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
UDI-06550: operaþÒo gerou erro ORACLE 6550
ORA-06550: linha 1, coluna 72:
PL/SQL: ORA-00942: a tabela ou view nÒo existe
ORA-06550: linha 1, coluna 42:
PL/SQL: SQL Statement ignored

有什么建议吗?是否有其他方法导入自治数据库?

我的理解是,第一种情况下的错误是说这个调用的参数(程序的第20行)无效:

dbms_datapump。add_file(处理=比;Job_handle, filename =>Dump_file_name,目录=>Credential_name, filetype =>

dbms_datapump.ku _file_type_uridump_file美元);发生这种情况时,可能是转储文件名或对该操作无效的凭据。UDI错误可能有其他原因,如"如何解决数据泵错误ORA-31623 UDE-31623(作业没有通过指定句柄附加到此会话)"中所述?(文件编号1907256.1)"(https://support.oracle.com/epmos/faces/DocContentDisplay?id=1907256.1),但结合次要错误,以及命令行版本操作的问题,我认为很可能是转储文件的URI和/或指定的凭据无效。

我对第二种情况不太确定,因为您提到使用19.7客户机。禁止显示21.3客户端正在使用,连接到19c服务器。虽然21c客户端是向后兼容的,但我希望看到最新的客户端在使用中,以确保它不是一个已经修复的错误。最新的即时客户端是21.8版本。

相关内容

  • 没有找到相关文章

最新更新