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


DB Backup Is Backing Up Previous Version of Proc


DB Backup Is Backing Up Previous Version of Proc

Author
Message
AZ Pete
AZ Pete
SSC Journeyman
SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)

Group: General Forum Members
Points: 96 Visits: 188
Hi All,

I'm experiencing a rather bizarre problem that baffles me.
I have a production DB that I backup from our production box and then restore to our Dev server for some testing.

Yesterday I had to deploy a new version of a stored proc to the production DB. This new version of the stored proc only had some very minor changes. Today I took a backup of the DB and restored it to our dev box. When I diff the DB (with RedGate SQL Diff) it shows a difference between the two DBs for that proc. The newly restored DB on the dev server has the old version of the procedure!

If I go into the object explorer and script out the proc, the old version is in fact what comes out from the newly restored DB (on our dev box). If I do the same on our production machine, the new version of the proc is there.
And it's not just that one proc. There are a few others as well. Some of which I updated weeks ago.

It seems that the backup didn't capture the new version of the proc?
Has anyone ever experienced this?

This is the backup command I use.

BACKUP DATABASE DbName
TO DISK = C:\SomePath
WITH
COPY_ONLY,
INIT,
NOSKIP,
NAME = SomeBackupName,
DESCRIPTION = SomeBackupDescription,
STATS = 10;


Any thoughts would be most appreciated.
Thanks!
Peter
GilaMonster
GilaMonster
SSC Guru
SSC Guru (237K reputation)SSC Guru (237K reputation)SSC Guru (237K reputation)SSC Guru (237K reputation)SSC Guru (237K reputation)SSC Guru (237K reputation)SSC Guru (237K reputation)SSC Guru (237K reputation)

Group: General Forum Members
Points: 237571 Visits: 46378
A backup is an extent-by-extent copy of the database. It cannot miss objects or take old versions of objects. What is in a backup is exactly what was in the database at the time of the backup.

Check when the procedure was altered (and if it's been altered back). Check what the date is of the backup you're looking at. Check that you're looking at the backup you think you're looking at (not a backup of QA or something)

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


free_mascot
free_mascot
SSCertifiable
SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)

Group: General Forum Members
Points: 7827 Visits: 2250
As explain by Gila it is not possible.

However if your all backup and everything are fine and still if you have the same problem there might be possibility that someone has changed the proc in dev after your restore db in dev.

---------------------------------------------------
"Thare are only 10 types of people in the world:
Those who understand binary, and those who don't."
homebrew01
homebrew01
SSChampion
SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)

Group: General Forum Members
Points: 13022 Visits: 9222
What is your restore script doing ? Any chance it is using an older backup file by mistake, not the most recent one ?



dan-572483
dan-572483
Hall of Fame
Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)

Group: General Forum Members
Points: 3821 Visits: 2000
You may have two versions of the same prodecure in different schemas, as in dbo.sp_myproc and sales.sp_myproc.

I've been thrown by this confusion before.

Or if you have multiple *.bak files that are identically or similarly named, you may be restoring an old backup.
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