--- a/oracle.rst Tue Sep 30 19:09:41 2014 +0300
+++ b/oracle.rst Tue Sep 30 19:13:46 2014 +0300
@@ -44,9 +44,19 @@
Database info.
==============
+List of users::
+
+ select distinct(OWNER) from ALL_TABLES;
+
List of current user owned tables::
select * from USER_TABLES;
+ select TABLE_NAME from USER_TABLES;
+
+List of tables by owner::
+
+ select OWNER || '.' || TABLE_NAME from ALL_TABLES
+ order by OWNER;
List of current user table sizes::
@@ -66,6 +76,14 @@
group by index_name, table_name
order by table_name;
+List of tables without primary keys::
+
+ select OWNER || '.' || TABLE_NAME from ALL_TABLES
+ where TABLE_NAME not in (
+ select distinct TABLE_NAME from ALL_CONSTRAINTS where CONSTRAINT_TYPE = 'P'
+ ) and OWNER in ('USER1', 'USER2')
+ order by OWNER, TABLE_NAME;
+
List of currenct user constraints::
select * from USER_CONSTRAINTS;