In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 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 remotely back up the database to the local in SQL Server, the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
1. Enable xp_cmdshell first
USEmaster
EXECsp_configure'showadvancedoptions',1
RECONFIGUREWITHOVERRIDE
EXECsp_configure'xp_cmdshell',1
RECONFIGUREWITHOVERRIDE
EXECsp_configure'showadvancedoptions',0
RECONFIGUREWITHOVERRIDE
2. Secondly, use variables for backup.
Declare@dbsysname
Declare@dbpathvarchar (120)
Set@db='shenyin'
-- the file name is based on the database name + date YYYYMMDD+ extension
Set@dbpath='D:\'+ @ db+convert (varchar (10), getdate (), 112) + '.bak'
3. Then create a mapping in sql
Execmaster..xp_cmdshell'netuseF:\ 192.168.4.109\ DBBackup "nulili"
/ user:192.168.0.156\ Administrator'/*/*
Explanatory notes:
F: the drive letter that maps the network path to the local machine
192.168.4.109 is my native IP.
DBBackup is a folder shared by me on this computer
Administrator is the user name for the login of the system account
"nulili" is the password of the Administrator user
4. Backup command (@ db is the name of the database to be backed up)
BackupDatabase@dbTodisk=@dbpath
5 、 COPY
Declare@copypathvarchar (200)
Set@copypath='copy'+@dbpath+'F:'
Select@copypath
Execmaster..xp_cmdshell@copypath
6. Delete
Declare@deletepathvarchar (200)
Set@deletepath='del'+@dbpath
Select@deletepath
Execmaster..xp_cmdshell@deletepath
7. Delete the mapping after completion
Execmaster..xp_cmdshell'netuseF:/delete'
8. Close xp_cmdshell
USEmaster
EXECsp_configure'showadvancedoptions',1
RECONFIGUREWITHOVERRIDE
EXECsp_configure'xp_cmdshell',0
RECONFIGUREWITHOVERRIDE
EXECsp_configure'showadvancedoptions',0
RECONFIGUREWITHOVERRIDE
SQL Server on how to remote backup database to the local share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.