将数据库保存在外部硬盘驱动器上 [英] Save database on external hard drive
本文介绍了将数据库保存在外部硬盘驱动器上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 PostgreSQL 创建一些数据库,但由于计算机内存不足,我想将它们保存在外部硬盘驱动器上.
I am creating some databases using PostgreSQL but I want to save them on an external hard drive due to lack of memory in my computer.
我该怎么做?
推荐答案
您可以通过将数据库指定为 data_directory
设置将其存储在另一个磁盘上.您需要在启动时指定此项,它将适用于所有数据库.
You can store the database on another disk by specifying it as the data_directory
setting. You need to specify this at startup and it will apply to all databases.
你可以把它放在postgresql.conf
中:
data_directory = '/volume/path/'
或者,在启动 PostgreSQL 时在命令行中指定:
Or, specify it on the command line when you start PostgreSQL:
postgres -c data_directory='/volume/path/'
参考:18.2.文件位置
这篇关于将数据库保存在外部硬盘驱动器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文