dbasim 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
dbasim-0.3.1/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ Copyright (c) 2026 Kulchart Tunyuwattana. All rights reserved.
2
+
3
+ dbasim is proprietary software. You may install and run it for your own personal training.
4
+ Scenarios marked Pro require an active dbasim Pro subscription.
5
+
6
+ You may not copy, modify, redistribute, sublicense or sell dbasim or any part of it, or
7
+ remove or bypass its licence checks, without written permission from the copyright holder.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. IN NO EVENT
10
+ SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY ARISING FROM THE
11
+ USE OF THE SOFTWARE. dbasim creates and drops database objects; use it only with Oracle Database
12
+ Free on your own computer.
13
+
14
+ Oracle is a registered trademark of Oracle Corporation. dbasim is an independent project and is
15
+ not affiliated with Oracle Corporation.
@@ -0,0 +1,7 @@
1
+ # Only the package, its READMEs and the licence go into the source distribution.
2
+ # Never ship: .oracle-password, selftest-*.txt, SELLING.md (store setup), landing/, tests/
3
+ include README.md README.en.md LICENSE
4
+ prune tests
5
+ prune landing
6
+ exclude SELLING.md run-selftest.bat run-selftest.ps1 .oracle-password selftest-*.txt
7
+ global-exclude *.py[cod] __pycache__
dbasim-0.3.1/PKG-INFO ADDED
@@ -0,0 +1,107 @@
1
+ Metadata-Version: 2.4
2
+ Name: dbasim
3
+ Version: 0.3.1
4
+ Summary: Oracle DBA break-fix simulator: inject real-world incidents into your own Oracle Free and get graded on the fix
5
+ Author: Kulchart Tunyuwattana
6
+ License-Expression: LicenseRef-Proprietary
7
+ Keywords: oracle,dba,database,training,troubleshooting,sql
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Education
12
+ Classifier: Intended Audience :: System Administrators
13
+ Classifier: Natural Language :: English
14
+ Classifier: Natural Language :: Thai
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Topic :: Database
18
+ Classifier: Topic :: Education
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: oracledb>=2.0
23
+ Provides-Extra: test
24
+ Requires-Dist: pytest>=7; extra == "test"
25
+ Dynamic: license-file
26
+
27
+ # dbasim — learn to fix Oracle from real incidents
28
+
29
+ Thai is the default language; run `dbasim lang en` for English.
30
+
31
+ dbasim plants a "the database is broken" incident in Oracle Database Free on your own computer.
32
+ A simulated app keeps using it the whole time. You find the cause, fix it, and dbasim checks
33
+ whether your fix really worked.
34
+
35
+ > ⚠️ dbasim creates and drops users and tablespaces in the database it points at. Only use it with
36
+ > Oracle Free on your own machine. It refuses to run against anything that is not Free and never
37
+ > drops a `SHOP` user it did not create.
38
+
39
+ ## Requirements
40
+
41
+ - Docker (on Windows: Docker Desktop + WSL2)
42
+ - About 3GB free RAM and 10GB free disk
43
+ - Python 3.9 or newer
44
+
45
+ ## 1. Start Oracle Database Free
46
+
47
+ ```bash
48
+ docker run -d --name dbasim-oracle -p 1521:1521 \
49
+ -e ORACLE_PWD=ChangeMe123 \
50
+ container-registry.oracle.com/database/free:latest
51
+
52
+ docker logs -f dbasim-oracle # wait for DATABASE IS READY TO USE!
53
+ ```
54
+
55
+ Downloading and using Oracle Database Free is governed by the
56
+ [Oracle Free Use Terms and Conditions](https://www.oracle.com/downloads/licenses/oracle-free-license.html),
57
+ between you and Oracle.
58
+
59
+ ## 2. Install dbasim
60
+
61
+ ```bash
62
+ pip install dbasim
63
+ ```
64
+
65
+ ## 3. Configure
66
+
67
+ ```bash
68
+ export DBASIM_ADMIN_PASSWORD=ChangeMe123 # Windows PowerShell: $env:DBASIM_ADMIN_PASSWORD="ChangeMe123"
69
+ export DBASIM_DSN=localhost:1521/FREEPDB1 # default
70
+ export DBASIM_SCALE=0.3 # smaller data for slow machines
71
+ dbasim lang en # English (Thai is the default)
72
+ dbasim doctor
73
+ ```
74
+
75
+ ## 4. Play
76
+
77
+ | Command | What it does |
78
+ | --- | --- |
79
+ | `dbasim list` | List scenarios and your scores |
80
+ | `dbasim start s01` | Start a scenario (plants the problem + starts the simulated app) |
81
+ | `dbasim logs` | Read the app's log, like when a ticket comes in |
82
+ | `dbasim status` | Time spent, score, and the password of user SHOP |
83
+ | `dbasim hint` | Get a hint (-15 points each) |
84
+ | `dbasim check` | Check your fix; once solved you see a senior DBA's write-up |
85
+ | `dbasim solution --yes` | Give up and see the solution (0 points) |
86
+ | `dbasim lang en` / `th` | Switch language (or set `DBASIM_LANG`) |
87
+ | `dbasim reset` | Remove everything dbasim created and undo settings the scenarios invite you to change |
88
+
89
+ Use any tool you like: SQL*Plus, SQLcl, SQL Developer, connected as SYSTEM to `FREEPDB1`.
90
+ Every scenario can be solved with what Oracle Free ships (`v$` views, `DBMS_XPLAN`, trace).
91
+ No AWR/ASH needed.
92
+
93
+ ## Scenarios
94
+
95
+ | ID | Scenario | Level | Plan |
96
+ | --- | --- | --- | --- |
97
+ | s01 | Order search page is slow | Easy | Free |
98
+ | s02 | Month-end report slow after data migration | Easy | Free |
99
+ | s03 | The nightly batch fails every night | Easy | Free |
100
+ | s04 | Payment entry screen hangs | Medium | Pro (coming soon) |
101
+ | s05 | CPU spikes after a new app release | Medium | Pro (coming soon) |
102
+
103
+ The first three scenarios are free forever: no sign-up and no licence key. Pro scenarios are
104
+ not on sale yet (coming soon). Watch this repository to hear when they launch.
105
+
106
+ Found a problem, or want to suggest a scenario? Open an issue at
107
+ https://github.com/kulchartt/oracledbasim/issues
@@ -0,0 +1,81 @@
1
+ # dbasim — learn to fix Oracle from real incidents
2
+
3
+ Thai is the default language; run `dbasim lang en` for English.
4
+
5
+ dbasim plants a "the database is broken" incident in Oracle Database Free on your own computer.
6
+ A simulated app keeps using it the whole time. You find the cause, fix it, and dbasim checks
7
+ whether your fix really worked.
8
+
9
+ > ⚠️ dbasim creates and drops users and tablespaces in the database it points at. Only use it with
10
+ > Oracle Free on your own machine. It refuses to run against anything that is not Free and never
11
+ > drops a `SHOP` user it did not create.
12
+
13
+ ## Requirements
14
+
15
+ - Docker (on Windows: Docker Desktop + WSL2)
16
+ - About 3GB free RAM and 10GB free disk
17
+ - Python 3.9 or newer
18
+
19
+ ## 1. Start Oracle Database Free
20
+
21
+ ```bash
22
+ docker run -d --name dbasim-oracle -p 1521:1521 \
23
+ -e ORACLE_PWD=ChangeMe123 \
24
+ container-registry.oracle.com/database/free:latest
25
+
26
+ docker logs -f dbasim-oracle # wait for DATABASE IS READY TO USE!
27
+ ```
28
+
29
+ Downloading and using Oracle Database Free is governed by the
30
+ [Oracle Free Use Terms and Conditions](https://www.oracle.com/downloads/licenses/oracle-free-license.html),
31
+ between you and Oracle.
32
+
33
+ ## 2. Install dbasim
34
+
35
+ ```bash
36
+ pip install dbasim
37
+ ```
38
+
39
+ ## 3. Configure
40
+
41
+ ```bash
42
+ export DBASIM_ADMIN_PASSWORD=ChangeMe123 # Windows PowerShell: $env:DBASIM_ADMIN_PASSWORD="ChangeMe123"
43
+ export DBASIM_DSN=localhost:1521/FREEPDB1 # default
44
+ export DBASIM_SCALE=0.3 # smaller data for slow machines
45
+ dbasim lang en # English (Thai is the default)
46
+ dbasim doctor
47
+ ```
48
+
49
+ ## 4. Play
50
+
51
+ | Command | What it does |
52
+ | --- | --- |
53
+ | `dbasim list` | List scenarios and your scores |
54
+ | `dbasim start s01` | Start a scenario (plants the problem + starts the simulated app) |
55
+ | `dbasim logs` | Read the app's log, like when a ticket comes in |
56
+ | `dbasim status` | Time spent, score, and the password of user SHOP |
57
+ | `dbasim hint` | Get a hint (-15 points each) |
58
+ | `dbasim check` | Check your fix; once solved you see a senior DBA's write-up |
59
+ | `dbasim solution --yes` | Give up and see the solution (0 points) |
60
+ | `dbasim lang en` / `th` | Switch language (or set `DBASIM_LANG`) |
61
+ | `dbasim reset` | Remove everything dbasim created and undo settings the scenarios invite you to change |
62
+
63
+ Use any tool you like: SQL*Plus, SQLcl, SQL Developer, connected as SYSTEM to `FREEPDB1`.
64
+ Every scenario can be solved with what Oracle Free ships (`v$` views, `DBMS_XPLAN`, trace).
65
+ No AWR/ASH needed.
66
+
67
+ ## Scenarios
68
+
69
+ | ID | Scenario | Level | Plan |
70
+ | --- | --- | --- | --- |
71
+ | s01 | Order search page is slow | Easy | Free |
72
+ | s02 | Month-end report slow after data migration | Easy | Free |
73
+ | s03 | The nightly batch fails every night | Easy | Free |
74
+ | s04 | Payment entry screen hangs | Medium | Pro (coming soon) |
75
+ | s05 | CPU spikes after a new app release | Medium | Pro (coming soon) |
76
+
77
+ The first three scenarios are free forever: no sign-up and no licence key. Pro scenarios are
78
+ not on sale yet (coming soon). Watch this repository to hear when they launch.
79
+
80
+ Found a problem, or want to suggest a scenario? Open an issue at
81
+ https://github.com/kulchartt/oracledbasim/issues
dbasim-0.3.1/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # dbasim — ฝึกแก้ปัญหา Oracle จากสถานการณ์จริง
2
+
3
+ [English](README.en.md)
4
+
5
+ dbasim สร้าง "เหตุการณ์ DB มีปัญหา" ขึ้นใน Oracle Database Free บนเครื่องของคุณเอง
6
+ มีแอปจำลองที่มีคนใช้งานอยู่ตลอด ให้คุณหาสาเหตุ แก้ปัญหา แล้วให้ระบบตรวจว่าแก้ถูกหรือไม่
7
+
8
+ > ⚠️ dbasim จะสร้างและลบ user / tablespace ใน DB ที่ชี้ไป ใช้กับ Oracle Free ในเครื่องตัวเองเท่านั้น
9
+ > โปรแกรมจะไม่ยอมทำงานกับ DB ที่ไม่ใช่ Free และจะไม่ลบ user `SHOP` ที่ไม่ได้สร้างเอง
10
+
11
+ ## สิ่งที่ต้องมี
12
+
13
+ - Docker (Windows ใช้ Docker Desktop + WSL2)
14
+ - RAM ว่างประมาณ 3GB และ disk ว่าง 10GB
15
+ - Python 3.9 ขึ้นไป
16
+
17
+ ## 1. เปิด Oracle Database Free
18
+
19
+ ```bash
20
+ docker run -d --name dbasim-oracle -p 1521:1521 \
21
+ -e ORACLE_PWD=ChangeMe123 \
22
+ container-registry.oracle.com/database/free:latest
23
+
24
+ docker logs -f dbasim-oracle # รอจนเห็น DATABASE IS READY TO USE!
25
+ ```
26
+
27
+ การดาวน์โหลดและใช้ Oracle Database Free อยู่ภายใต้
28
+ [Oracle Free Use Terms and Conditions](https://www.oracle.com/downloads/licenses/oracle-free-license.html)
29
+ ระหว่างคุณกับ Oracle โดยตรง
30
+
31
+ ## 2. ติดตั้ง dbasim
32
+
33
+ ```bash
34
+ pip install dbasim
35
+ ```
36
+
37
+ ## 3. ตั้งค่า
38
+
39
+ ```bash
40
+ export DBASIM_ADMIN_PASSWORD=ChangeMe123 # Windows PowerShell: $env:DBASIM_ADMIN_PASSWORD="ChangeMe123"
41
+ export DBASIM_DSN=localhost:1521/FREEPDB1 # ค่า default
42
+ export DBASIM_SCALE=0.3 # ถ้าเครื่องช้า ลดขนาดข้อมูลลง
43
+ dbasim doctor
44
+ ```
45
+
46
+ ## 4. เล่น
47
+
48
+ | คำสั่ง | ทำอะไร |
49
+ | --- | --- |
50
+ | `dbasim list` | ดูโจทย์ทั้งหมดและคะแนน |
51
+ | `dbasim start s01` | เริ่มโจทย์ (สร้างปัญหา + เปิดแอปจำลอง) |
52
+ | `dbasim logs` | ดู log ของแอป เหมือนตอนรับ ticket |
53
+ | `dbasim status` | เวลาที่ใช้ คะแนน และรหัสผ่าน user SHOP |
54
+ | `dbasim hint` | ขอคำใบ้ (หัก 15 คะแนนต่อครั้ง) |
55
+ | `dbasim check` | ตรวจคำตอบ ผ่านแล้วจะเห็นเฉลยแบบ DBA อาวุโส |
56
+ | `dbasim solution --yes` | ยอมแพ้ ดูเฉลย (0 คะแนน) |
57
+ | `dbasim lang en` | เปลี่ยนเป็นภาษาอังกฤษ (`dbasim lang th` กลับเป็นไทย หรือตั้ง `DBASIM_LANG`) |
58
+ | `dbasim reset` | ล้างทุกอย่างที่ dbasim สร้าง และคืนค่าที่โจทย์ชวนให้แก้ (cursor_sharing, idle timeout, logon trigger ที่ตั้ง cursor_sharing) |
59
+
60
+ ใช้เครื่องมืออะไรแก้ก็ได้ เช่น SQL*Plus, SQLcl, SQL Developer ต่อด้วย SYSTEM เข้า `FREEPDB1`
61
+ ทุกโจทย์แก้ได้ด้วยเครื่องมือที่มีใน Oracle Free (`v$` views, `DBMS_XPLAN`, trace)
62
+ ไม่ต้องใช้ AWR/ASH
63
+
64
+ ## โจทย์ที่มีตอนนี้
65
+
66
+ | ID | โจทย์ | ระดับ | แผน |
67
+ | --- | --- | --- | --- |
68
+ | s01 | หน้าค้นหาออเดอร์ช้า | ง่าย | ฟรี |
69
+ | s02 | Report ปิดเดือนช้าหลังย้ายข้อมูล | ง่าย | ฟรี |
70
+ | s03 | Batch กลางคืนล้มทุกคืน | ง่าย | ฟรี |
71
+ | s04 | หน้าจอบันทึกการชำระเงินค้าง | กลาง | Pro (เร็วๆ นี้) |
72
+ | s05 | CPU พุ่งหลังปล่อยแอปเวอร์ชันใหม่ | กลาง | Pro (เร็วๆ นี้) |
73
+
74
+ 3 โจทย์แรกเล่นฟรีตลอด ไม่ต้องสมัครสมาชิกและไม่ต้องใช้ license key ส่วนโจทย์ Pro ยังไม่เปิดขาย (เร็วๆ นี้) กด Watch ที่ repo นี้ไว้เพื่อรับข่าวตอนเปิดตัว
75
+
76
+ เจอปัญหาหรืออยากเสนอโจทย์ใหม่ เปิด issue ได้ที่ https://github.com/kulchartt/oracledbasim/issues
77
+
78
+ ## ทดสอบทุกโจทย์กับ Oracle จริง (Windows คลิกเดียว)
79
+
80
+ ดับเบิลคลิก `run-selftest.bat` สคริปต์จะ:
81
+ 1. เช็ค Docker และ Python
82
+ 2. ดาวน์โหลดและเปิด Oracle Database Free (ครั้งแรกโหลดหลาย GB)
83
+ 3. ติดตั้ง dbasim ใน `.venv`
84
+ 4. รัน `dbasim selftest` ซึ่งทำทุกโจทย์: ฝังปัญหา → ตรวจว่าต้องไม่ผ่าน → แก้ด้วยวิธีเฉลย → ตรวจว่าต้องผ่าน
85
+
86
+ ผลจะอยู่ใน `selftest-result.txt` และ `selftest-dbasim.txt`
87
+
88
+ ## สำหรับนักพัฒนา
89
+
90
+ ```bash
91
+ pip install -e ".[test]"
92
+ pytest
93
+ ```
94
+
95
+ โครงของโจทย์อยู่ใน `dbasim/scenarios/` แต่ละข้อมี `setup` (ฝังปัญหา), `workload_step`
96
+ (ผู้ใช้จำลอง), `collect` (วัดค่าใน DB) และ `evaluate` (ตัดสินแบบ pure Python ทดสอบได้โดยไม่ต้องมี Oracle)
@@ -0,0 +1 @@
1
+ __version__ = "0.3.1"