Developing and Deploying with SQL AzureWord文档下载推荐.docx
- 文档编号:5019890
- 上传时间:2023-05-04
- 格式:DOCX
- 页数:17
- 大小:802.53KB
Developing and Deploying with SQL AzureWord文档下载推荐.docx
《Developing and Deploying with SQL AzureWord文档下载推荐.docx》由会员分享,可在线阅读,更多相关《Developing and Deploying with SQL AzureWord文档下载推荐.docx(17页珍藏版)》请在冰点文库上搜索。
Copyright
Thisisapreliminarydocumentandmaybechangedsubstantiallypriortofinalcommercialreleaseofthesoftwaredescribedherein.
TheinformationcontainedinthisdocumentrepresentsthecurrentviewofMicrosoftCorporationontheissuesdiscussedasofthedateofpublication.BecauseMicrosoftmustrespondtochangingmarketconditions,itshouldnotbeinterpretedtobeacommitmenton
thepartofMicrosoft,andMicrosoftcannotguaranteetheaccuracyofanyinformationpresentedafterthedateofpublication.
Thiswhitepaperisforinformationalpurposesonly.MICROSOFTMAKESNOWARRANTIES,EXPRESS,IMPLIED,ORSTATUTORY,ASTOTHEINFORMATIONINTHISDOCUMENT.
Complyingwithallapplicablecopyrightlawsistheresponsibilityoftheuser.Withoutlimiting
therightsundercopyright,nopartofthisdocumentmaybereproduced,storedin,orintroducedintoaretrievalsystem,ortransmittedinanyformorbyanymeans(electronic,mechanical,photocopying,recording,orotherwise),orforanypurpose,withouttheexpresswrittenpermissionofMicrosoftCorporation.
Microsoftmayhavepatents,patentapplications,trademarks,copyrights,orotherintellectualpropertyrightscoveringsubjectmatterinthisdocument.ExceptasexpresslyprovidedinanywrittenlicenseagreementfromMicrosoft,thefurnishingofthisdocumentdoesnotgiveyouanylicensetothesepatents,trademarks,copyrights,orotherintellectualproperty.
©
2010MicrosoftCorporation.Allrightsreserved.
Microsoft,ADO.NETDataServices,CloudServices,LiveServices,.NETServices,SharePointServices,SQLAzure,SQLAzureDatabase,SQLServer,SQLServerExpress,SyncFramework,
VisualStudio,WindowsLive,andWindowsServeraretrademarksoftheMicrosoft
groupofcompanies.
Allothertrademarksarepropertyoftheirrespectiveowners.
DevelopingwithSQLAzure
SQLAzureisbuiltontheSQLServer’scoreengine,sodevelopingagainstSQLAzureisverysimilartodevelopingagainston-premiseSQLServer.WhiletherearecertainfeaturesthatarenotcompatiblewithSQLAzure,mostT-SQLsyntaxiscompatible.TheMSDNlinkprovidesacomprehensivedescriptionofT-SQLfeaturesthataresupported,notsupportedandpartiallysupportedinSQLAzure.
ThereleaseofSQLServer2008R2addsclienttoolssupportforSQLAzureincludingaddedsupporttoManagementStudio(SSMS).SQLServer2008R2(andabove)havefullsupportforSQLAzure–intermsofseamlessconnectivity,viewingobjectsintheobjectexplorer,SMOscriptingetc.
Atthispointoftime,ifyouhaveanapplicationthatneedstobemigratedintoSQLAzure,thereisnowaytotestitlocallytoseeifitworksagainstSQLAzure.TheonlywaytotestistoactuallydeploythedatabaseintoSQLAzure.
ConnectingtoSQLAzure
ConnectingtoSQLAzurecanbedifferentdependingupontheversionofSQLServerManagementStudiobeingused.WhileSQLServer2008R2releaseprovidesfullsupportforSQLAzureandisarecommendedtoolofchoice,itistrickywithpriorversionsofManagementStudioandinvolvesaworkaround.YouwillseethefollowingerrormessagewhenyouentertheservernameandusercredentialsintheConnectionwindowthatappearswhenyouopentheManagementStudioforthefirsttime.
TheworkaroundistoclickOKandcanceloutoftheConnectionWindow.
Then,clickthe“NewQuery”icon.
EnterthecredentialsinthisConnectionWindow.
Note:
Theloginshouldbeintheformat:
username@servername
Ifyouneedtoconnecttoaspecificdatabase,clickontheOptionsbuttonabove,andenterthedatabasenameintheConnecttodatabasebox.
USE<
Database>
isnotsupported.Soifyouneedtoconnecttoanotherdatabaseafteryouareloggedin,rightclickanywhereintheEditor,clickonConnectionandthenonChangeConnection.IfyouareusingSQLServer2008R2ManagementStudio,youcanclickonthedatabaseyouwishtoconnectto,andthenclickontheNewQuerybutton.
ConnectingtoSQLAzureusingsqlcmd
YoucanconnecttoMicrosoftSQLAzureDatabasewiththesqlcmdcommandpromptutilitythatisincludedwithSQLServer.ThesqlcmdutilityletsyouenterTransact-SQLstatements,systemprocedures,andscriptfilesatthecommandprompt.ToconnecttoSQLAzurebyusingsqlcmd,appendtheSQLAzureservernametotheloginintheconnectionstringbyusingthe<
login>
@<
server>
notation.Forexample,ifyourloginislogin1andthefullyqualifiednameoftheSQLAzureserveris,theusernameparameteroftheconnectionstringis:
login1@servername.Thisrestrictionplaceslimitationsonthetextyoucanchoosefortheloginname.Formoreinformation,seeCREATELOGIN(SQLAzureDatabase).
SQLCMDdoesnotcomewiththebaseinstallofSQLServerortheclienttools.ItcanbeinstalledfromtheSQLServer2008R2FeaturePack.
SQLAzuredoesnotsupportthe–zand–Zoptionsusedforchanginguser’spasswordwithSQLCMD.Tochangeloginpasswords,youcanusetheALTERLOGIN(SQLAzureDatabase)afterconnectingtothemasterdatabase.
ThefollowingexampleshowshowtoconnecttoauserdatabaseinaSQLAzureserverandcreateanewtableinthedatabase:
C:
\>
sqlcmd-U<
ProvideLogin@Server>
-P<
ProvidePassword>
-S<
ProvideServerName>
-d<
ProvideDatabaseName>
1>
CREATETABLEtable1(Col1intprimarykey,Col2varchar(20));
2>
GO
3>
QUIT
SQLAzurerequiresalltablestohaveClusteredIndex.Ifyoutrytoinsertdataintoatablethatisaheap,youwillseeanerrormessage.
DeployingtoSQLAzure
DeployingyourdatabasedevelopedonpremiseintoSQLAzureinvolves2steps–schemamigrationanddatamigration.Atthistime,backingupandrestoringanon-premisedatabaseintoSQLAzureisnotsupported.Dependingonwhattoolsyouusetogeneratetheschema,itcanbealittletricky.ThisisbecauseSQLAzuresupportsonlyasubsetoftheTSQLsupportedbySQLServer2008.AsnewfeaturesarebeingaddedtoSQLAzure,thetoolssupportingtheschemagenerationneedtobemodifiedtosupportthosenewfeatures.SQLServer2008R2hasfullsupportforSQLAzure.Youcanpointthedatabase“GenerateScriptsWizard”toscriptagainstaSQLAzuredatabaseandthescriptsgeneratedcanbeexecuteddirectlyonaSQLAzuredatabase.ForcustomersthatdonothavetheSQLServer2008R2NovemberCTPversionofSSMS,thereisaworkaround.
SchemaMigrationwithSQLServer2008R2
TheNovemberupdatetoSQLServer2008R2includessupportforSQLAzure.TheGenerateScriptsWizardnowallowsyoutoscriptfordatabaseversionSQLAzuresothescriptsgeneratedaredirectlycompatibletobeexecutedonSQLAzure.
∙RightclickonthedatabasethatyouwanttogeneratethescriptsforintheObjectExplorerofyouronpremiseSQLServer,pointtoTasksandselectGenerateScripts.
∙ClickonNext
∙Choosetheobjects–Youcaneitherselectspecificobjectsoralldatabaseobjects
∙Choosetheappropriateoutputtype
∙ClickontheAdvancedbuttonfromabovescreen
∙ChoosetheSQLAzureDatabaseoptionfromthedropdownforScriptforthedatabaseenginetypeoption,asshownintheabovescreen.
∙ClickNextuntilFinish.
ThescriptsthusgeneratedarecompatiblewithSQLAzureandcanbecompiledonSQLAzurewithoutanyfurthermodifications.
SchemaMigrationwithpre-SQLServer2008R2
Thescriptgeneratedviathe“GenerateScripts”optionfrompreviousversionsofSSMSneedstobemodifiedtomakeitcompatiblewithSQLAzure.
∙RightclickonthedatabasethatyouwanttogenerateSQLAzurescriptsforintheObjectExplorerofyouronpremiseSQLServer,pointtoTasksandselectGenerateScripts.
∙IntheScriptWizarddialogbox,clickNexttogettotheSelectDatabasestep.SelectScriptallobjectsintheselecteddatabase,andthenclickNext.
∙InChooseScriptOptions,clickontheAdvancedbuttonand,setthefollowingoptions:
oConvertUDDTstoBaseTypes=True
oScriptExtendedProperties=False
oScriptLogins=False
oScriptUSEDATABASE=False
oScriptData=False
SQLAzuredoesnotsupportuser-defineddatatypes,extendedproperties,Windowsauthentication,ortheUSEstatement.
∙ClickNextuntilFinish.TheScriptWizardgeneratesthescript.ClickClosewhenthescriptiscompleted.
∙Inthegeneratedscript,deleteallinstancesof"
SETANSI_NULLSON"
.
∙EachCREATETABLEstatementincludesa"
WITH(PAD_INDEX=OFF,STATISTICS_NORECOMPUTE=OFF,IGNORE_DUP_KEY=OFF,ALLOW_ROW_LOCKS=ON,ALLOW_PAGE_LOCKS=ON)ON[PRIMARY]"
clause.Deleteallinstancesofthatclause.
∙EachCREATETABLEstatementincludesthe"
ON[PRIMARY]"
Inthewizardabove,thereisanoptiontoscriptdataalongwithschema.ThisoptioncanbesettoTrueifyouhavefewtableswithfewrowsofdata.However,ifyouhaveseveraltableswithtensofthousandsofrows,thisscriptcanbecomequitelargewithanINSERTstatementforeachrow.AmoreefficientwaytomigrateyourdataisviaBCPorSSISorbyusingtheSqlBulkCopyAPI,asdescribedinthefollowingsection.
DataMigration:
Followingaretheoptionsavailabletomigratedatafromon-premiseSQLServerintoSQLAzure.
∙SettingtheScriptDataoptiontoTrueinthedatabaseGenerateScriptsWizard
∙BCP
∙SQLServerIntegrationServices(SSIS)usingADO.NET
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Developing and Deploying with SQL Azure
链接地址:https://www.bingdoc.com/p-5019890.html