附加的数据库是只读的 [英] database attached is read only

查看:30
本文介绍了附加的数据库是只读的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下脚本附加数据库.但是创建的数据库是只读的.
我应该在脚本中进行哪些修改以使其可读写.请帮帮我.

I used the following the script to attach a database. But the database created is read only.
What modifications should I make in the script to make it read-write. Please help me.

USE [master]
GO
CREATE DATABASE [GemDatabase] ON 
( FILENAME = N'E:\Program Files (x86)\ICE Products\ICEConnect200\New Database\GemDatabase.mdf' ),
( FILENAME = N'E:\Program Files (x86)\ICE Products\ICEConnect200\New Database\GemDatabase_log.ldf' )
 FOR ATTACH
GO
if not exists (select name from master.sys.databases sd where name = N'GemDatabase' and SUSER_SNAME(sd.owner_sid) = SUSER_SNAME() ) EXEC [GemDatabase].dbo.sp_changedbowner @loginame=N'sa', @map=false
GO

推荐答案

首先确保 .mdf 文件所在的文件夹不是只读的.如果是,请取消选中该选项并确保它反映到该文件夹​​中的文件夹和文件.

First make sure that the folder in which your .mdf file resides is not read only. If it is, un-check that option and make sure it reflects to folders and files within that folder.

完成后,打开 Management Studio,在对象资源管理器中右键单击只读的数据库并选择属性.在选项菜单中,检查只读属性是否为 false.

Once that is done, Open Management Studio, in the Object Explorer right click on the Database which is read only and select Properties. In the Options Menu, check that the Read-Only property is false.

这篇关于附加的数据库是只读的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆