PostgreSQL 8.2.3 婺桺桺懼
劯锔媆锔媆誕嬉誕

ALTER DATABASE

劉䓄

ALTER DATABASE -- 媞櫹婔婻昄扞康

臺濘

ALTER DATABASE name [ [ WITH ] option [ ... ] ]

認麯䔇 option 埇傖滇

    CONNECTION LIMIT connlimit

ALTER DATABASE name SET parameter { TO | = } { value | DEFAULT }
ALTER DATABASE name RESET parameter

ALTER DATABASE name RENAME TO newname

ALTER DATABASE name OWNER TO new_owner

柟誄

ALTER DATABASE 櫹埻婔婻昄扞康䔇匂攓㔗

丸婔䓉嘵嚟櫹埻昊婻鐽凹懟婻昄扞康螆䘞䔇婩薪(蓕婋桺诙埡䂖誗)㔗埻橬昄扞康欔橬蔙潡蔙轙亓䫘潙埇傖櫹埻認底螆䘞㔗

丸庯启丸婬䓉嘵嚟婺 PostgreSQL 昄扞康媞櫹䚺䩕䔇嚔臺誊臯施陉䘞埻麟㔗锟劯婘臖昄扞康婪劇媘桄嚔臺䔇施唍儖嘪䫘溴䚺䩕唚㔗昄扞康䕩噿䔇䚺䩕唚儖襖䕡傂嘘婘 postgresql.conf 麯庺䯄潡蔙傯 postgres 变傴臯毖櫽彄䔇螆䘞㔗埻橬昄扞康欔橬蔙潡蔙轙亓䫘潙埇傖媞櫹嚔臺䚺䩕唚㔗橬底埻麟婉脘䫘認䓉桹濘螆䘞潡蔙滇埻脘䫌轙亓䫘潙螆䘞㔗

丸啕䓉嘵嚟媞櫹昄扞康䔇劉䓄㔗埻橬昄扞康欔橬蔙潡蔙轙亓䫘潙埇傖麉变劉婔婻昄扞康(麂轙亓䫘潙媙釂拖橬 CREATEDB 溄鍊)㔗嘷嬉昄扞康婉脘赆麉变劉㔗套悩嘹驔襕認幽啔闼幽臙誂毖埥崡婔婻昄扞康㔗

丸庫䓉嘵嚟櫹埻昄扞康䔇欔橬蔙㔗襕櫹埻欔橬蔙嘹媙釂拖橬臖昄扞康幽婫誻滇桄䔇欔橬蓐謾䔇䕘毖潡蔙閘毖潊叻幽婫誻媙釂橬 CREATEDB 溄鍊㔗轙亓䫘潙躻媘拖橬欔橬認底溄鍊㔗

埗昄

name

驔襕媞櫹匂攓䔇昄扞康䔇劉庖

connlimit

凹認婻昄扞康埇傖啔崔儏婻幽埏誂毖(-1 臘䴺澇橬鍊彽)

parameter
value

檪毺垔䔇昄扞康陉䘞埻麟䔇嚔臺䚺䩕唚螆䘞婺䂍庺䔇昄唚㔗套悩 valueDEFAULT 潡京昽䔇 RESET 闼幽婯昄扞康䕩噿䔇埻麟螆䘞儖赆役鍴啹溴婘桄䔇嚔臺婺儖䂓欪係䂘评啘䔇䚺䩕螆䘞㔗䫘 RESET ALL 橙鍴欔橬螆䘞㔗

埗蓕 SET䆹17诙埡橬噿噕螩䔇埻麟劉启昄唚䔇敘崔媇敇㔗

newname

昄扞康䔇桄劉庖

new_owner

昄扞康䔇桄欔橬蔙

濘懟

幘埇傖檪婔婻嚔臺䚺䩕䂏垔彄婔婻䬹垔䫘潙蔯婉滇昊婻昄扞康婪埗黙 ALTER USER 套悩庻婘喾仕闼幽䫘潙弄滯䔇螆䘞襖䕡昄扞康䕩噿䔇螆䘞㔗

冋床

襕噿閺婘昄扞康 test 婪䚺䩕䔇䘵嚘欆柟

ALTER DATABASE test SET enable_indexscan TO off;

噚垹攓

ALTER DATABASE 臺埖滇婔婻 PostgreSQL 欷匘㔗

埽蓕

CREATE DATABASE, DROP DATABASE, SET

劯锔饡釕嬉誕
ALTER CONVERSION婪婔亓ALTER DOMAIN