为什么运行 sqlldr 后我的外键被禁用?
在构建过程中,我们运行 sqlldr 以使用一些示例数据填充我们的数据库。在 sqlldr 涉及的每个表上,外键在 sqlldr 运行后将被禁用。
sqlldr 只会禁用约束 与其他表相关(例如: 外键)不是主键。
SQLLDR 只会重新启用 IT 禁用的约束,而不是 你自己做的。
我认为这意味着我的外键应该启用。
我们所有的 sqlldr 控制文件都与此类似:
options (direct=true, rows=20000)
load data
infile "clinical_code.txt"
append
into table clinical_code
fields terminated by "|"
trailing nullcols
rows
计数故意大于数据文件中的行数,因为如果它较小,它损坏了我的主键。
为什么 sqlldr 没有像文档暗示的那样重新启用我的外键?
如果需要的话,我可以编写 SQL 来重新启用索引。我想知道为什么会发生这种情况。
使用传统的加载路径是一个不错的选择,但它会增加我们的构建过程 2 分钟的时间,如果可能的话,我想避免这种情况。
During our build process, we run sqlldr to populate our database with some sample data. On every table that sqlldr touches, the foreign keys are disabled after sqlldr runs.
According to this Ask Tom posting:
sqlldr will only disable constraints
that relate to other tables (eg:
foreign keys) NOT the primary key.SQLLDR will only re-enable the
constraints which IT disabled, not the
ones you did yourself.
I would take that to mean that my foreign keys should be enabled.
All of our sqlldr control files are similar to this one:
options (direct=true, rows=20000)
load data
infile "clinical_code.txt"
append
into table clinical_code
fields terminated by "|"
trailing nullcols
The rows
count is intentionally larger than the number of rows in the data file because if it was smaller, it corrupted my primary key.
Why is sqlldr not re-enabling my foreign keys like the documentation seems to imply?
I am fine writing the SQL to re-enable the indices if necessary. I'd like to know why this is happening.
Using conventional load path is an ok alternative, but it would add 2 minutes to our build process and I'd like to avoid that if possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从 SQL*Loader 10gR2 文档:
看来您必须指定 REENABLE 关键字才能在加载后自动启用约束。
From the SQL*Loader 10gR2 documentation :
It seems you have to specify the
REENABLE
keyword to enable the constraints automatically after the load.在 SQL Loader 中,我们还有索引维护选项和与约束相关的选项。
如果它只是直接加载,那么“重新启用选项”将起作用,并且约束状态将根据输入数据。
如果它是直接和并行加载那么我认为你必须在加载后启用。
In SQL Loader , we have Index maintenance options and options related to constraints also .
if its only direct load then ' reenable option ' will work and constraint state will be as per input data.
if its direct and parallel load then i think you have to enable after loading .