Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


After restore how the way @@DBTS changes?


After restore how the way @@DBTS changes?

Author
Message
emrahakdeniz
emrahakdeniz
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 Visits: 79
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?
David Benoit
David Benoit
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2108 Visits: 3650
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

“He is no fool who gives what he cannot keep to gain that which he cannot lose” - Jim Elliot
Carl Federl
Carl Federl
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2340 Visits: 4349
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
luckysql.kinda
luckysql.kinda
Old Hand
Old Hand (314 reputation)Old Hand (314 reputation)Old Hand (314 reputation)Old Hand (314 reputation)Old Hand (314 reputation)Old Hand (314 reputation)Old Hand (314 reputation)Old Hand (314 reputation)

Group: General Forum Members
Points: 314 Visits: 659
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.
emrahakdeniz
emrahakdeniz
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 Visits: 79
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.
Damiano P
Damiano P
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 24
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
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