今天做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