繁体   English   中英

多租户应用程序的数据库配置

[英]Database provisioning of a multi tenant application

我正在开发一个多租户应用程序,该程序将自动执行配置过程。

设置过程将创建一个具有表,过程,函数的新SQL Server数据库,并将默认数据插入数据库。

我的问题是执行此过程的最佳方法是什么?

我的感觉是:

1.Create multiple sets of SQL scripts like DBScripts,TableScripts,ProcScripts ect.
2.In DBScripts,just add create database code and here you can hardcode the db name also.
3.And whenver there are any changes in these scripts you can edit and release the new build for the client.

4.Client just has to click some button on front end to create DB,Tables,Sprocs etc.

在尝试从C#执行数据库脚本后,由于头痛不已,我决定使用以下脚本以编程方式还原数据库。

RESTORE FILELISTONLY
FROM DISK = 'C:\BaackUpFile.bak'

RESTORE DATABASE DbName
FROM DISK = 'C:\BaackUpFile.bak'
WITH MOVE 'YourMDFLogicalName' TO 'C:\DataYourMDFFile.mdf',
MOVE 'YourLDFLogicalName' TO 'C:\DataYourLDFFile.ldf'

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM