asm cluster filesystem datenbank-cloning leicht gemacht
TRANSCRIPT
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
ASM Cluster Filesystem Datenbank-Cloning leicht gemacht
Sebastian Solbach BU Datenbank, ORACLE Deutschland B.V. Co. KG Month 06, 2015
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Agenda
3
Klonen von Datenbanken
12c ASM Cluster Filesystem
Pluggable Databases auf ACFS & ACFS Snapshots
Snapshot von 12c nonCDB und 11.2.0.4 Datenbanken
1
2
3
4
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Warum Datenbank Cloning?
• Test Backup & Recovery
• Test Upgrade auf ein neues Datenbank-Release
• Test Applikationen & Datenbank Performance
• Anlegen von Standby Datenbanken
• Reporting
• Gold Image Cloning
• ... und vieles mehr...
4
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Agenda
5
Klonen von Datenbanken
12c ASM Cluster Filesystem
Pluggable Databases auf ACFS & ACFS Snapshots
Snapshot von 12c nonCDB und 11.2.0.4 Datenbanken
1
2
3
4
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
ASM Cluster Filesystem
• Generelles modernes, POSIX kompatibles Filesystem
– Basiert auf ASM Dynamic Volumes (ADVM)
– Extent basierend & Journaling
– NFS / CIFS Export möglich (mit 12c HA NFS)
• Integriert in die 12c Grid Infrastruktur
– Oracle Cluster
– Oracle Restart (Vorsicht: Kein Automount)
6
ACFS
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
ASM Überblick
Server
Oracle Database
Operating System
Logical Volume Manager
File System
Server
Oracle Database
Operating System
ASM
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
ASM Überblick
Datendateien
Redolog
Controlfile
SPFile
Passwordfile
Oracle Datenbank
(oracle Executable)
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
ASM Überblick – Compatibility Level
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
ASM Dynamic Volumes
• Neuer Filetyp in ASM (wie eine Datendatei): ASMVOL
• Verwaltet mit ASMCMD, ASMCA, Enterprise Manager
• Dynamisch ladbarer Kerneltreiber
• Erzeugen eines Device Files
– Linux: /dev/asm/acfsdata-207
– Windows: \\.\acfsfra-345
10
Volume Betriebssystem
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | 11
ACFS/ASM/AOKS auf Exadata
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
• COMPATIBLE.ASM > 12.1
– Replication Status of Diskgroup
– Managing a shared password file in a disk group
• + COMPATIBLE.RDBMS > 12.1 – Greater than 2 TB Oracle ASM disks without Oracle Exadata storage
• + COMPATIBLE.ADVM > 12.1.0.2
– Storing database data files and redo logs in Oracle ACFS file systems
– Support for 1023 snapshots
– Accelerator volume for Oracle ACFS file system
12
Automatic Storage Management Administrator's Guide Features Enabled By Disk Group Compatibility Attribute Settings
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
• Redundancy:
– Default = ASM Diskgroup Redundancy
• Stripe Columns
• Stripe Width
– 12c geänderter Default: Datenbanken 1M = Allocation Unit
13
ASM Dynamic Volume
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | 14
ASM Dynamic Volume
ASMCMD> volinfo --all
Diskgroup Name: DATA
Volume Name: ACFSDATA
Volume Device: /dev/asm/acfsdata-207
State: ENABLED
Size (MB): 16384
Resize Unit (MB): 64
Redundancy: UNPROT
Stripe Columns: 8
Stripe Width (K): 1024
Usage: ACFS
Mountpath: /u01/app/oracle/oradata
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Create ASM Cluster Filesystem
• Type:
– Local Node
– Cluster
• Datenbank braucht Cluster Filesystem
15
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | 16
ASM Cluster Filesystem im Cluster $ crsctl stat res -t -init
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
...
ora.drivers.acfs
1 ONLINE ONLINE bumucsvm1 STABLE
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | 17
ASM Cluster Filesystem im Cluster $ crsctl stat res -t
--------------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------------
ora.DATA.ACFSDATA.advm
ONLINE ONLINE bumucsvm1 Volume device /dev/asm/acfsdata-207 is online,STABLE
ONLINE ONLINE bumucsvm2 STABLE
ora.DATA.dg
ONLINE ONLINE bumucsvm1 STABLE
ONLINE ONLINE bumucsvm2 STABLE
ora.data.acfsdata.acfs
ONLINE ONLINE bumucsvm1 mounted on /u01/app/oracle/oradata,STABLE
ONLINE ONLINE bumucsvm2 mounted on /u01/app/oracle/oradata,STABLE
ora.proxy_advm
ONLINE ONLINE bumucsvm1 STABLE
ONLINE ONLINE bumucsvm2 STABLE
---------------------------------------------------------------------------------------
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | 18
ASM Cluster Filesystem im Cluster # acfsutil info fs /u01/app/oracle/oradata
/u01/app/oracle/oradata
ACFS Version: 12.1.0.2.0
on-disk version: 42.0
flags: MountPoint,Available
mount time: Thu May 21 18:52:34 2015
allocation unit: 4096
volumes: 1
total size: 17179869184 ( 16.00 GB )
total free: 11350839296 ( 10.57 GB )
file entry table allocation: 1097728
primary volume: /dev/asm/acfsdata-207
label:
state: Available
major, minor: 250, 105985
size: 17179869184 ( 16.00 GB )
free: 11350839296 ( 10.57 GB )
ADVM diskgroup DATA
ADVM resize increment: 67108864
ADVM redundancy: unprotected
ADVM stripe columns: 8
ADVM stripe width: 1048576
number of snapshots: 0
snapshot space usage: 0 ( 0.00 )
replication status: DISABLED
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Agenda
19
Klonen von Datenbanken
12c ASM Cluster Filesystem
Pluggable Databases auf ACFS & ACFS Snapshots
Snapshot von 12c nonCDB und 11.2.0.4 Datenbanken
1
2
3
4
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Datenbanken: Warum auf ACFS?
• Schneller Clone (Read Only Time verringern)
• Read/Write Clone – mit Orginal kann weitergearbeitet werden
• Platzsparend
• Kostengünstig (Snapshot braucht nur Enterprise Edition)
• Annähernd gleiche Performance wie ASM
• Filesystem!
20
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | 21
ACFS Lizenzierung
Oracle ACFS Features Oracle Database Files Non-Oracle Database Files
ACFS features other than those listed below
FREE FREE
Snapshots Oracle DB EE required FREE
Encryption Not Available FREE
Security Not Available FREE
Replication Not Available FREE
Auditing Not Available FREE
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
12.1.0.2 Pluggable Datenbanken Cloning
• Einfaches Cloning von 12c Pluggable Datenbanken (PDBs)
– PDB in Read Only Status setzen
– PDB Clone anlegen
– PDB Snapshot Clone anlegen
22
SQL> alter pluggable database spdb open read only;
SQL> create pluggable database s2pdb from spdb;
SQL> create pluggable database s2pdb from spdb snapshot copy;
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | 23
ASM Cluster Filesystem im Cluster # acfsutil info fs /u01/app/oracle/oradata
/u01/app/oracle/oradata
ACFS Version: 12.1.0.2.0
on-disk version: 43.0
flags: MountPoint,Available
mount time: Thu May 21 18:52:34 2015
allocation unit: 4096
volumes: 1
total size: 17179869184 ( 16.00 GB )
total free: 11257479168 ( 10.48 GB )
file entry table allocation: 1097728
primary volume: /dev/asm/acfsdata-207
label:
state: Available
major, minor: 250, 105985
size: 17179869184 ( 16.00 GB )
free: 11257479168 ( 10.48 GB )
ADVM diskgroup DATA
ADVM resize increment: 67108864
ADVM redundancy: unprotected
ADVM stripe columns: 8
ADVM stripe width: 1048576
number of snapshots: 1
snapshot space usage: 28811264 ( 27.47 MB )
replication status: DISABLED
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Snaptshot Clone Directory Structure
24
ACFS Root (oradata)
SPDB
.ACFS/snaps
NEW PDB/SCDB/SPDB/datafile
CDB_ROOT
datafile
NEW PDB datafile
Symlink
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Snapshot Clone
25
SQL> select * from v$pdbs;
CON_ID GUID NAME OPEN_MODE RES
---------- -------------------------------- -------------------- ---------- ---
OPEN_TIME CREATE_SCN TOTAL_SIZE BLOCK_SIZE RECOVERY SNAPSHOT_PARENT_CON_ID
---------- ---------- ---------- ---------- -------- ----------------------
3 16A0C7F3EA950D21E05370F4A50A9346 SPDB READ ONLY NO
15-JUN-15 1476617 943718400 8192 ENABLED 0
4 18943D57D3410C0BE05371F4A50A5C6D S2PDB MOUNTED
15-JUN-15 4690778 0 8192 ENABLED 0
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Snapshot Clone
26
# ll
drwxr-x--- 3 oracle oinstall 8192 May 22 01:20 16A0C7F3EA950D21E05370F4A50A9346
drwxr-x--- 3 oracle asmadmin 8192 Jun 15 21:14 18943D57D3410C0BE05371F4A50A5C6D
# # ll 18943D57D3410C0BE05371F4A50A5C6D/datafile
lrwxrwxrwx 1 oracle asmadmin 142 Jun 15 21:14 o1_mf_sysaux_bqy909kw_.dbf ->
/u01/app/oracle/oradata/.ACFS/snaps/18943D57D3410C0BE05371F4A50A5C6D/SCDB/16A0C
7F3EA950D21E05370F4A50A9346/datafile/o1_mf_sysaux_bowt1yln_.dbf
lrwxrwxrwx 1 oracle asmadmin 142 Jun 15 21:14 o1_mf_system_bqy909gr_.dbf ->
/u01/app/oracle/oradata/.ACFS/snaps/18943D57D3410C0BE05371F4A50A5C6D/SCDB/16A0C
7F3EA950D21E05370F4A50A9346/datafile/o1_mf_system_bowt1yfj_.dbf
-rw-r----- 1 oracle asmadmin 20979712 Jun 15 21:14 o1_mf_temp_bqy909ly_.dbf
lrwxrwxrwx 1 oracle asmadmin 141 Jun 15 21:14 o1_mf_users_bqy909m4_.dbf ->
/u01/app/oracle/oradata/.ACFS/snaps/18943D57D3410C0BE05371F4A50A5C6D/SCDB/16A0C
7F3EA950D21E05370F4A50A9346/datafile/o1_mf_users_bowtbxb7_.dbf
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
ACFS Verzeichnis „Hidden“
27
[root@bumucsvm1 oradata]# ll
total 96
drwx------ 2 root root 65536 May 21 18:52 lost+found
drwxr-x--- 2 oracle oinstall 8192 May 22 01:13 scdb
drwxr-x--- 8 oracle oinstall 8192 Jun 15 21:14 SCDB
# cd .ACFS
[root@bumucsvm1 .ACFS]# ll
total 8
drwxrwx--- 6 root root 4096 May 21 18:52 repl
drwxr-xr-x 3 root root 4096 Jun 15 21:14 snaps
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
ACFS Informationen SNAPShot
28
# acfsutil snap info /u01/app/oracle/oradata
snapshot name: 18943D57D3410C0BE05371F4A50A5C6D
snapshot location:
/u01/app/oracle/oradata/.ACFS/snaps/18943D57D3410C0BE05371F4A50A5C6D
RO snapshot or RW snapshot: RW
parent name: /u01/app/oracle/oradata
snapshot creation time: Mon Jun 15 21:14:18 2015
number of snapshots: 1
snapshot space usage: 415596544 ( 396.34 MB )
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
ASM Cluster File System
• V$ASM_FILESYSTEM
• V$ASM_ACFSVOLUMES
• V$ASM_ACFSSNAPSHOTS
• V$ASM_ACFS_SECURITY_INFO
• V$ASM_ACFS_ENCRYPTION_INFO
V$Views
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Entfernen der PDB
• Drop der PDB:
• Snapshot wird gelöscht:
• Problem: Wenn man sich im .ACFS/snap Folder sich befindet...
30
SQL> drop pluggable database s2pdb including datafiles;
Pluggable database dropped.
# acfsutil snap info /u01/app/oracle/oradata
number of snapshots: 0 (active)
1 (delete pending)
snapshot space usage: 1097728 ( 1.04 MB )
# acfsutil snap delete –t 18943D57D3410C0BE05371F4A50A5C6D
/u01/app/oracle/oradata
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Best Practices
• Eigenes ACFS Filesystem für Datenbank oder PDB:
– Restriktion auf 1023 Snapshots
– Größe der Snapshots
– Verwaltung/Identifikation der Snapshots
31
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Agenda
32
Klonen von Datenbanken
12c ASM Cluster Filesystem
Pluggable Databases auf ACFS & ACFS Snapshots
Snapshot von 12c nonCDB und 11.2.0.4 Datenbanken
1
2
3
4
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
gDBClone Database
• Perl Skript zum:
– Klonen von Datenbanken • Von ASM nach ACFS
• Remote oder Lokal
– Erzeugen von DB-Snapshots (lokal)
– Löschen von DBs
http://www.oracle.com/technetwork/indexes/samplecode/gdbclone-download-
2295388.html
33
Snapshot Management Script
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
• Remote zu Lokal (Clone) • Lokal zu Lokal
34
gDBClone
ASM/FS ASM
ASM/FS ACFS
ASM/FS ACFS
ACFS SNAP
SNAP SNAP
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
gDBClone
35
# ./gDBClone
Usage:
gDBClone clone -sdbname <source DB name>
-sdbhost <source DB Host SCAN name> | -sbckloc '<backup>'
-tdbname <Target Database Name> -acfs <acfs mount point>
[ -sdbport <Source DB SCAN Listener Port> ]
[ -tdbport <Target DB SCAN Listener Port> ]
[ -syspw <Source DB SYSDBA Password> ] [-racmod <db type> ]
gDBClone snap -sdbname <source DB name> -tdbname <Target Database Name>
[ -sdbport <Source DB SCAN Listener Port> ]
[ -tdbport <Target DB SCAN Listener Port> ]
[ -syspw <Source DB SYSDBA Password> ] [-racmod <db type> ]
gDBClone listdb [ -tree ] | [ -verbose ]
gDBClone deldb -tdbname <database name> [ -force ]
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Single Instance
RACOne Node
RAC
Source
Single Instance
RACOne Node
RAC
Target
DB Clone – Database Type
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
RMAN Backup vs. Snapshot
37
6,17
38,35
47,23
59,23
2,23 2,15 2,2 2,43 0
10
20
30
40
50
60
70
5 Gb 25 Gb 35 Gb 45 Gb
Clone Creation Time and DB Size
RMAN Snapshot
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
gDBClone Beispiel
38
clone: Lokal – Lokal von ASM auf ACFS ASM/FS ACFS
# ./gDBClone clone -sdbname ssdb -sdbhost bumucsvm1-scan -tdbname sclone -acfs
/u01/app/oracle/oradata
2015-06-15 23:16:57: I Checking source host bumucsvm1-scan...
2015-06-15 23:16:57: I Getting host info...
2015-06-15 23:16:57: I Starting.....
2015-06-15 23:16:57: I Validating environment.....
Enter the source ssdb SYSDBA password:
2015-06-15 23:17:02: I Checking SCAN listener bumucsvm1-scan:1521...
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
gDBClone Beispiel
• Klone von Backup:
– Keine Auswirkung auf Produktion
– RMAN Backup kann auch auf NFS liegen
• Hinweis: Bei 12.1 NFS Export mit insecure option
39
clone: Lokal – Lokal von Backup auf ACFS
RMAN Full Backup
ACFS
# ./gDBClone clone -sdbname SSDB -sbckloc /u01/app/oracle/fra/SSDB -tdbname
SCLONE -acfs /u01/app/oracle/oradata
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
gDBClone Beispiel
40
snap
# ./gDBClone snap -sdbname SCLONE -tdbname SDOAG
ACFS SNAP
SNAP SNAP
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
gDBClone
41
listDB
# ./gDBClone listdb
DB Name DB Type DB Role Location/Parent
-------- ----------- -------- ----------------
SNAP0 SINGLE Snapshot GOLD
SNAP3 RACOneNode Snapshot SNAP1
SNAP4 SINGLE Snapshot SNAP3
SNAP2 RACOneNode Snapshot GOLD
SNAP5 SINGLE Snapshot SNAP1
GOLD RAC Master /cloudfs
SNAP1 SINGLE Snapshot SNAP0
# ./gDBClone listdb -tree
Parent Child
------ -----
GOLD
SNAP0
SNAP1
SNAP3
SNAP4
SNAP5
SNAP2
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
gDBClone
• Löscht Datenbank und Snapshot
42
deldb
# ./gDBClone deldb -tdbname DOAG
You are going to drop the database DOAG, are you sure (Y/N)? y
Connecting to database
47% complete
Updating network configuration files
52% complete
Deleting instance and datafiles
76% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/SNAP32.log" for further
details.
acfsutil snap delete: Snapshot operation is complete.
ACFS snapshot SNAP3 on /cloudfs ACFS file system has been deleted.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
gDBClone
• Source Datenbank muss im Archivelog Modus sein
• gDBClone wird als Root ausgeführt
• Keine Sonderzeichen für den DBNamen verwenden
• Gegebenfalls DEBUG Funktion verwenden
• Funktioniert nur mit Administrator Managed DBs!
• Hidden Commands:
43
Hinweise / Tipps und Tricks
./gDBClone listsnap -acfs <acfs_mount_point> [ -tree ]
./gDBClone delsnap -snapname <snapshot name> -acfs <acfs_mount_point>
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
gDBClone
• gDBClone mit –debug Option erzeugt Output und Tracefile zur Fehleranalyse
• gDBClone log/trace file: /tmp/clone/gDBClone.trc
• Falls die Debug Option verwendet wird, befinden sich unter /tmp/clone einige “dynamische” Dateien zum Debuggen
44
Debug
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | 45