0

我正在尝试使用以下命令在 SQL Server 2005 数据库上启用 select into/bulkcopy 数据库选项:

EXEC sp_dboption 'mydbname', 'select into/bulkcopy', 'true'

执行上述操作后,运行EXEC sp_dboption 'mydbname', 'select into/bulkcopy'告诉我该选项仍设置为 OFF。

我已经确认我的 Windows 登录名是数据库中的用户并且属于 db_owner 角色。阅读sp_dboption 的 MSDN 文档后,这似乎是使用该过程更改数据库选项的唯一先决条件。

我是否缺少任何其他步骤或设置可能会阻止我启用此选项?

4

1 回答 1

3

That procedure is deprecated. You can use

 ALTER DATABASE [mydbname] SET RECOVERY BULK_LOGGED WITH NO_WAIT

This seems to happen if your DB is currently in SIMPLE recovery model.

Looking at the sp_dboption procedure definition the relevant bit of code is

    if @alt_optvalue = 'ON'
    begin
        if databaseproperty(@dbname, 'IsTrunclog') = 1
            select @alt_optvalue = 'RECMODEL_70BACKCOMP'
        else
            select @alt_optvalue = 'BULK_LOGGED'
    end

The effect of running ALTER DATABASE [mydbname] SET RECOVERY RECMODEL_70BACKCOMP WITH NO_WAIT seems to be to set the recovery model to SIMPLE so basically it has no effect in this instance

于 2011-02-08T17:00:43.517 回答