Previous Topic: dbmgr -export Function—Create Script that Defines a DatabaseNext Topic: dbmgr -util Function—Manage Existing Database


dbmgr -migrate Function—Copy Data to a Flat File

The dbmgr ‑migrate function copies data from user and program records in an existing database to a flat file (binary format). It can also copy the data from the flat file into a new database. The database from which the data is imported must be version 1.21 or later.

When you copy a flat file into a new database, use the same version of this function that you used to create the flat file. If you have more than one version, we strongly recommend that you use the most recent version.

Note: For better security, delete the old database, the script used to build the new database, and the flat file created by this function after copying the data from the old database into the new database.

Important! Always create a backup of the database before using this function.

This command has the following format:

dbmgr {migrate|‑m} {-r|-w|-h} [-s] filename \
[-v versionNumber] [-f fileName]
-migrate|-m

Executes the database migration function of the dbmgr utility.

filename

Defines the flat file you want to copy data from or into.

‑f filename

Directs output to the specified file, instead of the standard output device.

‑h

Displays the help for this function.

‑r

Reads the database in the current directory and copies certain data into the flat file filename.

‑s

Reads the information from the database using the CA ControlMinder server rather than reading the database directly. This option is only valid with the ‑r switch.

You must have administrator privileges and R (read) and W (write) access to the terminal to use this option.

If you do not specify this option, the function reads from or writes to the database in the current directory.

-v versionNumber

Reads a flat file that was created by a previous version. This option is only valid for -w command. Enter this option after the file name and supply the version number.

‑w

Reads the flat file filename and copies the data into the database in the current directory.

Example: Copy data from an existing database to a new database

The following steps illustrate how to copy data from an existing database into a new database. The old database is assumed to be in the directory /tmp/old_db. The new database is assumed to be in the directory ACInstallDir/seosdb (where ACInstallDir is the directory in which you installed CA ControlMinder).

Note: This procedure is written using UNIX pathnames but can be followed on Windows by modifying these pathnames as appropriate.

  1. Log in as a superuser.
  2. If the CA ControlMinder daemons are running, shut them down with the following command:
    secons ‑s
    
  3. Create a backup of the old database by copying it to a different location or to a backup medium.
  4. Copy the database into /tmp/old_db, then create a script that duplicates the old database by running the dbmgr utility on the old database:
    cd /tmp/old_db
    /opt/CA/AccessControl/bin/dbmgr ‑export ‑l -f lang_script
    
  5. Create a new database:
    cd /opt/CA/AccessControl/seosdb
    /opt/CA/AccessControl/bin/dbmgr -c -cq
    
  6. Execute the script generated in the previous step and create the new database:
    cd /opt/CA/AccessControl/seosdb
    /opt/CA/AccessControl/bin/selang ‑l /tmp/old_db/lang_script
    
  7. Execute the dbmgr utility to create a flat file containing data from the old database:
    cd /tmp/old_db
    /opt/CA/AccessControl/bin/dbmgr ‑migrate ‑r flat_file
    
  8. Load the data from the flat file into the new database:
    cd /opt/CA/AccessControl/seosdb
    /opt/CA/AccessControl/bin/dbmgr ‑migrate ‑w /tmp/old_db/flat_file