开发者

Secrutiy permissions problem in SQLCMD from cmd prompt

I'm trying to create a sqlcmd script to turn on database mirroring between two servers. Most of it is fine, but I'm having a massive headache with the security step.

As part of the process the script creates a security certificate on each server which is then associated with a user on the opposing server in order to ensure the appropriate permissions (I know I could use a domain user instead of certificates but in this instance it's not an option for various reasons). Running the script from box 1 it creates the security certificate and copies it to box 2 fine. However the sqlcmd script can only connect to box 2 as a sql user (as far as I know) and then we hit a problem - that user can create a certificate but it doesn't have the permissions to copy it back to box 1 and so the script fails at that point.

I've tried using "runas" but I just can't get it working very well in a script. Is there anything else I can try 开发者_如何学编程to solve this problem - remember I need it all to run from a single sqlcmd or batch file.

cheers, Matt


Got there in the end by running xcopy from runas rather than standatd DOS copy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜