下载此文档

sqlserver附加数据库sqlserver附加数据库.doc


文档分类:IT计算机 | 页数:约13页 举报非法文档有奖
1/13
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/13 下载此文档
文档列表 文档介绍
sqlserver附加数据库(sqlserver附加数据库)
Remote desktop
Frequently-used:
1. mstsc /v: 192. 168. 0. 1
Used when the connection sqlcmd command:
Sqlcmd -S Server\Instance
Where Server is the name of the computer and Instance is the name of the instance.
After the 3. connection, type the following command:
USE [master]
GO
CREATE DATABASE [databas e_name] ON (FILENAME = N'C:\Program, Files\Microsoft, SQL,
Server\MSSQL10_50. MSSQLSERVER\MSSQL\Data\<database, name>. mdf'),
(FILENAME = N'C:\Program, Files\Microsoft, SQL, Server\MSSQL10_50. MSSQLSERVER\MSSQL\Data\<database, name>. Idf')
FOR ATTACH;
GO
Among them, database name is the name you want to attach the database, FileName is the path and file name of the database and log files, FOR and ATTACH are specified by attaching a set of existing operating system files to create database.
4. , to verify that the database is attached, type the following two commands:
Select name from
Go
The 5. sqlcmd tool displays the names of all databases attached to the SQL Server Express instance. In the list, you should see the database name provided in step 3.
-must first establish [DataBase] folder in the C drive under
USE Master
GO
Check that the test database exists, and if it exists, delete it
IF EXISTS (SELECT, NAME, FROM, SYSDATABASES, WHERE, NAME
='MyDB')
DROP DATABASE MyDB
GO
CREATE DATABASE MyDB
ON
一 data files
(
NAME = MyDB_dat,
FILENAME =' C:\DataBase\MyDB_dat. mdf' ,
SIZE = 10 一 defaults to MB
MAXSIZE = 50,
FILEGROWTH = 5
-log file 登录

名称二 mydb log,
文件名二“C: \ \ mydb_log LDF的数据库,
Imb大小=,
25mb MAXSIZE =,
增长速度为Imb


——数据库创建示例2
使用主

如果存在(选择的名字name = "mydb”中)
删除数据库文件
使用主

创建一个数据库

——主数据文件

名称二 mydb dat 1,
文件名="C: \ \ mydb dat 1 mdf数据库,
大小为10 MB,一默认值为
为二50,
增长速度为5
),
——次要数据文件
名称二 mydb_dat2,
文件名="c: \ \ mydb_dat2 NDF的数据库,
大小为10 MB,一默认值为
为=50,
增长速度为5
)
登录
——主日志
(
名称=mydb_logL
文件名="C: \ \ mydb_logl LDF的数据库,
Imb大小=,
25mb MAXSIZE =,
增长速度为Imb
),
次要日

sqlserver附加数据库sqlserver附加数据库 来自淘豆网www.taodocs.com转载请标明出处.

非法内容举报中心
文档信息
  • 页数13
  • 收藏数0 收藏
  • 顶次数0
  • 上传人小健
  • 文件大小86 KB
  • 时间2022-05-20