[MySQL] ROLLBACK, SAVEPOINT / DB ๋ฐฑ์—…, ๋ณต์›


ROLLBACK, SAVEPOINT


  • rollback : ์ฟผ๋ฆฌ ์‹คํ–‰ ์ทจ์†Œ (์ง์ „์— commit์ด ์‹คํ–‰๋œ ์ง€์ ๊นŒ์ง€)

    • autocommit=0 ์ผ ๋•Œ๋งŒ ๊ฐ€๋Šฅ

    • set autocommit = 1 : update, delete ์ฆ‰์‹œ ์ ์šฉ ํ—ˆ์šฉ

    • set autocommit ํ•œ ๋ฒˆ ์‹คํ–‰ํ•˜๋ฉด ๊ณ„์† ์ ์šฉ

    • SET AUTOCOMMIT = 0; 
      UPDATE ...;
      ROLLBACK;
      
  • savepoint : ๋ณ€๊ฒฝ๋œ ์ง€์ ์˜ ์œ„์น˜ ์ €์žฅ, ์ €์žฅ๋œ ์ง€์ ๊นŒ์ง€ ๋ณต๊ตฌ ๊ฐ€๋Šฅ

    • SAVEPOINT point_name;

    • savepoint queryStart;
      
      update ...;
      delete ...;
      
      rollback to queryStart;
      
  • ์‹คํ–‰ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” โ€˜COMMIT;โ€™



DB ๋ฐฑ์—… / ๋ณต์›ํ•˜๊ธฐ


  • DB ๋ฐฑ์—…

    Navigator - Administration

    โ–ถ

    MANAGEMENT - Data Export

    โ–ถ

    Tables to Export - ๋ฐฑ์—… ํ•  Schema ์„ ํƒ

    โ–ถ

    Objects to Export ์„ธ ํ•ญ๋ชฉ ๋ชจ๋‘ ์„ ํƒ

    โ–ถ

    Export Options - Export to Self-Contained File ์„ ํƒ ํ›„ ์•„๋ž˜ ๋‘ ํ•ญ๋ชฉ ๋ชจ๋‘ ์„ ํƒ (Create Dump .. , Include Create Schema)

    โ–ถ

    ํด๋” ์„ ํƒ - ์„ ํƒํ•œ Schema์™€ ๊ฐ™์€ ์ด๋ฆ„์œผ๋กœ ๋ฐฑ์—… ํด๋”์— ์ €์žฅ

    โ–ถ

    Start Export



  • DB ๋ณต์›

    Navigator - Administration

    โ–ถ

    MANAGEMENT - Data Import/Resotre

    โ–ถ

    Import from Self-Contained File ์ฒดํฌ ํ›„ ํŒŒ์ผ ์ฐพ๊ธฐ

    โ–ถ

    Default Target Schema Newโ€ฆ์— ๋™์ผํ•œ ์ด๋ฆ„ ์ž…๋ ฅ ํ›„ Start Import

    โ–ถ

    Navigator - Schemas์— import ํ•œ schema๊ฐ€ ์ƒ๊ธด ๊ฑธ ํ™•์ธ ํ•  ์ˆ˜ ์žˆ๋‹ค

    โ–ถ

    ์ฟผ๋ฆฌ๋ฌธ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ (!!์ฟผ๋ฆฌ๋ฌธ๊ณผ db์Šคํ‚ค๋งˆ๋Š” ๋‹ค๋ฅธ ๊ฒƒ!!)

Categories:

MySQL