Microsoft SQL Express 2005 database backup automation problem / error ( command line )

I am trying to automate backing up a daatabase in MS SQLExpress 2005 and am doing it from the command line. The exact command I am issuing (the same box that SQL exist on) is:

SqlCmd -E -S (Local) -Q"BACKUP DATABASE [control_point] TO DISK = N'c:\backup\control_point.B
ak' WITH FORMAT, INIT, NAME = N'Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10"

When issued I get the following errors:

HResult 0x7E, Level 16, State 1
VIA Provider: The specified module could not be found.
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.

I know that remote connections are allowed. I found the syntax to use from the command line online. Any help resolving the matter would truly be appreciated.

bkailaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Cedric_DCommented:
You should specify credentials for sqlcmd to access SQL Sever.



-E option means trusted connection, i.e. windows authentification for logged-on user.

To test it, login first in SQL Management Studio to (Local) db with the Windows Authentification.

If it works, then probably you use your call in Task Scheduler which is run without logon. Then you should specify username and password at Task Scheduler.

The other reason could be - you have named instance, so you should specify -S SEVERNAME\INSTANCENAME or -S IP-address\INSTANCENAME

And again, test it with SQL Studio first.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bkailaAuthor Commented:
Your awesome!
It was the SEVERNAME\INSTANCENAME that did it

What would the switches be if if you could only use SQL (sa) authentication?

Thank you!
0
bkailaAuthor Commented:
What would the switches be if if you could only use SQL (sa) authentication?
0
Cedric_DCommented:
To use SQL Authentication instead of Windows, you have to replace -E switch with "-U user -P password" switches.
0
bkailaAuthor Commented:

Thank you again Cedric!!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.