commit ab09e775d1897f94d8ca4f6a13fa409b96c49e74 Author: James Pattinson Date: Tue Oct 14 09:16:13 2025 -0400 first commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..b5597f3 --- /dev/null +++ b/README.md @@ -0,0 +1,77 @@ +# Oracle Clone Script + +Created by James Pattinson (Rubrik PS) October 2025 + +This script (`oracle_clone.sh`) performs a clone of an Oracle database using the Rubrik CDM API. + +## Usage + +```bash +./oracle_clone.sh [options] +``` + +- ``: Source Oracle database SID. +- ``: Target hostname for the clone. + +## Options + +- `-h ` Source DB hostname (if source SID is not unique) +- `-t ` Recovery point timestamp (`"YYYY-MM-DD HH:MM:SS"`, uses latest if not specified) +- `-n ` New database SID for the clone +- `-p ` Custom pfile for the clone +- `-a ` Advanced Cloning Options (can be used multiple times) +- `-b ` Comma-separated list of PDBs to clone (include only these PDBs. `PDB$SEED` is always included) +- `-c ` Number of RMAN channels to use (sets `numChannels` in the API payload) +- `-d` Dry run mode - show API payload without executing + +## Configuration (`rbk_api.conf`) + +Before running the script, you must configure Rubrik API access in the `rbk_api.conf` file (located in the same directory). This file should define the following variables: + +- `RUBRIK_IP`: The IP address or DNS name of your Rubrik CDM cluster. +- `ID`: The service account ID or user credential for API authentication. +- `SECRET`: The secret or password for the service account/user. +- `RSC_HOST`: API endpoint host for SLA modification and other GraphQL calls + +**Example `rbk_api.conf`:** +```properties +RUBRIK_IP= +ID="client|your-service-account-id" +SECRET=your-service-account-secret +RSC_HOST=customername.my.rubrik.com +``` + +> **Note:** Do not share your `rbk_api.conf` file or secrets publicly. + +## Notes + +- The script requires access to the Rubrik API and expects the supporting functions `oracle_funcs.sh` to be present in the same directory. +- Time is passed to `date` on the local machine and uses the local timezone. +- If `-b` is specified, the script will print the list of PDBs included in the clone. +- The `-c` option allows you to specify the number of RMAN channels to use for the clone operation. This is passed as `numChannels` in the API payload. + +## Example + +```bash +./oracle_clone.sh -h dbhost01 -t "2024-06-01 12:00:00" -n CLONE01 -b PDB1,PDB2 -c 8 orcl targethost +``` + +This will clone the `orcl` database from `dbhost01` to `targethost`, using the specified timestamp, new SID `CLONE01`, only include `PDB$SEED`, `PDB1`, and `PDB2`, and use 8 RMAN channels for the operation. + +```bash +./oracle_clone.sh -n CLNONE -a AUDIT_FILE_DEST,/u01/app/oracle/admin/CLNONE/adump \ + -a DB_FILE_NAME_CONVERT,"'SHED','CLNONE'" -a DB_CREATE_FILE_DEST,/u01/app/oracle/oradata/CLNONE/ \ + -a CONTROL_FILES,"'/u01/app/oracle/oradata/CLNONE/control01.ctl, /u01/app/oracle/fast_recovery_area/CLNONE/control02.ctl'" \ + -b PDBXYZ,PDBABC SHED pve-ora19c-3 +``` + +Uses the latest available Point-in-Time of the source `SHED` and clones to a new database `CLNONE` on the target host `pve-ora19c-3`. The Advanced Cloning Options are present: + +``` +AUDIT_FILE_DEST = /u01/app/oracle/admin/CLNONE/adump +DB_FILE_NAME_CONVERT = 'SHED','CLNONE' +DB_CREATE_FILE_DEST = /u01/app/oracle/oradata/CLNONE/ +CONTROL_FILES = '/u01/app/oracle/oradata/CLNONE/control01.ctl, /u01/app/oracle/fast_recovery_area/CLNONE/control02.ctl' +``` + +Additionally, only PDBs `PDBXYZ` and `PDBABC` will be cloned. \ No newline at end of file