我的问题很简单。我有可能按照这个过程完成。
像这样的命令
backup database master to disk='\\csd0201wnt29f\backup\master.bak' with stats=1
我的意思是stats=1
条款。
方法
public void executar(Backup bkp, String comando) throws Exception {
Connection conexao = ConnectionFactory.connectBase(bkp.getServidor(), bkp.getUsuario(), bkp.getSenha());
PreparedStatement cmd = conexao.prepareCall(comando, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
PreparedStatement cmdQuery = conexao.prepareCall("select @@spid");
ResultSet set = cmdQuery.executeQuery();
int spid=0;
if (set.next()) {
spid=set.getInt(1);
System.out.println("SPID" + set.getInt(1));
}
SQLMonitor s = new SQLMonitor(bkp, spid);
s.start();
cmd.execute();
cmdQuery.close();
cmd.close();
conexao.close();
}
电话
public void RealizaBackup(Backup bkp) throws Exception {
SQLComando cmd = new SQLComando();
System.out.println("backup database " + bkp.getBase() + " to disk='" + bkp.getCaminho() + "\\" + bkp.getBase() + ".bak' with stats=1");
cmd.executar(bkp, "backup database " + bkp.getBase() + " to disk='" + bkp.getCaminho() + "\\" + bkp.getBase() + ".bak' with stats=1");
}