Here you can find the material related to my session at Oracle Open World 2014. I’m sorry I’m late in publishing them, but I challenge you to find spare time during Oracle Open World! It’s the busiest week of the year! (Hard Work, Hard Play)
Slides
Demo 1 video
Demo 2 video
Demo 1 script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
clear function pause () { echo read -p "$*" echo } tnsping cdbatl pause "next... status db" clear echo \$ srvctl status database -db CDBATL srvctl status database -db CDBATL pause "next... status pdb" clear sqlplus sys/racattack@cdbatl as sysdba <<EOF set echo on select INST_ID, CON_ID, name, OPEN_MODE from gv\$pdbs where con_id!=2 order by name, inst_id; exit EOF pause "next... add singleton service" clear ### add service MAAZAPP SINGLETON cmd="srvctl add service -db CDBATL -service maazapp -serverpool CDBPOOL -cardinality singleton -role primary -failovertype select -failovermethod basic -policy automatic -failoverdelay 2 -failoverretry 180 -pdb maaz" echo \$ $cmd eval $cmd pause "next... start service" clear cmd="srvctl start service -db CDBATL -service maazapp -instance CDBATL_1" echo \$ $cmd eval $cmd pause "next... status pdb" clear sqlplus sys/racattack@cdbatl as sysdba <<EOF set echo on select INST_ID, CON_ID, name, OPEN_MODE from gv\$pdbs where con_id!=2 order by name, inst_id; exit EOF cmd="srvctl status database -db cdbatl" echo echo \$ $cmd eval $cmd cmd="srvctl status service -service maazapp -db cdbatl" echo echo \$ $cmd output=`$cmd` echo $output current=`echo $output | awk '{print $NF}'` if [ $current == "raca01" ] ; then target="raca02" else target="raca01" fi pause "pause... please launch demo1_client.sh" pause "next... relocate service from $current to $target" clear cmd="srvctl relocate service -db CDBATL -service maazapp -currentnode $current -targetnode $target" echo \$ $cmd eval $cmd pause "next... status pdb" clear sqlplus sys/racattack@cdbatl as sysdba <<EOF set echo on select INST_ID, CON_ID, name, OPEN_MODE from gv\$pdbs where con_id!=2 order by name, inst_id; exit EOF pause "next... close pdb immediate on old inst" clear sqlplus sys/racattack@cdbatl as sysdba <<EOF set echo on alter pluggable database maaz close immediate instances=('CDBATL_1'); exit EOF pause "next... status pdb" clear sqlplus sys/racattack@cdbatl as sysdba <<EOF set echo on select INST_ID, CON_ID, name, OPEN_MODE from gv\$pdbs where con_id!=2 order by name, inst_id; exit EOF pause "next... modify service to uniform" clear cmd="srvctl modify service -db CDBATL -service maazapp -cardinality uniform" echo \$ $cmd eval $cmd pause "next... status pdb" clear sqlplus sys/racattack@cdbatl as sysdba <<EOF set echo on select INST_ID, CON_ID, name, OPEN_MODE from gv\$pdbs where con_id!=2 order by name, inst_id; exit EOF echo cmd="srvctl status service -service maazapp -db cdbatl" echo \$ $cmd eval $cmd exit |
Demo 2 script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
txtblk='\e[0;30m' # Black - Regular txtred='\e[0;31m' # Red txtgrn='\e[0;32m' # Green txtrst='\e[0m' # Text Reset function echop () { echo echo -e "${txtgrn}$*${txtrst}" } function echos () { echo echo -e "${txtred}$*${txtrst}" } function pause() { echo read -p "$*" echo } clear echop "Status of the PRIMARY DATABASE" sqlplus sys/racattack@cdbatl as sysdba <<EOF set echo on select db_unique_name, database_role from v\$database; select inst_id, con_id, name,open_mode from gv\$pdbs where con_id!=2 order by con_id, inst_id; exit EOF pause "next... standby status" clear echos "Status of the STANDBY DATABASE" sqlplus sys/racattack@cdbgva as sysdba <<EOF set echo on select db_unique_name, database_role from v\$database; select open_mode from v\$database; select inst_id, con_id, name,open_mode from gv\$pdbs where con_id!=2 order by con_id, inst_id; exit EOF pause "next... dgmgrl status" clear echos "Data Guard configuration and status of the STANDBY database" dgmgrl <<EOF connect sys/racattack show configuration; show database 'CDBGVA'; exit EOF pause "please do tail -f on the apply instance" pause "next... create new pdb ludo on primary " clear echop "Create new pluggable database on the primary: " echop "create pluggable database ludo admin user ludoadmin identified by ludoadmin;" sqlplus sys/racattack@cdbatl as sysdba <<EOF set echo on create pluggable database ludo admin user ludoadmin identified by ludoadmin; select inst_id, con_id, name,open_mode from gv\$pdbs where con_id!=2 order by con_id, inst_id; exit EOF pause "next... create service for primary on both clusters" clear echop "Create service for primary ROLE on the primary cluster (CDBATL) via SSH" cmd="srvctl add service -db CDBATL -service ludoapp -serverpool CDBPOOL -cardinality singleton -role primary -failovertype select -failovermethod basic -policy automatic -failoverdelay 1 -failoverretry 180 -pdb ludo" echo "\$ ssh raca01 $cmd" ssh raca01 ". /home/oracle/.bash_profile ; $cmd" echos "Create service for primary ROLE on the standby cluster (CDBGVA)" cmd="srvctl add service -db CDBGVA -service ludoapp -serverpool CDBPOOL -cardinality singleton -role primary -failovertype select -failovermethod basic -policy automatic -failoverdelay 1 -failoverretry 180 -pdb ludo" echo "\$ $cmd" eval $cmd pause "next... start service on primary" clear echop "Starting service on the primary via SSH" cmd="srvctl start service -db CDBATL -service ludoapp" echo "\$ ssh raca01 $cmd" ssh raca01 ". /home/oracle/.bash_profile ; $cmd" pause "next... create read only service for physical standby on both clusters" clear echop "Creating temporarily the readonly service for PRIMARY ROLE on the primary cluster (CDBATL) via SSH" cmd="srvctl add service -db CDBATL -service ludoread -serverpool CDBPOOL -cardinality singleton -role primary -failovertype select -failovermethod basic -policy automatic -failoverdelay 1 -failoverretry 180 -pdb ludo" echo "\$ ssh raca01 $cmd" ssh raca01 ". /home/oracle/.bash_profile ; $cmd" echop "Starting the readonly service for PRIMARY ROLE on the primary cluster (CDBATL) via SSH" cmd="srvctl start service -db CDBATL -service ludoread" echo "\$ ssh raca01 $cmd" ssh raca01 ". /home/oracle/.bash_profile ; $cmd" echop "Modifying the readonly service from PRIMARY ROLE to PHYSICAL STANDBY on the primary cluster (CDBATL) via SSH" cmd="srvctl modify service -db CDBATL -service ludoread -role physical_standby -pdb ludo" echo "\$ ssh raca01 $cmd" ssh raca01 ". /home/oracle/.bash_profile ; $cmd" echos "Creating the readonly service for PHYSICAL STANDBY on the standby cluster (CDBGVA)" cmd="srvctl add service -db CDBGVA -service ludoread -serverpool CDBPOOL -cardinality singleton -role physical_standby -failovertype select -failovermethod basic -policy automatic -failoverdelay 1 -failoverretry 180 -pdb ludo" echo "\$ $cmd" eval $cmd pause "next... start read only service" clear echos "Starting the readonly service on the standby cluster" cmd="srvctl start service -db CDBGVA -service ludoread" echo "\$ $cmd" eval $cmd pause "next... standby status" clear echos "Standby status" sqlplus sys/racattack@cdbgva as sysdba <<EOF select db_unique_name, database_role from v\$database; select open_mode from v\$database; select inst_id, con_id, name,open_mode from gv\$pdbs where con_id!=2 order by con_id, inst_id; exit EOF pause "please connect to the RW service" pause "next... dgmgrl status and validate" clear echos "Validate Standby database" dgmgrl <<EOF connect sys/racattack show configuration; validate database 'CDBGVA'; exit EOF pause "next... switchover to CDBGVA" clear echos "Switchover to CDBGVA! (it takes a while)" dgmgrl <<EOF connect sys/racattack switchover to 'CDBGVA'; exit EOF |
There’s one slide describing the procedure for cloning one PDB using the standbys clause. Oracle has released a Note while I was preparing my slides (one month ago) and I wasn’t aware of it, so you may also checkout this note on MOS:
Making Use of the STANDBYS=NONE Feature with Oracle Multitenant (Doc ID 1916648.1)
UPDATE: I’ve blogged about it in a more recent post: Tales from the Demo Grounds part 2: cloning a PDB with ASM and Data Guard (no ADG)
UPDATE 2: I’ve written another blog post about these topics: Cloning a PDB with ASM and Data Guard (no ADG) without network transfer
Cheers!
—
Ludovico
Latest posts by Ludovico (see all)
- New views in Oracle Data Guard 23c - January 3, 2024
- New in Data Guard 21c and 23c: Automatic preparation of the primary - December 22, 2023
- Does FLASHBACK QUERY work across incarnations or after a Data Guard failover? - December 13, 2023
Pingback: Oracle RAC, Oracle Data Guard, and Pluggable Databases: When MAA Meets Oracle Multitenant (OOW14) - Ludovico Caldara - Blogs - triBLOG