首页 > 数据库 > SQL Server > 正文

sql server2000实验

2024-08-31 00:48:17
字体:
来源:转载
供稿:网友

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

/*
**  creabase.sql
**
**  drop and rereate the credit database.  record the time required.
*/

print 'begin creabase.sql'
go

use master
set nocount on
go

if db_id('credit') is 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') 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=50mb)
go

alter database classnorthwind
  modify file (name='classnorthwind_log',
        size=25mb)
go
alter database classnorthwind
  modify file (name='classnorthwind_log',
        filegrowth=20%)
go


exec sp_helpdb classnorthwind
go

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表