重新生成db(oracle)中的所有序列
再会。我有一个非常具体的任务:重新生成数据库中的所有序列。里面有400多张桌子,所以我不能用手做。 有人可以帮我做吗? 多谢..
Good day. I have a very specific task: regenerate all sequences in database. There is a 400+ tables in it, so I can't do it by hands.
Can somebody help me to do it?
Thanks a lot..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请注意,这是非常危险的。你很可能会犯错误。首先运行 select 以检查您要执行的操作并创建一个 select 表,以便您可以在需要时手动重新创建同义词。
使用
all_synonyms
或dba_synonyms
代替user_synonyms
可能会导致删除系统同义词不这样做如果您希望数据库随后正常工作,我还建议在您创建的 1 个测试同义词上测试代码,以确保它完全执行您想要的操作。
另外我真的不明白这样做有什么意义?如果同义词存在,为什么需要重新生成它们?或者这是在另一台服务器上完成的?如果是这样,请在
user_synonyms
之后添加@server_name
并删除drop
。Please note this is highly dangerous. You may very well make mistakes. Run the select first to check what you're about to do and create a table of the select so you can re-create the synonyms manually later if you need to.
Using
all_synonyms
ordba_synonyms
instead ofuser_synonyms
may result in dropping system synonyms do not do this if you want your database to work afterwardsI'd also recommend testing the code on 1 test synonym you create to ensure that it does exactly what you want.
Plus I don't really see the point of doing this at all? If the synonyms are there why do you need to re-generate them? Or is this being done on another server? If so add
@server_name
afteruser_synonyms
and remove thedrop
.