Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 osql attach db fails with -S option

Author  Topic 

kittu_s
Starting Member

3 Posts

Posted - 2005-11-01 : 23:05:34
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

nr
SQLTeam MVY

12543 Posts

Posted - 2005-11-02 : 11:48:19
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
   

- Advertisement -