October 10, 2013 at 1:39 pm
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
October 10, 2013 at 2:14 pm
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
October 15, 2013 at 3:55 am
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."
October 15, 2013 at 5:32 am
What is your restore script doing ? Any chance it is using an older backup file by mistake, not the most recent one ?
October 15, 2013 at 10:20 am
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.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply