I've got a question for everyone. I would like to make full backups of my
database on a daily basis. I would like to be able to store the last 7 days
worth of backups. I want to just backup to a regular disk directory as I
will move to tape from that directory. Is there any good way to do this
built in or do I need to search elsewhere? Something like:
Monday.bak
Tuesday.bak
Wednesday.bak
Thursday.bak
Friday.bak
Saturday.bak
Sunday.bak
Excuse me if this is obvious and I've missed it. I don't know exactly what
to google for. Thanks for any assistance.
...ScottHave a look at maintenance plans (Management folder | Database Maintenance
plans)
They will walk you through the procedure. The names will not be Monday.bak,
Tuesday.bak but they will be easily identifiable as to
A. Which DB the backup represents
2. What date and time the backup was taken.
You can roll your own but this will do what you want.
--
--
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"Scott Hunter" <coolcsh@.hotmail.com> wrote in message
news:OvXy2nduDHA.1740@.TK2MSFTNGP12.phx.gbl...
> I've got a question for everyone. I would like to make full backups of my
> database on a daily basis. I would like to be able to store the last 7
days
> worth of backups. I want to just backup to a regular disk directory as I
> will move to tape from that directory. Is there any good way to do this
> built in or do I need to search elsewhere? Something like:
> Monday.bak
> Tuesday.bak
> Wednesday.bak
> Thursday.bak
> Friday.bak
> Saturday.bak
> Sunday.bak
> Excuse me if this is obvious and I've missed it. I don't know exactly what
> to google for. Thanks for any assistance.
> ...Scott
>
Showing posts with label basis. Show all posts
Showing posts with label basis. Show all posts
Saturday, February 25, 2012
Backups
I need to restore a backup dbs from one SQL Server to another on a nightly
basis. We do our backups using a Maintenance Plan. The name of the backup
file is different every night as the backups of each db run at different
times. Is there a way to fix the name of the backup files so they don't
have a time element in the name? Is there a way to discover the name that
was used last?
BarrySet up a job to do the backup with T-SQL instead of using the maint plan.
<barryfz@.home.com> wrote in message
news:%23neDZcOnEHA.4004@.TK2MSFTNGP10.phx.gbl...
> I need to restore a backup dbs from one SQL Server to another on a nightly
> basis. We do our backups using a Maintenance Plan. The name of the backup
> file is different every night as the backups of each db run at different
> times. Is there a way to fix the name of the backup files so they don't
> have a time element in the name? Is there a way to discover the name that
> was used last?
> Barry
>|||The following is a TSQL command that will perform a full
database backup to the file specified in the DISK=parameter. You can schedule this backup in SQL Server
Agent.
Backup Database DataBaseName to
DISK='\\Server\ShareName\DataBaseName_Data.BAK' with
RetainDays=1, INIT, Description='Daily Backup Routine'
This is just a direction for you to take your research.
Test this process as well as your restore procedures
prior to putting this into production.
Good luck,
D2
>--Original Message--
>I need to restore a backup dbs from one SQL Server to
another on a nightly
>basis. We do our backups using a Maintenance Plan. The
name of the backup
>file is different every night as the backups of each db
run at different
>times. Is there a way to fix the name of the backup
files so they don't
>have a time element in the name? Is there a way to
discover the name that
>was used last?
>Barry
>
>.
>|||I had to do this for a file that was being sent through a firewall every
night via FTP. So I dynamically created the ftp script every night.
In your situation then in DOS do something like this
Create a batch file
SETLOCAL
SET File_Name=FOR /F "usebackq" %%x IN (`dir *.txt /b /od`) DO SET FILE_NAME=%%x
IF {%File_Name%}={} exit 1
COPY %File_Name% Z:\SomeFolderNamedWhatEveryYouLike
ENDLOCAL
The for loop is the interesting bit, it simply lists every txt file in
date order and assigns the name to a variable File_Name. The only issue
is for every txt file the variable is changed, so if there are 100 files
the loop goes around 100 times before it finds the correct name
Adrian
barryfz@.home.com wrote:
> I need to restore a backup dbs from one SQL Server to another on a nightly
> basis. We do our backups using a Maintenance Plan. The name of the backup
> file is different every night as the backups of each db run at different
> times. Is there a way to fix the name of the backup files so they don't
> have a time element in the name? Is there a way to discover the name that
> was used last?
> Barry
>|||Hi Barry,
As community members had provided sufficient information about the way of
backup, I wanted to post a quick note to see if you would like additional
assistance or information regarding this particular issue. We appreciate
your patience and look forward to hearing from you!
Sincerely yours,
Mingqing Cheng
Online Partner Support Specialist
Partner Support Group
Microsoft Global Technical Support Center
---
Introduction to Yukon! - http://www.microsoft.com/sql/yukon
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only, many thanks!
basis. We do our backups using a Maintenance Plan. The name of the backup
file is different every night as the backups of each db run at different
times. Is there a way to fix the name of the backup files so they don't
have a time element in the name? Is there a way to discover the name that
was used last?
BarrySet up a job to do the backup with T-SQL instead of using the maint plan.
<barryfz@.home.com> wrote in message
news:%23neDZcOnEHA.4004@.TK2MSFTNGP10.phx.gbl...
> I need to restore a backup dbs from one SQL Server to another on a nightly
> basis. We do our backups using a Maintenance Plan. The name of the backup
> file is different every night as the backups of each db run at different
> times. Is there a way to fix the name of the backup files so they don't
> have a time element in the name? Is there a way to discover the name that
> was used last?
> Barry
>|||The following is a TSQL command that will perform a full
database backup to the file specified in the DISK=parameter. You can schedule this backup in SQL Server
Agent.
Backup Database DataBaseName to
DISK='\\Server\ShareName\DataBaseName_Data.BAK' with
RetainDays=1, INIT, Description='Daily Backup Routine'
This is just a direction for you to take your research.
Test this process as well as your restore procedures
prior to putting this into production.
Good luck,
D2
>--Original Message--
>I need to restore a backup dbs from one SQL Server to
another on a nightly
>basis. We do our backups using a Maintenance Plan. The
name of the backup
>file is different every night as the backups of each db
run at different
>times. Is there a way to fix the name of the backup
files so they don't
>have a time element in the name? Is there a way to
discover the name that
>was used last?
>Barry
>
>.
>|||I had to do this for a file that was being sent through a firewall every
night via FTP. So I dynamically created the ftp script every night.
In your situation then in DOS do something like this
Create a batch file
SETLOCAL
SET File_Name=FOR /F "usebackq" %%x IN (`dir *.txt /b /od`) DO SET FILE_NAME=%%x
IF {%File_Name%}={} exit 1
COPY %File_Name% Z:\SomeFolderNamedWhatEveryYouLike
ENDLOCAL
The for loop is the interesting bit, it simply lists every txt file in
date order and assigns the name to a variable File_Name. The only issue
is for every txt file the variable is changed, so if there are 100 files
the loop goes around 100 times before it finds the correct name
Adrian
barryfz@.home.com wrote:
> I need to restore a backup dbs from one SQL Server to another on a nightly
> basis. We do our backups using a Maintenance Plan. The name of the backup
> file is different every night as the backups of each db run at different
> times. Is there a way to fix the name of the backup files so they don't
> have a time element in the name? Is there a way to discover the name that
> was used last?
> Barry
>|||Hi Barry,
As community members had provided sufficient information about the way of
backup, I wanted to post a quick note to see if you would like additional
assistance or information regarding this particular issue. We appreciate
your patience and look forward to hearing from you!
Sincerely yours,
Mingqing Cheng
Online Partner Support Specialist
Partner Support Group
Microsoft Global Technical Support Center
---
Introduction to Yukon! - http://www.microsoft.com/sql/yukon
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only, many thanks!
Subscribe to:
Posts (Atom)