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:
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
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!
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
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.