Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

DB Backup Is Backing Up Previous Version of Proc Expand / Collapse
Author
Message
Posted Thursday, October 10, 2013 1:39 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, August 19, 2014 5:41 PM
Points: 4, Visits: 76
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
Post #1503768
Posted Thursday, October 10, 2013 2:14 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 1:53 PM
Points: 42,771, Visits: 35,870
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 2008, MVP
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

Post #1503794
Posted Tuesday, October 15, 2013 3:55 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, July 21, 2014 2:56 AM
Points: 2,603, Visits: 2,061
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."
Post #1504663
Posted Tuesday, October 15, 2013 5:32 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 12:24 PM
Points: 2,829, Visits: 8,477
What is your restore script doing ? Any chance it is using an older backup file by mistake, not the most recent one ?


Post #1504689
Posted Tuesday, October 15, 2013 10:20 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Tuesday, August 19, 2014 9:08 AM
Points: 550, Visits: 1,610
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.
Post #1504849
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse