Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sqlserver Backup
Message
De
18/10/2019 12:14:24
 
 
À
18/10/2019 00:55:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01671546
Message ID:
01671553
Vues:
70
>Sir I have these codes
>
>
>
>DECLARE @name VARCHAR(50) -- database name  
>DECLARE @path VARCHAR(256) -- path for backup files  
>DECLARE @fileName VARCHAR(256) -- filename for backup  
>DECLARE @fileDate VARCHAR(20) -- used for file name
> 
>-- specify database backup directory
>SET @path = 'C:\Backup\'  
> 
>-- specify filename format
>SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112) 
> 
>DECLARE db_cursor CURSOR READ_ONLY FOR  
>SELECT name 
>FROM master.sys.databases 
>WHERE name NOT IN ('master','model','msdb','tempdb')  -- exclude these databases
>AND state = 0 -- database is online
>AND is_in_standby = 0 -- database is not read only for log shipping
> 
>OPEN db_cursor   
>FETCH NEXT FROM db_cursor INTO @name   
> 
>WHILE @@FETCH_STATUS = 0   
>BEGIN   
>   SET @fileName = @path + @name + '_' + @fileDate + '.BAK'  
>   BACKUP DATABASE @name TO DISK = @fileName  
> 
>   FETCH NEXT FROM db_cursor INTO @name   
>END   
>
> 
>CLOSE db_cursor   
>DEALLOCATE db_cursor
>
>
>Ref: https://www.mssqltips.com/sqlservertip/1070/simple-script-to-backup-all-sql-server-databases/
>
>I put these codes into new query and click Execute.
>The codes work fine.
>
>Now I want these codes automatically run at 11PM every night.
>
>What should I do?
>
>Should I create a Stored procedure,
>if yes then how it will be execute automatically at scheduled time?
>
>Or is there any other possibility.
>
>Please help

If you want to save time during the backup, included the compression attribute on the backup.

The Redgate Software SQL Back is a nice way to manage SQL backups. We've used it for years. The support is fantastic.

Hank
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform