配置Sql Server 2008(Win7)
1.打開SQL server2012,使用windows身份登錄
 
2.登錄后,右鍵選擇“屬性”。左側(cè)選擇“安全性”,選中右側(cè)的“SQL Server 和 Windows 身份驗(yàn)證模式”以啟用混合登錄模式
 
3.選擇“連接”,勾選“允許遠(yuǎn)程連接此服務(wù)器”,然后點(diǎn)“確定”

4.展開“安全性”,“登錄名”;“sa”,右鍵選擇“屬性”

5.左側(cè)選擇“常規(guī)”,右側(cè)選擇“SQL Server 身份驗(yàn)證”,并設(shè)置密碼

6.右擊數(shù)據(jù)庫選擇“方面”

7.在右側(cè)的方面下拉框中選擇“服務(wù)器配置”;將“RemoteAccessEnabled”屬性設(shè)為“True”,點(diǎn)“確定”

8.至此SSMS已設(shè)置完畢,先退出,再用sa登錄,成功即表示sa帳戶已經(jīng)啟用
 
9.打開sql server配置管理器

10.下面開始配置SSCM,選中左側(cè)的“SQL Server服務(wù)”,確保右側(cè)的“SQL Server”以及“SQL Server Browser”正在運(yùn)行

11.將"客戶端協(xié)議"的"TCP/IP"也修改為“Enabled”

12.選擇“IP 地址”選項(xiàng)卡,設(shè)置TCP的端口為“1433”(默認(rèn)端口)

13.MSSQLSERVER的協(xié)議啟用TCP/IP

14.配置防火墻
   
配置Sql Server 2008(Win2003)

方法與配置Sql Server 2008(Win7)相同
從Win7連接Win2003的Sql Server 2008
1.新建鏈接服務(wù)器鏈接到Win2003的Sql Server 2008

2.查看Win2003上面的IP地址,配置”新建鏈接服務(wù)器”中的”常項(xiàng)”
 
3.配置”新建鏈接服務(wù)器”中的”安全項(xiàng)”,本地登錄為”sa”,遠(yuǎn)程用戶也為”sa”

4.鏈接成功

Win7啟動(dòng)MSDTC服務(wù)
1.運(yùn)行cmd,輸入net start msdtc啟動(dòng)msdtc服務(wù)

2.在管理工具中打開服務(wù)組件,右鍵”本地DTC”, 選擇”本地DTC”的”安全選項(xiàng)卡”,做如下設(shè)置:
(1)選中”網(wǎng)絡(luò)DTC訪問”
(2)在客戶端管理中選中”允許遠(yuǎn)程客戶端”“允許遠(yuǎn)程管理”
(3)在事務(wù)管理通訊中選”允許入站”“允許出站”“不要求進(jìn)行驗(yàn)證”
(4)保證DTC登陸賬戶為:NT Authority\NetworkService
(5)單擊”確定”。這樣將會(huì)提示您”MS DTC 將會(huì)停止并重新啟動(dòng)。
 
Win2003啟動(dòng)MSDTC服務(wù)
1.打開”控制面板”,打開”添加或刪除程序”,點(diǎn)擊”添加/刪除Windows組件”,選擇”應(yīng)用程序服務(wù)器”,勾選”啟用網(wǎng)絡(luò)DTC訪問”

2.在"開始"里的"運(yùn)行"中輸入dcomcnfg.exe啟動(dòng)"組件服務(wù)",右鍵”我的電腦”,”屬性”,在MSDTC選項(xiàng)卡中,點(diǎn)擊”安全配置”按鈕,在安全配置窗口中做如下設(shè)置:
(1)選中”網(wǎng)絡(luò)DTC訪問”
(2)在客戶端管理中選中”允許遠(yuǎn)程客戶端””允許遠(yuǎn)程管理”
(3)在事務(wù)管理通訊中選”允許入站” ”允許出站” ”不要求進(jìn)行驗(yàn)證”
(4)保證DTC登陸賬戶為:NT Authority\NetworkService
(5)單擊"確定"。這樣將會(huì)提示您"MS DTC 將會(huì)停止并重新啟動(dòng)”

轉(zhuǎn)載請(qǐng)注明出處:http://www.cnblogs.com/yydcdut/p/3456440.html
配置PHP
1.打開PHP配置文件,找到extension=php_mssql.dll,將前面的注釋符號(hào)去掉

2.找到mssql.secure_connection,將Off改為On

3.找到com.allow_dcom = true,將前面的注釋符號(hào)去掉

4.下載正確版本的 ntwdblib.dll (2000.80.194.0),覆蓋Apache-20/bin/ntwdblib.dll、覆蓋php-5.2.14-Win32/ntwdblib.dll并且復(fù)制ntwdblib.dll和php_mssql.dll到系統(tǒng)system32目錄下,重啟Apache
5.測(cè)試成功



轉(zhuǎn)載請(qǐng)注明出處:http://www.cnblogs.com/yydcdut/p/3459792.html
數(shù)據(jù)庫設(shè)計(jì)
1.E-R圖

2.數(shù)據(jù)庫創(chuàng)建
Win 7
Win 2003
3.數(shù)據(jù)表設(shè)計(jì)
Win7 創(chuàng)建數(shù)據(jù)表student_7
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 |
create table student_7
(
sid int not null,
sex nvarchar(1) not null,
sname varchar(20) not null,
school varchar(20) not null,
scount varchar(20) not null,
spwd varchar(20) not null,
constraint pk_student_7
primary key(sid,sex),
constraint uq_student_7_scount
unique(scount),
constraint chk_student_7_sex
check(sex='1')
)
|
Check(sex=1)指明存放sex=1的數(shù)據(jù),即女生。
Win2003 創(chuàng)建數(shù)據(jù)表student_2003
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 |
create table student_2003
(
sid int not null,
sex nvarchar(1) not null,
sname varchar(20) not null,
school varchar(20) not null,
scount varchar(20) not null,
spwd varchar(20) not null,
constraint pk_student_2003
primary key(sid,sex),
constraint uq_student_2003_scount
unique(scount),
constraint chk_student_2003_sex
check(sex='0')
)
|
Check(sex=0)指明存放sex=0的數(shù)據(jù),即男生。
Win7 創(chuàng)建視圖V3_student
|
1
2
3
4
5 |
create view V3_student
as
select * from student_7
union all
select * from [192.168.116.130].[V3].[dbo].[student_2003]
|
Win2003 創(chuàng)建視圖V3_student
|
1
2
3
4
5 |
create view V3_student
as
select * from student_2003
union all
select * from [192.168.233.1].[V3].[dbo].[student_7]
|
student水平分片數(shù)據(jù)表已經(jīng)建立,現(xiàn)在可以在任何位置,只要訪問本地V3_student分布式分區(qū)視圖,就實(shí)現(xiàn)了所有分布式數(shù)據(jù)庫的操作。此時(shí),對(duì)數(shù)據(jù)庫的全局操作和局部操作就如同操作本地集中式數(shù)據(jù)庫一樣。
-----------------------------------------------------------------------------------------------------------------
Win7創(chuàng)建數(shù)據(jù)表teacher
|
1
2
3
4
5
6
7
8
9
10
11
12 |
create table teacher
(
tid int not null,
tname varchar(20) not null,
tage int not null,
tsex int not null,
tcount varchar(20) not null,
tpwd varchar(20) not null,
tsuper int not null,
primary key(tid),
unique(tcount)
)
|
Win2003創(chuàng)建數(shù)據(jù)表teacher
|
1
2
3
4
5
6
7
8 |
create table teacher
(
tid int not null,
nowage int not null,
tel char(20) not null,
address varchar(80) not null,
primary key(tid)
)
|
Win7 創(chuàng)建存儲(chǔ)過程V3_teacher
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 |
create proc V3_teacher
(
@tid int,
@tname varchar(20),
@tage int,
@tsex int,
@tcount varchar(20),
@tpwd varchar(20),
@super int,
@nowage int ,
@tel char(20) ,
@address varchar(80)
)
as
set XACT_ABORT on
BEGIN DISTRIBUTED TRANSACTION
insert into teacher
values(@tid,@tname,@tage,@tsex,@tcount,@tpwd,@super);
insert into [192.168.116.130].[V3].[dbo].[teacher]
values(@tid,@nowage,@tel,@address);
COMMIT TRANSACTION
|
采用存儲(chǔ)過程實(shí)現(xiàn)垂直分片。此時(shí)插入數(shù)據(jù)之后,將分別插入到不同地址上的SQL Server的teacher的數(shù)據(jù)表里面。
-----------------------------------------------------------------------------------------------------------------
Win7創(chuàng)建數(shù)據(jù)表class
|
1
2
3
4
5
6
7
8
9 |
create table class
(
cid int not null,
sid int not null,
tid int not null,
cname varchar(20) not null,
score int not null,
primary key(cid,sid)
)
|
本地?cái)?shù)據(jù)表。
-----------------------------------------------------------------------------------------------------------------
Win 7:

Win2003:

4.程序代碼測(cè)試
水平分片測(cè)試
  
垂直分片測(cè)試
   
轉(zhuǎn)載請(qǐng)注明出處:http://www.cnblogs.com/yydcdut/p/3459836.html
轉(zhuǎn)載請(qǐng)注明出處:http://www.cnblogs.com/yydcdut/p/3456426.html
|