YourSQLDba设置共享路径备份

本文涉及的产品
云数据库 RDS SQL Server,独享型 2核4GB
简介:

 YourSQLDba可以将数据库备份到网络路径(共享路径),这个也是非常灵活的一个功能,以前一直没有使用过这个功能,最近由于一个需求,于是我测试了一下YourSQLDba备份到网络路径,中间遇到了一些问题,遂整理如下。

 

测试环境:

    操作系统:  Windows Server Standard 2012

  数据库版本:  SQL SERVER 2014

 

1:设置共享路径权限

 

    这一步很简单,也非常好理解。共享路径需要给某些特定用户才能访问,例如某个域账号。在此略过。

 

2:映射网络驱动器。

映射网络驱动器,顾名思义,就是将局域网内的一个共享文件夹作为一个虚拟的网络硬盘,然后将该网络硬盘映射到本地计算机,然后我们就可以在本地计算机上访问该共享文件夹

clipboard

clipboard[1]

 

3:然后使用Exec YourSQLDba.Maint.CreateNetworkDriv设置网络路径。

sp_configure 'show advanced option', 1;
go
reconfigure;
go
sp_configure 'xp_cmdshell', 1;
go
reconfigure;
go
 
 
Exec YourSQLDba.Maint.CreateNetworkDrives
  @DriveLetter = 'S:\'  
, @unc = '\\192.168.7.146\YourSQLDBABAK\Server1' 

设置网络路径,必须开启数据库“xp_cmdshell”选项,否则就会有如下错误。

Exec YourSQLDba.Maint.CreateNetworkDrives
 @DriveLetter = 'S:\'  
 @unc = '\\192.168.7.146\YourSQLDBABAK\Server1' 
 
 
息 15123,级别 16,状态 1,过程 sp_configure,第 62 行
he configuration option 'xp_cmdshell' does not exist, or it may be an advanced option.
et use S: /Delete
et use S: \\192.168.7.146\YourSQLDBABAK\Server1
5123: The configuration option 'xp_cmdshell' does not exist, or it may be an advanced option.
息 15123,级别 16,状态 1,过程 sp_configure,第 62 行
he configuration option 'xp_cmdshell' does not exist, or it may be an advanced option.

clipboard[2]

如果你遇到下面错误信息,请检查你SQL SERVER服务的登录账号是否是NT账号或域账号。如果是默认的NT Service\MSSQLSERVER则会遇到该错误提示。

clipboard[3]

clipboard[4]

可以讲SQL Server服务的登录账号改为共享路径设置权限的域账号。那么接下来,修改一下作业YourSQLDba_FullBackups_And_Maintenance里面的配置信息就OK了

exec Maint.YourSqlDba_DoMaint
  @oper = 'YourSQLDba_Operator'
, @MaintJobName = 'YourSQLDba: DoInteg,DoUpdateStats,DoReorg,Full backups'
, @DoInteg = 1
, @DoUpdStats = 1
, @DoReorg = 1
, @DoBackup = 'F'
, @FullBackupPath = 'S:\FULL_BACKUP\'
, @LogBackupPath = 'S:\LOG_BACKUP\'  
-- Flush database backups older than the number of days
, @FullBkpRetDays = 1
-- Flush log backups older than the number of days
, @LogBkpRetDays =1
-- Spread Update Stats over 7 days
, @SpreadUpdStatRun =1
-- Maximum number of consecutive days of failed full backups allowed
-- for a database before putting that database (Offline).
, @ConsecutiveFailedbackupsDaysToPutDbOffline = 9999
-- Each database inclusion filter must be on its own line between the following quote pair
, @IncDb =
'
'
-- Each database exclusion filter must be on its own line between the following quote pair
, @ExcDb =
'
'
-- Each database exclusion filter must be on its own line between the following quote pair
, @ExcDbFromPolicy_CheckFullRecoveryModel =
'
' 

在测试过程中发现YourSQLDba备份到共享路径对网络环境要求比较高,有几次在网络出现连续掉两个或两个以上包的时候,备份进程就出错,检查出错信息,发现如下错误信息。

<;Exec>
  <;ctx>yMaint.backups</ctx>
  <;Sql>
backup database [WSS_Content_get_teams_tdc]
to disk = 'S:\FULL_BACKUP\Test_[2014-11-11_18h49m05_Tue]_database.BAK'
with Init, Format, checksum, name = 'YourSQLDba:18h49: S:\FULL_BACKUP\Test_[2014-11-11_18h49m05_Tue]_database.BAK'
<;/Sql>
  <;err>Error 3201, Severity 16, level 1 : Cannot open backup device 'S:\FULL_BACKUP\Test_[2014-11-11_18h49m05_Tue]_database.BAK'. Operating system error 53(The network path was not found.).
Error 3013, Severity 16, level 1 : BACKUP DATABASE is terminating abnormally.
<;/err>
</Exec>
相关实践学习
使用SQL语句管理索引
本次实验主要介绍如何在RDS-SQLServer数据库中,使用SQL语句管理索引。
SQL Server on Linux入门教程
SQL Server数据库一直只提供Windows下的版本。2016年微软宣布推出可运行在Linux系统下的SQL Server数据库,该版本目前还是早期预览版本。本课程主要介绍SQLServer On Linux的基本知识。 相关的阿里云产品:云数据库RDS&nbsp;SQL Server版 RDS SQL Server不仅拥有高可用架构和任意时间点的数据恢复功能,强力支撑各种企业应用,同时也包含了微软的License费用,减少额外支出。 了解产品详情:&nbsp;https://www.aliyun.com/product/rds/sqlserver
相关文章
OushuDB-把需要加载的数据文件放到gpfdist数据目录
OushuDB-把需要加载的数据文件放到gpfdist数据目录
37 0
|
弹性计算 容灾 关系型数据库
PostgreSQL PITR 任意时间点恢复过程中如何手工得到recovery需要的下一个WAL文件名 - 默认情况下restore_command自动获取
标签 PostgreSQL , recovery , recovery.conf , restore_command , timeline , 时间线 , next wal , PITR , 时间点恢复 背景 PostgreSQL数据库支持PITR时间点恢复。默认情况下,只需要配置目标是时间点,resotre_command即可,PG会自动调用resotre_command去找需要的WA
1366 0
|
Web App开发
阿里云虚拟主怎么修改文件夹的读写属性777?
本文介绍阿里云虚拟主机怎么修改文件夹的读写属性777,购买前请先:领取阿里云幸运券,有很多优惠,下文中有领取链接。 购买建议多买几年,年数越多优惠越多。
2057 0
|
SQL 安全 数据库
sql 2012先分离迁移mdf mlf 文件到别的机器后附加 数据库成只读的修复方法
SQL Server2008附加数据库之后显示为只读时解决方法   从本地分离的数据库文件放到远程服务器上,附加数据库出现数据库为(只读情况) 阅读了以下两篇文章: 第一篇:http://blog.csdn.net/love_zt_love/article/details/7861334 啰嗦的话就不多说了,直入主题吧! 方案一: 碰到这中情况一般是使用的sa账户登录的,只要改为Windows身份验证,再附加数据库即可搞定。
1285 0