如何编写一个查询,为某个用户拥有的每个索引生成一组 ANALYZE INDEX 命令?
正如标题所示,在 Oracle 10g 数据库中,我想创建一个查询,该查询将为特定用户拥有的每个索引生成一组 ANALYZE INDEX 命令。当涉及到数据库主题时,我是一个完全的门外汉,所以请尽可能保证答案的虚拟性,谢谢!
As the title says, in an Oracle 10g database, I'd like to create a query that will generate a set of ANALYZE INDEX commands for every index owned by a certain user. I'm a complete layman when it comes to database topics, so please keep answers as dummy-proof as possible, thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您使用 Oracle 10g 时,您确实应该使用 DBMS_STATS。这可以简单地实现...
还有其他参数:c查看文档。
如果您想为其他用户的索引生成统计信息,请改用 ALL_INDEXES,并限制 OWNER。
如果您专注于分析,那么
As you're on Oracle 10g you really ought to be using DBMS_STATS instead. That could be implemented as simply as ...
There are other parameters: check out the documentation.
If you want to generate stats for some other user's indexes use ALL_INDEXES instead, and restrict on OWNER.
If your heart is set on ANALYZE then
你可以。但是,如果您是数据库主题的外行,我会非常担心您正在做的事情会给自己带来各种问题。所以我想问你想解决什么问题。
你可以做类似的事情
,但在我建议你实际运行这个之前,我真的很想了解你来自哪里。
You can. However, if you are a layman when it comes to database topics, I'd be very concerned that you're doing something that is going to create all sorts of problems for yourself. So I'd ask what problem you're trying to solve.
You can do something like
but I'd really want to understand where you're coming from before I'd suggest you'd actually run this.