Обсуждение: db rename
I thought there was an option to rename a database? I cannot seem to find the syntax in any of my books or on the web site. Am I incorrect? We are running 7.3.4. We have to bring our sytem down to upgrade the release this afternoon. There are a number of db changes taking place so I was thinking instead of taking the system down for an extended amount of time I could build another database with all our new items and then just rename it when we are ready.
Is there a rename option out there for our version?
thanks
Jodi
Is there a rename option out there for our version?
thanks
Jodi
--
_______________________________
Jodi L Kanter
BioInformatics Database Administrator
University of Virginia
(434) 924-2846
jkanter@virginia.edu
<tt><br /> Dear Jodi,<br /><br /><br /> psql>\h CREATE DATABASE<br /> Command: CREATE DATABASE<br /> Description:create a new database<br /> Syntax:<br /> CREATE DATABASE name<br /> [ [ WITH ] [ OWNER [=] dbowner ]<br/> [ LOCATION [=] 'dbpath' ]<br /> [ TEMPLATE [=] template ]<br /> [ ENCODING [=] encoding] ]<br /><br /> tradein_clients=#<br /><br /></tt><br /> You might consider using the TEMPLATE=template option<br/> by default its template1 , if you put the existing database name<br /> a replica of specified database is made<br/><br /> Hope it helps.<br /><br /> Regds<br /> Mallah.<br /><br /> Jodi Kanter wrote: <blockquote cite="mid417CF897.1020701@virginia.edu"type="cite"></blockquote> I thought there was an option to rename a database? I cannotseem to find the syntax in any of my books or on the web site. Am I incorrect? We are running 7.3.4. We have to bringour sytem down to upgrade the release this afternoon. There are a number of db changes taking place so I was thinkinginstead of taking the system down for an extended amount of time I could build another database with all our newitems and then just rename it when we are ready.<br /> Is there a rename option out there for our version?<br /> thanks<br/> Jodi <br /><div class="moz-signature">-- <br /></div><div class="Section1"><p class="MsoNormal"><i><span style="font-size:9pt; font-family: Arial;">_______________________________<br /></span></i><i><span style="font-size: 10pt;">JodiL Kanter<br /> BioInformatics Database Administrator<br /> University of Virginia<br /> (434) 924-2846<br /><ahref="mailto:jkanter@virginia.edu100">jkanter@virginia.edu</a></span></i><p class="MsoNormal"> </div><br /><br /><preclass="moz-signature" cols="72">-- regds Mallah. Rajesh Kumar Mallah +---------------------------------------------------+ | Tradeindia.com (3,11,246) Registered Users | | Indias' Leading B2B eMarketPlace | | <a class="moz-txt-link-freetext" href="http://www.tradeindia.com/">http://www.tradeindia.com/</a> | +---------------------------------------------------+ </pre>
syntax is: update pg_database set datname=<new_name> where datname=<old_name>; checkpoint; HTH, Chris ------------------( Forwarded letter 1 follows )--------------------- Date: Mon, 25 Oct 2004 08:59:03 -0400 To: Postgres.Admin.List[pgsql-admin]@postgresql.org.comp From: Jodi.Kanter[jkanter]@virginia.edu.comp Sender: pgsql-admin-owner+m15321@postgresql.org.comp Subject: [ADMIN] db rename I thought there was an option to rename a database? I cannot seem to find the syntax in any of my books or on the web site. Am I incorrect? We are running 7.3.4. We have to bring our sytem down to upgrade the release this afternoon. There are a number of db changes taking place so I was thinking instead of taking the system down for an extended amount of time I could build another database with all our new items and then just rename it when we are ready. Is there a rename option out there for our version? thanks Jodi -- _______________________________ Jodi L Kanter BioInformatics Database Administrator University of Virginia (434) 924-2846 jkanter@virginia.edu <mailto:jkanter@virginia.edu100>
Вложения
Jodi Kanter <jkanter@virginia.edu> writes: > I thought there was an option to rename a database? No, but you could always do an UPDATE on pg_database. It might be a good idea to ensure there are no backends running in the target database when you do the update. (I think that recent releases wouldn't care particularly, but I'm less sure about 7.3.4.) regards, tom lane