Commands working with Zabbix Oracle database

Show databases (aka table space in oracle) together with users:
select username, created, default_tablespace from dba_users;
Select shema so we do need to use it in every query:
alter session set current_schema=ZABBIX50USER;
SELECT * FROM ALL_TAB_COLS WHERE OWNER = 'ZABBIX50USER' AND TABLE_NAME = 'ITEMS';
Contraints per item:
select CONSTRAINT_NAME, CONSTRAINT_TYPE, TABLE_NAME from USER_CONSTRAINTS where TABLE_NAME='ITEMS';

List all tables in oracle database

select table_name from user_tables;

show all columns per table

desc drules
desc items

count hosts monitored behind proxy

select count(*) from hosts;

count all items monitored behind proxy

select count(*) from items;
Show users from user 'system' with password 'oracle':
select username from dba_users;

No comments: