Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi I am running SQL server 201

Status
Not open for further replies.

victory2461

Technical User
Feb 12, 2016
1
GB
Hi

I am running SQL server 2014

I am trying to execute 3 separate scripts.

I always get the same error messages

Below, is one of the SQL scripts that I am trying to execute, it gives the error messages at the bottom of the script

I am new to SQL, I have installed SQL 2014 server on Hyper=V 2012 server as a virtual server. It is on my network, and is connected to my Domain

I am the Administrator and the SQL server that I am using has a site name, I have also installed SQL studio Manager

(Please view the below script)


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
 
error pretty clear - "C:\Program Files\Microsoft SQL Server\MSSQL12.SQLCLUSTER\MSSQL\DATA" either does not exist or the user under which the sql server instance is running does not have access to it.

note that the directory where you try to create the database needs to be on the machine where you installed SQL Server.



Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
By the way, after you straighten out the path issue, best practice is to have your primary and log files on different drives from each other.

Dave [idea]
[]
 
Victory,

welcome here.

You haven't seen you don't have that path on your own installation. You most probably generated that script from an exising database and on the computer it came from the path of the database is as given in this script. So you learn the hard way the generated scripts are not friendly for usage on any other PC, you need to adjust this path to your computer in many places of the script.

This has very little to do with your sql knowledge level, paths to files are a very common thing in all applications. A path doesn't exist here, most probably. Does it?
So, as I already wrote in these two variations in thread436-1764393:

1. Adapt the code, use paths, which exist on your system.
2. Adjust the parts of the script pointig to disk paths you don't have on your machine.

Bye, Olaf.
 
After you adjusted the script to your installation, you'll see, that this script really just creates the database files, the mdf data file and the ldf transaction log file. There are no tables generated and no data is inserted. It makes quite some extensive settings you might or might not need, but roughly you'd have it much easier to simply create a new empty database with the Sql Server Management Studio (SSMS) by right click on the Dataabses node and use the "new database" context menu item, then follow instructions. Not only because a wizard and visul form is easier to use for a novice, but mostly, because your server installation knwos, where it has it's databases default folder and it will exist on your computer, therefore.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top