Monday, March 19, 2012

How to stop an open port listening on Windows forcefully

1) In command prompt type

netstat -a -o -n

2) find the PID number for that port number

Proto Local Address Foreign Address State PID
TCP 0.0.0.0:8009 0.0.0.0:0 LISTENING 5840
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 5840

3) In command prompt type

taskkill /F /PID 5840

This will kill process 5840 forcefully and release port 8009, 8080.

Oracle Savepoint example

CREATE TABLE TEST(
ID NUMBER PRIMARY KEY
);

CREATE OR REPLACE PROCEDURE TEST_PROC
IS
BEGIN
INSERT INTO TEST(ID) VALUES(5);
FOR I IN 1..10 LOOP
SAVEPOINT A;
DECLARE
V_NUM NUMBER:=5;
BEGIN
INSERT INTO TEST(ID) VALUES(I);
COMMIT;
EXCEPTION WHEN OTHERS THEN
ROLLBACK TO A;
END;
END LOOP;
END;
/