sql-server – RAW分区上的CREATE DATABASE不再有效?

前端之家收集整理的这篇文章主要介绍了sql-server – RAW分区上的CREATE DATABASE不再有效?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试使用两个原始(即未格式化的)分区创建数据库.

Microsoft Docs声明您可以这样做,您只需要指定原始分区的驱动器号,如下所示:

CREATE DATABASE DirectDevice 
ON (NAME = DirectDevice_system,FILENAME = 'S:')
LOG ON (NAME = DirectDevice_log,FILENAME = 'T:')

但是,sql Server 2017返回此错误

Msg 5170,Level 16,State 4,Line 1
Cannot create file ‘S:’ because it already exists. Change the file path or the file name,and retry the operation.
Msg 1802,Line 1
CREATE DATABASE Failed. Some file names listed could not be created. Check related errors.

documentation的相关位指出:

If the file is on a raw partition,os_file_name must specify only the drive letter of an existing raw partition. Only one data file can be created on each raw partition.

是的,驱动器S:和T:都是我系统中存在的未格式化的原始分区:

DISKPART> detail partition

Partition 4
Type    : ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
Hidden  : No
required: No
Attrib  : 0000000000000000
Offset in Bytes: 999934656512

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
* Volume 6     T                RAW    Partition    127 MB  Healthy

DISKPART> select partition 3

Partition 3 is now the selected partition.

DISKPART> detail partition

Partition 3
Type    : ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
Hidden  : No
required: No
Attrib  : 0000000000000000
Offset in Bytes: 1000067825664

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
* Volume 7     S                RAW    Partition    129 MB  Healthy

从驱动器号中删除冒号,如FILENAME =’S’和FILENAME =’T’,会导致:

Msg 5105,State 2,Line 1
A file activation error occurred. The physical file name ‘S’ may be incorrect. Diagnose and correct additional errors,State 1,Line 1
CREATE DATABASE Failed. Some file names listed could not be created. Check related errors.

SQL Server 2000 Documentation显示了CREATE DATABASE部分下的以下示例:

H. Use raw partitions
This example creates a database called Employees using raw partitions. The raw partitions must exist when the statement is executed,and only one file can go on each raw partition.

USE master
    GO
    CREATE DATABASE Employees
    ON
    ( NAME = Empl_dat,FILENAME = 'f:',SIZE = 10,MAXSIZE = 50,FILEGROWTH = 5 )
    LOG ON
    ( NAME = 'Sales_log',FILENAME = 'g:',SIZE = 5MB,MAXSIZE = 25MB,FILEGROWTH = 5MB )
    GO

但是,上面的示例显示了SIZE,MAXSIZE和FILEGROWTH参数,这些参数显然不是存储在RAW分区上的sql Server数据文件所必需的.

sql Server 2000文档中的更多详细信息,特别是有关原始驱动器的信息:

Using Raw Partitions
Microsoft® sql Server™ 2000 supports the use of raw partitions for creating database files. Raw partitions are disk partitions that have not been formatted with a Microsoft Windows NT® file system,such as FAT and NTFS. In some cases,using databases created on raw partitions can yield a slight performance gain over NTFS or FAT. However,for most installations the preferred method is to use files created on NTFS or FAT partitions.
When creating a database file on a raw partition,you do not specify the physical names of the files comprising the database; you specify only the drive letters of the disks on which the database files should be created.
If you are using Microsoft Windows® 2000 Server,you can create mounted drives to point to raw partitions. When you mount a local drive at an empty folder,Windows 2000 assigns a drive path to the drive rather than a drive letter. Mounted drives are not subject to the 26-drive limit imposed by drive letters; therefore,you can use an unlimited number of raw partitions. When you create a database file on a mounted drive,you must end the drive path to the file name with a trailing backslash (),for example,E:\Sample name. For information about creating a mounted drive,see the Windows 2000 Server documentation.

There are several limitations to consider when using raw partitions:
Only one database file can be created on each raw partition. The logical partition must be configured as a single database file,because there is no file system on the raw partition.

Standard file-system operations such as copy,move,and delete cannot be used with raw partitions.

Database files located on raw partitions cannot be backed up using the Windows NT Backup utility. However,sql Server database or transaction log backups can still be created.

Database files on raw partitions cannot be automatically expanded. Either initially create the database at its full size,or manually expand the database files. For more information,see Expanding a Database.

Only lettered partitions,such as E:,or mounted drives,such as E:\Sample name\ can be used. Numbered devices cannot be used.

File-system services such as bad block replacement are not available with raw partitions.

这是受到Brent Ozar’s post about SQL Server 6.5的启发,它支持原始分区

解决方法

我可以在Windows XP x64上使用sql Server 2000 SP4确认原始分区是否正常工作.

我刚刚通过查询分析器(颤抖)对sql Server 2000 SP4运行以下内容

CREATE DATABASE t
ON PRIMARY 
(
    NAME = t_primary,FILENAME = 'E:'
)
LOG ON 
(
    NAME = t_log,FILENAME = 'F:'
);

结果:

The CREATE DATABASE process is allocating 0.64 MB on disk ‘t_primary’.
The CREATE DATABASE process is allocating 1.00 MB on disk ‘t_log’.

上面的CREATE DATABASE t代码适用于Windows XP x64上的sql Server 2005;唯一的输出是Command(s)成功完成.

查看数据库文件时,SSMS显示以下内容

这不像一桶螺栓那么酷吗?

Windows Server 2012 Standard上的sql Server 2012 SP1,sql Server Management Studio服务帐户设置为“本地系统”:

在Windows Server 2012上作为“本地系统”运行的sql Server 2014(12.0.5000.0)表现出与sql Server 2017相同的行为;即,它返回此错误消息:

Msg 5170,Line 1 Cannot create file ‘E:’ because it already exists. Change the file path or the file name,and retry the operation. Msg 1802,Line 1 CREATE DATABASE Failed. Some file names listed could not be created. Check related errors.

原文链接:https://www.f2er.com/mssql/79501.html

猜你在找的MsSQL相关文章