While working on some project our developer encountered the mistakes and concealments in documentation on MS Exchange theme. The developer conducted his own research to solve the problems he had come across and the results are given in this article. Hope, you will find this paper helpful. We also would be grateful for your feedbacks on
.
MS Exchange databases backup/restore guide
When I was writing MS Exchange backup/restore application I faced some problems. I was trying to implement this application using MSDN but it contains too little information and too many errors. I searched for additional information on forums but didn't find any valuable materials (lots of people ask questions but no one answers them).
I had to conduct my own research and now I offer you my own Exchange backup/restore guide using a problem-solution scheme. The guide is aimed for those who will take the risk to develop a similar product and it will really save your time if you look here before viewing MSDN.
Nevertheless, MSDN remains the one of the best resources for developers and it is quite possible that its next version will be more complete and clear in the part of MS Exchange information. Until then, for those who wish to get answers just now, I wrote this paper.
Software requirements for my case are:
Microsoft Windows 2000 Server or higher
Microsoft Exchange Server 2000 or higher (I used esebcli2.dll for
backup/restore. Microsoft Exchange Server contains this library)
Initialization functions return an error ERROR_ACCESS_DENIED
You have to add restore/backup privileges.
Actions for adding a privilege:
1. Get the current process handle (GetCurrentProcess).
2. Open the access token associated with a process (OpenProcessToken).
3. Retrieve the LUID (LookupPrivilegeValue).
4. Enable privilege (AdjustTokenPrivileges).
MSDN doesn?t contain information about what and where to save on backup
operation
All of the database files and logs have to be saved. Moreover, we have to
save the Exchange structure.
For an instance must be saved: displayname.
For a database must be saved: displayname, GUID and streams (files of
database).
For log and patch files must be saved: names of files.
MSDN contains errors in description of DATABASE_BACKUP_INFO structure declaration
#define RPC_STRING [unique, string] wchar *typedef struct _DATABASE_BACKUP_INFO
{
RPC_STRING wszDatabaseDisplayName;
unsigned long cwDatabaseStreams;
RPC_SIZE(cwDatabaseStreams) wchar * wszDatabaseStreams;
GUID guidDatabase;
unsigned long ulIconIndexDatabase;
unsigned long fDatabaseFlags;
} DATABASE_BACKUP_INFO;
Let?s look at MSDN descriptions of wszDatabaseStreams:
wszDatabaseStreams
An array of file names corresponding to the file system files that make up the ESE database. There is no member of this structure that indicates how many elements this array contains. The last element in the array is empty, as indicated by the string value "00" (zero-zero)...
In fact:
wszDatabaseStreamsis a buffer containing individual file names separated by a single NULL character. The last file name in the buffer is followed by two consecutive NULL characters.
MDSN contains an error in description of restore operation for log files
MSDN description:
Restore the log and other files (returned by
HrESEBackupGetLogAndPatchFiles()). A call to HrESERestoreOpenFile() is required for all log and other files. This call will fail with the error hrRestoreAtFileLevel, but the call is needed to build log sequence information.
My description:
Call HrESERestoreOpenFile for every log file. This call will fail with the error hrRestoreAtFileLevel. After this call copy the file to restore log directory. We can retrieve log directory by calling HrESERestoreGetEnvironment.
I hope that you got answers you have been looking for or will be of need in future. For more info on the theme of this article you can contact us via
.