–建立一個名叫”puma”的DB
1 |
USE [master] |
2 |
GO |
3 |
CREATE DATABASE [puma] ON PRIMARY |
4 |
( NAME = N 'puma' , FILENAME = N 'D:DBpuma.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ) |
5 |
LOG ON |
6 |
( NAME = N 'puma_log' , FILENAME = N 'D:DBpuma_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%) |
7 |
GO |
–備份”puma”DB
1 |
BACKUP DATABASE puma TO DISK = 'D:DBpuma.bak' |
2 |
GO |
–還原”puma”DB到新的DB”puma2″
1 |
RESTORE DATABASE puma2 |
2 |
FROM DISK = 'D:DBpuma.bak' |
3 |
WITH |
4 |
MOVE 'puma' TO 'D:DBpuma2.mdf' , |
5 |
MOVE 'puma_log' TO 'D:DBpuma2_log.ldf' , |
6 |
REPLACE ; |
7 |
GO |