String oracle查询被锁住的会话="select sess.sid, sess.serial#, lo.oracle_username, lo.os_user_name, ao.object_name, lo.locked_mode from v$locked_object lo, dba_objects ao, v$session sess where ao.object_id = lo.object_id and lo.session_id = sess.sid;";
String 复制查询到的前两列="221 36884\n" +
"200 65203\n" +
"198 21222\n" +
"165 40281\n" +
"161 24872\n" +
"97 63528\n" +
"71 9188\n" +
"70 11531\n" +
"38 49936\n" +
"33 20983\n" +
"97 63528";
String[] 截取每行 = 复制查询到的前两列.split("\n");
String 解锁语句="ALTER system KILL SESSION 'item.sid,item.serial#';";
String 结果="";
for (String 每一行 : 截取每行) {
String[] 每一行数据 = 每一行.split(" ");
结果+=解锁语句.replace("item.sid", 每一行数据[0]).replace("item.serial#", 每一行数据[1])+"\n";
}
System.out.println(结果);