jdbc程序在oracle v$session.program默认都是显示为 'JDBC Thin Client',非常不便于管理,使用以下的代码可以设定自己program的名字
java.util.Properties props = new java.util.Properties(); props.setProperty("password","mypassword"); props.setProperty("user","myusername"); props.put("v$session.osuser", System.getProperty("user.name").toString()); props.put("v$session.machine", InetAddress.getLocalHost().getCanonicalHostName()); props.put("v$session.program", "My Program Name"); DriverManager.registerDriver (new oracle.jdbc.OracleDriver()); Connection conn= DriverManager.getConnection("jdbc:oracle:thin:@myhostname:1521:mysid",props);
还可以通过dbms_application_info.set_module and dbms_application_info.set_client_info to set clientinfo,module,action in v$session