未索引的外键
我正在寻找将显示与 gui 相同内容的命令行命令
Unindexed Foreign Keys
I am looking for the command line command that will display the same thing as the gui
Unindexed Foreign Keys
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
没有命令行命令(据我所知)可以做到这一点。但你可以自己推出。基本上,您需要一个查询来检查数据库中的这些内容,这实际上是您的 GUI 工具必须做的事情。查询类似于:
注意:此 SQL 并不完美。在某些情况下,它可能会被愚弄,认为存在指数下注,但实际上并非如此。列位于正确位置的多个不同索引可能会欺骗它。要正确执行此操作,您需要在内联视图中开始分组或使用分析函数来确保所有索引列都来自同一索引。所以我把它保留在这个简单的版本中,它在大多数情况下都可以工作。
然后您可以在 sqlplus 中运行此 SQL,或者可以将其嵌入到可以从命令行轻松运行的 shell 脚本中。一个粗略的方法是:
然后您可以像这样运行并获得基本结果:
There is no command line command (that I know of) which does it. But you can roll your own. Basically you need a query which checks the database for these, which is effectively what your GUI tool must be doing. The query would be something like:
NOTE: This SQL is NOT perfect. There could be situations where it is fooled into thinking there is an index bet there's not really. Multiple different indexes with columns in the right place could fool it. To do it properly you'll need to start grouping in inline views or use analytic functions to ensure all the index columns come from the same index. So I left it at this simple version which will work most of the time.
Then you can run this SQL in sqlplus, or you could embed it in a shell script which is easily run from the command line. A crude one would be:
Which you can then run like this and get the basic results:
以下是一个每次都能正确运行的脚本,由 Steve Adams 提供:
希望有所帮助。
The following is a script which should work correctly every time, courtesy of Steve Adams:
Hope that helps.