You create a copy of a database instance by importing a complete data backup of one database instance (source database) into another database instance (target database). The target database can be already exist or you can create a new database instance as the target database.
The database parameters of the target database do not have to be the same as those of the source database. However, we recommend that they be the same if you are creating the database copy for a standby instance. It is absolutely imperative, however, that you configure the data area of the target database to be large enough for the data backup to be imported.
Since the database IDs of the data backup and the target database are different, you have to initialize the target database when you import the backup. During this process, all catalog information and application data as well as any entries in the log area are deleted from the target database.
The first step is to create a complete data backup of the source database. You then log on to the target database as a DBM operator and define a backup template for a complete data backup for the target database. The values defined for the properties type, backup type, size, block size and overwrite have to be identical to the values of the backup template that was used to create the backup of the source database. You can define any backup template name; the data carrier (device/file) property must refer to the location where the complete data backup of the source database was saved.
You transfer the target database to the ADMIN operational state and open a database session with this database instance. Then you import the data backup from the source database to the target database using the newly-defined backup template and initialize the target database. Use the DBM command db_activate RECOVER.
Finally, you transfer the target database to the operational status ONLINE.
You have a database instance DEMODB and want to generate a database copy of it in database instance TESTDB. The database instances are located on different, but compatible, computers. They were both created with the same version of the database software. The database parameters in TESTDB were defined with the same values as in DEMODB.
Database computer: GENUA
DBM operator: User name OLEG, password MONDAY
Database system administrator: User name DBADMIN, password SECRET
Database computer: local, name PARMA
DBM operator: User name ELENA, password SUNDAY
Database system administrator: User name SUPER, password MAX
You can find the prerequisites under Database Manager CLI,
Call the Database Manager CLI in session mode, log on as operator OLEG with password MONDAY, and connect to database instance DEMODB:
>dbmcli –u OLEG,MONDAY –d DEMODB
dbmcli on DEMODB>
Define the backup template for a complete data backup to a file using the following properties:
Name of backup template: DemoDataCompl
Data carrier (device/file): Backups 2005\Data\completeDataJan
Type: file (FILE)
Backup type: complete data backup (DATA)
Size restriction: none (0)
Block size: 6
Overwrite: no (NO)
dbmcli on DEMODB>medium_put DemoDataCompl "Backups 2005\Data\completeDataJan" FILE DATA 0 6 NO
OK
Execute a complete data backup of DEMODB using the backup template DemoDataCompl:
dbmcli on DEMODB>db_connect
OK
dbmcli on DEMODB>backup_start DemoDataCompl
OK
...
...
Close the Database Manager CLI:
dbmcli on DEMODB>exit
Call the Database Manager CLI, log on as operator ELENA with password SUNDAY, and connect to database instance TESTDB:
>dbmcli ELENA,SUNDAY TESTDB
dbmcli on TESTDB>
Define the backup template for a complete data backup to a file using the following properties:
Name of backup template: DemoDataCompl_recover
Data carrier (device/file): \\GENUA\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\completeDataJan
Type: file (FILE)
Backup type: complete data backup (DATA)
Size restriction: none (0)
Block size: 6
Overwrite: no (NO)
dbmcli on TESTDB>medium_put DemoDataCompl_recover "\\GENUA\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\completeDataJan" FILE DATA 0 6 NO
OK
Transfer the database instance to the ADMIN operational state:
dbmcli on TESTDB>db_admin
OK
Open a database session:
dbmcli on TESTDB>db_connect
OK
Import the complete data backup from DEMODB to TESTDB (initializing TESTDB using the backup template DemoDataCompl_recover created for TESTDB:
dbmcli on TESTDB>db_activate RECOVER DemoDataCompl_recover
OK
Returncode 0
Date 20060126
Time 00142843
Server GENUA
Database DEMODB
Kernel Version Kernel 7.6.00 Build 016-123-109-428
Pages Transferred 6376
Pages Left 0
Volumes 1
Medianame DemoDataCompl_recover
Location C:\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\completeDataJan
Errortext
Label DAT_000000008
Is Consistent true
First LOG Page 3146
Last LOG Page
DB Stamp 1 Date 20060126
DB Stamp 1 Time 00113848
DB Stamp 2 Date
DB Stamp 2 Time
Page Count 6354
Devices Used 1
Database ID GENUA:DEMODB_20060125_165646
Max Used Data Page 0
Transfer the database instance to the ONLINE operational state:
dbmcli on TESTDB>db_online
OK
Exit the Database Manager CLI:
dbmcli on testdb>exit
OK
The database instance TESTDB on computer PARMA now contains the data from the complete data backup of DEMODB on computer GENUA.
TESTDB is in the ONLINE operational state.
The original database system administrator and other database users of TESTDB have been overwritten with the data for the database system administrator of DEMODB and the other database users of DEMODB, respectively. Only these users now have access to the database instance.
The original DBM operators of TESTDB are still valid and can still manage the database instance TESTDB using the Database Manager.
Creating and Configuring a Database Instance
Using the Parameter File from Another Database Instance
Defining a Backup Template for Complete Data Backup to a File
Database Administration, Database Copy