简体   繁体   English

寻找 Oracle DBMS_WM.Export_Schemas function 的工作示例

[英]Looking for working example of Oracle DBMS_WM.Export_Schemas function

I'm working with Oracle 19.6 and I'm trying to export versioned data using Workspace Manager.我正在使用 Oracle 19.6,我正在尝试使用 Workspace Manager 导出版本化数据。 The official documentation ( https://docs.oracle.com/en/database/oracle/oracle-database/19/adwsm/DBMS_WM-reference.html#GUID-9485C70D-9CF9-4649-8785-06C7D6CF32D6 ) shows an example but I was not able to make it work.官方文档( https://docs.oracle.com/en/database/oracle/oracle-database/19/adwsm/DBMS_WM-reference.html#GUID-9485C70D6-9CF9-7D649-8示例显示我无法让它工作。

Using "sys" user, the code returns "ORA-20283: invalid job_name parameter specified" at line "dbms_wm.export_schemas(job_name);"使用“sys”用户,代码在“dbms_wm.export_schemas(job_name);”行返回“ORA-20283: invalid job_name parameter specified”

With a dedicated user (the documentation says "The Data Pump job should not be created while using SYSDBA privileges") I get another error:使用专用用户(文档说“使用 SYSDBA 权限时不应创建数据泵作业”)我收到另一个错误:

31626. 00000 -  "job does not exist"
*Cause:    An invalid reference to a job which is no longer executing,
           is not executing on the instance where the operation was
           attempted, or that does not have a valid Master Table.
           Refer to any following error messages for clarification.
*Action:   Start a new job, or attach to an existing job that has a
           valid Master Table.

Another thing that bother me is that the sample code does not call "DBMS_DATAPUMP.START_JOB" as in regular datapump job.困扰我的另一件事是示例代码不像常规数据泵作业那样调用“DBMS_DATAPUMP.START_JOB”。

SR has been open to Oracle support for a long time so any help is greatly appreciated. SR 长期以来一直对 Oracle 支持开放,因此非常感谢任何帮助。

Thanks.谢谢。

Edit: As per the documentation, versioned data can be exported and imported with data pump and FULL=Y option.编辑:根据文档,可以使用数据泵和 FULL=Y 选项导出和导入版本化数据。 Doing so (and disabling all WMSYS triggers beforehand), returns tons of ORA-39111 and ORA-31684 as I didn't drop the objects in the target database, but strangely, "SPATIAL_CSW_ADMIN_USR" user is not present in the dump which leads to cascade of errors.这样做(并事先禁用所有 WMSYS 触发器)会返回大量 ORA-39111 和 ORA-31684,因为我没有将对象删除到目标数据库中,但奇怪的是,“SPATIAL_CSW_ADMIN_USR”用户不存在于转储中导致级联错误。

At the end of the day, import is "successfull" with 5685 errors but the content of ALL_WORKSPACES table shows only the default entry (nammed LIVE) when 12 are present in the source database.归根结底,导入“成功”并出现 5685 个错误,但当源数据库中存在 12 个时,ALL_WORKSPACES 表的内容仅显示默认条目(命名为 LIVE)。

Here is the steps I followed to successfully export versionned tables using dbms_wm.export_schemas:以下是我使用 dbms_wm.export_schemas 成功导出版本控制表的步骤:

Create a dedicated user to run the export:创建一个专用用户来运行导出:

create user sigea_exp identified by sigea_exp;
grant create session, create table, create procedure, exp_full_database, imp_full_database, DATAPUMP_EXP_FULL_DATABASE to sigea_exp;
GRANT UNLIMITED TABLESPACE TO sigea_exp;
grant read, write on directory EXPORT_AUTOMATIQUE to sigea_exp;
begin
    DBMS_WM.GRANTSYSTEMPRIV('ACCESS_ANY_WORKSPACE','sigea_exp', 'NO',TRUE);
end;

Check that WMSYS schema does not contain errors (connected as "sys" no row returned by the following statement):检查 WMSYS 架构是否不包含错误(连接为“sys”,以下语句没有返回行):

select * from ALL_OBJECTS where status = 'INVALID' and OWNER = 'WMSYS';

Run the following script, chosing carefully the name of the DIRECTORY (here 'EXPORT_AUTOMATIQUE'):运行以下脚本,仔细选择 DIRECTORY 的名称(此处为“EXPORT_AUTOMATIQUE”):

DECLARE
  job_name varchar2(128) := 'EXPORT_EAU_2';
  dpj number ;
BEGIN
  dpj := dbms_datapump.open('EXPORT', 'SCHEMA', null, job_name, 'COMPATIBLE');
  dbms_datapump.add_file(dpj, 'eau_schema.dmp', 'EXPORT_AUTOMATIQUE');
  dbms_datapump.add_file(dpj, 'eau_schema.log', 'EXPORT_AUTOMATIQUE', filetype=>dbms_datapump.KU$_FILE_TYPE_LOG_FILE);
  dbms_wm.export_schemas(job_name, 'WMSYS_N', FALSE);
  DBMS_DATAPUMP.START_JOB(dpj);
END;
/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM