Tuesday, March 27, 2012

backup sql with sripts

I have database in sql 'crmsource.mdf" I like to automate a backup for it.
OSQL -Usa -PmyPasword -n -Q "BACKUP DATABASE crmsource TO DISK =
'c:\backup\crmsource.dat_bak'"
I get an error:
[shared memory] SQL Server does not exist or access denied.
[shared memory]connectionOpen <connect>>.
Am I haveing this problem because the database is open? Is there a way to
backup without closing the database?
No you wont need to close the DB, you want to perform a hot backup. Hot
backups are done during the database is in use.
Make sure that you are heading for the right server with specifying the
server you wan to connect and issue the command via the
switch -SServername[\InstanceName].
If you aalready stuck with this, read the article
http://support.microsoft.com/default...;en-us;Q328306 that will
guide you to identify your problem.
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
"gemirkhanian@.hotmail.com"
<gemirkhanianhotmailcom@.discussions.microsoft.com> schrieb im Newsbeitrag
news:263E0B7C-D7AB-4474-A074-D3B177DD6CF3@.microsoft.com...
>I have database in sql 'crmsource.mdf" I like to automate a backup for it.
> OSQL -Usa -PmyPasword -n -Q "BACKUP DATABASE crmsource TO DISK =
> 'c:\backup\crmsource.dat_bak'"
> I get an error:
> [shared memory] SQL Server does not exist or access denied.
> [shared memory]connectionOpen <connect>>.
> Am I haveing this problem because the database is open? Is there a way to
> backup without closing the database?
|||Hello Jens
I created a batch file, content of the batch file is
OSQL -Sfs5-win\grouplink -Usa -Ppassword -n "BACKUP DATABASE crmsource TO
DISK" = 'c:\backup\crmsource.dat_bak'
I now get a syntax error.
I am still trying to automate a backup please help.
"Jens Sü?meyer" wrote:

> No you won′t need to close the DB, you want to perform a hot backup. Hot
> backups are done during the database is in use.
> Make sure that you are heading for the right server with specifying the
> server you wan to connect and issue the command via the
> switch -SServername[\InstanceName].
> If you aalready stuck with this, read the article
> http://support.microsoft.com/default...;en-us;Q328306 that will
> guide you to identify your problem.
> HTH, Jens Suessmeyer.
> --
> http://www.sqlserver2005.de
> --
>
> "gemirkhanian@.hotmail.com"
> <gemirkhanianhotmailcom@.discussions.microsoft.com> schrieb im Newsbeitrag
> news:263E0B7C-D7AB-4474-A074-D3B177DD6CF3@.microsoft.com...
>
>
|||What always helps in newsgroups is the exact error information, becasue
syntax errors are a wide range to search for, i guess in your examples you
didnt put the quotes right around that and that qour switch isnt mentioned
in a right way you, the best way is to use the -Q for the Query you want to
execute:
OSQL -Sfs5-win\grouplink -Usa -Ppassword -n -Q"BACKUP DATABASE crmsource TO
DISK = 'c:\backup\crmsource.dat_bak'"
That should work via Copy & Paste.
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
"gemirkhanian@.hotmail.com"
<gemirkhanianhotmailcom@.discussions.microsoft.com> schrieb im Newsbeitrag
news:65E020C3-67CB-4EDE-9E88-AF6B0994240B@.microsoft.com...[vbcol=seagreen]
> Hello Jens
> I created a batch file, content of the batch file is
> OSQL -Sfs5-win\grouplink -Usa -Ppassword -n "BACKUP DATABASE crmsource TO
> DISK" = 'c:\backup\crmsource.dat_bak'
> I now get a syntax error.
> I am still trying to automate a backup please help.
>
> "Jens Smeyer" wrote:

No comments:

Post a Comment