🚂 RailGuruji
Databases and SQLडेटाबेस और एसक्यूएल6 / 7

Transactions, locking and recoveryट्रांजैक्शन, लॉकिंग और पुनर्प्राप्ति

Practise the chapter · 13 Qपूरे अध्याय का अभ्यास · 13 प्रश्न
Updated अद्यतन 07 Oct 2026
This chapterयह अध्याय asked in 1 exam1 परीक्षा में पूछा गया
1
TRANSACTIONS AND THE ACID PROPERTIESट्रांजैक्शन और एसिड गुण
A TRANSACTION is a unit of work that must happen completely or not at all.
  • ATOMICITY: all of it or none of it
  • CONSISTENCY: it takes the database from one valid state to another
  • ISOLATION: concurrent transactions do not see each other's unfinished work
  • DURABILITY: once committed, it survives a failure
  • COMMIT makes the changes permanent; ROLLBACK undoes them; SAVEPOINT marks a point to roll back to
You can remember the four by the word ACID. So a transfer debits and credits together, or does neither.
ट्रांजैक्शन कार्य की वह इकाई है जो पूरी तरह हो या बिल्कुल न हो।
  • एटॉमिसिटी: सब कुछ या कुछ भी नहीं
  • कंसिस्टेंसी: यह डेटाबेस को एक वैध अवस्था से दूसरी वैध अवस्था में ले जाता है
  • आइसोलेशन: समवर्ती ट्रांजैक्शन एक-दूसरे का अधूरा काम नहीं देखते
  • ड्यूरेबिलिटी: कमिट होने के बाद यह विफलता में भी बचा रहता है
  • कमिट बदलाव स्थायी करता है; रोलबैक उन्हें पलटता है; सेवपॉइंट वह बिंदु चिह्नित करता है जहाँ तक लौटा जा सके
आप चारों को एसिड शब्द से याद रख सकते हैं। अर्थात् अंतरण में डेबिट और क्रेडिट साथ होते हैं, या दोनों में से कोई नहीं।
2
LOCKING AND CONCURRENCY CONTROLलॉकिंग और समवर्तिता नियंत्रण
CONCURRENCY CONTROL stops simultaneous transactions from corrupting each other's data.
  • Without it you get LOST UPDATES, DIRTY READS of uncommitted data, and inconsistent reads
  • A SHARED LOCK lets many transactions read; an EXCLUSIVE LOCK lets one transaction write
  • TWO-PHASE LOCKING: a transaction acquires all its locks before it releases any
  • DEADLOCK: two transactions each wait for a lock the other holds. The DBMS rolls one back
So shared locks allow reading together, and an exclusive lock allows one writer.
समवर्तिता नियंत्रण एक साथ चलने वाले ट्रांजैक्शनों को एक-दूसरे का डेटा बिगाड़ने से रोकता है।
  • इसके बिना आपको लॉस्ट अपडेट, अकमिटेड डेटा के डर्टी रीड, और असंगत रीड मिलते हैं
  • शेयर्ड लॉक कई ट्रांजैक्शनों को पढ़ने देता है; एक्सक्लूसिव लॉक एक ट्रांजैक्शन को लिखने देता है
  • टू-फेज लॉकिंग: ट्रांजैक्शन कोई लॉक छोड़ने से पहले अपने सभी लॉक ले लेता है
  • डेडलॉक: दो ट्रांजैक्शन एक-दूसरे के पास के लॉक की प्रतीक्षा करते हैं। डीबीएमएस एक को रोलबैक करता है
अर्थात् शेयर्ड लॉक साथ पढ़ने देते हैं, और एक्सक्लूसिव लॉक एक लेखक को।
3
ROLL BACK AND ROLL FORWARDरोल बैक और रोल फॉरवर्ड
After a failure the database recovers in two directions.
  • ROLL FORWARD re-applies the changes recorded in the REDO LOGS, including the archived ones
  • ROLL BACK undoes the changes of transactions that had NOT committed, using the ROLLBACK or UNDO data
  • After recovery, every committed transaction is restored, and every uncommitted one is rolled back
  • SMON performs this instance recovery when the database restarts
You keep the archived redo logs safe, because roll forward cannot run without them. So the redo log rolls forward, and the rollback data rolls back.
विफलता के बाद डेटाबेस दो दिशाओं में पुनर्प्राप्त होता है।
  • रोल फॉरवर्ड रीडू लॉग में दर्ज बदलाव फिर लागू करता है, आर्काइव्ड लॉग सहित
  • रोल बैक उन ट्रांजैक्शनों के बदलाव पलटता है जो कमिट नहीं हुए थे, रोलबैक या अनडू डेटा से
  • पुनर्प्राप्ति के बाद हर कमिटेड ट्रांजैक्शन बहाल होता है, और हर अकमिटेड रोलबैक होता है
  • डेटाबेस फिर शुरू होने पर एसमॉन यह इंस्टेंस पुनर्प्राप्ति करता है
आप आर्काइव्ड रीडू लॉग सुरक्षित रखते हैं, क्योंकि उनके बिना रोल फॉरवर्ड नहीं चल सकता। अर्थात् रीडू लॉग आगे बढ़ाता है, और रोलबैक डेटा पीछे लौटाता है।
Report an error on this pageइस पेज में गलती बताएँ

Finished this page? Practise its chapter.यह पेज पूरा हुआ? अब इसके अध्याय का अभ्यास कीजिए।

Only questions asked in real past papersकेवल पिछले वर्षों के प्रश्नपत्रों में पूछे गए प्रश्नOnly practice questions, none from a past paperकेवल अभ्यास प्रश्न, कोई भी पिछले प्रश्नपत्र से नहींPast-paper and practice questions togetherपिछले प्रश्नपत्रों के और अभ्यास प्रश्न, दोनों

or take the free Mock CBTया फ्री Mock CBT दें