Sunday, 22 September 2013
Saturday, 21 September 2013
Postgres processlist and locks
Processlist
select * from pg_stat_activity;
Exclude IDLE processes
select * from pg_stat_activity WHERE current_query not like '<IDLE>%';
Current running queries
select current_query,count(*) from pg_stat_activity WHERE current_query not like '<IDLE>%' group by current_query order by count(*) desc;
Queries holding Exclusive locks
select * from pg_stat_activity where procpid in(select pid from pg_locks where mode='ExclusiveLock');
select pid,count(*) from pg_locks where mode='ExclusiveLock' group by pid order by count(*) desc;
Kill a running query
SELECT pg_cancel_backend(procpid);
select * from pg_stat_activity;
Exclude IDLE processes
select * from pg_stat_activity WHERE current_query not like '<IDLE>%';
Current running queries
select current_query,count(*) from pg_stat_activity WHERE current_query not like '<IDLE>%' group by current_query order by count(*) desc;
Queries holding Exclusive locks
select * from pg_stat_activity where procpid in(select pid from pg_locks where mode='ExclusiveLock');
select pid,count(*) from pg_locks where mode='ExclusiveLock' group by pid order by count(*) desc;
Kill a running query
SELECT pg_cancel_backend(procpid);
Wednesday, 18 September 2013
Connecting to a oracle database without tnsnames
Here are the examples to connect using sqlplus to an oracle database without adding any tnsnames entry.
sqlplus scott/tiger@//10.103.18.99:1560/practicedb
If it does not work try this too
connect scott/tiger@(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.103.18.99)(PORT = 1560))) (CONNECT_DATA = (SID = practicedb)))
sqlplus scott/tiger@//10.103.18.99:1560/practicedb
If it does not work try this too
connect scott/tiger@(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.103.18.99)(PORT = 1560))) (CONNECT_DATA = (SID = practicedb)))
Subscribe to:
Posts (Atom)