標籤:windows azure 建立管理資料庫
Windows Azure建立管理資料庫
上一篇我們介紹了,windows azure上的功能,今天主要介紹如何在windows azure上建立sql 資料庫及管理資料庫。在Azure上建立的資料庫,只能通過sql manage studio進行遠端管理,同時設定允許連結ip進行遠端管理,同時在windows Azure上的資料庫操作管理只能通過SQL語句進行操作管理。哈哈,給我的感覺又回到了學校時代,老師教大家通過sql語句進行管理資料庫,這次有用武之地了。
我們首先開啟windows azure控制台,選擇SQL資料庫功能菜單,單擊建立
650) this.width=650;" title="clip_image002" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image002" src="http://img1.51cto.com/attachment/201407/25/451336_1406253061eNDN.jpg" height="278" />
選擇自訂建立
650) this.width=650;" title="clip_image004" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image004" src="http://img1.51cto.com/attachment/201407/25/451336_1406253061NJW5.jpg" height="277" />
指定資料庫的名稱、資料庫大小、版本等資訊
650) this.width=650;" title="clip_image006" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image006" src="http://img1.51cto.com/attachment/201407/25/451336_1406253061bgSu.jpg" height="290" />
在此我設定為:資料庫名稱為:MSDatabase、版本為STANDARD標準版、效能預設、大小1GB、資料庫規則預設,對於資料庫規則後期將會介紹。
650) this.width=650;" title="clip_image008" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image008" src="http://img1.51cto.com/attachment/201407/25/451336_14062530619clr.jpg" height="282" />
資料庫大小1GB
650) this.width=650;" title="clip_image010" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image010" src="http://img1.51cto.com/attachment/201407/25/451336_1406253064cYlr.jpg" height="313" />
650) this.width=650;" title="clip_image012" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image012" src="http://img1.51cto.com/attachment/201407/25/451336_1406253068uEwa.jpg" height="338" />
設定資料庫的登入名稱及密碼
650) this.width=650;" title="clip_image014" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image014" src="http://img1.51cto.com/attachment/201407/25/451336_1406253068lEJs.jpg" height="275" />
建立完成。
650) this.width=650;" title="clip_image016" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image016" src="http://img1.51cto.com/attachment/201407/25/451336_1406253068y3si.jpg" height="290" />
我們查看資料庫伺服器的連結名稱:
650) this.width=650;" title="clip_image018" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image018" src="http://img1.51cto.com/attachment/201407/25/451336_1406253068emrq.jpg" height="271" />
然後我們通過sql manage studio進行嘗試管理,提示失敗,不允許遠程進行管理
650) this.width=650;" title="clip_image020" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image020" src="http://img1.51cto.com/attachment/201407/25/451336_1406253068uidW.jpg" height="312" />
從此錯誤查看,應該是azure上的安裝設定,不允許該地址連結,需要添加運行連結的地址
650) this.width=650;" title="clip_image022" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image022" src="http://img1.51cto.com/attachment/201407/25/451336_1406253071Nzbs.jpg" height="273" />
我們開啟資料庫設定後查看配置
650) this.width=650;" title="clip_image024" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image024" src="http://img1.51cto.com/attachment/201407/25/451336_14062530718se0.jpg" height="272" />
單擊
650) this.width=650;" title="clip_image026" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image026" src="http://img1.51cto.com/attachment/201407/25/451336_1406253071coqD.jpg" height="276" />
650) this.width=650;" title="clip_image028" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image028" src="http://img1.51cto.com/attachment/201407/25/451336_14062530713nYl.jpg" height="274" />
650) this.width=650;" title="clip_image030" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image030" src="http://img1.51cto.com/attachment/201407/25/451336_1406253071iv2B.jpg" height="273" />
添加後,我們再次嘗試連結
650) this.width=650;" title="clip_image032" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image032" src="http://img1.51cto.com/attachment/201407/25/451336_1406253072iE03.jpg" height="321" />
650) this.width=650;" title="clip_image034" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image034" src="http://img1.51cto.com/attachment/201407/25/451336_1406253072P5Ts.jpg" height="292" />
650) this.width=650;" title="clip_image036" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image036" src="http://img1.51cto.com/attachment/201407/25/451336_1406253075gW3h.jpg" height="243" />
CREATE DATABASE Domino_LogGO
650) this.width=650;" title="clip_image038" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image038" src="http://img1.51cto.com/attachment/201407/25/451336_1406253075vfq8.jpg" height="291" />
650) this.width=650;" title="clip_image040" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image040" src="http://img1.51cto.com/attachment/201407/25/451336_1406253075uqLt.jpg" height="280" />
我定義以下欄位:
650) this.width=650;" title="clip_image041" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image041" src="http://img1.51cto.com/attachment/201407/25/451336_1406253075lvZr.png" height="189" />
所以通過以下命令:
USE DatabadenameIF OBJECT_ID(‘ Databadename.tableName‘, ‘U‘) IS NOT NULLDROP TABLE Test.tableName;GOCREATE TABLE tableName(ID NCHAR(10) PRIMARY KEY NOT NULL,ServerName VARCHAR(50) ,Data DATETIME,[Time] TIME(7),Info VARCHAR(500))GO
Test 資料庫名 tableName 表名
Test 替換 SBWeb
所以替換後結果如下:
650) this.width=650;" title="clip_image043" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image043" src="http://img1.51cto.com/attachment/201407/25/451336_140625307878cM.jpg" height="314" />
650) this.width=650;" title="clip_image045" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image045" src="http://img1.51cto.com/attachment/201407/25/451336_1406253078xrEV.jpg" height="298" />
650) this.width=650;" title="clip_image047" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image047" src="http://img1.51cto.com/attachment/201407/25/451336_1406253078FnVL.jpg" height="336" />
select * from Domino_log.dbo.Domino_logs
650) this.width=650;" title="clip_image049" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px;" border="0" alt="clip_image049" src="http://img1.51cto.com/attachment/201407/25/451336_1406253079Dyry.jpg" height="332" />
本文出自 “高文龍” 部落格,謝絕轉載!