@connor_mc_d 
Connor McDonald 
OracleDBA 
co.uk 
connormcdonald.wordpress.com
bio slide
a funny story 
5
6
7
gratuitous book plug 
8
why 
10
everyone wants 
11 
goodata
12 
SQL> select * from CUSTOMERS; 
CID FORENAME SURNAME DOB 
-------- --------------- ----------------- --------- 
101230 Sarah Johnson 01-JUN-75 
101233 Michael Smith 13-FEB-69 
101237 Peter Brown 24-OCT-82 
SQL> select * from CUSTOMERS; 
CID FORENAME SURNAME DOB 
-------- --------------- ----------------- --------- 
101230 Sarah Johnson 01-JUN-75 
101252 MyTestGuy DoesümlautWork 01-JAN-01 
101268 Spaces 01-JAN-01 
prod 
dev
easy to do 
13
14 
RMAN> DUPLICATE DATABASE TO myclone 
2 FROM ACTIVE DATABASE; 
prod
one small problem 
15
16
storage administrator 
17
18 
CEO
clone your database .... 
19 
once
everyone wants 
20 
currednatta
21 
prod 
dev 
nightly 
prod 
dev 
weekly 
prod 
dev 
annually
22
everyone wants 
23 
full sdiazetda
24 
prod 
dev 
annually
25 
prod 
dev
You are here 
Hard 
Place 
26
27 
prod 
dev
risk 
28
29 
procedure MY_LATEST_PROC is 
begin 
for i in ( 
select * 
from EVERY_PIECE_OF_DATA_WE_HAVE 
where UNINDEXED_COLUMN = 10 
) 
loop 
... 
end; 
SQL> exec MY_LATEST_PROC 
PL/SQL Procedure completed successfully. 
Elapsed: 00:00:00.03
30
everyone wants 
31 
their doawtna
32
33 
prod 
Mike Sue Tom Michelle
what typically happens ... 
34
35 
Mike Sue Tom Michelle 
dev
From: Mike 
To : EVERYBODY !! 
Which *@&@# changed my code 
and broke the build ?!?!? 
36
"Database environments are constantly 
getting bigger and bigger, and they are 
increasingly the bottleneck" 
-Tim Campos, 
Facebook CIO 
37
a solution is at hand 
38
clone db 
39
free ! 
40
let 
41 
me 
repeat
oracle feature that is free ! 
42
single prerequisite 
43
direct NFS (11.2) 
44
45
lets talk about NFS ... 
46
47
a little back story... 
48
90's 
49
50
51
52
53
something terrible happened... 
54
55
local disk causes ... 
56
"problems" 
57
58
"hard to manage" 
59
"inefficent" 
60
(some) truth 
61
62
"10 SCSI disks please" 
63
"sorry" 
64
fast SCSI 
65
fast wide SCSI 
66
ultra SCSI 
67
ultra wide SCSI 
68
ultra 2 SCSI 
69
ultra 2 wide SCSI 
70
ultra wide uber mega super duper SCSI 
71
the (claimed) solution 
72
73
consolidation 
74
performance 
75
ease of management 
76
77
SAN 
78
79
fine in the 90s... 
80
81 
FC 1Gb/sec 
Ethernet 10Mb/sec
"disks are slow ... 
82
... and fibre is ... 
83
84
85
modern disk drive 
86
150MB per second 
87
88 
2Gb/sec
2Gb / sec = 256MB / sec 
89
2 disks ! 
90
the other problem 
91
provide that data 
92
Like I always say, 
"Everything is a CPU problem." 
- Kevin Closson 
93
94
"the SAN can't be slow" 
95
96
advances 
97
98 
12486GGbb//sseecc
we need GB per second 
99
for disks ! 
100
flash etc even "worse" 
101
separating server from disk 
102
... can be an expensive mistake 
103
104 
CEO
irony 
105
106
Exadata "magic" 
107
big data "revolution" 
108
109
110
"move to code near to the data" 
111
112
consolidation makes sense if ... 
113
... storage tier offers something 
114
business continuance volume 
WAFL clustering 
115 
snapshots 
iSCSI site mirroring
successful vendors did this 
116
117
back to NFS 
118
does it "give me something" ? 
119
yes 
120
1) shared file system 
121
RAC / TTS / parallelism 
122
2) ethernet 
123
124
FC HBA 
FC switch 
125
so why isn't everyone using it ? 
126
"ethernet is slow" 
127
128 
1 Gb 4 Gb
bonding 
129
130 
124 Gb
technology advances 
131
132 
1410 GGbb
133
134
135 
60Gb
why direct NFS ? 
136
"NFS is slow" 
137
(partially) true 
138
139 
oracle 
OS 
NFS client cache
solution 
140
direct NFS 
141
142 
oracle 
NFS 
OS 
NFS client cache
direct NFS rocks ! 
143
144 
Source: 
Red Hat Enterprise Linux Protocol Performance 
Comparison with Oracle Database 11g Release 2 
NetApp, TR-3932, June 2011
even if no interest in cloning... 
145
... think about direct NFS 
146
147
back to clone db 
148
direct NFS means ... 
149
Oracle controls the I/O 
150
controls where writes go 
151
and voila ! clone db 
152
RMAN imagecopy clone via direct NFS 
153 
prod
"um ..... and ?" 
154
155 
RMAN imagecopy 
clone database 
prod 
dNFS 
COW
COW = copy on write 
156
clone is the imagecopy 
157
... but is read write ! 
158
deltas written as COW 
159
160 
SQL> connect /@myclone 
Connected. 
SQL> update EMP 
2 set ENAME = 'JOE' 
3 where ENAME = 'SUE';
161 
READ ONLY 
Ename: SUE 
JOE 
clone db
clone initial size = 
162
ZERO 
163
164 
SQL> select * from EMP;
165 
block1 block2 block3 block4 block5 
block1 block3 block5 
read only 
clone
clone 5 
166 
clone 2 
clone 1 
clone 3 
clone 4
how to do it ? 
167
"under the covers" worry 
168
Doc ID 1210656.1 
169 
perl clonedb.pl
its not ! 
170
time for a demo 
171
172
DEMO 
173 
demo1
so what does "clonedb.pl" do ? 
174
generates SQL ... (poorly) 
175
flexible point in time 
176 
demo2
and its fast 
demo3 / demo4 
177
this poor laptop... 
178
5 x ~20GB databases 
179 
(plus 12c + VM)
180
still can clone ! 
181
just COW data on dNFS 
182
183 
copy 
clone 
prod 
SAN SAN 
redo 
SAN 
COW
"but we're on windows" 
184
still can clone ! 
185
direct NFS works on windows 
186 
as you've just seen
real customer 
187
188
dev cdev 
nightly 
AIX / RAM 
189
virtually no limitations 
190
available RAM 
191
available disk 
192 
( small )
available licenses 
193 
( additional servers )
x86 the real winner 
194
every developer ... own database 
195 
VM on developer PC
discussion point 
196
197 
LICENSE RIGHTS 
We grant you a nonexclusive, nontransferable limited license to 
use the programs only for the purpose of developing, testing, 
prototyping and demonstrating your application, and not for any 
other purpose. 
If you use the application you develop under this license for any 
internal data processing or for any commercial or production 
purposes, or you want to use the programs for any purpose 
other than as permitted under this agreement, you must obtain 
a production release version of the program by contacting us or 
an Oracle reseller to obtain the appropriate license.
seems to be ok 
198
cloning ... in 12c 
199
trivial ... 
200
... but potentially space hungry 
201
1) trivial 
202
203
SQL> create pluggable database MY_CLONE_PDB 
204 
2 from MY_SOURCE_PDB; 
Pluggable database created.
you're done ! 
205
> 1 pluggable database 
206
207
DEMO 
208 
demo1.sh
avoiding space consumption 
209
"snapshot" copy 
210
DEMO 
211 
demo2.sh
:-( 
212
ZFS appliance 
NetApp appliance 
ACFS 
213
12.1.0.2 
214
215 
With the initialization parameter CLONEDB set 
to true, snapshot clones of a pluggable 
database are supported on any ... file systems 
with Oracle Direct NFS (dNFS) enabled 
(yet to verify)
"2 minute clone.... 
... 10 hour imagecopy" 
216
two technologies 
217
1 ) block change tracking 
218
full backup = slow 
219
incremental backup ... 
220
221
read every file ... every block 
222
"has SCN advanced ?" 
223 
write to backup
easy solution 
224
225 
SQL> alter database enable block change tracking 
2 using file 'c:oracledb112bct.dat' reuse; 
Database altered.
very low risk 
226
CTWR process 
227
cost = zero 
228
cost = "zero" 
229
reason 1 
230
lots of block changes ... 
231
.. lots of redo 
232
redo is complicated 
233
load CTWR versus LGWR 
234
reason 2 
235
asynchronous from user 
236
CTWR and CKPT 
237
238 
you 
buffer cache 
ckpt 
ctwr 
bct.dat 
dbwr
reason 3 
239
240 
SQL> select * from v$sgastat 
2 where name like '%change%'; 
POOL NAME BYTES 
------------ -------------------------- ---------- 
shared pool change notification obj m 16416 
shared pool change tracking state cha 2584 
shared pool change notification regis 16416 
shared pool change tracking recovery 262144
x$krc... 
241 
X$KRCFH 
X$KRCEXT 
X$KRCCDE 
X$KRCCDS 
X$KRCCDR 
X$KRCGFE 
X$KRCFDE 
X$KRCFBH 
X$KRCBIT 
X$KRCSTAT
space efficient 
242
243 
datafile 1 
datafile 2 
datafile 3 
BCT 32k 32k 32k
chunks 
244
245 
SQL> SELECT (count(distinct b.fno||' '||bno) * 32)/1024 MB 
2 FROM x$krcbit b, 
3 (SELECT MIN(ver) min_ver, fno 
4 FROM 
5 (SELECT curr_vercnt ver,curr_highscn high, 
6 curr_lowscn low,fno 
7 FROM x$krcfde 
8 UNION ALL 
9 SELECT vercnt ver, high, 
10 low, fno 
11 FROM x$krcfbh 
12 ) 
13 WHERE 
14 (SELECT MAX(bd.checkpoint_change#) 
15 FROM v$backup_datafile bd 
16 WHERE bd.incremental_level <= 1) between low and high 
17 GROUP BY fno ) sub 
18 WHERE b.fno = sub.fno 
19 AND b.vercnt >= sub.min_ver; 
MB 
---------- 
46.34375
detailed info... 
246 
http://www.pythian.com/documents/Pythian-oracle-block-change.pdf
DEMO* 
247
248 
C:oracle11.2.0.3BIN>rman target / 
Recovery Manager: Release 11.2.0.3.0 - Production on ... 
Copyright (c) 1982, 2011, Oracle and/or its affiliates.. 
connected to target database: DB112 (DBID=730732064) 
RMAN> RUN { 
2> allocate channel c1 type disk format 'c:oraclebkp%N.lev0'; 
3> 
4> BACKUP INCREMENTAL LEVEL 0 DATABASE; 
5> 
6> } 
using target database control file instead of recovery catalog 
allocated channel: c1 
channel c1: SID=190 device type=DISK
249 
Starting backup at 09/11/2014 13:58:15 
channel c1: starting datafile copy 
input datafile file number=00005 
name=C:ORACLEORADATADB112DATAFILEO1_MF_DEMO_95F7ZWNP_.DBF 
output file name=C:ORACLEBKPDEMO.LEV0 ... 
channel c1: datafile copy complete, elapsed time: 00:03:15 
... 
Finished backup at 09/11/2014 14:02:41 
released channel: c1 
RMAN>
4 minutes 36 seconds 
250 
20GB
DEMO 
251 
demo5
2 ) rolling recovery 
252
superfast incrementals 
253
... but what about recovery 
254
255 
20GB 
Mon Tue Wed Thu Fri
slow 
256
but .... 
257
recover from a backup 
258 
10g+
259 
RMAN> RECOVER COPY OF DATABASE 
WITH TAG 'rolling';
260 
20GB 
Mon Tue Wed Thu Fri
DEMO 
261 
demo7
262 
RMAN> RECOVER COPY OF DATABASE 
WITH TAG 'rolling' 
UNTIL TIME 'sysdate-3';
263 
RMAN> RUN { 
RECOVER COPY OF DATABASE 
WITH TAG 'rolling'; 
RECOVER COPY OF DATABASE 
WITH TAG 'day3' 
UNTIL TIME 'sysdate-3'; 
RECOVER COPY OF DATABASE 
WITH TAG 'day7' 
UNTIL TIME 'sysdate-7'; 
}
bringing it all together 
264
prod 
only once ! 
bkp 3day 7day 
incrementals 
265
266 
prod 
bkp 3day 7day
easy point in time copies 
267 
fast backup 
unlimited clones
free ! 
268
let 
269 
me 
repeat
oracle feature that is free ! 
270
once you see the benefits 
271
consider more rigour 
272
273
274
Connor McDonald 
OracleDBA 
co.uk 
275
276 
@connor_mc_d 
ORA-03113 
connormcdonald.wordpress.com

OakTable World Sep14 clonedb