July 27, 2017 at 2:16 am
Hi All,
We have a migration activity coming up where we backup our SQL server databases and restore on a different SAN in a different data center. My question is, does SQL server backup the STATISTICS data as well when we take a full backup ? Thanks in advance .
July 27, 2017 at 2:26 am
Yes - everything that is part of the database is backed up in a full database backup. Is it really important, though? It's easy enough to rebuild the statistics after the restore.
John
July 27, 2017 at 3:20 am
Hi John ,
Thanks so much for the info. I understand that it shouldn't be really worrying as we can update stats after restore as well which I had mentioned. Our management had brought-in some former employee (very senior) for any comments before migration activity commences, who insisted that the database 'will not' perform well after migration even with stats update. Anyways , thanks again for your response.
Arshad
July 27, 2017 at 3:25 am
Arshad
I'm sure (s)he'll be able to explain why (s)he thinks that! If it doesn't sound right to you, please post back here.
John
July 27, 2017 at 4:13 am
Hi John,
As I knew from my past experience of being part of migration activity for all the databases / apps from one data center to another , I was quite sure that the backups will suffice in terms of picking up almost every thing critical but that person disagrees on it. His point is , because new installation has new binaries , the meta data in the new servers will not have the stats data from the backups. I suppose , the restore operation does (and should) update the metadata in the new binaries and one doesn't even need to update stats actually .. please correct me if I am wrong in this sentence ...
Thank you
Arshad
July 27, 2017 at 4:37 am
Arshad
I'm not sure what he means by the metadata in the new binaries. Everything that's in the database is backed up with the database. Sure, there are some things that the database depends on that exist at the server level, for example logins, that wouldn't be included in the backup. Statistics isn't an example of that, though. You can see for yourself easily enough, by doing DBCC SHOW_STATISTICS on a table of your (or his) choice, and comparing the output just before backup on the old database and just after restore on the new.
John
July 27, 2017 at 5:36 am
The only reason I can think of for a database restored to a different SAN to not work efficiently is because the SAN was misconfigured, causing the database to thrash when trying to read or write data. And that's a whole 'nuther problem that won't be solved by anything but rebuilding the SAN.
July 27, 2017 at 6:20 am
Arsh - Thursday, July 27, 2017 4:13 AM. His point is , because new installation has new binaries , the meta data in the new servers will not have the stats data from the backups. I suppose , the restore operation does (and should) update the metadata in the new binaries
What?
There's no metadata in the binaries. Database metadata (like statistics) are stored in the databases themselves, and hence included in backups and present when a DB is restored from a backup
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
July 27, 2017 at 6:53 am
Hi,
Thanks All for putting info on this .
Gail , aren't the statistics stored in system objects , like sys.sysrscols etc . am I missing something ?
Thank you
Arshad
July 27, 2017 at 7:02 am
Arsh - Thursday, July 27, 2017 6:53 AMHi,
Thanks All for putting info on this .
Gail , aren't the statistics stored in system objects , like sys.sysrscols etc . am I missing something ?
Yes they are, in the databases themselves. Those system objects are in the user databases, not in the SQL binaries.
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
July 27, 2017 at 8:31 am
But , don't the system objects physically exist in the resource database and only logically are they in each database ? this is what I've been believing in so far .. I'm surely missing something I suppose .
Thank you
Arshad
July 27, 2017 at 8:39 am
Arsh - Thursday, July 27, 2017 8:31 AMBut , don't the system objects physically exist in the resource database and only logically are they in each database ? this is what I've been believing in so far .. I'm surely missing something I suppose .Thank you
Arshad
System objects exist on 2 levels. The server level, which is for everything that touches system and user databases, then the individual databases where the system objects only tell you about that particular database.
EDIT: And the database level ones are physically in each database. The server level ones exist in the system dbs, but certain master system objects can be called from any session context.
July 27, 2017 at 8:43 am
The statistics for a user object are physically stored in the relevant user database's files. See https://dba.stackexchange.com/questions/27151/where-are-statistics-physically-stored-in-sql-server, for example.
Cheers!
July 27, 2017 at 8:51 am
Arsh - Thursday, July 27, 2017 8:31 AMBut , don't the system objects physically exist in the resource database and only logically are they in each database ? this is what I've been believing in so far .. I'm surely missing something I suppose .
The definition of system views and functions exists in the resourceDB. The system tables, which contain things like statistics and other database metadata, exist in the user databases.
If it worked as you believed, you would not be able to move a database from one instance to another. Since you can do that, the system tables obviously are not found in the resource DB.
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
July 27, 2017 at 9:35 am
Thank you Brandie , Jacob , Gail for such useful insights.
Thank you
Arshad
Viewing 15 posts - 1 through 14 (of 14 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy