关于数据库的问题
什么 夏在别人的数据库有30m 自己的只有1m
我来给大家解释下, 30m和1m数据库的区别
1m 的数据库我想大家都是 看了那段录像,在sql里面创建了一个 数据库然后把那个mdb文件倒入进去就完事了爸,其实那样是不标准的做法!
30m的 是用sql脚本生成的数据库, 和前者比前来 多了主健 索引 等。。。
如果有人实在不会 使用sql脚本的话,我等会可以提供一个 生成好的 数据库备份!
以下是sql脚本,现在D盘下面创建 data 目录,然后用sql 事件查询器 运行!
use master
CREATE DATABASE [MuOnline] ON
(
NAME = N'MuOnline_dat',
FILENAME = N'D:\Data\MuOnline.mdf' , ------(可能需要修改)
SIZE = 30,
FILEGROWTH = 10%
)
LOG ON (
NAME = N'MuOnline_log',
FILENAME = N'D:\Data\MuOnline.ldf' , ------(可能需要修改)
SIZE = 30,
FILEGROWTH = 10%
)
GO
use MuOnline dedecms.com
CREATE TABLE AccountCharacter (
Number INT IDENTITY ( 1, 1 ) NOT NULL
, Id <I>var</I>CHAR( 10 ) NOT NULL PRIMARY KEY
, GameID1 <I>var</I>CHAR( 10 ) NULL
, GameID2 <I>var</I>CHAR( 10 ) NULL
, GameID3 <I>var</I>CHAR( 10 ) NULL
, GameID4 <I>var</I>CHAR( 10 ) NULL
, GameID5 <I>var</I>CHAR( 10 ) NULL
, GameIDC <I>var</I>CHAR( 10 ) NULL
)
CREATE TABLE [Character] (
[AccountID] [<I>var</I>char] (10) NOT NULL ,
[Name] [<I>var</I>char] (10) NOT NULL ,
[cLevel] [smallint] NULL ,
[LevelUpPoint] [int] NULL ,
[Class] [tinyint] NULL ,
[Experience] [int] NULL ,
[Strength] [smallint] NULL ,
[Dexterity] [smallint] NULL ,
[Vitality] [smallint] NULL ,
[Energy] [smallint] NULL ,
[Inventory] [<I>var</I>binary] (532) NULL ,
[MagicList] [<I>var</I>binary] (60) NULL ,
[MONEY=] [int] NULL ,
[Life] [real] NULL ,
[MaxLife] [real] NULL ,
[Mana] [real] NULL ,
[MaxMana] [real] NULL ,
[MapNumber] [smallint] NULL ,
[MapPosX] [smallint] NULL ,
[MapPosY] [smallint] NULL ,
[MapDir] [tinyint] NULL ,
[PkCount] [int] NULL ,
[PkLevel] [int] NULL ,
[PkTime] [int] NULL ,
[MDate] [smalldatetime] NULL ,
[LDate] [smalldatetime] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Character] WITH NOCHECK ADD
CONSTRAINT [DF_Character_cLevel] DEFAULT (1) FOR [cLevel],
CONSTRAINT [DF_Character_LevelUpPoint] DEFAULT (0) FOR [LevelUpPoint],
CONSTRAINT [DF_Character_Experience] DEFAULT (0) FOR [Experience],
CONSTRAINT [DF_Character_Money] DEFAULT (0) FOR [MONEY=],
CONSTRAINT [DF__Character__MapDi__0AD2A005] DEFAULT (0) FOR [MapDir],
CONSTRAINT [DF__Character__PkCou__0BC6C43E] DEFAULT (0) FOR [PkCount],
CONSTRAINT [DF__Character__PkLev__0CBAE877] DEFAULT (3) FOR [PkLevel],
CONSTRAINT [DF__Character__PkTim__0DAF0CB0] DEFAULT (0) FOR [PkTime],
CONSTRAINT [PK__Character__09DE7BCC] PRIMARY KEY CLUSTERED
(
[Name]
) ON [PRIMARY]
GO
CREATE VIEW vCharacterPreview
AS SELECT Name, cLevel, Class, Inventory FROM Character
CREATE TABLE [dbo].[GameServerInfo] (
[Number] [int] NOT NULL ,
[ItemCount] [int] NULL ,
[ZenCount] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[GameServerInfo] WITH NOCHECK ADD
CONSTRAINT [DF_GameServerInfo_Number] DEFAULT (0) FOR [Number],
CONSTRAINT [DF__GameServe__ItemC__0F975522] DEFAULT (0) FOR [ItemCount],
CONSTRAINT [DF_GameServerInfo_ZenCount] DEFAULT (0) FOR [ZenCount],
CONSTRAINT [PK_GameServerInfo] PRIMARY KEY NONCLUSTERED
(
[Number]
) ON [PRIMARY]
GO
insert GameServerInfo valueS(0,0,0)
CREATE TABLE [Guild] (
[G_Name] [<I>var</I>char] (8) NOT NULL ,
[G_Mark] [<I>var</I>binary] (32) NULL ,
[G_Score] [int] NULL ,
[G_Master] [<I>var</I>char] (10) NULL ,
[G_Count] [int] NULL ,
[G_Notice] [<I>var</I>char] (60) NULL ,
[Number] [int] IDENTITY (1, 1) NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [GuildMember] (
[Name] [<I>var</I>char] (10) NOT NULL ,
[G_Name] [<I>var</I>char] (8) NOT NULL ,
[G_Level] [tinyint] NULL
) ON [PRIMARY]
GO
CREATE TABLE [warehouse] (
[AccountID] [<I>var</I>char] (10) NOT NULL ,
[Items] [binary] (840) NULL ,
[MONEY=] [int] NULL ,
[EndUseDate] [smalldatetime] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[warehouse] WITH NOCHECK ADD
CONSTRAINT [PK_warehouse] PRIMARY KEY CLUSTERED
(
[AccountID]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Guild] WITH NOCHECK ADD
CONSTRAINT [PK_Guild] PRIMARY KEY NONCLUSTERED
(
[G_Name]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[GuildMember] WITH NOCHECK ADD
CONSTRAINT [PK_GuildMember] PRIMARY KEY NONCLUSTERED
(
[Name]
) ON [PRIMARY]
GO dedecms.com
ALTER TABLE [dbo].[warehouse] WITH NOCHECK ADD
CONSTRAINT [DF_warehouse_Money] DEFAULT (0) FOR [MONEY=]
GO
ALTER TABLE [dbo].[GuildMember] ADD
CONSTRAINT [FK_GuildMember_Guild] FOREIGN KEY
(
[G_Name]
) REFERENCES [dbo].[Guild] (
[G_Name]
)
GO