|
Posted by Andrewø ÝìŠÇ.²È¨žÉ¢rº,¡û\¢ on June 29, 2005, 12:16 pm
Please log in for more thread options
Based off of all of the great ideas here, I created a small .bat file to
backup the database with a 3 day alternating backup scheme and copying the
database to a backroom computer as well, providing some redudant storage.
I just schedule it as a task to run at a certain time on the backroom
computer (right after closing time) and it keeps the last three backups
automatically. To tell what date the backup was made, just look at the file
info and look at the timestamp. So far seems to work well.
Just replace the database name as well as the computer names/backup
directories with what you you need (making sure the directory you're trying
to save to is shared on the network).
BATCH FILE START:
::RMS Auto-backup with redundant storage
:: Checks if the other backups exist on ONE (main server) and renames them,
deleting the oldest backup
IF EXIST \ONEcRMSBackupsRMSbackup3.bck DEL
\ONEcRMSBackupsRMSbackup3.bck
IF EXIST \ONEcRMSBackupsRMSbackup2.bck REN
\ONEcRMSBackupsRMSbackup2.bck RMSbackup3.bck
IF EXIST \ONEcRMSBackupsRMSbackup1.bck REN
\ONEcRMSBackupsRMSbackup1.bck RMSbackup2.bck
:: Creates the newest backup on ONE (main server) from SQL query
OSQL -U sa -P 4050 -S one -Q "BACKUP DATABASE [61604] TO DISK =
'\ONEcRMSBackupsRMSbackup1.bck'"
:: Checks if the other backups exist on Backroom (redundant storage) and
renames them, deleting the oldest backup
IF EXIST "\BackroomC on BackofficeRMSBackupsRMSbackup3.bck" DEL
"\BackroomC on BackofficeRMSBackupsRMSbackup3.bck"
IF EXIST "\BackroomC on BackofficeRMSBackupsRMSbackup2.bck" REN
"\BackroomC on BackofficeRMSBackupsRMSbackup2.bck" RMSbackup3.bck
IF EXIST "\BackroomC on BackofficeRMSBackupsRMSbackup1.bck" REN
"\BackroomC on BackofficeRMSBackupsRMSbackup1.bck" RMSbackup2.bck
:: Copies the newest backup from ONE (main server) to Backroom (redundant
storage)
COPY /Y \ONEcRMSBackupsRMSbackup1.bck "\BackroomC on
BackofficeRMSBackupsRMSbackup1.bck"
END OF BATCH FILE:
Also, you could just use the first half which calls the sql and have it run
as a task on your register machine, which would prevent the need for the
backroom computer to be on in order for the backup to initiate.
Don't know if it's useful to anyone else or not, but there it is.
~Andrew Reinartz
Wayne & Mary's Nutrition Center
"Moe" wrote:
> Or just create a .bat file with notepad and include the following:
>
> OSQL -U sa -P dakota -S HomeOffice -q "RESTORE DATABASE horsin_around
> FROM DISK = 'H:horsin_around.bck' WITH REPLACE, STATS = 5"
>
> Of course change the parameters to match your system and database name.
>
> Rob wrote:
> > Mark,
> >
> > This is from the Store Operations Adminstrator Online Help - Restoring a
> > database'.
> > 1. On the Database menu, click Create. The Create Database Wizard
> > appears.
> >
> > 2. On the Welcome screen, click Next.
> >
> > 3. In the Database Name box, enter the name of the database you are
> > creating.
> >
> > 4. In the Initial Size (MB) box, enter the amount of space, in
> > megabytes (MB), to allocate on that device for the database, and then click
> > Next.
> >
> > 5. Specify how the database file should grow, and then click Next. In
> > most cases, you can accept the defaults.
> >
> > 6. Click the Browse icon to locate the backup file.
> >
> > 7. On the Open window, select the backup file from which you want to
> > restore. The backup file should have *.bck as the file extension. Then click
> > Open.
> >
> > 8. On the wizard screen, click Next.
> >
> > 9. To create the new database with the information from the backup
> > file, click Finish.
> >
> > 10. Store Operations should notify you that the restore is complete. Click
> > OK.
> >
> >
> > Rob
> >
> > > Rob, I have my backup working now based on your instructions, but now my
> > > stupid question is if I have a need to do a restore from this backup how
> > > do
> > > do that? I want to be prepared.
> > >
> > > Thanks
> > >
> > > "Rob" wrote:
> > >
> > >> 1.. In Notepad, paste the following text in the new batch file:
> > >>
> > >>
> > >> osql -U sa -P -S server name -Q "BACKUP DATABASE database name TO DISK =
> > >> 'e:backupback1.bck'"a.. If you have a password for the system
> > >> administrator user, you must enter the password after the -P parameter.
> > >> For
> > >> example, insert -P password.
> > >> b.. Replace server name with the name of your server. You can see the
> > >> name of your server in the SQL Server Service Manager.
> > >> c.. Replace database name with the actual name of your Store
> > >> Operations
> > >> database or Headquarters database.
> > >> d.. Replace e:backupback1.bck with the actual path of the drive and
> > >> the directory where you want to save the backup and the actual name that
> > >> you
> > >> want for the backup file.
> > >> 2.. Save the file.
> > >> 3.. Click Start, point to All Programs, point to Accessories, point to
> > >> System Tools, and then click Scheduled Tasks.
> > >>
> > >> Use Task Scheduler to run your batch file from the server. See Windows
> > >> Help for more information about how to set up and how to run Task
> > >> Scheduler.
> > >> Important Every time that you use Task Scheduler to run your batch file,
> > >> the
> > >> backup file name that the batch file generates is the same file name that
> > >> you entered for the path and file name when you created the batch file.
> > >> Therefore, if you want to maintain a series of backup files, use one of
> > >> the
> > >> following methods before or after you run the backup:
> > >>
> > >> a.. Move the backup file to another location.
> > >> b.. Rename the backup file.
> > >> Otherwise, the backup file will be appended every time that you use Task
> > >> Scheduler to run the batch file. This may make the backup file unusable.
> > >>
> > >>
> > >> > root - what would the command line need to be in the .bat file to
> > >> > initiate
> > >> > the backup process?
> > >> >
> > >> > thanks,
> > >> > kevin
> > >> >
> > >> > "root" wrote:
> > >> >
> > >> >> Larry,
> > >> >>
> > >> >> You can do a .bat file and schedule it to run in the scheduled tasks
> > >> >> OR
> > >> >> you
> > >> >> can download the SQL trial and only install the Enterprise Manager
> > >> >> part.
> > >> >> Enterprise Manager will give you the GUI for MSDE and enable you to do
> > >> >> a
> > >> >> scheduled maintenance plan with backup, shrink, and other tasks...
> > >> >>
> > >> >>
> > >> >>
> > >> >> message
> > >> >> > Does anyone have an easy solution for automatically backing up the
> > >> >> > database
> > >> >> > for RMS? Our clerks seem to be unable to remember to do it daily.
> > >> >> >
> > >> >> > Thanks for any help.
> > >> >> >
> > >> >> > Larry
> > >> >>
> > >> >>
> > >> >>
> > >>
> > >>
> > >>
>
>
|