PostgreSQL DBA(29) - Backup&Recovery#2(日期格式导致的错误)

由于日期格式的不同,PostgreSQL在执行恢复读取recovery.conf的时候会出现问题. 
错误信息 
在recovery.conf文件,recovery_target_time的设置

 
  1.  
  2. recovery_target_time='2019-3-11 14:40:00'
  3.  

如按上述设置,则会出现错误

 
  1.  
  2. [xdb@localhost testdb]$ pg_ctl start
  3. waiting for server to start....2019-03-11 14:04:45.121 CST [21749] LOG: listening on IPv4 address "0.0.0.0", port 5432
  4. 2019-03-11 14:04:45.121 CST [21749] LOG: listening on IPv6 address "::", port 5432
  5. 2019-03-11 14:04:45.123 CST [21749] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
  6. 2019-03-11 14:04:45.135 CST [21749] LOG: redirecting log output to logging collector process
  7. 2019-03-11 14:04:45.135 CST [21749] HINT: Future log output will appear in directory "log".
  8. stopped waiting
  9. pg_ctl: could not start server
  10. Examine the log output.
  11.  

日志提示

 
  1.  
  2. [xdb@localhost log]$ cat postgresql-2019-03-11_122129.csv
  3. 2019-03-11 12:21:29.233 CST,,,1680,,5c85e249.690,1,,2019-03-11 12:21:29 CST,,0,LOG,00000,"ending log output to stderr",,"Futu
  4. 2019-03-11 12:21:29.236 CST,,,1682,,5c85e249.692,1,,2019-03-11 12:21:29 CST,,0,LOG,00000,"database system was interrupted; la
  5. 2019-03-11 12:21:29.249 CST,,,1682,,5c85e249.692,2,,2019-03-11 12:21:29 CST,,0,FATAL,42601,"syntax error in file ""recovery.c
  6. 2019-03-11 12:21:29.250 CST,,,1680,,5c85e249.690,2,,2019-03-11 12:21:29 CST,,0,LOG,00000,"startup process (PID 1682) exited w
  7. 2019-03-11 12:21:29.250 CST,,,1680,,5c85e249.690,3,,2019-03-11 12:21:29 CST,,0,LOG,00000,"aborting startup due to startup pro
  8. 2019-03-11 12:21:29.252 CST,,,1680,,5c85e249.690,4,,2019-03-11 12:21:29 CST,,0,LOG,00000,"database system is shut down",,,,,,
  9.  

在recovery.conf文件的第3行有语法错误,猜测是日期格式问题

日期格式

 
  1.  
  2. testdb=# show datestyle;
  3. DateStyle
  4. -----------
  5. ISO, MDY
  6. (1 row)
  7.  

PG日期格式为月-日-年,recovery.conf文件的日期调整为该格式即可解决上述问题.

内容转载:http://blog.itpub.net/6906/viewspace-2638064

猜你喜欢

转载自blog.csdn.net/shwuqu110/article/details/88400030