向 Oracle OLTP 表添加列
我正在尝试在应用程序运行且繁忙时向 Oracle 10 OLTP 数据库中的常用表添加可为空列。添加可为空的列只是数据字典的更改,因此任何表锁都只会保留很短的时间(可以由系统处理)。
问题是我的 ALTER TABLE 经常会失败:
ORA-00054: resource busy and acquire with NOWAIT specified
我当前的方法是通过运行它来强行更改,直到表上碰巧没有锁。这意味着我无法在 SQL*Plus 中完整运行这样的脚本,但需要复制并粘贴每个语句并确保其有效。
有更好的办法吗?
I'm attempting to add a nullable column to a frequently used table in an Oracle 10 OLTP database while the application is running and busy. Adding a nullable column is only a data dictionary change and therefore any table lock is only held for a short period of time (which can be handled by the system).
The problem is that my ALTER TABLE
often fails with this:
ORA-00054: resource busy and acquire with NOWAIT specified
My current approach is to bludgen the change in by running it until there happens to be no locks on the table. This means I can't run such a script in SQL*Plus in full, but need to copy and paste each statement and make sure it works.
Is there a better way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
暴力方法怎么样?将其置于无限循环中并在完成后退出。伪代码(尚未检查):
How about a brute force approach? Put it in an infinite loop and exit it when done. Pseudocode(haven't checked it):