• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 937
  • Last Modified:

sql server: Directory lookup for the file "C:\sqldata\bdPruebas.mdf" failed with the operating system error 2(The system cannot find the file specified.).

i have this code:
create database demoFilegroups
on primary
(
      name = 'bdPruebas',
      filename = 'C:\sqldata\bdPruebas.mdf',
      size = 3, maxsize=500, filegrowth=2
),
filegroup secondary
(
      name = 'bdPruebas_sec1',
      filename = 'C:\sqldata\bdPruebas_sec1.ndf',
      size = 3, maxsize=500, filegrowth=2
),
(
      name = 'bdPruebas_sec2',
      filename = 'C:\sqldata\bdPruebas_sec2.ndf',
      size = 3, maxsize=500, filegrowth=2
)
log on
(
name = 'bdPruebas_log',
filename = 'C:\sqllog\bdPruebas.ldf',
size = 40, maxsize=500, filegrowth=2
)

i execute
but i have this error

Msg 5133, Level 16, State 1, Line 1

Directory lookup for the file "C:\sqldata\bdPruebas.mdf" failed with the operating system error 2(The system cannot find the file specified.).

Msg 1802, Level 16, State 1, Line 1

CREATE DATABASE failed. Some file names listed could not be created. Check related errors.

0
enrique_aeo
Asked:
enrique_aeo
  • 2
  • 2
1 Solution
 
Ryan McCauleyCommented:
I hate to ask the obvious, but does that folder exist? SQL won't create it on its own, but needs that folder to already exist so it can create files.
0
 
enrique_aeoAuthor Commented:
the folder exists. Even copy the path and put it in Start / Run and Windows Explorer showed
0
 
Ryan McCauleyCommented:
Does the SQL Server account have access to that path? Not sure what account the SQL Server service is running as - if it's something like Network Service, though, or a domain user, you'll need to grant read/write access to that path. If it's not able to write files there, it treats it like it doesn't exist.
0
 
enrique_aeoAuthor Commented:
was a permissions problem
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now