snippetsqlMinor
CREATE DATABASE on RAW partitions no longer works?
Viewed 0 times
createlongerdatabaserawworkspartitions
Problem
I'm attempting to create a database using two raw, i.e. unformatted, partitions.
Microsoft Docs states you can do this, you simply need to specify only the drive letter of the raw partition, as in:
However, SQL Server 2017 returns this error:
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, Level 16, State 4, Line 1
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
The pertinent bit of the documentation states:
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.
And yes, drive S: and T: are both unformatted raw partitions that do exist in my system:
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
Removing the colon from the drive letters, as in
Msg 5105, Level 16, State 2, Line 1
A
Microsoft Docs states you can do this, you simply need to specify only the drive letter of the raw partition, as in:
CREATE DATABASE DirectDevice
ON (NAME = DirectDevice_system, FILENAME = 'S:')
LOG ON (NAME = DirectDevice_log, FILENAME = 'T:')However, SQL Server 2017 returns this error:
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, Level 16, State 4, Line 1
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
The pertinent bit of the documentation states:
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.
And yes, drive S: and T: are both unformatted raw partitions that do exist in my system:
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
Removing the colon from the drive letters, as in
FILENAME = 'S' and FILENAME = 'T', results in:Msg 5105, Level 16, State 2, Line 1
A
Solution
I can confirm raw partitions work, as expected, with SQL Server 2000 SP4 on Windows XP x64.
I just ran the following through Query Analyzer (shudders) against SQL Server 2000 SP4:
The results:
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'.
The above
SSMS shows the following when you look at the database files:
Isn't that about as cool as a bucket of bolts?
SQL Server 2012 SP1 on Windows Server 2012 Standard, with SQL Server Management Studio service account set to "Local System":
SQL Server 2014 (12.0.5000.0) running as "Local System" on Windows Server 2012 exhibits the same behavior as SQL Server 2017; i.e., it returns this error message:
Msg 5170, Level 16, State 4, Line 1
Cannot create file 'E:' because it already exists. Change the file path or the file name, and retry the operation.
Msg 1802, Level 16, State 4, Line 1
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
I just ran the following through Query Analyzer (shudders) against SQL Server 2000 SP4:
CREATE DATABASE t
ON PRIMARY
(
NAME = t_primary
, FILENAME = 'E:'
)
LOG ON
(
NAME = t_log
, FILENAME = 'F:'
);The results:
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'.
The above
CREATE DATABASE t code works with SQL Server 2005 on Windows XP x64; the only output is Command(s) completed successfully.SSMS shows the following when you look at the database files:
Isn't that about as cool as a bucket of bolts?
SQL Server 2012 SP1 on Windows Server 2012 Standard, with SQL Server Management Studio service account set to "Local System":
SQL Server 2014 (12.0.5000.0) running as "Local System" on Windows Server 2012 exhibits the same behavior as SQL Server 2017; i.e., it returns this error message:
Msg 5170, Level 16, State 4, Line 1
Cannot create file 'E:' because it already exists. Change the file path or the file name, and retry the operation.
Msg 1802, Level 16, State 4, Line 1
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
Code Snippets
CREATE DATABASE t
ON PRIMARY
(
NAME = t_primary
, FILENAME = 'E:'
)
LOG ON
(
NAME = t_log
, FILENAME = 'F:'
);Context
StackExchange Database Administrators Q#205749, answer score: 3
Revisions (0)
No revisions yet.