还原AdventureWorks2008示例数据库遇到的问题
近来需要AdventureWorks2008示例数据库,而安装的Sqlserver 2008 默认又没有安装这个数据库,只有自己安装了。于是去官网上找数据库下载,可惜目前官网不提供这个数据库下载了,只好在网上荡,好在还有资源。这个也提供一下,如果有需要可以下载。 Adventure
近来需要AdventureWorks2008示例数据库,而安装的Sqlserver 2008 默认又没有安装这个数据库,只有自己安装了。于是去官网上找数据库下载,可惜目前官网不提供这个数据库下载了,只好在网上荡,好在还有资源。这个也提供一下,如果有需要可以下载。
AdventureWorks2008示例数据库:http://download.csdn.net/detail/truman_xy/4462462
AdventureWorks2008数据库字典:http://download.csdn.net/detail/truman_xy/4462471
这个是数据库备份文件,直接还原即可。可惜我在还原的时候遇到个小插曲,报错:System.Data.SqlClient.SqlError: FILESTREAM 功能被禁用。又是个没有遇到的问题,只好再搜,这里把搜索结果也整理一下。
FILESTREAM是SQL Server 2008 新添加的特性, 默认是关闭的. 如果数据库备份文件启用了这个功能,在另外一台电脑上还原时也需要启动这个特性。网上给出了一般的解决方案:
1、开始-->Microsoft SQL Server 2008-->配置工具-->SQL Server 配置管理器
2、SQL Server服务-->SQL Server(MSSQLSERVER)右键属性
3、选择FILESTREAM选项卡,选中前两项:针对Transact-SQL访问启用FILESTREAM(E);针对文件I/O流访问启用FILESTREAM(E)
4、确定,然后重启该服务
这个方法我试了,可惜不成功,查了下,原来这个配置是用来控制 access 的,不对路。只好换个方法,调用sp_configure 存储过程来启用FILESTREAM:
<span>USE</span><span> master </span><span>GO</span> <span>EXEC</span> sp_configure filestream_access_level, <span>2</span> <span>RECONFIGURE</span>
然后重新还原数据库,完全正常。
AdventureWorks2008数据库只能比SQL Server 2008版本更高的数据库上,同理AdventureWorks2008R2只有还原在比SQL Server 2008 R2更高的版本上。如果不小心把AdventureWorks2008R2还原到SQL Server 2008上,就会报错:数据库 'AdventureWorks2008R2' 的版本为 661,无法打开。此服务器支持 655 版及更低版本。不支持降级路径。661是sql2008 R2的版本号,655是sql2008的版本号,这个时候只有升级数据库或者改换示例数据库。查看数据库版本:
<span>use</span><span> master </span><span>go</span> <span>select</span> <span>@@VERSION</span> <span>declare</span> <span>@a</span> <span>nvarchar</span>
10.0.1600其实就是SQL 2008
10.0.2531其实就是 SQL Server 2008 SP1
10.50.1600其实就是SQL 2008 R2
10.50.2500其实就是SQL 2008 R2 SP1

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











Backing up and restoring a MySQL database in PHP can be achieved by following these steps: Back up the database: Use the mysqldump command to dump the database into a SQL file. Restore database: Use the mysql command to restore the database from SQL files.

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

Hibernate polymorphic mapping can map inherited classes to the database and provides the following mapping types: joined-subclass: Create a separate table for the subclass, including all columns of the parent class. table-per-class: Create a separate table for subclasses, containing only subclass-specific columns. union-subclass: similar to joined-subclass, but the parent class table unions all subclass columns.

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

Using the database callback function in Golang can achieve: executing custom code after the specified database operation is completed. Add custom behavior through separate functions without writing additional code. Callback functions are available for insert, update, delete, and query operations. You must use the sql.Exec, sql.QueryRow, or sql.Query function to use the callback function.

JSON data can be saved into a MySQL database by using the gjson library or the json.Unmarshal function. The gjson library provides convenience methods to parse JSON fields, and the json.Unmarshal function requires a target type pointer to unmarshal JSON data. Both methods require preparing SQL statements and performing insert operations to persist the data into the database.

Through the Go standard library database/sql package, you can connect to remote databases such as MySQL, PostgreSQL or SQLite: create a connection string containing database connection information. Use the sql.Open() function to open a database connection. Perform database operations such as SQL queries and insert operations. Use defer to close the database connection to release resources.
