Tôi có tệp .sql được tạo bởi postgresql trong khi quay lại. Bây giờ tôi muốn nhập tập tin này vào một cửa sổ máy chạy postgresql.Nhập tệp .sql trên windows vào postgresql
Làm cách nào để thực hiện việc này. Các tập tin là khoảng 1.5gb.
Tôi có tệp .sql được tạo bởi postgresql trong khi quay lại. Bây giờ tôi muốn nhập tập tin này vào một cửa sổ máy chạy postgresql.Nhập tệp .sql trên windows vào postgresql
Làm cách nào để thực hiện việc này. Các tập tin là khoảng 1.5gb.
Bạn nên sử dụng psql lệnh công cụ dòng:
psql -h hostname -p port_number -U username -f your_file.sql databasename
này cũng làm việc cho tôi:
psql dbname username < file.sql
nhấp chuột vào Shell SQL và đăng nhập vào cơ sở dữ liệu và sử dụng nhập khẩu
Server [localhost]:
Database [postgres]:
Port [5432]:
Username [postgres]:
Password for user postgres:
psql (9.2.4)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.
postgres=# \i c:/data/data01.sql
bắt đầu công cụ lệnh psql, nó sẽ cung cấp cho bạn hộp thoại như sau
Server [localhost]:
Database [postgres]:
Port [5432]:yourport
Username [postgres]:
Password for user postgres:**********
sau đó kết nối với cơ sở dữ liệu của bạn
postgres=# \c yourdatabase;
sau đó nhập tệp
yourdatabase=# \i c:/path/path/data/data01.sql
lưu ý thư mục/cho thư mục tách
Chỉ cần một lưu ý: "<" điều hành thắng' t làm việc trong Windows Powershell. – Chief