|
Backups the Easy Way
Posted: 16 May 06 5:07 AM
|
fiogf49gjkf0d Tired of going thru Enterprise Manager to do ad hoc backups?
Would you like a one button backup?
Create this batch file and put it on your desktop or start menu.
This example backups up the SalesLogix database into C:\backup\sql\saleslogix. It will name the file saleslogix_date_time.bak (where date/time are the current date/time of course.
change the batch file to backup other databases or to other locations:
----Batch File Start----
@rem to change to a different database change [SalesLogix] and MEDIANAME = N'SalesLogix' to Database name
@echo off cls color 9b echo. echo. echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» echo ºCreated by Gregor Anton º echo º www.antonsolutions.comº echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ REM GFA 060515 echo. echo. echo Backs up the SalesLogix database to c:\backup\sql\SalesLogix with current date and time as filename. echo. FOR /F "tokens=2-4 DELIMS=/ " %%F IN ('date /T') DO (set v_date=%%H%%F%%G) FOR /F "tokens=1-2 DELIMS=: " %%A IN ('time /T') DO (set v_time=%%A%%B)
echo: rem change [SalesLogix] to your database name, replace MEDIANAME = N'SalesLogix' with MEDIANAME = N'YourDatabaseName' echo BACKUP DATABASE [SalesLogix] TO DISK = N'C:\backup\SQL\SalesLogix\saleslogix_%v_date%_%v_TIME%.bak' WITH INIT , NOUNLOAD , NAME = N'SalesLogix backup', NOSKIP , STATS = 10, NOFORMAT , MEDIANAME = N'SalesLogix' > slxbackup.sql echo sa rem replace password with your sa password isql -U sysdba -P masterkey -i slxbackup.sql color pause
---Batch File End----
|
|
|