熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> SQL Server >> 正文

一個SQL Server 2000實驗的具體說明

2022-06-13   來源: SQL Server 

  今天做sql server 的一個實驗比較簡單的那種新建數據庫修改日志文件的大小等等吧應該還是比較簡單的了下面還是記錄一下啦~都這麼就沒有來過了的
  
  /*
  ** CREABASESQL
  **
  ** Drop and Rereate the credit database Record 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

From:http://tw.wingwit.com/Article/program/SQLServer/201311/22096.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.