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