I am using this command to back up a database:
osql -S (local) -E -Q "backup database mydb to disk = 'mydb.bak' WITH STATS = 10"
I am then using this command to restore:
osql -S (local) -E -Q "RESTORE DATABASE mydb2 FROM DISK = 'mydb.bak' WITH MOVE 'mydb' TO 'c:\mydb2.mdf', MOVE 'mydb_Log' TO 'c:\mydb2_Log.ldf', REPLACE, STATS = 10"
I get the error "Logical file is not part of database". When I use "RESTORE FILELISTONLY", it shows the logical filenames are truncated by one character, i.e. "myd" and "mydb_Lo". This does not happen with all databases, and I have not been able to identify a pattern.