This CLI cookbook recipe describes how to Detach and Attach an SAP ASE dSource using the CLI, please note that you cannot detach a dSource from the GUI or the CLI however reattach is strictly through the CLI.
Prerequisites
A dSource can only be attached to a new data source once it has been unlinked.
When attaching an SAP ASE dSource to a new data source, the new data source must be the same logical database satisfying the following constraints:
- Same dbid
- Same dbname
- Same creation time
You must also make sure that you follow the normal prerequisites for an SAP ASE data source found in Requirements for SAP ASE Source Hosts and Databases.
Procedure
Detach a dSource
1. Login to the CLI as delphix_admin or a user with Admin privileges.
2. Select the dSource.
delphix> database "dexample"
3. Run the
detachSourcecommand
, specifying the currently active source. Note: This step can be skipped if the dSource has already been detached through the GUI.delphix database "dexample"> detachSource delphix database "dexample" detachSource *> set source=dexample delphix database "dexample" detachSource *> commit
Attach a dSource
1. Log into the CLI as delphix_admin or a user with Admin privileges.
2. Run the
attachSource
command.delphix database "dexample"> attachSource delphix database "dexample" attachSource *> set source.name=source_ASE_servername_example delphix database "dexample" attachSource *> set source.config=source_ASE_servername_example/dexample delphix database "dexample" attachSource *> set dbCredentials.password=sybase delphix database "dexample" attachSource *> set dbUser=sa delphix database "dexample" attachSource *> set source.loadBackupPath=/tmp/backups delphix database "dexample" attachSource *> set sourceHostUser="source_host_environment/sybase" delphix database "dexample" attachSource *> set stagingHostUser="staging_host_environment/sybase" delphix database "dexample" attachSource *> set stagingRepository="staging_ASE_servername_example" delphix database "dexample" attachSource *> edit source.operations.preSync delphix database "dexample" attachSource source.operations.preSync *> add delphix database "dexample" attachSource source.operations.preSync 0 *> get type: RunCommandOnSourceOperation (*) command: (required) delphix database "dexample" attachSource source.operations.preSync 0 *> set command=# delphix database "dexample" attachSource source.operations.preSync 0 *> back delphix database "dexample" attachSource source.operations.preSync *> back delphix database "dexample" attachSource *> edit source.operations.postSync delphix database "dexample" attachSource source.operations.postSync *> add delphix database "dexample" attachSource source.operations.postSync 0 *> get type: RunCommandOnSourceOperation (*) command: (required) delphix database "dexample" attachSource source.operations.postSync 0 *> set command=# delphix database "dexample" attachSource source.operations.postSync 0 *> back delphix database "dexample" attachSource source.operations.postSync *> back delphix database "dexample" attachSource *> ls Properties type: ASEAttachSourceParameters dbCredentials: type: PasswordCredential password: ******** (*) dbUser: sa (*) source: type: ASELinkedSource name: source_ASE_servername_example (*) config: dexample (*) externalFilePath: (unset) loadBackupPath: /tmp/backups (*) loadBackupServerName: source_backupserver_name_example (*) monitorLocation: (unset) operations: type: LinkedSourceOperations postSync: 0: type: RunCommandOnSourceOperation (*) command: # (*) preSync: 0: type: RunCommandOnSourceOperation (*) command: # (*) sourceHostUser: source_ASE_servername_example/sybase (*) stagingHostUser: staging_ASE_servername_example/sybase (*) stagingPostScript: (unset) stagingPreScript: (unset) stagingRepository: staging_ASE_servername_example (*) delphix database "dexample" attachSource *> commit ASE_DB_CONTAINER-3 Dispatched job JOB-25 DB_ATTACH_SOURCE job started for "Untitled/dexample". DB_ATTACH_SOURCE job for "Untitled/dexample" completed successfully.
Note: this command is only necessary if you are using a Remote Backup Server configuration from staging to source, instead of an NFS mounted shared directory for backups and transaction log dumps:
delphix database "dexample" attachSource *> set source.loadBackupServerName=source_backupserver_name_example