Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

Having Trouble with first SQL 2012 Database Expand / Collapse
Author
Message
Posted Thursday, April 11, 2013 8:01 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, January 7, 2014 12:24 PM
Points: 39, Visits: 110
Just moved from learning mysql to SQL Server 2012, and already having an issue.

Here is my code:
CREATE DATABASE ApressFinancial ON PRIMARY
( Name = N' ApressFinancial ',
FILENAME = N' C:\Program Files\Microsft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\APRESSFINANCIAL.mdf' ,
SIZE = 4096KB ,
MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME= N'ApressFinancial_log',
FILENAME= N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\APRESSFINANCIAL_log.ldf' ,
SIZE = 1024KB, MAXSIZE = 2048GB, FILEGROWTH = 10%)
COLLATE SQL_LATIN1_General_CP1_CI_AS
GO

Here is my error

Msg 5105, Level 16, State 2, Line 1
A file activation error occurred. The physical file name ' C:\Program Files\Microsft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\APRESSFINANCIAL.mdf' may be incorrect. Diagnose and correct additional errors, and retry the operation.
Msg 1802, Level 16, State 1, Line 1
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
Post #1441531
Posted Thursday, April 11, 2013 8:48 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Sunday, October 19, 2014 3:52 PM
Points: 364, Visits: 385
Looks like a typo in your file path

CREATE DATABASE ApressFinancial ON PRIMARY ( 
Name = N' ApressFinancial ',
FILENAME = N' C:\Program Files\Microsft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\APRESSFINANCIAL.mdf' ,
SIZE = 4096KB ,
MAXSIZE = UNLIMITED,
FILEGROWTH = 1024KB )
LOG ON (
NAME= N'ApressFinancial_log',
FILENAME= N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\APRESSFINANCIAL_log.ldf' ,
SIZE = 1024KB,
MAXSIZE = 2048GB,
FILEGROWTH = 10%)
COLLATE SQL_LATIN1_General_CP1_CI_AS

"Microsft SQL Server" is missing an "o"
Post #1441543
Posted Thursday, April 11, 2013 9:04 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, January 7, 2014 12:24 PM
Points: 39, Visits: 110
wow. I'm an idiot. Thank you so much
Post #1441545
Posted Thursday, April 11, 2013 9:21 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Sunday, October 19, 2014 3:52 PM
Points: 364, Visits: 385
No worries, it happens to all of us at some point

Also, here are a couple of newbie-unfriendly defaults that you may wish to change:

1. Please consider moving the database to somewhere other than the C: drive if at all possible

2. Either set the database Recovery Model to Simple, or set up regular transaction log backups
Post #1441550
Posted Thursday, April 11, 2013 9:34 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, January 7, 2014 12:24 PM
Points: 39, Visits: 110
Ah ok I thought it would be best to start practicing with full recovery as in a production environment but I get your point starting out.
Post #1441556
Posted Friday, April 12, 2013 8:11 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, January 7, 2014 12:24 PM
Points: 39, Visits: 110
Just tried it again.

Msg 5105, Level 16, State 2, Line 1
A file activation error occurred. The physical file name ' C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\APRESSFINANCIAL.mdf' may be incorrect. Diagnose and correct additional errors, and retry the operation.
Msg 1802, Level 16, State 1, Line 1
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.


Does it have anything to do with the whole sql server folder being read only?
Post #1441724
Posted Friday, April 12, 2013 12:53 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, January 7, 2014 12:24 PM
Points: 39, Visits: 110
anyone?
Post #1441852
Posted Friday, April 12, 2013 1:19 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 10:03 AM
Points: 40,385, Visits: 36,829
You've got a space before C:. ' C:\' chould be 'C:\' Directories never have a space at the beginning

btw, we're all volunteers here, we all post in our spare time, we don't work for SSC.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1441874
Posted Friday, April 12, 2013 2:09 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, January 7, 2014 12:24 PM
Points: 39, Visits: 110
Oh I know don't mistake my impatience for arrogance or whatever. You guys are amazing helpers. I just was getting really frustrated. And it worked so you've done me a great favor. I need to learn how to really look at the syntax, I just hope it's rookie mistakes.
Post #1441919
Posted Friday, April 12, 2013 4:07 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, January 7, 2014 12:24 PM
Points: 39, Visits: 110
This may be a stupid question but everytime I make a new command or query with T-SQL, do I have to open up a new query window or can I just delete the previous query and type in the blank of said query?
Post #1441953
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse