SQLTeam.com | Weblogs | Forums

Unable to execute script


#1

Hi There

I trying to execute the following scripts but get the following error
I have installed SQL 2014 server as a Virtual server o Hyper-V 2012,, I am logged on as Administrator, the server is joined to my Doman. I have created a Site name for my SQL server, I have created a new database for this script,but every time I try to execute any scripts, I get the following errors.

I am new to SQL, so am unsure how t resolve this error message

Please see below

USE [master]
GO

/****** Object: Database [XD77_Log] Script Date: 2016-01-13 18:34:11 ******/
CREATE DATABASE [XD77_Log]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'XD77_Log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL12.SQLCLUSTER\MSSQL\DATA\XD77_Log.mdf' , SIZE = 5120KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'XD77_Log_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL12.SQLCLUSTER\MSSQL\DATA\XD77_Log_log.ldf' , SIZE = 2048KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO

ALTER DATABASE [XD77_Log]
COLLATE Latin1_General_100_CI_AS_KS;
GO

ALTER DATABASE [XD77_Log] SET COMPATIBILITY_LEVEL = 120
GO

IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [XD77_Log].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO

ALTER DATABASE [XD77_Log] SET ANSI_NULL_DEFAULT OFF
GO

ALTER DATABASE [XD77_Log] SET ANSI_NULLS OFF
GO

ALTER DATABASE [XD77_Log] SET ANSI_PADDING OFF
GO

ALTER DATABASE [XD77_Log] SET ANSI_WARNINGS OFF
GO

ALTER DATABASE [XD77_Log] SET ARITHABORT OFF
GO

ALTER DATABASE [XD77_Log] SET AUTO_CLOSE OFF
GO

ALTER DATABASE [XD77_Log] SET AUTO_SHRINK OFF
GO

ALTER DATABASE [XD77_Log] SET AUTO_UPDATE_STATISTICS ON
GO

ALTER DATABASE [XD77_Log] SET CURSOR_CLOSE_ON_COMMIT OFF
GO

ALTER DATABASE [XD77_Log] SET CURSOR_DEFAULT GLOBAL
GO

ALTER DATABASE [XD77_Log] SET CONCAT_NULL_YIELDS_NULL OFF
GO

ALTER DATABASE [XD77_Log] SET NUMERIC_ROUNDABORT OFF
GO

ALTER DATABASE [XD77_Log] SET QUOTED_IDENTIFIER OFF
GO

ALTER DATABASE [XD77_Log] SET RECURSIVE_TRIGGERS OFF
GO

ALTER DATABASE [XD77_Log] SET DISABLE_BROKER
GO

ALTER DATABASE [XD77_Log] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO

ALTER DATABASE [XD77_Log] SET DATE_CORRELATION_OPTIMIZATION OFF
GO

ALTER DATABASE [XD77_Log] SET TRUSTWORTHY OFF
GO

ALTER DATABASE [XD77_Log] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO

ALTER DATABASE [XD77_Log] SET PARAMETERIZATION SIMPLE
GO

ALTER DATABASE [XD77_Log] SET READ_COMMITTED_SNAPSHOT OFF
GO

ALTER DATABASE [XD77_Log] SET HONOR_BROKER_PRIORITY OFF
GO

ALTER DATABASE [XD77_Log] SET RECOVERY FULL
GO

ALTER DATABASE [XD77_Log] SET MULTI_USER
GO

ALTER DATABASE [XD77_Log] SET PAGE_VERIFY CHECKSUM
GO

ALTER DATABASE [XD77_Log] SET DB_CHAINING OFF
GO

ALTER DATABASE [XD77_Log] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )
GO

ALTER DATABASE [XD77_Log] SET TARGET_RECOVERY_TIME = 0 SECONDS
GO

ALTER DATABASE [XD77_Log] SET DELAYED_DURABILITY = DISABLED
GO

ALTER DATABASE [XD77_Log] SET READ_WRITE
GO

Msg 5133, Level 16, State 1, Line 6
Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL12.SQLCLUSTER\MSSQL\DATA\XD77_Log.mdf" failed with the operating system error 3(The system cannot find the path specified.).
Msg 1802, Level 16, State 1, Line 6
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
Msg 911, Level 16, State 1, Line 14
Database 'XD77_Log' does not exist. Make sure that the name is entered correctly.
Msg 5011, Level 14, State 5, Line 18
User does not have permission to alter database 'XD77_Log', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 18
ALTER DATABASE statement failed.
Msg 911, Level 16, State 4, Line 23
Database 'XD77_Log' does not exist. Make sure that the name is entered correctly.
Msg 5011, Level 14, State 5, Line 27
User does not have permission to alter database 'XD77_Log', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 27
ALTER DATABASE statement failed.


#2

Does this directory exist? Do you have rights on this directory? Does the security account that is running the SQL Server service have rights to this directory?


#3

In addition to what stephen_hendricks said, locating the database in C:\Program Files... is a really bad idea - sounds like the server that generated this script has default settings for database location. Unless this requirement is for a really simple database, with minimal activity, then I suggest locating it at a better place - with LDF and MDF files on separate spindles and taking advantave of any other Best Practice that is appropriate.