A remote full clone copies an existing pluggable database into another container database. The destination connects to the source using a database link, receives copied contents in new physical files on its storage, and retains those contents for independent work. The source remains in place.
Oracle DBA Lesson 49 Part 2 — Remote Clone and Safe Test Handoff
Cloning also carries application configuration. Local users, local grants, stored job definitions, and connection settings need review before the copy is used for testing. A copied invoice job could still send requests to the original external system.
Connection direction and scope
APP_PDB is the source and TEST_PDB is the new destination. Both are ordinary PDBs in separate, single-instance Oracle Database 19c CDBs. This is a full clone, without snapshot-copy or refresh clauses.
| Item | Location and meaning |
|---|---|
CLONE_SOURCE private database link | Destination CDB$ROOT, owned by the account executing the clone |
| Source service | Reaches APP_PDB directly |
| Connection initiation | Destination database server to source through Oracle Net |
| Copied data | Source to new destination files on disk |
| File placement | Destination Oracle managed files configuration and available space |
The destination account needs CREATE PLUGGABLE DATABASE in the destination root. A private link also needs the local CREATE DATABASE LINK privilege and secure source authentication. Test reachability and name resolution from the destination database server. A successful connection from an administrator's laptop, by itself, leaves the database-server route still to be tested.
For a link directly into the source PDB, the source account can be local or common. It needs CREATE SESSION and either CREATE PLUGGABLE DATABASE, granted locally or commonly on the source PDB, or the documented SYSOPER authority. A link into the source CDB root requires a common user and the privileges appropriate to that scope. Grant the privileges documented for that connection path. A longer privilege list from a general documentation example is wider than this path requires. With GLOBAL_NAMES=TRUE, the database-link name also has to satisfy that setting.
Provision the link through protected credential handling, and keep any password out of the statement that is saved with the lesson. A private link belongs to its owner. Changing the executing account can change whether that link is available. See remote-clone prerequisites and CREATE DATABASE LINK.
Conditions before copying
Check the source consistency conditions from Part 1: an open source, ARCHIVELOG mode plus local undo for a hot clone, and the required archived redo available throughout the operation. If either mode requirement is absent, arrange the required READ ONLY source window. Plan any intentional source-mode change and restore the original mode afterward. Keep the source open. A close is a separate planned change, and it is not a shortcut for this clone.
For the cross-CDB path, review:
- Platform endianness, installed options, and the documented source and destination compatibility requirements. Source options must be the same as the destination options, or a subset of them.
- Database release, release update, and upgrade implications for the specific pair. The procedure here is a compatible 19c-to-19c pair. It makes no general cross-version eligibility claim.
- Character-set and national-character-set rules. The general compatibility requirement has the documented destination
AL32UTF8exception. Application containers have additional matching rules. - Encryption and keystore handling. A source with encrypted data, or with a keystore set, requires the documented keystore-password clause, even with an auto-login software keystore. The short
CREATEbelow assumes that this condition does not apply. Use the full documented procedure when it does. - Destination Oracle managed files placement, capacity, an unused target name, the relevant edition and licensing limits, and any external file or integration dependencies.
Copy duration depends on network throughput, storage throughput, and the source workload. Oracle 19c DBCA offers a remote-clone interface, including silent mode. That interface still requires these prerequisites and the post-clone checks. Data Guard, RAC, application containers, and cross-version upgrades require their own expanded procedure.
Contain copied work before the first opening
Prepare the destination's network and application controls before opening the new PDB. Permit the specific source route needed for cloning, and contain access to mail gateways, payment endpoints, and other original application systems. Review that temporary source route after copying. A broad network exception can also make copied application links usable.
On a dedicated, disposable, single-instance test CDB, one available job containment control is JOB_QUEUE_PROCESSES=0 in the destination root before the clone is opened. This affects DBMS_SCHEDULER and DBMS_JOB execution across that CDB, including its PDBs. It also affects Scheduler-dependent features such as materialized-view refreshes and AutoTask. Do not apply this root-wide change to an unrelated shared CDB.
The parameter change needs root-scoped ALTER SYSTEM. CREATE PLUGGABLE DATABASE does not include that authority. Later inspection queries need a container switch and dictionary access to the views they read.
-- Dedicated test destination only; inspect and record the existing value first.
SHOW CON_NAME
SHOW PARAMETER job_queue_processes
ALTER SYSTEM SET job_queue_processes = 0 SCOPE=MEMORY;
SHOW PARAMETER job_queue_processes
The expected container is destination CDB$ROOT. Verify that the effective value is zero. A memory-only change does not survive a restart. Recheck containment after any restart and before the first opening. Plan to restore the recorded value, and disable or safely reconfigure copied jobs before allowing workers again. The parameter controls database job workers in this CDB. It is separate from network controls, application-session controls, external schedulers, and external work that is already running.
On a shared destination, use a target-specific pre-open containment procedure. Keep network and application access contained until that procedure is in place. See JOB_QUEUE_PROCESSES and Scheduler with a CDB.
Create and open the remote copy
With the source checks, private link, Oracle managed files destination, and pre-open containment established, execute in destination CDB$ROOT:
CREATE PLUGGABLE DATABASE test_pdb
FROM app_pdb@clone_source;
TEST_PDB is the new destination. APP_PDB@CLONE_SOURCE identifies the remote source through the private link. This copies the source into new destination files. The original source remains available under its planned operating conditions. The new PDB is initially MOUNTED, with creation status NEW.
Keep containment in place during the first read/write opening:
ALTER PLUGGABLE DATABASE test_pdb OPEN READ WRITE;
SELECT name, open_mode, restricted
FROM v$pdbs
WHERE name = 'TEST_PDB';
SELECT time, name, cause, type, status, message, action
FROM pdb_plug_in_violations
WHERE name = 'TEST_PDB' AND status = 'PENDING'
ORDER BY time;
Read open mode, restriction, and pending violations together. Investigate unresolved errors and the required actions before application access. The first read/write opening completes integration into the destination CDB. A successful CREATE on its own leaves readiness still to be checked. If creation fails, inspect the PDB state and the alert log before retrying. An unusable PDB needs the documented cleanup procedure.
In TEST_PDB, inventory copied Scheduler work:
ALTER SESSION SET CONTAINER = test_pdb;
SELECT owner, job_name, enabled, state
FROM dba_scheduler_jobs
ORDER BY owner, job_name;
SELECT owner, job_name, job_type, job_action,
credential_owner, credential_name
FROM dba_scheduler_jobs
ORDER BY owner, job_name;
ENABLED and STATE describe each job's scheduling configuration. Whether its destination is appropriate for testing is a separate check. Inspect actions, referenced programs, chains, schedules, credentials, and destinations. Inventory legacy DBMS_JOB work and external schedulers separately. Enable workers only after that review, and only for work aimed at a test destination. A successful inventory query supplies the list. DBA_SCHEDULER_JOBS uses the columns documented in ALL_SCHEDULER_JOBS.
Resolve copied integrations and hand over the copy
For every integration, record whether it remains disabled, is removed, or is reconfigured and tested against a test destination. For the copied invoice job, that means a test endpoint and test credentials, or a disabled job. Check database links, wallets, application settings, directory and external-file dependencies, and service registration as well. External wallets and files may need separate handling. Check every copied dependency for availability and for a test destination that is safe to call.
Use a distinct service for the test application. The default PDB service follows the new PDB name. SERVICE_NAME_CONVERT can rename user-defined services during creation. The default service keeps the new PDB name. When the source contains APP_SERVICE and that service needs conversion:
CREATE PLUGGABLE DATABASE test_pdb
FROM app_pdb@clone_source
SERVICE_NAME_CONVERT = ('app_service', 'test_service');
This is an alternative to the earlier CREATE. Use this form at creation when a user-defined service needs a new name, and create that target only once. Review service ownership, listener registration, and the actual client connection route. Common users and commonly granted privileges also need a destination-CDB review. Source common-account privileges need that review because a remote clone can carry them over in a different form. See CREATE PLUGGABLE DATABASE.
Verify file ownership in each CDB separately. For the destination:
-- Destination root, with dictionary visibility for TEST_PDB.
SELECT db_unique_name FROM v$database;
SELECT p.name, f.con_id, f.file_name
FROM cdb_data_files f JOIN v$pdbs p ON p.con_id = f.con_id
WHERE p.name = 'TEST_PDB'
ORDER BY f.file_id;
Inspect temporary files separately and compare them with the source CDB's own file inventory. CON_ID is meaningful within a CDB. It is a container number inside that CDB, so the same number can appear in another CDB. Record the database identity and the host and storage context with the full paths. The same path text can exist on different hosts, and different paths can still share hardware. Confirm the actual owner and the actual placement.
Root CDB_* results depend on dictionary privileges, the account's CONTAINER_DATA visibility, and the target's open or restricted state. Investigate missing visibility before reading an absent row as an absent file. Encrypted-file inspection may also require an open keystore. See CDB views and DBA_DATA_FILES.
Through the test service, verify the target identity and the known committed application keys and counts captured at an agreed quiet baseline. A later count on the live source may have changed. Prepare and validate backup and recovery for the new PDB before handoff.
Recap
A remote full clone copies APP_PDB to TEST_PDB in another CDB through a private database link owned in the destination root. The destination server opens that connection, and the new files are placed with the destination's Oracle managed files. Meet the Part 1 consistency conditions, the cross-CDB compatibility checks, and any keystore requirement before CREATE. Contain the source route, original application endpoints, and database jobs before the first opening. On a dedicated test CDB, JOB_QUEUE_PROCESSES=0 in the destination root is a memory-only control for Scheduler and DBMS_JOB work across that CDB. Open TEST_PDB read write, then read its mode, restriction, and pending violations. Inventory copied jobs, credentials, services, and files. Point each integration at a test destination or leave it disabled, confirm file ownership and the quiet baseline through the test service, and prepare backup and recovery before handoff.
No comments:
Post a Comment