Chat Programming with Oracle consistency and "bodyguard" transactions

Source: Internet
Author: User
Tags dba exception handling savepoint

The topic of fire recently, why learn python?

A lot of people say fire! And can be artificial intelligence, but also big data, of course, very fire like to learn a lot of people, high-paying position more easily to drive the trend. First of all, I do not object to this point of view, I have only studied two shell and Java University, the real learning is self-study, the purpose is not to develop, in order to exercise their own programming ideas and learning, in order to learn programming less to go some detours and learning.

Oneself is also the choice Python, why, after the development direction of the internship is the database, the late May DBA, may also take the data analysis and other business routes, it does not matter what is important is to combine work to improve their ability, personal competitiveness in advance to play a good line, Regardless of the DBA database Server Ops shell script and Pyhton and Perl are undoubtedly the best choice, then if the data analysis and other python can also play their own useful, for their own career development planning has a great help, very practical significance, for a few years after better for work, I feel that this is not a passion for programming, not the programming mania of the technical staff starting point! do not take the two years of fire, development prospects, high salary as the basis for learning, so empty without planning to learn, the mentality is not correct first, and then you will change with the times and lag behind!

Yesterday talking about the integrity of the data, then is the accuracy and reliability of data, we want to ensure entity integrity, referential integrity, domain integrity, user-defined integrity, this time back to look at the constraints is really important!

What do we mean by consistency?

We start from the actual, consistent literal meaning to listen, all know that the data is consistent, in the location of the bank card balance is 100 yuan, the change of a local query but without losing 100 yuan, which is unacceptable. then the data in the database will always accompany the data read and write operations, which on the database state requirements are particularly high, that is, every time the database operation changes, can be accepted, read is normal, is the consistency of the database embodiment, and sometimes not the database is true and reliable state, then it is considered inconsistent.

"Bodyguard" appearances.

say Oracle These integrity Ah, consistency AH is also the Oracle built-in "Big Boss", all equipped with bodyguards to protect, then we say a integrity of the Bodyguard Affairs management.

Transaction management is not simple, ensure data consistency in the database, in the previous we said, when the commit and rollback operations are a transaction commit or transaction rollback, our SQL statement is included in the transaction language. The transaction keyword is transaction, and there is life cycle, the transaction begins, executes, and ends, and the start of the transaction is implicit, and the end is done with the instruction action.

Commands commonly used by control transactions in Oracle:

1. Commit

English literal translation is the submission, which is a sign of the end of the transaction, what it means to use this command means that the data of this transaction will be stored on our disk, changing the state of the database is a reliable and acceptable state, the most secure and effective way for development is to display the data submitted, before the submission, In fact, the database has been updated but not recognized by the database, through the end of the transaction command to recognize the operation, the submission occupies very little resources, 1 of the 1000 cost of the commit database resources are the same.

2, Rollback

The English literal translation comes back, we make the revocation name before the transaction commits, when the database update is not recognized, when the transaction ends rollback the current contained data is rolled back to the last commit state, this process will read the rollback information, This information is used to restore the changes that have occurred in the database, and if you delete the data using the Delete command, then insert into data at rollback time, which is very resource-intensive for the database for each rollback, and is suitable for exception handling operations , you should check the operation carefully before committing the transaction instead of rolling back!

3, savepoint and rollback savepoint

In the context of rollback, rollback rollback of the current firm has operations, then we use the command savepoint in the transaction to establish a standard starting point, only allow the user to rollback after the action, rollback savepoint is the data after the rollback of the punctuation, Both are a way to make up for rollback extreme commands, and transaction rollback is more flexible and controllable.

Properties and isolation levels for transactions

1, read only--will not be able to modify the data within the transaction, and this can be used at the beginning of the transaction, the database state will be frozen, the database state and transaction start state consistent

2, read write--readable writable state, the database default is this state

3, serializable--isolation level, specify the serialization transaction, can realize the same as read-only function, isolate the impact of other database state, but allow DML operation, do not recognize the other transaction to the database modification, even if committed, but does not mean ignoring the original table data modification, the table data has actually been modified, It's just that this business doesn't recognize

4, read commited--The default level of isolation level, can only read other transactions have been committed modified, for uncommitted data, only the modification transaction itself can be read.

principle of transaction processing

1. atomicity (atomicity)

2. Consistency (consistency)

3. Isolation (lsolation)

This post will be continuously updated


Chat Programming with Oracle consistency and "bodyguard" transactions

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.