JoseDroid Posted October 15, 2020 at 07:31 PM Report Share #619576 Posted October 15, 2020 at 07:31 PM Boa noite, Estou á procura de um programa totalmente gratuito que faça backup de uma bd em sql server diretamente para a cloud (dropbox, drive, azure etc) Alguém me pode ajudar? Já testei vários mas ao fim de 30 dias deixa de fazer tenho de comprar Link to comment Share on other sites More sharing options...
sabing Posted May 20, 2022 at 05:43 PM Report Share #625979 Posted May 20, 2022 at 05:43 PM Boa tarde, Você pode estar fazendo um script de backup , você pode estar comprando um espaço na nuvem se subindo , tipo você pode estar fazendo um programinha que funciona invisível, e com uma hora determinada ele faz o backup e sobe para nuvem, vou colocar aqui uns tutoriais que vai te ajudar cria uma pasta e deixa esse arquivo .bat lá , quando chegar uma determinada hora ele executa depois que gerar o .log o programinha pega o .backup e leva na nuvem @echo off CLS echo Running dump ... sqlcmd -S SERVER\SQLEXPRESS -U username -P password -Q "BACKUP DATABASE master TO DISK='D:\DailyDBBackup\DB_master_%date:~-10,2%%date:~-7,2%%date:~-4,4%.bak'" echo Zipping ... "C:\Program Files\7-Zip\7z.exe" a -tzip "D:\DailyDBBackup\DB_master_%date:~-10,2%%date:~-7,2%%date:~-4,4%_%time:~0,2%%time:~3,2%%time:~6,2%.bak.zip" "D:\DailyDBBackup\DB_master_%date:~-10,2%%date:~-7,2%%date:~-4,4%.bak" echo Deleting the SQL file ... del "D:\DailyDBBackup\DB_master_%date:~-10,2%%date:~-7,2%%date:~-4,4%.bak" echo Done! public static void EnviarArquivoFTP(string arquivo, string url, string usuario, string senha) { try { FileInfo arquivoInfo = new FileInfo(arquivo); FtpWebRequest request = (FtpWebRequest)WebRequest.Create(new Uri(url)); request.Method = WebRequestMethods.Ftp.UploadFile; request.Credentials = new NetworkCredential(usuario, senha); request.UseBinary = true; request.ContentLength = arquivoInfo.Length; using (FileStream fs = arquivoInfo.OpenRead()) { byte[] buffer = new byte[2048]; int bytesSent = 0; int bytes = 0; using (Stream stream = request.GetRequestStream()) { while (bytesSent < arquivoInfo.Length) { bytes = fs.Read(buffer, 0, buffer.Length); stream.Write(buffer, 0, bytes); bytesSent += bytes; } } } } catch (Exception ex) { throw ex; } } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now