Document #: US-38732,EN
------------------------------------------------------------------------------
Major subject: analysis Minor subjects: tech_notes
Keywords: dba_guide
Abstract:
The "Copying a Database in the Same Installation" section,
from the INGRES Database Administrator's Guide chapter "Loading
and Unloading the Database". How to copy or rename a database.
This document is equivalent to Release 6 Technical Note
#5 or Release 5 note #43.
Expert note:
Copying a Database in the Same Installation
===========================================
The procedure below shows how to use 'unloaddb' to unload
and reload a database on the same installation.
Please note the following:
o Since 'unloaddb' creates many files, you may find it
useful to create a subdirectory and then run the
command while in the subdirectory. If you do this, all
of the files created by 'unloaddb' will be in this
subdirectory. This is shown in step 2 below.
o For complete details on how 'unloaddb' works, refer to
the previous section "Using Unloaddb."
Procedure: Copying a Database
-----------------------------
Here is the procedure to move or copy a database with
'unloaddb':
1. Log in as the owner of the database you would like to
move.
2. Optionally create a subdirectory to contain all of the
'unloaddb' files:
UNIX: $ mkdir path
$ cd path
VMS: $ create/dir device:[full_path]
$ set def device:[full_path]
3. At the operating system prompt, run 'unloaddb' on the
database you are unloading:
$ unloaddb -c dbname
4. Set UNIX permissions on the 'unload.ing' file:
UNIX ONLY: $ chmod 777 unload.ing
5. Execute the 'unload.ing' command file:
UNIX: $ unload.ing
VMS: $ @unload.ing
6. Reload into a new, empty database of another name by
first creating the new database:
$ createdb newdb
7. Using a text editor on the 'reload.ing' command file,
change the name of the database for the "cpxxx.in" file
to the new database name. Here is an example that has
changed the database name to "newdb":
UNIX: $ sql -s -f4F79.38 -f8F79.38 -uDBA newdb < /path/cpDBA.in
VMS: $ sql -s -f4F79.38 -f8F79.38 -uDBA newdb - < WORK_DEV:[WORKDIR]cpDBA.in
8. If you want to create the new database in a different
location from the original, change the location name in
the cp_ingre.in or cpUSER.in script to the new location
name.
9. If you want to change ownership of the database, see
Chapter 8 of the Database Administrator's Guide.
10. Execute the 'reload.ing' command file:
UNIX: $ reload.ing
VMS: $ @reload.ing
This loads into the new database and is the most time
consuming step.
11. Run 'sysmod' on the database after loading it. Issue
the command:
$ sysmod newdb
12. If you want to remove the original database, use the
'destroydb' command:
$ destroydb original_dbname
Note
Make sure you successfully unloaded and reloaded the
database before you destroy the original database.
Releases affected: all(all.all) - Releases not affected:
Errors:
Bugs/SIRS:
------------------------------------------------------------------------------
Ingres Database Reference
To William's Home Page
© William Yuan 2000
Email William