Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get all sequences in an Oracle database?

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.

like image 669
sheidaei Avatar asked Feb 12 '14 19:02

sheidaei


People also ask

Where are sequences stored in Oracle?

Answer: The values for a sequence are internal to Oracle but most guru's says that the values are stored in the SYS. SEQ$ table with supplemental parts in the OBJ$ table, with the OBJ# column as the join key.

How do I find the sequence of a database?

You should use the query "select sequence_name from all_sequences;" to find out all sequences accessible to the schema user.

How do I see existing sequences in current user?

To display names of all sequences from Oracle database you can use: USER_SEQUENCES, ALL_SEQUENCES, DBA_SEQUENCES, USER_OBJECTS.

How do I find sequences in SQL?

The syntax to a view the properties of a sequence in SQL Server (Transact-SQL) is: SELECT * FROM sys. sequences WHERE name = 'sequence_name'; sequence_name.


1 Answers

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.

like image 155
Mark J. Bobak Avatar answered Sep 24 '22 04:09

Mark J. Bobak