【例4.2】
(3)
CREATE DATABASE newxk
ON
(NAME =newxk_data,
FILENAME ='C:/newxk_data.mdf',
SIZE=3,
MAXSIZE=10,
FILEGROWTH=1)
LOG ON
(NAME ='newxk_log',
FILENAME='C:/newxk_log.ldf',
SIZE =2MB,
MAXSIZE= 15MB,
FILEGROWTH=1MB)
GO
【例4.3】
CREATE DATABASE mydb
ON
PRIMARY (NAME=mydb_data1,
FILENAME='C:/mydb_data1.mdf',
SIZE =10MB,
MAXSIZE=20,
FILEGROWTH=2),
( NAME=mydb_data2,
FILENAME='C:/mydb_data2.ndf',
SIZE=8MB,
MAXSIZE=20,
FILEGROWTH=2),
( NAME=mydb_data3,
FILENAME='C:/mydb_data3.ndf',
SIZE=6MB,
MAXSIZE=20,
FILEGROWTH=2)
LOG ON
( NAME=mydb_log1,
FILENAME='C:/mydb_log1.ldf',
SIZE=7MB,
MAXSIZE= 20,
FILEGROWTH=2),
( NAME=mydb_log2,
FILENAME='C:/mydb_log2.ldf',
SIZE=9MB,
MAXSIZE=20,
FILEGROWTH=2)
GO
【例4.4】
sp_helpdb Xk
【例4.5】
sp_helpdb
【例4.6】
USE MASTER
GO
ALTER DATABASE xk
MODIFY FILE(NAME='xk_data',
SIZE=5MB)
GO
ALTER DATABASE xk
MODIFY FILE(NAME='xk_log',
SIZE=6MB)
GO
【例4.7】
USE MASTER
GO
ALTER DATABASE Xk
ADD FILE
(NAME=xk2,
FILENAME="C:/xk2.ndf",
SIZE=4MB,
MAXSIZE=10MB,
FILEGROWTH=1MB)
GO
【例4.8】
ALTER DATABASE Xk
ADD LOG FILE
(NAME=xklog2,
FILENAME='C:/xklog2.ldf',
SIZE=5MB,
MAXSIZE=10MB,
FILEGROWTH=1MB)
GO
【例4.10】
sp_dboption 'Xk','read only','true'
GO
【例4.11】
sp_dboption 'Xk','read only','FALSE'
GO
【例4.12】
USE Xk
GO
DBCC SHRINKFILE(xk2,2)
GO
【例4.13】
USE Xk
GO
DBCC SHRINKDATABASE(Xk,30)
GO
【例4.14】
(1)
sp_renamedb 'mydb','mydatabase'
GO
(2)
C:/osql-Usa -P123456
1> sp_renamedb 'mydb','mydatabase'
2>go
【例4.15】
DROP DATABASE mydatabase
GO