Server
Today to do a SQL Server 2000 experiment, the simpler kind, the new database, modify the size of the log file, etc., well, it should be relatively simple. The following is still a record of it ~ all so did not come.
/*
* * Creabase. Sql
**
* * Drop and rereate the credit database. Record of the time required.
*/
PRINT ' Begin creabase. SQL '
Go
Use master
SET Nocount ON
Go
IF db_id (' credit ') was not NULL
DROP DATABASE Credit
Go
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 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\credittables.ndf ',
SIZE = 8MB,
MAXSIZE = Unlimited,
FileGrowth = 50MB)
To FILEGROUP CREDITTABLESFG
ALTER 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 CREDITINDEXESFG
Go
PRINT '
IF db_id (' credit ') was 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 is 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=50MB)
Go
ALTER DATABASE Classnorthwind
MODIFY FILE (name= ' Classnorthwind_log ',
SIZE=25MB)
Go
ALTER DATABASE Classnorthwind
MODIFY FILE (name= ' Classnorthwind_log ',
filegrowth=20%)
Go
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.