我的代码是
use master
go
if exists (select * from sysdatabases where name='bbsDB')
drop database bbsDB
go
exec xp_cmdshell 'mkdir d:\project'
create database bbsDB
on
(
name='bbsDB_data',
filename='d:\project\bbsDB_data.mdf',
size=10,
filegrowth=20%
)
log on
(
name='bbsDB_log',
filename='d:\project\bbsDB_log.ldf',
size=3,
maxsize=20,
filegrowth=10%
)
go
错误提示是
Msg 15281, Level 16, State 1, Procedure xp_cmdshell, Line 1
SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'xp_cmdshell' by using sp_configure. For more information about enabling 'xp_cmdshell', see "Surface Area Configuration" in SQL Server Books Online.
Msg 5133, Level 16, State 1, Line 2
Directory lookup for the file "d:\project\bbsDB_data.mdf" failed with the operating system error 2(系统找不到指定的文件。).
Msg 1802, Level 16, State 1, Line 2
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
这里我为什么不能用xp_cmdshell创建文件,请给出答案
use master
go
if exists (select * from sysdatabases where name='bbsDB')
drop database bbsDB
go
exec xp_cmdshell 'mkdir d:\project'
create database bbsDB
on
(
name='bbsDB_data',
filename='d:\project\bbsDB_data.mdf',
size=10,
filegrowth=20%
)
log on
(
name='bbsDB_log',
filename='d:\project\bbsDB_log.ldf',
size=3,
maxsize=20,
filegrowth=10%
)
go
错误提示是
Msg 15281, Level 16, State 1, Procedure xp_cmdshell, Line 1
SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'xp_cmdshell' by using sp_configure. For more information about enabling 'xp_cmdshell', see "Surface Area Configuration" in SQL Server Books Online.
Msg 5133, Level 16, State 1, Line 2
Directory lookup for the file "d:\project\bbsDB_data.mdf" failed with the operating system error 2(系统找不到指定的文件。).
Msg 1802, Level 16, State 1, Line 2
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
这里我为什么不能用xp_cmdshell创建文件,请给出答案
解决方案 »
- 求助 关于一个表的字段 是否在另外两个表里的问题
- 求一条SQL插入语句
- 数据库的日志问题
- 怎样删除A数据库中所有名称含有BBB的表?
- 求救,sqlserver2000 隔断时间就自动停止服务,望高手指点下
- SQL Server 的支不支持递归函数!!
- 谁可以给我一个在Delphi中调用存储过程的例子。
- 急……,不小心把数据库在管理器中给删除了,没有选择保留备份,怎么能够将数据给找回来??能行马上给分!!!!
- 请教一个问题,急呀!
- 请问怎样编写SQL语句:在成绩列输入数据,然后对其进行排序,并把结果存入排名列.
- powerdesigner 12.5 如何连接SQL Server 2005
- 安装sql2000 sp4出错
exec master..xp_cmdshell 'mkdir d:\project'
--add
go
GO
RECONFIGURE
GO
sp_configure 'xp_cmdshell', 1
GO
RECONFIGURE
GO
use master
go
if exists (select * from sysdatabases where name='bbsDB')
drop database bbsDB
go
sp_configure 'show advanced options', 1
GO
RECONFIGURE
GO
sp_configure 'xp_cmdshell', 1
GO
RECONFIGURE
GO
create database bbsDB
但是还有问题
Configuration option 'show advanced options' changed from 0 to 1. Run the RECONFIGURE statement to install.
Configuration option 'xp_cmdshell' changed from 0 to 1. Run the RECONFIGURE statement to install.
Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "d:\project\bbsDB_data.mdf" failed with the operating system error 2(系统找不到指定的文件。).
Msg 1802, Level 16, State 1, Line 1
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
你有d:\project 这个路径么?你首先在D盘下 创建一个project文件夹 再试试
go
if exists (select * from sysdatabases where name='bbsDB')
drop database bbsDB
go
exec xp_cmdshell 'mkdir d:\project'
create database bbsDB
on
(
name='bbsDB_data',
filename='d:\project\bbsDB_data.mdf',
size=10,
filegrowth=20%
)
log on
(
name='bbsDB_log',
filename='d:\project\bbsDB_log.ldf',
size=3,
maxsize=20,
filegrowth=10%
)
go
就是这个代码 我也是2008
你得按四楼的方式打开