Moving an Existing Database to the Cloud
The SetForeignKeyEnabledStatus stored procedure will be used todisable foreign key constraints during data migration. This will permit you to load your tables in whatever order is convenient without regard to primary key / foreign key relationships. You will run this stored procedure again when data migration is complete to re-enable all of the foreign key constraints.
The SetIndexEnabledStatus stored procedure will be used todisable all non-clustered indexes during data migration. This speeds up the data loading process. You will run this stored procedure again when data migration is complete to rebuild all of the non-clustered indexes.
ExportTableData.cmd
bcp dbo.MyTableName out MyTableName.dat -n -S MySqlServerName -T
Note: Use the–n parameter to use the “native” file format for export.
The native formatimproves performance on import by avoiding unnecessary conversions. Use the–T parameter to connect to SQL Server using your Windows credentials.
bcp dbo.MyTableName in MyTableName.dat -n -S myserver.database.windows.net -Umysqladminuser@myserver -Pmysqladminuserpassword -E
Managing Cache Expiration and Resource Versioning
// save to blob and set its TTL
dstBlob.Properties.ContentType = "image/jpeg";
dstBlob.Properties.CacheControl = "public, max-age=" + ttl.ToString("N0");
dstBlob.SetProperties();
Using Versioning to Invalidate Content Cached by the CDN
In order to changes propagated immediately to clients. First of all, you need to turn on "Query String" to the CDN
Content stored by a CDN edge server remains in its cache for as long as is specified by the Cache-Control header on the source blob. This means that clients requesting the resource receive a copy from the
server’s cache until the resource’s TTL expires. Only then does the server retrieve an updated copy from its source.
Notice that the URL of the image downloaded from the CDN includes a query parameter with a version number and that the image immediately updates to match the source image in blob storage despite the fact that
the remaining TTL is not yet zero. This confirms that,
because of the unique URL, the CDN is forced to request the image again from the Blob service.