In the last few minutes of the webcast (part 10), I goofed up one line of code and didn’t realize it until today. As my very last demo (and there were at least 10 different scenarios/concepts/demos yesterday) in my webcast, I decided to show a Database Snapshot on a Mirror database. It was the second database snapshot that I had created so my first database snapshot demo was just fine. However, when I went to create the database snapshot on the mirror, I inadvertently left off the most important part “AS SNAPSHOT OF AdventureWorks”. The irony is that I tried to query some tables and just ended up (because we were right at the end of the webcast ;)) saying that I probably wasn’t getting the table names right. Ha – there were no tables… I hadn’t created a database snapshot, I had created just another database – so the only tables I was seeing were the catalog views.
Anyway, just for clarity, I corrected the “Demo Scripts” zip that’s associated with Part 10 BUT if you’ve already downloaded it then you’ll have the old (and incorrect) version of this script (SnapshotOnMirror.sql). And, for completeness, I’ll put the code that I executed during the webcast here:
AdventureWorks
USE
go
USE
mastergo
CREATE
DATABASE AdventureWorksSnapON
( NAME = N‘AdventureWorks_Data’,
FILENAME = N‘C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorksSnap_Data.mdfss’)
— , SIZE = 167872KB , MAXSIZE = UNLIMITED, FILEGROWTH = 16384KB )
go
and the code that I should have executed here:
USE AdventureWorks
go
USE
master
go
CREATE
DATABASE AdventureWorksSnap
ON
( NAME = N‘AdventureWorks_Data’,
FILENAME = N‘C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorksSnap_Data.mdfss’)
— , SIZE = 167872KB , MAXSIZE = UNLIMITED, FILEGROWTH = 16384KB )
AS SNAPSHOT OF AdventureWorks <<<< ———-
go
USE AdventureWorksSnap
go
SELECT * FROM person.contact
go
So, quick demos right at the end of the webcast might not have been my best idea ;). But – I’m surprised none of you called me on it?! I’ll blame it on this for now.
Have a great weekend,
kt