ASR中的SQL临时数据库 [英] SQL Temp DB in ASR

查看:97
本文介绍了ASR中的SQL临时数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天-

我们当前正在将SQL服务器复制到ASR.这很好.但是,在恢复计划期间,我们注意到由于未复制TempDB/LOG,因此SQL无法启动.我正在寻找一个脚本来执行以下操作 故障转移后请勿动手.下面的方法可以正常工作,但是在故障转移后需要一个命令才能登录并运行命令.

We are currently replicating our SQL servers to ASR. This is working great. However, during the Recovery Plan we are noticing that due to us not replicating our TempDB/LOG , SQL is not starting. I am looking to develop a script that will do the below with no hands on after fail over. The below will work, however requires one to login and run command after failover.

千方百计-如果有人知道更好的方法,我也愿意听.

By all means - if someone know of a better way, I am willing to listen as well. 

表现得像我对这个过程非常陌生-因此任何逐步的过程都是最有帮助的.

Act like I am very new to the process - so any step by step process would be most helpful.

1.)借助SQL,我们在此处内置了TempDB和TempLog驱动器.由于客户流失,我们不会重复.如果故障转移到测试网络–如何自动映射以下内容? 如果框故障转移但尝试自动执行后,如果我从CMD运行,则以下脚本将起作用.

1.)   With SQL we have TempDB and TempLog drives here on premise. We do not replicate those due to churn. If failing over to Test Network – how can I map out the following automatically? The below script will work if I run from the CMD once the box has failed over but am trying to automate.

/*需要在临时存储位置中创建任何子文件夹*/

//以恢复模式启动

净启动MSSQLSERVER/f/T3608/m"SQLCMD"

//连接到实例

sqlcmd -A -S ServerNAME

使用USE master;    

USE master;    

  GO     

 GO     

//将tempdb文件的位置更改为Azure临时存储驱动器

ALTER DATABASE tempdb

ALTER DATABASE tempdb      

 修改文件(NAME = tempdev,FILENAME ='E:\ ServerNAME \ tempdb.mdf');

GO     

GO     

"ALTER DATABASE"临时数据库

 ALTER DATABASE tempdb      

 修改文件(名称=临时日志,FILENAME ='E:\ ServerNAME \ templog.ldf');      

 MODIFY FILE (NAME = templog, FILENAME = 'E:\ServerNAME\templog.ldf');      

  GO

退出

//停止并重新启动SQL实例.

MS SQLServer的净停止

净启动MSSQLServer

推荐答案

@

@chrissezhi_sc It would be more suitable to move this thread to the Databases forums. My suggestion in theory for your scenario is to have job/process monitoring the failover process, then run a script: Bash,Python or PS to perform the actions you mentioned. Monitoring the failover can be something as easy as doing pings over a period of time, monitoring the process etc... Let me know if this helps.

Thanks,

亚当


这篇关于ASR中的SQL临时数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆