Oracle PL/SQL 加载 XML

发布于 2024-10-22 03:29:38 字数 1518 浏览 25 评论 0原文

我不知道问这个问题的最佳方式,但让我解释一下这个问题,它可能会有所帮助。

目前,我们有一个使用 Oracle OAI 中心分发给我们的数据源。数据通过 DBLinks 提供给我们。

该信息提供商将升级到 Oracle ODI,并且出于多种原因要求所有数据传输均通过 SFTP 使用加密的 XML 文件进行。

现在,这给我们作为数据接收者带来了一个新问题,因为我们现在需要修改我们的系统,将 XML 数据加载到曾经由 DBLink 填充的表中。

我们当前的设置是:

  • Oracle 10g (10.2.0.4)
    • Oracle 在 Unix (HP-UX) 上运行
  • 众多 Win2k3 服务器控制接口/ETL 流程。

目前,OAI 中心会将数据放入 ETL 层的多个表中。例如说“人”。我认为该表的结构不相关...

当数据加载到 PERSON 表中时,OAI 交付会将文件结束标记传输到数据库,该标记存储在表“EOF”中 - 它保存“PERSON”中预期收到的记录计数。

Windows 服务器有一个批处理进程,每 30 秒轮询一次,检查是否存在 EOF 记录,如果存在,则启动我们的 ETL 处理。

我想尽可能避免更改系统的这一部分,所以我建议的解决方案是解析新的 XML 文件并将它们加载到 Oracle 数据库中,问题是执行此操作的最佳方法是什么:

  • XML文件将被传送到 Windows 服务器
  • 首选是使用 PL/SQL 加载数据

将数据加载到 Oracle (Unix) 数据库(源数据位于 Windows 端)的最佳方法是什么。

如果可能的话,我想避免使用任何 Unix 脚本 - 因为我的开发团队没有足够的 Unix 经验来让他们在这方面放松。

任何建议将不胜感激。

XML 格式如下 - 元素名称映射到数据库上的列名称:

<PERSON>
  <HEADER>
    <Creator>~</Creator>
    <DigitalSigniture>~</DigitalSigniture>
    <Owner>~</Owner>
    <Title>~</Title>
    <Marking>~</Marking>
   </HEADER>

   <PERSONS>
     <EMPLOYEE_NUMBER>~</EMPLOYEE_NUMBER>
     <FIRST_NAME>~</FIRST_NAME>
     <LAST_NAME>~</LAST_NAME>
     ......
   </PERSONS>
<PERSON>

编辑: 我还意识到数量,在正常(平均)一天,我将处理大约 80,000 条 XML 记录,在特殊的一天,我将处理多达 300,000 条记录(通常每年一次)。

I don't know the best way to ask this, but let me explain the issue and it may help.

We currently have a feed of data that is distributed to us using an Oracle OAI hub. The data is fed to us using DBLinks.

The information provider is going to be upgrading to Oracle ODI, and for numerous reasons are mandating that all data transfer is conducted using encrypted XML files over SFTP.

Now this introduces a new issue for ourselves as data recipient, as we now need to amend our systems to load XML data into the tables that once were populated by DBLinks.

The set-up we currently have is:

  • Oracle 10g (10.2.0.4)
    • Oracle is running on Unix (HP-UX)
  • Numerous Win2k3 servers controlling interface / ETL flow.

So currently, the OAI hub will place data into a number of tables in our ETL layer. Say for example "PERSON". The structure of this table i dont believe is relevant...

When the data has been loaded into the PERSON table, the OAI delivery will transmit an End-of-file marker to the database, this is stored in table "EOF" - it holds a count of recieved records expected in "PERSON".

The windows server has a batch process that polls every 30 seconds, this checks to see if an EOF record exists, if it does then it kicks off our ETL processing.

I want to avoid changing this part of the system if possible, so what i am proposing as a solution is to parse the new XML files and load them into the Oracle database, the question is what is the best way to do this:

  • The XML files will be delivered to the Windows Servers
  • Preference would be to use PL/SQL to load the data

What is the best way to load the data into the Oracle (Unix) database, with the source data being on the Windows side.

I want to avoid having to use any Unix scripting if possible - as my development team don't have enough Unix experience to let them loose on this.

Any suggestions will be grateful.

The XML format is as below - and element names map to column names on DB:

<PERSON>
  <HEADER>
    <Creator>~</Creator>
    <DigitalSigniture>~</DigitalSigniture>
    <Owner>~</Owner>
    <Title>~</Title>
    <Marking>~</Marking>
   </HEADER>

   <PERSONS>
     <EMPLOYEE_NUMBER>~</EMPLOYEE_NUMBER>
     <FIRST_NAME>~</FIRST_NAME>
     <LAST_NAME>~</LAST_NAME>
     ......
   </PERSONS>
<PERSON>

EDIT:
I am also conscious of volumes, on a normal (average) day i will be processing about 80,000 XML records, and on an exceptional day i will processing up to 300,000 (typically once per year).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

吃兔兔 2024-10-29 03:29:38

要分解 XML 并将其加载到 Oracle 表中,您可以使用我在这篇博文中描述的技术:http://rwijk.blogspot.com/2010/03/shredding-xml-into-multiple-tables-in.html

问候,
抢。

一些加载文件的链接:
http://download.oracle.com/docs /cd/B19306_01/appdev.102/b14259/xdb25loa.htm#ADXDB2900
http://www.oracle-developer.net/display.php?id=416

To shred your XML and load them into Oracle-tables, you can use the technique I described in this blogpost: http://rwijk.blogspot.com/2010/03/shredding-xml-into-multiple-tables-in.html

Regards,
Rob.

Some links for loading the files:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb25loa.htm#ADXDB2900
http://www.oracle-developer.net/display.php?id=416

ぃ双果 2024-10-29 03:29:38

我建议忘记内置的 Oracle XML 功能,并使用任何普通语言在“客户端”处理 XML 文件并将准备使用的数据提交到数据库。 (寻找Python或.NET)

如果您允许从网络访问数据库服务器文件系统,则可能存在安全风险。

一天8万条记录对于Oracle来说应该不是什么大问题。我们做得更加接近实时。

I would offer to forget about build-in Oracle XML features and use any normal language to process XML files on the "client side" and submit ready to use data to the DB. (Look for Python or .NET)

It could be a security risk, if you allows to access DB server file system from network.

80 000 records a day should not be a big problem for Oracle. We do much more close to real time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文