You can setup the Oracle Resource Manager to kill the session when it blocks another session for more than specific ammount of time.
About the query, look at v$session

Regards