SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


backup/restore process


backup/restore process

Author
Message
arkiboys
arkiboys
Say Hey Kid
Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)

Group: General Forum Members
Points: 712 Visits: 264
Hi,
Hi,
Our business can afford to loose data up-to one hour.
So in-case of say if a table is dropped or a disaster, etc., I would like to be able to recover the data at lease up-to one hour ago.
Let's say the database failes at 11:55 pm
I am trying to set the scripts of backup and restore of the database as follows:

Are the sample scripts correct please? See below:

BACKUP
------
1-
Make sure the database recovery is set to full

--schedule this script to run every mid-night monday-friday
BACKUP DATABASE AdventureWorks TO DISK = 'C:\AdventureWorks.BAK'
GO

2-
schedule this transaction log backup to run every 15 minutes
BACKUP LOG AdventureWorks TO DISK = 'C:\AdventureWorks.TRN'
GO

Re-store
--------
1-
RESTORE DATABASE AdventureWorks FROM DISK = 'C:\AdventureWorks.BAK'
WITH NORECOVERY
GO

2-
RESTORE LOG AdventureWorks FROM DISK = 'C:\AdventureWorks.TRN'
WITH RECOVERY,
STOPAT = 'Nov 12, 2012 11:45:00 PM'
GO
GilaMonster
GilaMonster
SSC Guru
SSC Guru (224K reputation)SSC Guru (224K reputation)SSC Guru (224K reputation)SSC Guru (224K reputation)SSC Guru (224K reputation)SSC Guru (224K reputation)SSC Guru (224K reputation)SSC Guru (224K reputation)

Group: General Forum Members
Points: 224608 Visits: 46319
Don't append backups to one file. Backups should ideally each to their own file, preferably time-stamped (DatabaseName20121115211501.trn)

To restore to a point in time, you need a full backup taken before that point and all log backups since then (not just one of them)

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


arkiboys
arkiboys
Say Hey Kid
Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)

Group: General Forum Members
Points: 712 Visits: 264
GilaMonster (11/18/2012)
Don't append backups to one file. Backups should ideally each to their own file, preferably time-stamped (DatabaseName20121115211501.trn)

To restore to a point in time, you need a full backup taken before that point and all log backups since then (not just one of them)

1-Do you mean to overwrite?
2-I am thinking of having t he full backup of the database every mid-night and transaction log backups every 15 minutes.
Does this mean if there is a disaster at 11:55 pm, to restore to 11:45 pm I should a) get the previous midnight database backup, b) from that point I have to restore every singly transaction log in order until 11:45 pm?
Perry Whittle
Perry Whittle
SSC Guru
SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)

Group: General Forum Members
Points: 54075 Visits: 17681
arkiboys (11/19/2012)
1-Do you mean to overwrite?

No, write to a new file each time with a unique name


arkiboys (11/19/2012)
2-I am thinking of having t he full backup of the database every mid-night and transaction log backups every 15 minutes.
Does this mean if there is a disaster at 11:55 pm, to restore to 11:45 pm I should a) get the previous midnight database backup, b) from that point I have to restore every singly transaction log in order until 11:45 pm?

Yes, the last full backup and any log backups up to the point you wish to restore to.

-----------------------------------------------------------------------------------------------------------

"Ya can't make an omelette without breaking just a few eggs" ;-)
arkiboys
arkiboys
Say Hey Kid
Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)

Group: General Forum Members
Points: 712 Visits: 264
Perry Whittle (11/19/2012)
arkiboys (11/19/2012)
1-Do you mean to overwrite?

No, write to a new file each time with a unique name


arkiboys (11/19/2012)
2-I am thinking of having t he full backup of the database every mid-night and transaction log backups every 15 minutes.
Does this mean if there is a disaster at 11:55 pm, to restore to 11:45 pm I should a) get the previous midnight database backup, b) from that point I have to restore every singly transaction log in order until 11:45 pm?

Yes, the last full backup and any log backups up to the point you wish to restore to.

1- if the backup of transaction log is scheduled to run say every 15 minutes then how can I "write to a new file each time with a unique name" ?
2- restoring each transaction log sinice the previous midnight seems to be a long process. How about introducing a differential backup?
wenihal
wenihal
SSC-Enthusiastic
SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)

Group: General Forum Members
Points: 132 Visits: 144
arkiboys (11/19/2012)
1- if the backup of transaction log is scheduled to run say every 15 minutes then how can I "write to a new file each time with a unique name" ?


Have a look at Ola Hallengren's SQL Server Maintenance Solution. It's very easy to setup and use. Read and download from:

http://ola.hallengren.com/

Many DBAs use it.
GilaMonster
GilaMonster
SSC Guru
SSC Guru (224K reputation)SSC Guru (224K reputation)SSC Guru (224K reputation)SSC Guru (224K reputation)SSC Guru (224K reputation)SSC Guru (224K reputation)SSC Guru (224K reputation)SSC Guru (224K reputation)

Group: General Forum Members
Points: 224608 Visits: 46319
arkiboys (11/19/2012)
2- restoring each transaction log sinice the previous midnight seems to be a long process. How about introducing a differential backup?


Then you would need to restore the full backup, the latest differential and all log backups from the differential to the point you're restoring to.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Perry Whittle
Perry Whittle
SSC Guru
SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)

Group: General Forum Members
Points: 54075 Visits: 17681
arkiboys (11/19/2012)
1- if the backup of transaction log is scheduled to run say every 15 minutes then how can I "write to a new file each time with a unique name" ?

Your backup script would use the timestamp to form part of the filename. It's common to append the database name, backup type and timestamp to form the backup filename.

E.g. a log backup run on Noddy database at 15:34pm would generate a file called

Noddy_TLog_20121119_153400.trn




arkiboys (11/19/2012)
2- restoring each transaction log sinice the previous midnight seems to be a long process. How about introducing a differential backup?

Now your learning, good idea ;-)

-----------------------------------------------------------------------------------------------------------

"Ya can't make an omelette without breaking just a few eggs" ;-)
arkiboys
arkiboys
Say Hey Kid
Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)Say Hey Kid (712 reputation)

Group: General Forum Members
Points: 712 Visits: 264
Thank you
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search