> For the complete documentation index, see [llms.txt](https://doc.omflow.com.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.omflow.com.tw/id-2/2-14-1.md).

# DBMaker注意事項

DBMaker 為 OMFLOW Windows 版本可選擇之內建資料庫，以下總結可能出現的錯誤：

## 1. 版本更新時出現 Journal Full 錯誤訊息

查看error.log出現以下類似錯誤訊息：

* \[DBMaker] 日誌已滿：事務已被中斷 (11311) (SQLExecDirectW)

### 解決辦法：

OMFLOW Patch 在 migration 時若資料量過多造成此錯誤，需加大或新增 Journal File，以下為操作步驟：

#### 修改dmconfig.ini

Windows版本路徑為 `C:\Program Files\OMFLOW Server\DBMaker\dmconfig.ini`

```
DB_JNFIL = OMFLOW1.JNL OMFLOW2.JNL OMFLOW3.JNL OMFLOW4.JNL OMFLOW5.JNL OMFLOW6.JNL OMFLOW7.JNL OMFLOW8.JNL
DB_JNLSZ = 8G
DB_SMODE = 2
DB_FORCS = 1
```

#### 重啟DBMaker服務

> 此方法無法完全解決，當資料過於龐大時仍有機會造成此錯誤。

## 2. OMFLOW 進行介面操作時出現 out of DCCA memory 錯誤

查看error.log出現以下類似錯誤訊息：

* \[DBMaker] out of DCCA memory: initial DCCA setting is too small (1103) (SQLFetch)

### 解決辦法：

當 lock 太多會佔用 DCCA 導致記憶體不足，請在 dmconfig.ini 設定，設定後重新啟動 DBMaker 服務。

#### 修改dmconfig.ini

Windows版本路徑為 `C:\Program Files\OMFLOW Server\DBMaker\dmconfig.ini`

```
DB_SCASZ = 1024M
```

#### 重啟DBMaker服務

## 3. 上架流程出現 DBMaker 錯誤訊息

查看error.log出現以下類似錯誤訊息：

* \[DBMaker] total length of all columns exceeds maximum length : this table needs at least 8081 bytes, it should be less than the maximum length of a page 8064 bytes (6527) (SQLExecDirectW)')
* \[DBMaker] Invalid field name : FORMITM\_127 (6523) (SQLPrepare)

### 解決方法

此錯誤為表單設計欄位超過DBMaker長度限制時未成功建置table，導致資料與實際table columns產生落差。

#### 修改dmconfig.ini

```
DB_PGSIZ = 32
```

#### 匯出原有資料庫並重新建立

詳細步驟請聯繫 <https://www.dbmaker.com.tw/serForm.php>

## 4. 出現「視圖已存在」錯誤訊息

查看error.log出現以下類似錯誤訊息：

* \[DBMaker] 該表或視圖已存在 : \<TABLE\_NAME> (6520) (SQLExecDirectW)

### 解決方法

當 migration 因任何因素失敗時，導致下次 migration 無法正確從上次結束的地方開始執行。

#### 將出問題的 APP migration 歸零並重新執行

```
python manage.py migrate your_app zero
python manage.py makemigrations your_app
python manage.py migrate
```

## 5. 出現表單異常卡住之問題

查看error.log並未出現錯誤訊息

### 解決方法

請更新 OMFLOW 至 1.2.0 以上版本

## 6. 硬碟空間不足之問題

查看error.log出現以下類似錯誤訊息：

* \[DBMaker] no disk space or quota : /opt/dbmaker/database/fo/\_\_0O619F.TMP (11211)

### 解決方法

由於tablespace不正常增長導致，需重啟 DBMaker 資料庫清空暫存檔案，並關閉tablespace動態新增改為手動新增，

```
//列出所有 tablespace
select TS_NAME from systablespace;
//查詢 table 所在的 tablespace
def table ;
//將 DEFTABLESPACE 修改為 regular ts
ALTER TABLESPACE DEFTABLESPACE SET AUTOEXTEND OFF;

EXTENDTS() stored procedure to extend tablespace
Description: provide stored procedure for user to extend or add file to tablespace based
on some condition.

Synatx: EXTENDTS(VARCHAR(128) TABLESPACE_NAME INPUT,
VARCHAR(100) THRESHOLD_PAGE INPUT,
VARCHAR(100) THRESHOLD_FRAME INPUT,
VARCHAR(256) FILE_PREFIX INPUT,
VARCHAR(256) FILE_PATH INPUT)
Check and extend tablespace by adding page or
file according to the threshold_page/frame. The syntax for threshold_page/frame is "nFree
nAdd nMax". EXTENDTS() will check and extend when the tablespace's free page/frame < nFree
and add nAdd page/frame. If user has specified the FILE_PREFIX, it will check whether
the data file's npage + nAdd > nMax and add a file as FILE_PATH/FILE_PREFIX_%d.DB/BB.
example: CALL EXTENDTS('TS1', '10280 20560 10G', '10280 20560 10G','TS1','/data/ts1');
or CALL EXTENDTS('TS1', '100M 200M 10G', '100M 200M 10G','TS1','/data/ts1');

For example: If user want to extend deftablespace when free space < 100M and add 200M,
can use the following task to define it.

User can create task as following example:
call task_create('task1','STORE_PROCEDURE', 'call EXTENDTS(''DEFTABLESPACE'', ''100M 200M 100G'',
''100M 200M 100G'', null, null)');

Or if user want to add file if exceed 10G, user must specify file_prefix
call task_create('task1','STORE_PROCEDURE', 'call EXTENDTS(''TS1'', ''100M 200M 10G'', ''100M
200M 10G'', ''TS1'', ''/data/ts1/'')');
If the file in TS1 exceed 10G (NOTE: limitation: the file size cannot be exactly 10G)
it will create logical file TS1_01.DB in the /data/ts1/TS1_01.DB

After create a task, user can create/enable it in the schedule daemon.

To run the stored procedure for every 30 minitues:
call schedule_create('sche1','task1','*/30 * * * *','2012-12-12 12:12:00','2028-12-12 12:12:00');

call schedule_enable('sche1');
```
