search
HomeDatabaseMysql Tutorial数据库文件损坏的恢复方法

说明如下:SQL Server 2000文件损坏的恢复 1、建一个测试数据库test(数据库类型为完全)。 2、建一个表,插入点记录。 create table a(c1 varchar(2)) go insert into a values('aa') go insert into a values('bb') go 3、作完全备份,到文件test_1.bak。 4

   说明如下:SQL Server 2000文件损坏的恢复

  1、建一个测试数据库test(数据库类型为完全)。

  2、建一个表,插入点记录。

  create table a(c1 varchar(2)) go insert into a values('aa') go insert into a values('bb') go

  3、作完全备份,到文件test_1.bak。

  4、在作一点修改。

  insert into a values('cc') go create table b(c1 int) go insert into b values(1) go insert into b values(2) go

  5、shutdown 数据库服务器。

  SQL Server 2000文件损坏的恢复6、用ultraedit编辑数据库文件test_data.mdf,随便修改点字节内容,相当于数据库遭到致命的损坏。

  7、启动数据库,并且运行企业管理器,点开数据库,看到test变成灰色,而且显示置疑。

  8、运行isql -SLocalhost -Usa -P。

  1> backup log test TO DISK=' D:Program FilesMicrosoft SQL ServerMSSQLBACKUP est_2.bak' WITH NO_TRUNCATE 2>go

  已处理2页,这些页属于数据库 'test' 的文件 'TEST_Log'(位于文件 1 上)。

  BACKUP LOG 操作成功地处理了 2 页,花费了 0.111 秒(0.087 MB/秒)。

  SQL Server 2000文件损坏的恢复9、进行恢复最老的完全备份。

  1> RESTORE DATABASE test FROM DISK=' D:Program FilesMicrosoft SQL ServerMSSQL BACKUP est_1.bak' WITH NORECOVERY 2> go

  已处理96页,这些页属于数据库 'test' 的文件 'TEST_Data'(位于文件 1 上)。已处理1页,这些页属于数据库 'test' 的文件 'TEST_Log'(位于文件 1 上)。

  RESTORE DATABASE 操作成功地处理了 97 页,花费了 0.107 秒(7.368 MB/秒)。

  10、恢复最近的日志。

  1> RESTORE LOG test FROM DISK=' D:Program FilesMicrosoft SQL ServerMSSQLBACKU P est_2.bak' WITH RECOVERY 2> go

  已处理 2 页,这些页属于数据库 'test' 的文件 'TEST_Log'(位于文件 1 上)。

  RESTORE LOG 操作成功地处理了 2 页,花费了 0.056 秒(0.173 MB/秒)。

  数据已经完全恢复了,可以使用了。

  select * from a go

  总结,,DBA应该有一个完善的数据库备份计划。本例中,如果没有一个完全备份的话,数据库的恢复就不可能。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What Are the Limitations of Using Views in MySQL?What Are the Limitations of Using Views in MySQL?May 14, 2025 am 12:10 AM

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

Securing Your MySQL Database: Adding Users and Granting PrivilegesSecuring Your MySQL Database: Adding Users and Granting PrivilegesMay 14, 2025 am 12:09 AM

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

What Factors Influence the Number of Triggers I Can Use in MySQL?What Factors Influence the Number of Triggers I Can Use in MySQL?May 14, 2025 am 12:08 AM

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

MySQL: Is it safe to store BLOB?MySQL: Is it safe to store BLOB?May 14, 2025 am 12:07 AM

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

MySQL: Adding a user through a PHP web interfaceMySQL: Adding a user through a PHP web interfaceMay 14, 2025 am 12:04 AM

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL: BLOB and other no-sql storage, what are the differences?MySQL: BLOB and other no-sql storage, what are the differences?May 13, 2025 am 12:14 AM

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

MySQL Add User: Syntax, Options, and Security Best PracticesMySQL Add User: Syntax, Options, and Security Best PracticesMay 13, 2025 am 12:12 AM

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

MySQL: How to avoid String Data Types common mistakes?MySQL: How to avoid String Data Types common mistakes?May 13, 2025 am 12:09 AM

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools