bestlong 怕失憶論壇

 

 

搜索
bestlong 怕失憶論壇 論壇 Database - 資料庫 PostgreSQL 在 Windows 環境用排程進行 PostgreSQL database 的備份 ...
查看: 8283|回復: 1
go

在 Windows 環境用排程進行 PostgreSQL database 的備份與維護 [複製鏈接]

Rank: 9Rank: 9Rank: 9

1#
發表於 2006-6-18 22:03 |只看該作者 |倒序瀏覽 |打印
1)  建立一個目錄 %APPDATA%\postgresql
在我的環境中為 C:\Documents and Settings\bestlong\Application Data\postgresql

2)  建立一個檔案 %APPDATA%\postgresql\pgpass.conf
可使用文字編輯程式如 Notepad

3)  輸入必要的設定在 %APPDATA%\postgresql\pgpass.conf
內容如下行
localhost:*:myDBname:myUserName:myPassword

4)  建立批次檔來執行備份或維護作業, 指令如下:
"C:\Program Files\PostgreSQL\8.0\bin\psql" -h localhost -d myDBname -U myUserName -f Name-Of-File-With-Maintenance-Commands
"C:\Program Files\PostgreSQL\8.0\bin\pg_dump" -f Name-Of-My-Dump-File -Fc -Z 9 -h localhost -U myUserName myDBname

5)  Use the task scheduler to run your newly created batch file whenever you'd like it to run

I actually run my batch file every night.  My DB has no activity during the night, so I run my maintenance then.

Name-Of-File-With-Maintenance-Commands contains SQL to refresh a materialized view and do a vacuum full analyze
我是雪龍
http://blog.bestlong.idv.tw
http://www.bestlong.idv.tw

Rank: 9Rank: 9Rank: 9

2#
發表於 2006-6-18 22:13 |只看該作者
可參考官方文件
Client Interfaces
- libpq - C Library
-- The Password File
我是雪龍
http://blog.bestlong.idv.tw
http://www.bestlong.idv.tw
‹ 上一主題|下一主題

Archiver|怕失憶論壇

GMT+8, 2025-5-2 04:11 , Processed in 0.035385 second(s), 11 queries .

Powered by Discuz! X1.5

© 2001-2010 Comsenz Inc.