2

I am trying to create a site collection with its dedicated content database in SharePoint 2010. To that end, I am trying to use powershell with New-SPContentDatabase command. Here is the command I run:

PS C:\> New-SPContentDatabase -Name "WSS_Content_DB_Custom" -DatabaseServer "DBServer_" -WebApplication "https://SPWebApplicationUrl.com" | out-null

When I run this command, this is the error I get:

New-SPContentDatabase : Directory lookup for the file "E:\Databases\WSS_Content_DB_Custom.mdf" failed with the operating system error 3(The system cannot find the path specified.).

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

At line:1 char:22

+New-SPContentDatabase <<<< -Name "WSS_Content_DB_Custom" -DatabaseServer "DBServer_" -WebApplication "https://SPWebApplicationUrl.com" | out-null

+CategoryInfo : InvalidData: (Microsoft.Share...ContentDatabase: SPCmdletNewContentDatabase) [New-SPContentDatabase], SqlException

+FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewConte ntDatabase

I have checked online for any possible resolution, but no hint avail. I just dont understand why the command is looking on the E: for the mdf file.

Edit: Additional details:
My db server is responding to ping request and my other mdf files in the db server is stored in F:/

4
  • Did you check the default path for creation of new DBs in sql server? See msdn.microsoft.com/en-us/library/dd206993.aspx
    – Akhoy
    Aug 27 '15 at 21:32
  • yes, that is the first thing i checked and it is set to F: for the mdf files.
    – Tom
    Aug 27 '15 at 21:48
  • You could try to create a database manually in SQL-Server Management Studio to isolate the error to SQL-Server or to SharePoint. Does Drive E: even exist on your SQL-Server? Another Idea: Look at the MDF-File in your "model" database, as this is the template for new databases.
    – MHeld
    Aug 28 '15 at 8:09
  • E;/ does not even exist in the server. But, the solution was to restart the sql server service. Looks like initially the files were stored in E:/ and then moved to F:/ But during that transition the services were not restarted.
    – Tom
    Aug 28 '15 at 19:26
1

The only explanation to this issue falls along the line of what @Akhoy has suggested. You may have the DB path set to F:/ but, perhaps you need to restart your SQL Server/ Agent Service.

0

I stumbled upon the same problem lately and i will try to clarify some things to anyone that might be searching for a proper solution.

This error does not come from the Sharepoint Central Administration, but occurs on the SQL Server of the Sharepoint Farm.

In my case, someone had switch the default Database location(a setting that anyone with the correct rights on the SQL Server can find by right clicking on the SQL Server on the DB servers tab of SSMS and navigation to Database settings) and the SQL Server could not create the Database to a not existing Disk (for example H:).

This happenes because when a command from the Central Administration is issued in order to make a new Content Database, the SQL Server uses the Default Database Location in order to create the MDF and LDF files. In case the Dist letter is non-existent the SQL Server cannot create the Database and the Administrator is presented with the above error.

In order to fix it, the Admin will have to switch the Default Database Location to a valid Disk space and perform an Sql Services restart, because the setting is written to the registry and will be seen on the SQL Server after the Sql Services restart.

Below some links that point to the solution.

  1. https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2012/dd206993(v=sql.110)?redirectedfrom=MSDN

  2. https://thomaslarock.com/2015/02/changing-default-database-file-locations-in-sql-server/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.