Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize remote scheduled backup of database in SQL Server

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail how to achieve remote scheduled database backup in SQL Server. The content of the article is of high quality. Therefore, Xiaobian shares it with you as a reference. I hope you have a certain understanding of relevant knowledge after reading this article.

Create a network map (Y is the drive letter;IP address followed by the name of the shared folder;password is the password, enclosed in double quotes;account is the login name of the remote computer)

exec master.. xp_cmdshell 'net use Y: \\192.168.0.69\sqlbackup "password" /user:192.168.0.69\account'

--Make file name according to date and time (note folder in path, need to be established first)

declare @filename varchar(200)

select @filename = 'Y:\DB\' + replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ','-'),':','') + '.bak'

--Perform a backup (DB is the name of the database to be backed up)

backup database [DB] to disk = @filename

--Delete network mapping (Y is drive letter, ditto)

exec master.. xp_cmdshell 'net use Y: /delete'

About SQL Server how to achieve remote scheduled backup database to share here, I hope the above content can have some help for everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report