Monday, 23 December 2013

How to rebuild Priv.edb and .stm files in Exchange?

About Exchange Information store:

The core elements of Exchange Information store are Extensible Storage Engine and storage files (such as: database file, native content file, transaction logs, checkpoint files, reserved logs and other files).

The Exchange information store consists of transaction logs and storage groups that further consist of mailbox stores, public stores and mailboxes. The default location of Exchange Information Stores is MDBDATA folder. However, the user can also choose to move the data to a custom location of his choice.

Each Mailbox Store contains one Priv1.edb & Priv1.stm file. Similarly, the Public Folder Store contains Pub1.edb & Pub1.stm files. Each edb file has a corresponding stm file. A STM file is the streaming media file that stores multimedia data in MIME format. The amount of data stored in a STM file varies in different cases such as: STM file contains a little amount of data if MAPI Outlook protocol is used. The POP3 or IMAP clients store larger amount of data in STM files. In case of OWA, all the mailbox data is stored in EDB file, the STM file will contain the sent attachments.

The exchange provides Public Folder Replication feature which lets it create, maintain and synchronize the multiple instances of the same public folder on different Exchange servers. This feature increases the fault tolerance and efficiency of Exchange server as it keeps the public folder data replicated and provides access to a local copy of a public folder.  Thus, it provides more security and accessibility for an organization/user to work in a distributed network environment.

Exchange Log files: The Exchange transaction log files record all the information about a transaction that is being committed to the Exchange database.

Exchange database contains three types of log files: current transaction log (E##.log), secondary transaction logs (E#######.log), reserved log files (Res1.log& Res2.log)

The secondary transaction files are numbered sequentially starting with E0000001.log. ## indicates the Storage Group identifier.

The log files can prove to be helpful, if a user requires recovering the database from disaster or crash. If the user doesn’t have a valid recent backup then he can roll back the transactions to reach back to the previous state.

Just like other data files, Exchange database files are also prone to corruption. There can be various software or hardware reasons for the corruption of EDB database.
Such as:
  • Conflicting firewall, malware protection, or Antivirus application
  • Increased size of EDB database
  • Accidental shutdown
  • Power failure
  • Virus attacks
  • Hardware/system crash etc.
You can repair and recover the corrupt Exchange database by running Eseutil and Isinteg commands but there are several cases when these inbuilt repair utilities fail to perform efficient Exchange recovery. If you run eseutil /P command or eseutil /mh for data recovery, it may be possible that you get an error,” .STM file doesn't match the *.EDB file that resides on the server” Or other similar error messages indicating the failure of Eseutil and Isinteg utilities.

Consider the scenario: if the Exchange store has been shut down accidentally, you are not able to load your data from backup, the exchange database has got corrupt and Eseutil & Isinteg utilities both couldn’t recover the data. Then, what would you do in such situation? Your all work will be hampered so, in such situation you can create new edb and stm files so that, the users can continue working with their Exchange mail accounts.

Follow the given steps to rebuild a priv.edb file using log files:
  • Ensure that you have all log files from E0000001.log to E00.log.
  • Stop all the running Information Stores Services.
  • Rename the MDBDATA folder
  • Create a new empty MDBDATA folder.
  • Restart the Information Stores Services.
  • Go to Exchange Administration.
  • Right click on the priv1.edb file.
  • Click “mount”.
  • A message screen will be prompted that says that there is no edb file. Just ignore it and click ok to proceed.
  • A fresh PRIV1.edb and PRIV1.stm file will be created and all log files will be replayed now. New empty user mailboxes will be created; the users can now continue mail operations sending & receiving mails.
Note: You should backup your PRIV1 edb, PUB1 edb and stm files before running ESEUTIL for disaster recovery.

Follow the given steps to recreate the STM file:
  • Backup you EDB database
  • Stop the “Microsoft Exchange System Attendant" services and any antivirus software, if running.
  • Run the "Regedit” command by going to "Start" -> "Run”.
  • Now you need to modify some of the registry values, First go to:   [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSExchangeIS\VirusScan] and then set the value of "Enable" from 1 to 0.
  • Now Run eseutil /mh command as below:
Eseutil /mh “Path of the database”
eseutil /mh "C:\Program Files\Exchsrvr\MDBDATA\priv1.edb"
eseutil /mh "C:\Program Files\Exchsrvr\MDBDATA\pub1.edb"

The command let you know the state of the database .i.e. clean shutdown or dirty shutdown. You can run the – eseutil /ml for checking the health of the log files. If the log files are in healthy state then you can run Eseutil /r for Soft recovery with the command.
  • You can create the *.STM file by running eseutil /p /createstm command.
eseutil /p /createstm "C:\Program Files\Exchsrvr\MDBDATA\priv1.edb" (for private mailbox store *.STM file)
eseutil /p /createstm "C:\Program Files\Exchsrvr\MDBDATA\pub1.edb" (public store *.STM file)
  • Again Run the "Regedit" and go to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSExchangeIS\VirusScan]
  • and change the values of "Enable" from 0 to 1.
  • Restart "Microsoft Exchange System Attendant" services.
  • Go to Exchange "System Manager and open mailbox store/Public store. For each mailbox store, run "mailbox cleanup agent". Then, Select the checkbox "reconnect all mailboxes".
  • Open the properties of the mailbox store/Public store. Go to Database" tab and select the checkbox "This database can be overwritten by a restore".
  • Finally, mount the mailbox store/Public store; your .STM file has been created. You can now run the antivirus software or other Exchange services.
Note: These steps are valid for Exchange 2000/2003.

Transaction log files play a very important role in rebuilding the Exchange mailbox database. If the edb file gets corrupt then you can roll up the transactions in a new edb. You can easily re-build the Priv1.edb File by using Transaction log files as explained above.

If you are looking for an easy and efficient Exchange database recovery method then, you can find several EDB repair tools in the market. Such software are competently enriched with powerful Exchange recovery features. You can easily repair the corrupt Exchange database files and save the recovered items to a new or existing PST file. The EDB recovery software are en-composed of advanced features and algorithms for performing efficient Exchange database recovery in a small time span.

Different data recovery companies provide different types of Exchange recovery software with varied feature set. However, what you can do is: just do an online search, find the software that seem to suit your needs, evaluate & compare their features, run the Demo and if satisfied with the Demo version, there is no harm in purchasing the full version.


Post a Comment