数据库

位置:IT落伍者 >> 数据库 >> 浏览文章

一个SQL Server 2000实验的具体说明


发布日期:2024年08月11日
 
一个SQL Server 2000实验的具体说明

今天做sql server 的一个实验比较简单的那种新建数据库修改日志文件的大小等等吧应该还是比较简单的了下面还是记录一下啦~都这么就没有来过了的

/*

**CREABASESQL

**

**Drop and Rereate the credit databaseRecord the time required

*/

PRINT Begin CREABASESQL

GO

USE master

SET nocount ON

GO

IF db_id(credit) IS NOT NULL

DROP DATABASE credit

GO

CREATE DATABASE [credit]

ON PRIMARY (NAME = Ncredit_Data

FILENAME = NC:\Program Files\Microsoft SQL Server\MSSQL\Data\credit_DataMDF

SIZE =

FILEGROWTH = %)

LOG ON (NAME = Ncredit_Log

FILENAME = NC:\Program Files\Microsoft SQL Server\MSSQL\Data\credit_LogLDF

SIZE =

FILEGROWTH = %)

GO

ALTER DATABASE credit

ADD FILEGROUP CreditTablesFG

GO

ALTER DATABASE credit

ADD FILEGROUP CreditIndexesFG

GO

ALTER DATABASE credit

ADD FILE (

NAME = CreditTables

FILENAME = C:\Program Files\Microsoft SQL Server\MSSQL\Data\CreditTablesndf

SIZE = MB

MAXSIZE = UNLIMITED

FILEGROWTH = MB )

TO FILEGROUP CreditTablesFG

ALTER DATABASE credit

ADD FILE (

NAME = CreditIndexes

FILENAME = C:\Program Files\Microsoft SQL Server\MSSQL\Data\CreditIndexesndf

SIZE = MB

MAXSIZE = UNLIMITED

FILEGROWTH = MB )

TO FILEGROUP CreditIndexesFG

GO

PRINT

IF db_id(credit) IS NOT NULL

PRINT CREATED DATABASE credit

ELSE

PRINT CREATE DATABASE credit FAILED

PRINT

GO

/*

**This script sets the database recovery model to SIMPLE

**for the ClassNorthwind database Simple Recovery allows

**the database to be recovered to the most recent backup

**

**Look under the status column of your sp_helpdb results to

**view the recovery model that has been set for a database

*/

USE ClassNorthwind

ALTER DATABASE ClassNorthwind SET RECOVERY SIMPLE

EXEC sp_helpdb ClassNorthwind

GO

/*

This script modifies the maximum size of the ClassNorthwind transaction log file

and increases its current size

*/

USE master

GO

ALTER DATABASE ClassNorthwind

MODIFY FILE (NAME=ClassNorthwind_Log

MAXSIZE=MB)

GO

ALTER DATABASE ClassNorthwind

MODIFY FILE (NAME=ClassNorthwind_Log

SIZE=MB)

GO

ALTER DATABASE ClassNorthwind

MODIFY FILE (NAME=ClassNorthwind_Log

FILEGROWTH=%)

GO

EXEC sp_helpdb ClassNorthwind

GO

               

上一篇:在SQL Server中如何删除数据库

下一篇:SQL Server数据库对象信息的获取方法