Database maintenance

Time:2021-1-20

affair

The object of database concurrency control

Transaction is the logical work unit of database

The operations in the sequence are either all done or none done

 

characteristic;

Atomicity

All operations in a transaction are indivisible, either executed or not executed. This is the atomicity of a transaction.

uniformity

A successful transaction must be able to change dB from one consistent state to another.

Isolation

It means that the execution of a transaction in the database cannot be interfered by other transactions, that is, the operation and data used in a transaction are isolated from other transactions, and the concurrent execution of each transaction cannot interfere with each other.

Persistence

After a transaction is committed, no matter what happens to the DBMS, all the updating operations of the transaction to the DB will be kept in the DB forever and will not be lost.

 

The breakdown of database system

Transaction failure

system failure

Medium fault

 

 

Data backup and restore

 

 

 

--To create a backup device:
sp_ Addumpdevice '< device type >,' < backup device name >, '< physical file >'

--Full database backup:
Backup database > to < backup device name >

--Database differential backup:
< database full backup > + with differential

--Transaction log backup:
Backup log < Database > to < backup device name >

--To delete a backup device:
sp_ Dropdevice '< backup device name >','delfile '

 

 

--Restore from database backup:
Restore database < database name > from < backup device name >
[WITH NORECOVERY]

--Restore from transaction log backup:
Restore log < database name > from < backup device name >
[WITH NORECOVERY]

--Restore by specified time point:
Restore log < database name > from < backup device name >
With recovery, stopat = '< date > < time >'