-- Backup environment: Back up the database server (192.168.1.8) database (TEST) to C $(192.168.1.145 ).
-- First, perform a ing with the client
Exec master .. xp_mongoshell
'Net use Z: \ 192.168.1.145 \ C $ "password"/User: 192.168.1.145 \ Administrator'
/* -- Description:
Z: indicates the drive letter of the local machine corresponding to the ing network path, which corresponds to the following Backup
\ 192.168.1.145 \ C $ is the network path to be mapped
192.168.1.145 \ Administrator
192.168.1.145 is the remote computer name, and administrator is the login user name.
The password of the administrator user specified above
--*/
-Second, back up the database
Backup database test to disk = 'z: \ test. Bak'
-- Finally, delete the ing after the backup is complete.
Exec master.. xp_mongoshell 'net use Z:/delete'
Put the preceding job in sqlserver to achieve automatic backup.
The backup name can be automatically generated.
Exec master .. xp_mongoshell
'Net use Z: \ 10.1.1.197 \ D $ \ dbback "123456"/User: 10.1.1.197 \ Administrator'
Declare @ a char (80)
Select @ A = 'z: \ '+ Replace (replace (convert (varchar (19), getdate (), 120 ),'','-'),':', '-') + '-service_korea.bak'
Backup database pubs to disk = @
Exec master.. xp_mongoshell 'net use Z:/delete'