SQL 如何获取 Oracle 数据库中的所有序列?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21738117/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I get all sequences in an Oracle database?
提问by sheidaei
Is there any command that I can run so that I can get all the sequences? I am using Oracle 11g. I am using Toad for Oracle to connect to it. I can visually see the sequences in Toad, but I like to know the command line for it.
是否有任何我可以运行的命令来获取所有序列?我正在使用 Oracle 11g。我正在使用 Toad for Oracle 连接到它。我可以直观地看到 Toad 中的序列,但我喜欢了解它的命令行。
回答by Mark J. Bobak
select sequence_owner, sequence_name from dba_sequences;
DBA_SEQUENCES -- all sequences that exist
ALL_SEQUENCES -- all sequences that you have permission to see
USER_SEQUENCES -- all sequences that you own
Note that since you are, by definition, the owner of all the sequences returned from USER_SEQUENCES
, there is no SEQUENCE_OWNER
column in USER_SEQUENCES
.
请注意,根据定义,您是从 返回的所有序列的所有者USER_SEQUENCES
,因此 中没有SEQUENCE_OWNER
列USER_SEQUENCES
。
回答by Pete B.
You may not have permission to dba_sequences. So you can always just do:
您可能没有 dba_sequences 的权限。所以你总是可以这样做:
select * from user_sequences;