Postgresql 中数据库的备份
Postgresql中数据库的备份有多种形式: 1、利用图形化界面进行备份 2、利用命令进行备份 利用图形化界面备份简单易操作,但不稳定。可以利用命令进行备份. ExamplesTo dump a database called $pg_dump mydb > db.sql To reload such a script into a (freshly created) database named $psql -d newdb -f db.sql To dump a database into a custom-format archive file: $pg_dump -Fc mydb > db.dump To reload an archive file into a (freshly created) database named $pg_restore -d newdb db.dump To dump a single table named $pg_dump -t mytab mydb > db.sql To dump all tables whose names start with $pg_dump -t 'detroit.emp*' -T detroit.employee_log mydb > db.sql To dump all schemas whose names start with $pg_dump -n 'east*gsm' -n 'west*gsm' -N '*test*' mydb > db.sql The same,using regular expression notation to consolidate the switches: $pg_dump -n '(east|west)*gsm' -N '*test*' mydb > db.sql To dump all database objects except for tables whose names begin with $pg_dump -T 'ts_*' mydb > db.sql To specify an upper-case or mixed-case name in $pg_dump -t '"MixedCaseName"' mydb > mytab.sql 以上命令在执行的过程中需要加上常用连接数据库的命令 例如:利用自定义格式进行备份 pg_dump -h localhost -U wyh -d -Fcdatabasename >d:/databasename.dump (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |