Sqlserver2005附加数据库时出错解决办法
一篇关于Sqlserver2005附加数据库时出错提示操作系统错误5(拒绝访问)错误5120的解决办法 ,有碰过相同问题的朋友可以参考本文章得以解决哦。
最近几天从网上找了几个.net的登录案例想要研究研究代码,结果在用
Sql Server2005附加文件时弹出错误信息:如下图:
,一时无解,遂求助于百度谷歌,经过各种试验,特将解决办法整理于此,希望能帮到大家,同时如果有好的意见大家多多交流啊!
方案一:切换登录方式
出现这种情况是由于用“混合验证方式”(SQL Server身份验证)登录数据库造成的,只要将登录方式改为“windows身份验证方式”
登录即可解决该问题,附加成功后再换用“混合验证模式”登陆就没问题了。
此方法经本人测试成功。
方案二:修改服务
选择 所有程序-SQL Server 2005-配置工具-选择"SQL Server Configuration Manager"或者“SQL Server 配置管理器”,
打开“SQL Server Configuration Manager”配置界面,在左侧选择"SQL Server 2005 服务",在右侧右击打开“SQL Server (SQLEXPRESS)” 的属性,在内置账户处将网络服务--”Network Service”改为本地系统--"Local System",
点击“重新启动”后再附加数据库就OK了。
此方法经本人测试成功。
附加数据库成功后如果担心改变设置后影响以后使用可以将内置账户处的“Local System”再改回
“Network Service”,数据库仍可打开。
主要配置过程如下图:
1.打开“SQL Server Configuration Manager”配置界面:
2.选择SqlServer(SQLEXPRESS),选项,并右击:
3.选择“Local System”:
4.选择“重新启动”:
5.配置成功:
这样配置后附加数据库就不会出错了。
出现的问题:
网上有人说:将数据库文件copy到其他文件夹后再附件可以附加上,但此方法经本人测试后无效。
附加数据库后发现数据库属性为只读的解决办法
附加后发现数据库属性为“只读” 解决方法为:
打开“Sql Server 2005”,在只读的数据库上右击选择属性,选中属性窗口左侧"选择页"下面的"选项",在窗口右边将“数据库为只读”项
改为“False”,点击确定即可。
原因:之所以附加上的数据库为“只读”,是因为启动SQL Server 的默认的启动账号“网络服务”对所附加(Attach)的数据库文件的
权限不够造成的。此方法经本人测试成功。
主要配置过程如图:
步骤一:
步骤二:

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

HQL and SQL are compared in the Hibernate framework: HQL (1. Object-oriented syntax, 2. Database-independent queries, 3. Type safety), while SQL directly operates the database (1. Database-independent standards, 2. Complex executable queries and data manipulation).

"Usage of Division Operation in OracleSQL" In OracleSQL, division operation is one of the common mathematical operations. During data query and processing, division operations can help us calculate the ratio between fields or derive the logical relationship between specific values. This article will introduce the usage of division operation in OracleSQL and provide specific code examples. 1. Two ways of division operations in OracleSQL In OracleSQL, division operations can be performed in two different ways.

Oracle and DB2 are two commonly used relational database management systems, each of which has its own unique SQL syntax and characteristics. This article will compare and differ between the SQL syntax of Oracle and DB2, and provide specific code examples. Database connection In Oracle, use the following statement to connect to the database: CONNECTusername/password@database. In DB2, the statement to connect to the database is as follows: CONNECTTOdataba

Interpretation of MyBatis dynamic SQL tags: Detailed explanation of Set tag usage MyBatis is an excellent persistence layer framework. It provides a wealth of dynamic SQL tags and can flexibly construct database operation statements. Among them, the Set tag is used to generate the SET clause in the UPDATE statement, which is very commonly used in update operations. This article will explain in detail the usage of the Set tag in MyBatis and demonstrate its functionality through specific code examples. What is Set tag Set tag is used in MyBati

What is Identity in SQL? Specific code examples are needed. In SQL, Identity is a special data type used to generate auto-incrementing numbers. It is often used to uniquely identify each row of data in a table. The Identity column is often used in conjunction with the primary key column to ensure that each record has a unique identifier. This article will detail how to use Identity and some practical code examples. The basic way to use Identity is to use Identit when creating a table.

WindowsServerBackup is a function that comes with the WindowsServer operating system, designed to help users protect important data and system configurations, and provide complete backup and recovery solutions for small, medium and enterprise-level enterprises. Only users running Server2022 and higher can use this feature. In this article, we will explain how to install, uninstall or reset WindowsServerBackup. How to Reset Windows Server Backup If you are experiencing problems with your server backup, the backup is taking too long, or you are unable to access stored files, then you may consider resetting your Windows Server backup settings. To reset Windows

Solution: 1. Check whether the logged-in user has sufficient permissions to access or operate the database, and ensure that the user has the correct permissions; 2. Check whether the account of the SQL Server service has permission to access the specified file or folder, and ensure that the account Have sufficient permissions to read and write the file or folder; 3. Check whether the specified database file has been opened or locked by other processes, try to close or release the file, and rerun the query; 4. Try as administrator Run Management Studio as etc.

How to use SQL statements for data aggregation and statistics in MySQL? Data aggregation and statistics are very important steps when performing data analysis and statistics. As a powerful relational database management system, MySQL provides a wealth of aggregation and statistical functions, which can easily perform data aggregation and statistical operations. This article will introduce the method of using SQL statements to perform data aggregation and statistics in MySQL, and provide specific code examples. 1. Use the COUNT function for counting. The COUNT function is the most commonly used
