[英]Execute a .sql file with psql and make a log file
我是第一次處理 psql,我需要一個執行 .sql 文件的命令,執行后,它應該生成一個帶有腳本輸出的 .log 文件。 我正在尋找與我在 SQL Server 中使用的其他命令類似的東西:
sqlcmd -U userid -P password -S serveraddress -i path_to_the_sql_file -o path_where_to_save_log_file
你能幫我嗎? :-)
我會花一些時間在 psql頁面上。
一個簡單的例子:
psql -U userid -h serveraddress -d some_db -f path_to_the_sql_file -L=path_where_to_save_log_file
使用 Postgres,您需要使用客戶端連接到數據庫。 在上面的鏈接中還有其他用於輸入命令和捕獲輸出的選項。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.