I've inherited an old SQL Anywhere 8 database on which I'm trying to perform regular backups via the DBBACKUP command line. I have no prior experience with Sybase or SQL Anywhere. I've only been able to get it working using the following command line when the database is offline:

dbbackup -c "dbf=D:\Data\database.db;uid=DBA;pwd=sql" D:\Data\Backup

However, I don't know how to either 1) perform the backup while the database is active (preferred), or to 2) gracefully stop the database in order to perform the backup using the above command line. When I try the above command while the database is active, I get the error: "Specified database is invalid". So I've tried another command:

dbbackup -c "ENG=servername;DBN=database;UID=DBA;PWD=sql" D:\Data\Backup

And get the error: "Specified database not found."

I'm not familiar with the Connection Parameters, so perhaps I am using the wrong ones. For ENG I'm using the hostname of the server and for DBN I'm using the name of the database specified when starting the database: dbsrv8.exe -n database D:\Data\database.db Is this correct?

This is on Windows Server 2012. One thing of note is that when I first set this up, I configured the ODBC (32-bit) connection and the database would start and run automatically (but only as that user?). At some point I had to revert back to how we started it on the old server: I have a monitor that checks if the process dbsrv8.exe is running and if not starts it up running as the System account using the command dbsrv8.exe -n database D:\Data\database.db. This way the database will start up soon after a reboot without having log in and manually start it.

Any recommendations on how to either 1) perform the backup while the database is active (preferred), or to 2) gracefully stop the database in order to perform the backup.

Thanks for any advice or suggestions!

asked 31 Dec '13, 11:33

Breck_Jeff's gravatar image

Breck_Jeff
30112
accept rate: 0%

edited 31 Dec '13, 12:12

Graeme%20Perrow's gravatar image

Graeme Perrow
8.5k371109


If the database is not running (as in your first example), running dbbackup is not necessary - you can simply copy the files:

copy D:\Data\database.db D:\Data\Backup\
copy D:\Data\database.log D:\Data\Backup\

If you have any dbspaces, you'll have to copy those as well. The dbbackup command will do the same thing (and in a single statement), but will be much slower.

If you want to back up a database that is running, you need to give dbbackup the server name that use used when starting the server. In your case, with the command line of dbsrv8.exe -n database D:\Data\database.db, the first "database" is the server name (after the -n), and second "database" is the database name (the name of the file without the ".db" extension). So your dbbackup command should be:

dbbackup -c eng=database;dbn=database;uid=dba;pwd=sql D:\Data\Backup

If you are running on a different machine, or the server is running as a service, then shared memory will not work and you need to tell dbbackup to use TCP/IP to connect to the server. To do this, you'd add the LINKS parameter:

dbbackup -c eng=database;dbn=database;uid=dba;pwd=sql;links=tcpip D:\Data\Backup

If you still can't connect, it's possible you need more TCP/IP parameters in order to find the server (for example, if the server is running on a different subnet, or there is a firewall involved). For v12 or later clients, you should use the HOST parameter. For earlier clients, there are a number of TCP/IP parameter to use; the v11 documentation is here.

permanent link

answered 31 Dec '13, 12:19

Graeme%20Perrow's gravatar image

Graeme Perrow
8.5k371109
accept rate: 52%

edited 31 Dec '13, 16:44

Graeme, thanks for the suggestion. I just tried

dbbackup -c eng=database;dbn=database;uid=dba;pwd=sql D:DataBackup

but still get the error "Specified database not found."

Any other ideas?

(31 Dec '13, 15:09) Breck_Jeff
Replies hidden

Are you running this on the same machine where the server is running? Is the server running as a service or under a different user account?

(31 Dec '13, 15:25) Graeme Perrow

Yes, this is on the same machine as the SQL Anywhere server. The server is run using "dbsrv8.exe -n database D:Datadatabase.db" run under the System account.

(31 Dec '13, 16:30) Breck_Jeff
Replies hidden
2

Ah - if the server is running under System, then shared memory won't work. You'll need to add the LINKS parameter to your connection string to tell dbbackup to use TCP/IP to find the server. Your new command would be:

dbbackup -c eng=database;dbn=database;uid=dba;pwd=sql;links=tcpip D:\Data\Backup

(31 Dec '13, 16:34) Graeme Perrow

Looks like that did the trick! I just had to add "LINKS=tcpip" to the connection paramters!

(02 Jan '14, 10:59) Breck_Jeff
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×72
×34
×31

question asked: 31 Dec '13, 11:33

question was seen: 3,565 times

last updated: 02 Jan '14, 10:59