SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 osql attach db fails with -S option
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kittu_s
Starting Member

3 Posts

Posted - 11/01/2005 :  23:05:34  Show Profile  Reply with Quote
Hi,

I am facing a problem with permissions while creating a database using script (i am using SQL Express database).

I am excuting a script using following command

osql -E -S <servername>\<instancename> -i <scriptpath> -o <log file name>

It is throwing the below error (copied from log file)
"1> 2> 3> 4> 5> 6> 7> Msg 1802, Level 16, State 4, Server DEV2\SMSPUBTOOL, Line 3
CREATE DATABASE failed. Some file names listed could not be created.
Check related errors.
Msg 5123, Level 16, State 1, Server DEV2\SMSPUBTOOL, Line 3
CREATE FILE encountered operating system error 5(Access is denied.)
while attempting to open or create the physical file 'C:\Program
Files\Microsoft Publishing Tool\DATA\pubDB_Data.MDF'.
1> 2> 3> Msg 15010, Level 16, State 1, Server DEV2\SMSPUBTOOL, Procedure sp_dboption, Line 64
The database 'pubDB' does not exist. Use sp_helpdb to show available
databases."


This problem occurs only if i give "program files" path for creating mdf and ldf files.
But i have admin previliges on the machine.
Can some doby suggest me if any other approach for creating database.

Thanks a lot for help

Krishna.s


Edited by - kittu_s on 11/02/2005 00:46:20

nr
SQLTeam MVY

United Kingdom
12543 Posts

Posted - 11/02/2005 :  11:48:19  Show Profile  Visit nr's Homepage  Reply with Quote
Looks like you are trying to create 'C:\Program Files\Microsoft Publishing Tool\DATA\pubDB_Data.MDF'
which is the database file.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000