SQL Server user-customized database repair

Source: Internet
Author: User
Tags backup

This article explains how users can customize the database repair

Automatic Application redo Log

1, the use of the set AutoRecovery command to automatically apply redo log, the completion of the data file repair operations.

Sql>startup MOUNT: Starts the instance and loads the database.

Sql>set AutoRecovery on: Enable the Redo Log auto Apply feature.

Sql>recover database: Restores specified tablespaces, data files, or entire databases.

Sql>alter Database open: When the restore is complete, the databases are opened.

2, the use of Recovery Automatic command to automatically apply the redo log, the completion of the data file repair operations.

Sql>startup MOUNT: Starts the instance and loads the database.

Sql>recover AUTOMATIC DATABASE.

Sql>alter Database open: When the restore is complete, the databases are opened.

II. database Media Recovery in non-archive mode

1, restore the database to the original location.

Sql>shutdown IMMEDIATE If the database is still open, shut down the database, restore the database file to its original location, and restore the entire database with the most recent consistent full backup, you must fix all the data files and control files.

SQL>RECOVER DATABASE UNTIL CANCEL
SQL>CANCEL
SQL>ALTER DATABASE OPEN RESETLOGS;
将当前重做日志顺序号设置为1。

Sets the current redo log order number to 1.

2, restore the database to a new location.

Sql>shutdown IMMEDIATE: If the database is still open, shut down the database, restore the database file to a new location, and restore the entire database with the last established consistent full backup, all data files and control files must be repaired; Edits the Control_files parameter in the initialization parameter file so that it performs the control file saved in the new location.

Sql>startup MOUNT: If the restored database file is in a new location, the control file must be modified with the ALTER DATABASE RENAME file statement to point to the repaired data file in the new location. Such as:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.