SQL Server2000 experiment

xiaoxiao2021-03-06  55

Today, I doing SQL Server 2000, which is relatively simple, newly built databases, modify the size of the log file, etc., Well, should be more simple. Below or record it ~ all haven't come.

/ * ** creeaBase.sql **** Drop and retreate the credit database. Record the time required. * /

Print 'Begin Creabase.sql'go

Use masterset nocount ongo

IF db_id ('credit') is not null DROP DATABASE CREDITGO

Create Database [Credit] on primary (name = n'credit_data ', filename = n'c: / program files / microsoft sql server / mssql / data / credit_data.mdf', size = 50, fileGrowth = 10%) log on Name = n'credit_log ', filename = n'c: / program files / microsoft SQL Server / MSSQL / DATA / CREDIT_LOG.LDF', SIZE = 1, FileGrowTH = 10%) GO

ALTER DATABASE credit ADD FILEGROUP CreditTablesFGGOALTER DATABASE credit ADD FILEGROUP CreditIndexesFGGOALTER DATABASE credit ADD FILE (NAME = CreditTables, FILENAME = 'C: / Program Files / Microsoft SQL Server / MSSQL / Data / CreditTables.ndf', SIZE = 8MB, MAXSIZE = UNLIMITED, FILEGROWTH = 50MB) TO FILEGROUP CreditTablesFGALTER DATABASE credit ADD FILE (NAME = CreditIndexes, FILENAME = 'C: / Program Files / Microsoft SQL Server / MSSQL / Data / CreditIndexes.ndf', SIZE = 8MB, MAXSIZE = UNLIMITED, FILEGROWTH = 50MB) To Filegroup CreditIndexesfgog

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 fileland increas ITS current size. * /

Use mastergo

Alter Database ClassnorthWind Modify File (name = 'classnorthwind_log', maxsize = 50MB) GO

Alter Database ClassNorthWind Modify File (Name = 'ClassnorthWind_Log', size = 25MB) Goalter Database ClassNorthWind Modify File (Name = 'ClassnorthWind_Log', FileGrowth = 20%) Go

EXEC SP_HELPDB ClassNorthWindgo

转载请注明原文地址:https://www.9cbs.com/read-117296.html

New Post(0)