SQL 2005 Express Edition - Install new instance

倖福魔咒の 提交于 2019-12-22 05:11:20

问题


Looking for a way to programatically, or otherwise, add a new instance of SQL 2005 Express Edition to a system that already has an instance installed. Traditionally, you run Micrsoft's installer like I am in the command line below and it does the trick. Executing the command in my installer is not the issue, it's more a matter of dragging around the 40 MBs of MS-SQL installer that I don't need if they have SQL Express already installed. This is what my installer currently executes:

SQLEXPR32.EXE /qb ADDLOCAL=ALL INSTANCENAME=<instancename> SECURITYMODE=SQL SAPWD=<password> SQLAUTOSTART=1 DISABLENETWORKPROTOCOLS=0

I don't need assistance with launching this command, rather the appropriate way to add a new instance of SQL 2005 Express without actually running the full installer again.

I'd go into great detail about why I want to do this but I'd simply bore everyone. Suffice to say, having this ability to create a new instance without the time it takes to reinstall SQL Express etc. would greatly assist me for the deployment of my application and it's installer. If makes any difference to anyone, I'm using a combination of NSIS and Advanced Installer for this installation project.


回答1:


It sounds like a user instance might help you. If you have the MDF and LDF files, you can connect to the files by instructing SQL Server Express to launch a user instance and attach the specified file to that instance.

This artile http://msdn.microsoft.com/en-us/library/bb264564.aspx has a good description of how you can lean on the existing SQL Server Express installation to instantiate a user-specific instance for the duration of your connection.

Hope it helps.




回答2:


I do not know how to do it with an API, but if no one gives a better solution, you can always use Process.Start() to execute your command line as-is.




回答3:


After months/years of looking into this it appears it can't be done. Oh well, I guess I just reinstall each time I want a new instance. I guess it's because each instance is it's own service.



来源:https://stackoverflow.com/questions/150223/sql-2005-express-edition-install-new-instance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!