Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Can't Get SQL To Backup!

Author  Topic 

wpcs65775
Starting Member

4 Posts

Posted - 2008-06-24 : 18:30:47
New to using SQL and i'm havng problems getting SQL to backup. Getting errors:

Backup device 'C:\MSSQL7\Backup\ADV_db_200806241704.BAK' failed to open. Operating system error = 32(The process cannot access the file because it is being used by another process.).

The backup data in 'C:\MSSQL7\Backup\ADV_db_200806241649.BAK' is incorrectly formatted. Backups cannot be appended, but existing backup sets may still be usable.

wpcs65775
Starting Member

4 Posts

Posted - 2008-06-25 : 14:56:03
Also, manual backup can be done but will not do scheduled back up.
Go to Top of Page

tosscrosby
Aged Yak Warrior

676 Posts

Posted - 2008-06-25 : 14:58:13
Well it looks like version 7.0 and I don't know if the syntax is different but can you try something like:

BACKUP DATABASE ADV_db TO C:\MSSQL7\Backup\ADV_db_200806241704.BAK with init

This will initialize a new file and should clear up the "incorrectly formatted" error. Also, since the file also appears to be in use, check to see what has the file locked at the server. Is a tape backup of that file running? A virus scan being performed against the file?

Terry
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-06-28 : 23:26:30
Looks like the file was locked by file backup or anti-virus app.
Go to Top of Page

maninder
Posting Yak Master

100 Posts

Posted - 2008-06-29 : 11:41:31
Do you have Other system Backup Tool like VERITAS Backup happening at the same time.
That can lock the Files, during that Time.

Also are you Appending the Backups in the Same file, or there Diff Files in the Backup Location.

Maninder
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-06-29 : 14:35:39
If the file is locked by other processes, you'll get that error even you specify 'with init' in backup.
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2008-07-02 : 01:48:43
Also , check to see that theat there aren't specific security protocols set on this file

Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com
Go to Top of Page

wpcs65775
Starting Member

4 Posts

Posted - 2008-07-03 : 11:00:39
There is a third party backup program but it is not running while we are performing backups. Also, backup has been done to a different directory on the hard drive, backup shows it's successful but when i try to restore it, it just says loading and never finishes.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-07-03 : 11:03:48
quote:
Originally posted by wpcs65775

There is a third party backup program but it is not running while we are performing backups. Also, backup has been done to a different directory on the hard drive, backup shows it's successful but when i try to restore it, it just says loading and never finishes.



Because you are restoring database with 'NoRecovery Option'. Try restoring with Recovery option and stats as well.
Go to Top of Page

tosscrosby
Aged Yak Warrior

676 Posts

Posted - 2008-07-03 : 11:09:43
Can you post your restore script? I have a feeling sodeep may have already answered the issue however.

Terry
Go to Top of Page

wpcs65775
Starting Member

4 Posts

Posted - 2008-07-03 : 11:32:54
Sorry, i'm still new to this. Where can i find the "NoRecovery Option"?
Go to Top of Page

tosscrosby
Aged Yak Warrior

676 Posts

Posted - 2008-07-03 : 12:05:20
From BOL:

RESTORE DATABASE { database_name | @database_name_var }
[ FROM < backup_device > [ ,...n ] ]
[ WITH
[ RESTRICTED_USER ]
[ [ , ] FILE = { file_number | @file_number } ]
[ [ , ] PASSWORD = { password | @password_variable } ]
[ [ , ] MEDIANAME = { media_name | @media_name_variable } ]
[ [ , ] MEDIAPASSWORD = { mediapassword | @mediapassword_variable } ]
[ [ , ] MOVE 'logical_file_name' TO 'operating_system_file_name' ]
[ ,...n ]
[ [ , ] KEEP_REPLICATION ]
[ [ , ] { NORECOVERY | RECOVERY | STANDBY = {undo_file_name|@undo_file_name_var} } ]
[ [ , ] { NOREWIND | REWIND } ]
[ [ , ] { NOUNLOAD | UNLOAD } ]
[ [ , ] REPLACE ]
[ [ , ] RESTART ]
[ [ , ] STATS [ = percentage ] ]
]

The norecovery option leaves the database in a state to allow logs (or differentials) to be restored on top of the full backup. Change it to recovery and the database should come online.

Terry
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-07-04 : 21:17:53
You can fix it with 'restore database db_name with recovery'.
Go to Top of Page
   

- Advertisement -