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

After restore how the way @@DBTS changes? Expand / Collapse
Author
Message
Posted Tuesday, July 21, 2009 5:57 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, March 18, 2014 11:11 AM
Points: 6, Visits: 73
Hello everyone.

The @@DBTS value of my db before back-up is not equal after restore. Does any one knows how this value changes and how can I prevent this change?
Post #756491
Posted Tuesday, July 21, 2009 8:32 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, July 21, 2014 5:04 PM
Points: 2,107, Visits: 3,581
I would highly doubt that there is a way to change this. Can you explain what you are using this for? My guess is that you are going to have to seek an alternative solution.



David

@SQLTentmaker
SQL Tentmaker
“He is no fool who gives what he cannot keep to gain that which he cannot lose” - Jim Elliot
Post #756636
Posted Tuesday, July 21, 2009 9:04 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, May 12, 2014 12:57 PM
Points: 2,285, Visits: 4,225
This behavior is documented by MS titled "Backing Up and Restoring a Database (Sync Services)" at http://msdn.microsoft.com/en-us/library/bb726016.aspx

SQL = Scarcely Qualifies as a Language
Post #756671
Posted Tuesday, July 21, 2009 9:22 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Saturday, July 19, 2014 8:57 PM
Points: 310, Visits: 650
Following comment give your answer:

@@DBTS returns the last-used timestamp value of the current database. A new timestamp value is generated when a row with a timestamp column is inserted or updated.

Post #756686
Posted Wednesday, July 22, 2009 12:14 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, March 18, 2014 11:11 AM
Points: 6, Visits: 73
Carl Federl (7/21/2009)
This behavior is documented by MS titled "Backing Up and Restoring a Database (Sync Services)" at http://msdn.microsoft.com/en-us/library/bb726016.aspx


This behavior is not same as explained. In my case @@DBTS increased but not decreased. I implemented the sync. scenario like msdn says. I found a solution without keeping @@DBTS unchanged, but I am realy curious about how last timestamp changes after restore happens. I assume @@DBTS value should be same before backup and after restore, but it was not. I realized that after restore, @@DBTS increased about data count in the database.
Post #757157
Posted Tuesday, February 2, 2010 12:22 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, February 14, 2014 1:47 AM
Points: 5, Visits: 23
I'm continuing this post cause it seems to be regarding the same "issue" i'm having.

Scenario:
We are developing a syncronization utility between a central DB and some occasionally cnnected clients using Ms Sync Framework v2 RTM.
Both client and server are using SQL Server 2008 (Express edition on clients machines) and we are using tracking tables (instead of the sql server 2008 change tracking feature) to keep track of changes; those tables are updated by some triggers, each tracking table has a timestamp (rowversion) column used to know which records are modifies/added/deleted from the lasy synchronization with a client.


We are facing some weird behaviour of newly created clients (we just restore a copy of server dbs on the client machine and do some stuff with timestamps). We are still investigating on that weird behaviour and we think it might be related to "something" done by sqlkl server right before a backup.


EXAMPLE:
I have a database with some tables (with timestamp column), lets call it myDB.
After working on data (so the timestamp value grows) i check the last value with SELECT @@DBTS
The value, for this example, is 10000.
If i backup the db and then restore it as myRestoredDB, after doing a SELECT @@DBTS i will get something like 11235 and not 10000, that means that something has been done before backing up myDB. (NOTE: no pending transactions before backing up the db )

So i tried the following thing:
I changed some data on myDB, verified the timestamp value with SELECT @@DBTS (this time was 12000), then i set myDB OFFLINE and then back ONLINE, did my SELECT @@DBTS once again and the returned value was 13426.
I did my backup and then restored the db as myDBRestored2, now executed SELECT @@DBTS and last timestamp was, as expected, 13426.

What is Sql server doing to the database when i set it OFFLINE (or before doing a backup)?
I need to do the same things before doing the backup, of course OFFLINE mode is not an option, any suggestion is really helpful.

Tried already to google about that, but i havent found anything useful.
Tried also to shrink the log file and force a checkpoint, obviously with no results.

Thanks
Damiano
Post #858195
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse