cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to backup database

Hi there,

can someone explain me how to backup epo database with command line of osql?
I have found articles in knwoledge base but i can´t backup database. I´m always getting error.
The command should be:

osql -U sa -P password -S C-VIRUS01\EPOSERVER -n -Q "BACKUP DATABASE [epo4_C-VIRUS01] TO DISK = ´c:\backup.bak´ WITH INIT,SKIP"

When I type this i´m getting an error:

[DBNETLIB]SQL Server doesn´t exist or no connection possible.
[DBNETLIB]ConnectionOpen (Connect())

Can someone give me a hint whats wrong?
5 Replies

RE: How to backup database

You must use the Instance Name i think.
For e.g.\\.\pipe\mssql$SQLSERVERXPRESS\sql\query

I do my Backup with the following Script:


@echo off
setlocal
::null *** DEKLARATION DER VARIABLEN ***

::null Bei SQL2000 muss osql aktiviert werden. Bei den Versionen funktioniert es zwar auch mit osql, aber es sollte sqlcmd.exe
::null aktiviert werden. Auerdem muss sich sqlcmd im Pfad befinden (Standard)
set "SQLCMDoderOSQLexe=sqlcmd.exe"
@rem set "SQLCMDoderOSQLexe=osql.exe"

::null Backupvariablen
set "backupSpeicherPfad=E:\WSUS_DB_Backup"
set "backupFileName=EPO.bak"
set "backupDBname=ePO4_WSUS3"
set "backupInstance=\\.\pipe\mssql$SQLSERVERXPRESS\sql\query -E"

::null Hier nach nichts mehr ndern...

set "backupSpeicherOrt=%backupSpeicherPfad%\%backupFileName%"
set "backupscript1=BACKUP DATABASE [%backupDBname%] TO DISK = N'%backupspeicherort%' WITH NOFORMAT, INIT, NAME = N'%backupDBname%-Vollstndig Datenbank Sichern', SKIP, NOREWIND, NOUNLOAD, STATS = 10"
set "backupscript2=GO"
set "backupscriptname=backup.sql"

::null *** ERSTELLEN DER SKRIPTE ***
echo %backupscript1% > "%~dp0\%backupscriptname%"
echo %backupscript2% >> "%~dp0\%backupscriptname%"

::null *** AUSFUEHREN DER SICHERUNG ***

sqlcmd -S %backupInstance% -i "%~dp0\%backupscriptname%"


set "backupSpeicherPfad=File Path to the Backup Folder"
set "backupFileName=Filename.bak"
set "backupDBname=Database Name"
set "backupInstance=\\.\pipe\mssql$SQLSERVERXPRESS\sql\query -E" <--- instance

When you are useing osql u have to change
set "SQLCMDoderOSQLexe=sqlcmd.exe"
@rem set "SQLCMDoderOSQLexe=osql.exe"
in
@rem set "SQLCMDoderOSQLexe=sqlcmd.exe"
set "SQLCMDoderOSQLexe=osql.exe"

RE: How to backup database

I don´t have sqlcmd.exe on the server. 😞
Only osql is present.

RE: How to backup database

Hi,
read the last lines again 😉

 


When you are useing osql u have to change
set "SQLCMDoderOSQLexe=sqlcmd.exe"
@rem set "SQLCMDoderOSQLexe=osql.exe"
in
@rem set "SQLCMDoderOSQLexe=sqlcmd.exe"
set "SQLCMDoderOSQLexe=osql.exe"

RE: How to backup database



Okay, where to set these parameters?
I´m a little bit confused now.

RE: How to backup database

In the Script i posted on line 7 and 8.

Then change the Variables to your Setup

line 11-14
set "backupSpeicherPfad=File Path to the Backup Folder"
set "backupFileName=Filename.bak"
set "backupDBname=Database Name"
set "backupInstance=\\.\pipe\mssql$SQLSERVERXPRESS\sql \query -E" <--- instance

Then run the Script in the Dos Box or as Task and it should work.

I dont know an other way to do an Backup of the Epo Database.
Perhaps someone others know.
You Deserve an Award
Don't forget, when your helpful posts earn a kudos or get accepted as a solution you can unlock perks and badges. Those aren't the only badges, either. How many can you collect? Click here to learn more.

Community Help Hub

    New to the forums or need help finding your way around the forums? There's a whole hub of community resources to help you.

  • Find Forum FAQs
  • Learn How to Earn Badges
  • Ask for Help
Go to Community Help

Join the Community

    Thousands of customers use the McAfee Community for peer-to-peer and expert product support. Enjoy these benefits with a free membership:

  • Get helpful solutions from McAfee experts.
  • Stay connected to product conversations that matter to you.
  • Participate in product groups led by McAfee employees.
Join the Community
Join the Community