cancel
Showing results for 
Search instead for 
Did you mean: 

problem restoring database

Former Member
10,259

Hi all,

I'm not able to restore a database from a 5.5 version to a 12 version. I'm getting the following error:

The database archive 'E:\\MICHAEL LS\\VANDEMOORTELE\\Vdm.db' could not be restored on the server '_sc069543125'.
Error during backup/restore: unable to open device E:\\MICHAEL LS\\VANDEMOORTELE\\Vdm.db (Unknown err status reading HDR labels)
[Sybase][ODBC Driver][SQL Anywhere]Error during backup/restore: unable to open device E:\\MICHAEL LS\\VANDEMOORTELE\\Vdm.db (Unknown err status reading HDR labels)
SQLCODE: -697
SQLSTATE: HY000
SQL Statement: RESTORE DATABASE 'Vdm.db' FROM 'E:\\MICHAEL LS\\VANDEMOORTELE\\Vdm.db'

Accepted Solutions (0)

Answers (3)

Answers (3)

Breck_Carter
Participant

The RESTORE DATABASE statement only works for backups created with the BACKUP DATABASE TO format of the BACKUP statement, which is intended to create an all-in-one-single-file backup of both database and transaction log in a single file on magnetic tape.

The BACKUP statement didn't exist in version 5.5, so by definition your file 'E:MICHAEL LS\\VANDEMOORTELE\\Vdm.db' is NOT a "database archive", which is SQL-Anywhere-speak for a tape backup.

Instead, your file 'E:\\MICHAEL LS\\VANDEMOORTELE\\Vdm.db' is a much simpler "image backup", which is actually a copy of the original database.

So... you don't need to run any kind of "restore" process, but you do have to "upgrade" the database to Version 12; sadly, unlike versions 6, 7, 8 and 9, versions 10 through 12 can't start a version 5 database until it has been upgraded.

The following script demonstrates how to upgrade using the version 12 dbunload utility.

REM If you're a command-line kinda guy, here is my template Windows 
REM batch file run_dbunload_upgrade_v5_to_v12.bat. It does the 
REM unload-reload-all-in-one-dbunload-step, then starts dbeng12 
REM and dbisql so you can make sure the new database is up and running.

REM Be sure to stop *all* database engines on the computer you're using, 
REM before starting the upgrade.

REM dbunload...
REM -an ...  where to put new database
REM -ap ...  new database page size
REM -c ...   old database startup connection string
REM -o ...   where to put unload console display text file
REM -v       verbose mode for console display

PAUSE MAKE SURE YOU DO NOT HAVE ANY ENGINES RUNNING.

"%SQLANY12%\\bin32\\dbunload.exe"^
  -an ddd12.db^
  -ap 4096^
  -c "DBF=sademo.db;UID=dba;PWD=sql"^
  -o dbunload_log_sademo.txt^
  -v

PAUSE dbunload/reload done...

"%SQLANY12%\\bin32\\dbspawn.exe"^
  -f "%SQLANY12%\\bin32\\dbeng12.exe"^
  -o dbeng12_log_ddd12.txt^
  ddd12.db

PAUSE dbeng12 started...

"%SQLANY12%\\bin32\\dbisql.exe"^
  -c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"

PAUSE dbisql running...

V12 supports only V10 and later databases. Use 5.5 server.

Former Member
0 Kudos

thanks for the help. I've indeed restored the database in my sql anywhere 12 version but I'm not able to connect with jdbc to the database.

I'm using the following jdbc url (with and without the databasename) with a user and password to get a connection but I'm receiving a login failed:

DBURL=jdbc:jtds:sybase://localhost:2638/test

yet I'm able to run the dbisql.exe in command line

dbisql.exe -c "ENG=test;DBN=test;UID=$USERID;PWD=$PASSWORD"

could someone tell what I'm doing wrong when trying to connect?

justin_willey
Participant
0 Kudos

I suggest you post this as a new question rather than as an answer to the original - that way it's much more likely to be noticed by someone who can help.

VolkerBarth
Contributor
0 Kudos

IMHO, the jConnect URL seems somewhat unusual, cf. this sample from the docs:

"jdbc:sybase:Tds:localhost:2638"

or - when specifying a particular database on the server

"jdbc:sybase:Tds:host:port?ServiceName=database"

jeff_albion
Product and Topic Expert
Product and Topic Expert
0 Kudos

If you're really attempting to use jTDS as your JDBC driver, you should review the answer to this question - it likely will not work as you expect.

Trying jTDS within SQuirreL SQL also does not connect successfully for me to a version 12 SQL Anywhere database - it immediately disconnects.


If you wish/need to use a Type-4 JDBC driver with SQL Anywhere, we would instead recommend using jConnect.

If you can move to a mixed native-managed solution, the Sybase SQL Anywhere JDBC Type-1 driver is generally more efficient when accessing the SQL Anywhere database server. See the technical document page here and the blog entries here and here for more information.

For a historical list of how the iAnywhere JDBC driver has been used (which may help clarify older documentation), see the blog entry here.