我从heroku(with the default export way)的postgres数据库中导出了一个转储文件。导出成功,我设法在本地导入所有表,或多或少有一些错误,除了一个表。
我将表格分开,我无法导入,这是一堆COPY
sql命令,我试图单独导入它。不幸的是它总是抛出语法错误。出口的一部分是这样的:
COPY "yachts" ("id", "user_id", "description", "per_day", "per_week", "security_fee", "cleaning_fee", "check_in_at", "check_out_at", "min_stay_days", "created_at", "updated_at", "year_manufactured", "registration_number", "registration_name", "currency", "longitude", "latitude", "published", "country", "rating", "marina", "zoom_level", "archived", "score", "score_adjustment", "crew_per_day", "location_id", "commission_percentage", "year_refitted", "locale", "crew_type", "included_in_price", "apa_fee", "per_weekend", "sent_script_to_linkwise", "read_only", "published_at", "test_boat", "handover_day", "lloyds_verified", "docs_verified", "location_name", "calendar_updated_at", "rate_to_euros", "created_by_id", "published_by_id", "crew_status", "position", "seasonal_pricing", "last_year_with_pricing", "crew_per_week", "listing_title", "locked", "cached_minimum_day_price_cents", "cached_maximum_day_price_cents", "type", "pier_location", "usage") FROM stdin;
1196 2743 Cabins 2\r\nBeds 4\r\nToilet 1\r\nShower 1\r\n\r\nDepth meter\r\nRudder position indicator\r\nGPS chart plotter\r\nBattery charger, transformer\r\nBow thruster\r\nStern thruster\r\nAnchor winch\r\nAnchor\r\nShore power\r\nGas cooker\r\nMicrowave + oven\r\nRefrigerator\r\nCoffee machine\r\nHeating\r\nWarm water via boiler\r\nCar radio + CD player\r\nTV + DVB-T + DVD player 213 \N 750 85 13:00:00 09:00:00 1 2013-12-13 16:32:19.657946 2015-07-10 10:26:06.327685 \N Drait 82 EUR 12.424844 52.413048 f DE \N Marina Brandenburg-Plaue 12 f 4500 0 0 2945358 20.00 \N en \N --- []\n 0 \N t f 2013-12-13 16:32:19.657946 f \N f f Brandenburg an der Havel \N 1.00000 \N \N none 0101000020E6100000BCCD1B2785D92840D0D6C1C1DE344A40 t 2015 0 River boat in Bradenbourg f 21300 21300 MotorBoat \N \N
\.
为了获得更好的格式,我将此文件包含更多记录https://ufile.io/6yecu
我尝试使用psql
和pg_restore
,但在我看来,由于许多转义字符导致记录导致问题。我可以做一些事情来导入这个或丢失了吗?很遗憾,我无权再次导出数据库。
更新
在拆分过程中似乎我损坏了文件的选项卡,正如Jasen的评论中正确提到的那样。我试图用这个命令导入原始文件:
psql new_database < backup_db
我收到很多错误:https://ufile.io/aozf7