> For the complete documentation index, see [llms.txt](https://docs.postgresql.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.postgresql.tw/15/appendixes/additional-supplied-modules/basic_archive.md).

# F.6. basic\_archive

## F.6. basic\_archive

[F.6.1. Configuration Parameters](#id-1.11.7.15.5)

[F.6.2. Notes](#id-1.11.7.15.6)

[F.6.3. Author](#id-1.11.7.15.7)

`basic_archive` 是一個封存模組範例。此模組會將已完成的 WAL 段檔案複製到指定目錄。它未必特別實用，但可作為開發自訂封存模組的起點。關於封存模組的詳細資訊，請參閱[第 51 章](/15/server-programming/51.-archive-modules.md)。

若要運作，必須透過 [archive\_library](/15/server-administration/server-configuration/write-ahead-log.md#GUC-ARCHIVE-LIBRARY) 載入此模組，並啟用 [archive\_mode](/15/server-administration/server-configuration/write-ahead-log.md#GUC-ARCHIVE-MODE)。

### F.6.1. Configuration Parameters

`basic_archive.archive_directory` (`string`)

伺服器應複製 WAL 段檔案到此目錄。此目錄必須事先存在。預設值為空字串，實際上會停止 WAL 封存；不過若已啟用 [archive\_mode](/15/server-administration/server-configuration/write-ahead-log.md#GUC-ARCHIVE-MODE)，伺服器會累積 WAL 段檔案，等待你提供設定值。

這些參數必須在 `postgresql.conf` 中設定。典型用法如下：

```

# postgresql.conf
archive_mode = 'on'
archive_library = 'basic_archive'
basic_archive.archive_directory = '/path/to/archive/directory'
```

### F.6.2. Notes

伺服器當機時，可能在封存目錄留下以 `archtemp` 為前綴的暫存檔。建議在當機後重新啟動伺服器之前刪除這些檔案。伺服器運作期間也可以安全地移除它們，前提是它們與任何正在進行的封存無關；不過操作時仍應格外謹慎。

### F.6.3. Author

Nathan Bossart

***

原文：[PostgreSQL 15.19 Documentation](https://www.postgresql.org/docs/15/basic-archive.html)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.postgresql.tw/15/appendixes/additional-supplied-modules/basic_archive.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
