osql -S"服务器名称" -U"用户名" -P"密码" -d"数据库名称" -i"输入文件全路径" -o"日志输出文件全路径" 例如: osql -S"192.168.85.126" -U"sa" -P"psw" -d"dbName" -i"F:\SQL文件夹\1.sql" -o"F:\SQL文件夹\日志\1.txt"
点击运行即可 也可以直接在代码里,生成并执行.bat文件 例子:
ublic string GetCMDOutString(string path, string arguments) { System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(); psi.FileName = path; psi.UseShellExecute = true; psi.Arguments = arguments; psi.CreateNoWindow = false; psi.RedirectStandardOutput = false; String s = ""; System.Diagnostics.Process p = System.Diagnostics.Process.Start(psi); while (p.WaitForExit(0) == false) { s += p.StandardOutput.ReadLine() + "\r\n"; } return s; } 处理效率还不错,更新五万条数据,一共用25秒,其中只有15秒实在执行数据库操作,且cpu占用不高。 |
using System;
using System.Diagnostics; namespace ProcessSample { class ProcessMonitorSample { public static void Main() { // Define variables to track the peak // memory usage of the process. long peakPagedMem = 0, peakWorkingSet = 0, peakVirtualMem = 0; Process myProcess = null; try { // Start the process. myProcess = Process.Start("NotePad.exe"); // Display the process statistics until // the user closes the program. do { if (!myProcess.HasExited) { // Refresh the current process property values. myProcess.Refresh(); Console.WriteLine(); // Display current process statistics. Console.WriteLine("{0} -", myProcess.ToString()); Console.WriteLine("-------------------------------------"); Console.WriteLine(" physical memory usage: {0}", myProcess.WorkingSet64); Console.WriteLine(" base priority: {0}", myProcess.BasePriority); Console.WriteLine(" priority class: {0}", myProcess.PriorityClass); Console.WriteLine(" user processor time: {0}", myProcess.UserProcessorTime); Console.WriteLine(" privileged processor time: {0}", myProcess.PrivilegedProcessorTime); Console.WriteLine(" total processor time: {0}", myProcess.TotalProcessorTime); Console.WriteLine(" PagedSystemMemorySize64: {0}", myProcess.PagedSystemMemorySize64); Console.WriteLine(" PagedMemorySize64: {0}", myProcess.PagedMemorySize64); // Update the values for the overall peak memory statistics. peakPagedMem = myProcess.PeakPagedMemorySize64; peakVirtualMem = myProcess.PeakVirtualMemorySize64; peakWorkingSet = myProcess.PeakWorkingSet64; if (myProcess.Responding) { Console.WriteLine("Status = Running"); } else { Console.WriteLine("Status = Not Responding"); } } } while (!myProcess.WaitForExit(1000)); Console.WriteLine(); Console.WriteLine("Process exit code: {0}", myProcess.ExitCode); // Display peak memory statistics for the process. Console.WriteLine("Peak physical memory usage of the process: {0}", peakWorkingSet); Console.WriteLine("Peak paged memory usage of the process: {0}", peakPagedMem); Console.WriteLine("Peak virtual memory usage of the process: {0}", peakVirtualMem); } finally { if (myProcess != null) { myProcess.Close(); } } } } }
相关推荐
对日外包 DOS命令 写的VBSCRIPT 与批处理文件 用于数据库压缩,可以参考其中的命令
就是一条还原命令
批处理备份mysql数据库,亲自测试过,只要修改下配置文件即可使用。
数据库备份自动备份批处理文件,欢迎下载
数据库启动文件 只需要把你的服务名写进去就可以启动本地的数据库
批处理导出oracle数据库为dump文件,之后可以正常导入
Oracle服务都是手动启动、关闭,每次都需要一个个启动比较麻烦,自然就想到到了批处理文件管理,这个是我写的一个批处理文件,希望对大家有用了。
此批处理文件双击后 能自动向注册表添加,立马解决挂起问题,已经帮助过很多人解决了......
一键安装mysql数据库,同时可以执行数据库脚本 经过测试当前文件可以兼容各个版本的系统,压缩包内包括说明文档,下载后如果有什么问题可以私信我
用一个批处理文件连接mysql,其中用如何连接和如何备份一mysql数据库
NULL 博文链接:https://wang-z-p2007.iteye.com/blog/908042
这是一个批处理文件,效果是便捷的打开 数据库的服务。
Oracle数据库批处理关闭服务,启动也可以通过找到服务做类似文件
为了客户友好,一键安装数据库,客户直接双击批处理文件xxx.bat,cmd自动执行一系列安装命令。(安装路径是默认的)
用批处理方式附件数据库 修改AttchDb.sql @filename1=N'数据库存放位置 MDF文件', @filename2=N'数据库存放位置 LDF文件'
将该批处理文件加入系统任务计划,定时即可。 如:sn.txt内容为31,则备份文件:31_test.sql,同时删除该目录下1_test.sql文件。 可以根据实际需要,修改批处理数据库名,mysql数据库bin目录,配置文件保存目录,...
NULL 博文链接:https://heisetoufa.iteye.com/blog/287301
NULL 博文链接:https://zhouhaitao.iteye.com/blog/954129
应用于开机或者需要批处理的数据库命令,处理数据更快更有效。
很好用的开关数据库连接批处理文件,mysql,oracle