rick@jpusa1.UUCP (Rick Mills) (07/29/89)
Sorry for the informix specific question, but.... Is there any easy way to rename a database in Informix SQL 2.1 ? I can rename the database_name.dbs directory, but I'm sure there are tables in the DB dictionary with hard-coded full pathnames. Any suggestions? -- Rick Mills {gargoyle.uchicago.edu,uunet.uu.net,spl1,ddsw1}!jpusa1.uucp!rick
aland@infmx.UUCP (Dr. Scump) (07/30/89)
In article <1141@jpusa1.UUCP> rick@jpusa1.UUCP (Rick Mills) writes: > Sorry for the informix specific question, but.... > Is there any easy way to rename a database in Informix SQL 2.1 ? >I can rename the database_name.dbs directory, but I'm sure there are > tables in the DB dictionary with hard-coded full pathnames. > Any suggestions? >-- >Rick Mills {gargoyle.uchicago.edu,uunet.uu.net,spl1,ddsw1}!jpusa1.uucp!rick In most cases, it *is* as simple as renaming the .dbs directory name prefix. The only exception is if you have explicit pathnames specified for any tables -- if any of those directories are renamed, you would have to (carefully!) update the catalog accordingly. In the "systables" catalog table, there is a column called "dirpath". For any given table, the O/S file name prefix for the table's files will be here. Normally, it is just the table name (if the table files reside in the .dbs directory). If, however, you built a table somewhere else via the CREATE TABLE ... IN [pathname] clause (say, to put a table in another file system), the full pathname of the table (excluding the .dat suffix) is found here. You can update this value with a regular UPDATE statement if you are primary DBA, but use special care. Normally, renaming the database won't affect such "external" tables anyway. Summary: run a "select tabname, dirpath from systables" and see if any directory names appear that need to be changed. If so, update the dirpath accordingly, exit the database, and rename the directories using mv. -- Alan S. Denney @ Informix Software, Inc. {pyramid|uunet}!infmx!aland "I want to live! -------------------------------------------- as an honest man, Disclaimer: These opinions are mine alone. to get all I deserve If I am caught or killed, the secretary and to give all I can." will disavow any knowledge of my actions. - S. Vega