简体   繁体   English

可以将相同的sqlcmd.exe用于任何数据库备份

[英]Can the same sqlcmd.exe used for any db back up

We are using sqlcmd.exe to back up our database programatically. 我们正在使用sqlcmd.exe以编程方式备份​​数据库。 So while i am checking the path of exe it is placed inside "C:\\Program Files\\Microsoft SQL Server\\100\\Tools\\Binn\\SQLCMD.EXE" 因此,当我检查exe的路径时,它位于"C:\\Program Files\\Microsoft SQL Server\\100\\Tools\\Binn\\SQLCMD.EXE"

So my doubt is can the same sqlcmd.exe used to take db backup from sql server 2005 and 2008, or to take back up of 2005 whether we have to use different sqlcmd? 因此,我的疑问是可以使用同一个sqlcmd.exe从sql server 2005和2008进行数据库备份,还是要备份2005的数据库,是否必须使用其他sqlcmd?

The sqlcmd utility in SQL Server lets you run Transact-SQL statements and related commands at a command prompt, within a script file or in a Query Editor window in SQL Server Management Studio. SQL Server中的sqlcmd实用程序使您可以在命令提示符下,脚本文件中或SQL Server Management Studio中的“查询编辑器”窗口中运行Transact-SQL语句和相关命令。 It can be a handy tool, whether you want to run simple ad hoc queries or create script files to perform routine tasks or automate procedures. 无论您是要运行简单的即席查询还是创建脚本文件来执行例行任务或使过程自动化,它都可以成为方便的工具。 Although the utility supports a number of advanced options, you can start using sqlcmd with relative ease by entering simple commands at the Command Prompt window on any system where SQL Server is installed. 尽管该实用程序支持许多高级选项,但是您可以通过在安装了SQL Server的任何系统上的“命令提示符”窗口中输入简单命令来相对轻松地开始使用sqlcmd。

Interactive mode in sqlcmd To quickly get started using sqlcmd you can enter interactive mode. sqlcmd中的交互模式要快速开始使用sqlcmd,可以进入交互模式。 Interactive mode lets you run Transact-SQL statements and sqlcmd commands directly, similar to entering statements in a Query Editor. 交互模式使您可以直接运行Transact-SQL语句和sqlcmd命令,类似于在查询编辑器中输入语句。

Syntax to take backup: 进行备份的语法:

sqlcmd -S.\SQLExpress -Q"BACKUP DATABASE dbName  TO DISK = 'path'"

The path you have mentioned in the post is correct. 您在帖子中提到的路径是正确的。 It can vary version to version of sql server. 它可以随版本不同的sql server。

You can use the sqlcmd of sqlserver 2005 to take backup of sql server 2008. 您可以使用sqlserver 2005的sqlcmd备份sql server 2008。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 可以配置sqlcmd.exe路径吗? - Can sqlcmd.exe path be configured? 检测是否安装了 SQLCMD.exe 的正确方法? - Proper way to detect if SQLCMD.exe is installed? “sqlcmd.exe -S Instance USE ...”在命令行中工作,但我无法将其移动到 c # process - "sqlcmd.exe -S Instance USE ..." work in command line, but I can't move it to c # process 任何人都有一些示例代码可以在C#中创建可被任何OLE DB应用程序使用的OLE DB提供程序? - Anyone have some sample code to create a OLE DB Provider in C# that can be used by any OLE DB app? 可以使用DataTable更新数据库吗? - Can a DataTable be used to update the DB? 在域 class 和同一目标 class 的多个版本之间来回转换时,可以使用哪种策略? - Which strategy can be used when converting back and forth between a domain class and several versions of the same target class? 我们可以在C#中为宏开发一个.exe文件以在新机器中设置excel文件吗,该机器之前不包含任何宏 - Can we develop a .exe file, in c# for macros to set up excel file in new machine which does not contains any macros earlier LINQ和DB无法检索正确的数据 - LINQ and DB can not retrieve correct data back 如何从 exe 文件中提取与用于创建此 exe 文件相同的 .ico 文件? - How to extract from exe file the same .ico file as the one used to create this exe? 如何备份 WPF 数据网格使用的可观察集合? - How do I back up the observable collection used by a WPF datagrid?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM