Showing posts with label backups. Show all posts
Showing posts with label backups. Show all posts

Monday, July 18, 2011

The 'Microsoft Information Store' returned 'Backup is already active.

While backing up Exchange Stores on a Microsoft Exchange 2003 server for a friend using the ol' faithful Windows NTBackup, I came across the following error.


Backup Status
Operation: Backup
Active backup destination: File
Media name: "exchange_backup.bkf created 18/07/2011 at 10:33 PM"

Volume shadow copy creation: Attempt 1.
Backup of "ExchSrvr01\Microsoft Information Store\First Storage Group"
Backup set #1 on media #1
Backup description: "Set created 18/07/2011 at 10:33 PM"
Media name: "exchange_backup.bkf created 18/07/2011 at 10:33 PM"

Backup Type: Normal

Backup started on 18/07/2011 at 10:33 PM.
The 'Microsoft Information Store' returned 'Backup is already active.

' from a call to 'HrESEBackupSetup()' additional data '-'The 'Microsoft Information Store' returned 'Functions called in an invalid sequence.

' from a call to 'HrESEBackupClose()' additional data '-'
The operation was ended.
Backup completed on 18/07/2011 at 10:33 PM.
Directories: 0
Files: 0
Bytes: 0
Time: 1 second

----------------------

The operation did not successfully complete.

----------------------


Failing to remember any solutions off hand, I consulted the Oracle, (Google is the almighty I am talking about). In return for my search, I got hundreds of matches. I opened the first one, as it was from Microsoft Support http://support.microsoft.com/kb/820272. This said that I had my Exchange Server Databases installed on the same drive as my operating system. Due to this the backup was failing. This did not fit my situation so I trawled further.


Persistence and bullheadedness is the recipe to success and Viola! I found my answer. To be quite honest, when I read it, I thought it to be too simple to work. I said to myself, if this works, I will be a monkey's uncle. And as it stands, a happy monkey has just inherited me as their uncle :)

The problem was due to the simple fact that circular logging was enabled on the Storage Group. I disabled it, restarted the Microsoft Exchange Information Store service and tried NTBackup again. To my hearts joy, it worked :) (exact article can be found here http://www.tek-tips.com/viewthread.cfm?qid=1182209&page=1


Have a great week.

Tuesday, July 1, 2008

Week 27 Article 01 - Batch scripting for removal of older files

With so many scripting languages out there, it is sometimes a wonder why someone would choose batch scripts. I choose them mostly for their simplicity. Some would argue about this but then again everyone has their own views.

Recently I came across a mammoth task. One of the backup programs used by a client wasn't behaving as expected. Some background would be helpful at this point so here goes. Backups were done on two removable hard disks, one used one week and then interchanged with the other. The disconnected hard disk was taken off site for storage. The backup software would create a base image of the system on the first day of the week and every consecutive day, it would do an incremental backup. If all went well, by the end of the week, one would have a backup set that could recover a file deleted within the last 5 days. Now here comes the problem! The hard disk has got a limited capacity and can hold only so many files. As instructed in the settings of the backup program, it was supposed to keep two full sets of backups (a full set being a base image plus the incrementals based on it) and to delete any additional sets if it ran out of space on that particular hard disk (deletions using FIFO method). But the deletions were not happening properly and sometimes the backups failed due to unavailability of space. To solve this problem, I resorted to using my favorite tool, scheduled batch scripts and in the process came across a beautiful tool, which was distributed as part of the Windows 2000 Resource Kit but is now integrated into Windows 2003 as a standard. [Take note of this commands ability to search for files older than a certain age, the /D parameter]

FORFILES [/P pathname] [/M searchmask] [/S][/C command]
[/D [+ | -] {dd/MM/yyyy | dd}]

Description:
Selects a file (or set of files) and executes a command on that file. This is
helpful for batch jobs.

Parameter List:
/P pathname Indicates the path to start searching. The default folder is
the current working directory (.).

/M searchmask Searches files according to a searchmask. The default
searchmask is '*' .

/S Instructs forfiles to recurse into subdirectories.
Like "DIR /S".

/C command Indicates the command to execute for each file. Command
strings should be wrapped in double quotes.

The default command is "cmd /c echo @file".

The following variables can be used in the
command string:
@file - returns the name of the file.
@fname - returns the file name without extension.
@ext - returns only the extension of the file.
@path - returns the full path of the file.
@relpath - returns the relative path of the file.
@isdir - returns "TRUE" if a file type is a directory, and
"FALSE" for files.
@fsize - returns the size of the file in bytes.
@fdate - returns the last modified date of the file.
@ftime - returns the last modified time of the file.

To include special characters in the command line, use the
hexadecimal code for the character in 0xHH format (ex. 0x09
for tab). Internal
CMD.exe commands should be preceded with "cmd /c".

/D date Selects files with a last modified date greater than or
equal to (+), or less than or equal to (-), the specified
date using the "dd/MM/yyyy" format; or selects files with a
last modified date greater than or equal to (+) the current
date plus "dd" days, or less than or equal to (-) the
current date minus "dd" days. A valid "dd" number of days
can be any number in the range of 0 - 32768.
"+" is taken as default sign if not specified.

/? Displays this help message.

Examples:
FORFILES /?
FORFILES
FORFILES /P C:\WINDOWS /S /M DNS*.*
FORFILES /S /M *.txt /C "cmd /c type @file | more"
FORFILES /P C:\ /S /M *.bat
FORFILES /D -30 /M *.exe
/C "cmd /c echo @path 0x09 was changed 30 days ago"
FORFILES /D 01/01/2001
/C "cmd /c echo @fname is new since Jan 1st 2001"
FORFILES /D +1/7/2008 /C "cmd /c echo @fname is new today"
FORFILES /M *.exe /D +1
FORFILES /S /M *.doc /C "cmd /c echo @fsize"
FORFILES /M *.txt /C "cmd /c if @isdir==FALSE notepad.exe @file"