Gerenciando Ambientes de Teste e Desenvolvimento se beneficiando dos snapshots do ACFS Usando o 'gDBclone' em Clusters de Aplicativo Real (RAC) em Ambientes Multitenant

Por Y V Ravi Kumar Oracle ACE director, Nassyam Basha Oracle ACE director, Rodrigo Mufalani Oracle ACE
Publicado em Julho 2018

Revisado por Mario Andrés Escobar



Introdução


O pacote gDBClone aumenta ainda mais as funcionalidades do Oracle Automatic Storage Management Cluster File System (ACFS) snapshot para criar cópias eficientes dos databases e gerenciar o ciclo de tempo de vida de um ambiente de testes ou desenvolvimento se torna tão simples com métodos extremamente eficientes. O pacote gDBClone é uma ferramenta simples que fornece métodos para clonar um database para ambientes de testes ou desenvolvimento. O Oracle Automatic Storage Management Cluster File System (ACFS) é um filesystem fornecido pela Oracle em diversos Sistemas Operacionais realmente integrado ao ASM (Automatic Storage Management).

Pacote gDBClone realiza sete funcionalidades principais:

  • Clone: Cria um clone database (como Primary ou como Standby) de um database de produção copiando o DB para o cluster de teste ou dev destino
  • Snap: Cria snapshots esparsados do DB para serem usados em teste e desenvolvimento
  • Convert: Converte um determinado database para RAC (Real Application Cluster) OneNode, RAC ou de nonCDB (non-container database) para um PDB (pluggable database) de um CDB  
  • ListDBs: Lista os clones dos databases e seus snapshots
  • DelDB: Deleta um clone do databases e/ou seus snapshots
  • ListHomes: Lista as Oracle Homes disponíveis
  • SYSPwF: Cria um arquivo de senhas criptografado (encrypted password file)

 

Instalação do gDBClone


O gDBClone pode ser instalado via RPM (RedHat Package Manager) usando o comando:

Nota: Faça o download do pacote gDBclone, e ele tem dependências “perl” e “perl-XML-Simple”.

  • perl-XML-Simple-2.18-6.el6.noarch.rpm
  • gDBClone-3-0.2.noarch.rpm

[root@rac1-12c ~]# cd /home/oracle/
[root@rac1-12c oracle]# ls –lrh *.rpm
-rw-r--r--  1 oracle oinstall  72K Jun  5 23:51 perl-XML-Simple-2.18-6.el6.noarch.rpm
-rw-r--r--  1 oracle oinstall  70K Jun  5 23:39 gDBClone-3-0.2.noarch.rpm
[root@rac1-12c oracle]# chmod -R 777 *.rpm

[root@rac1-12c oracle]# rpm -ivh perl-XML-Simple-2.18-6.el6.noarch.rpm
warning: perl-XML-Simple-2.18-6.el6.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID 192a7d7d: NOKEY
Preparing...             ########################################### [100%]
1:perl-XML-Simple        ########################################### [100%]
[root@rac1-12c oracle]#

[root@rac1-12c oracle]# rpm -ivh gDBClone-3-0.2.noarch.rpm
warning: gDBClone-3-0.2.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID e7004b4d: NOKEY
Preparing...              ########################################### [100%]
 1:gDBClone               ########################################### [100%]

gDBClone has been installed on /opt/gDBClone succesfully!

[root@rac1-12c oracle]# cd /opt/gDBClone/
[root@rac1-12c gDBClone]# ls -lrth
total 52K
-rwxr-xr-x 1 root root  46K May 29 14:20 gDBClone

[root@rac1-12c gDBClone]# su - oracle
[oracle@rac1-12c ~]$.oraenv
ORACLE_SID = [racdb1]? +ASM1
The Oracle base remains unchanged with value /u01/app/oracle

[oracle@rac1-12c ~]$ asmcmd

ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB 

MOUNTED  EXTERN  N         512   4096  1048576     16370     8542                0 
MOUNTED  EXTERN  N         512   4096  1048576     15342    15240                0 

Usable_file_MB  Offline_disks  Voting_files  Name

          8542              0             Y  DATA/
         15240              0             N  RECO/


Verifique a disponibilidade dos volumes com ASMCMD

ASMCMD> volinfo --all
no volumes found


Crie um volume ‘vol1’ com tamanho de 12G no diskgroup ‘RECO’

ASMCMD> volcreate -G RECO -s 12G vol1

ASMCMD> volinfo --all
Diskgroup Name: RECO
         Volume Name: VOL1
         Volume Device: /dev/asm/vol1-29
         State: ENABLED
         Size (MB): 12288
         Resize Unit (MB): 64
         Redundancy: UNPROT
         Stripe Columns: 8
         Stripe Width (K): 1024
         Usage:
         Mountpath:
ASMCMD> exit

[oracle@rac1-12c ~]$ su - root
Password:
[root@rac1-12c ~]# modprobe  oracleacfs
[root@rac1-12c ~]# modprobe  oracleadvm
[root@rac1-12c ~]# modprobe  oracleoks
[root@rac1-12c ~]# lsmod | grep oracle
oracleacfs           3307969  1
oracleadvm            506254  2
oracleoks             505749  2 oracleacfs,oracleadvm
[root@rac1-12c ~]# exit

[oracle@rac1-12c ~]$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/vg_rac1-lv_root   35G   23G   11G  68% /
tmpfs                        3.9G  630M  3.3G  16% /dev/shm
/dev/sda1                    477M   55M  397M  13% /boot

[oracle@rac1-12c ~]$ mkfs -t acfs /dev/asm/vol1-29
mkfs.acfs: version                   = 12.1.0.2.0
mkfs.acfs: on-disk version           = 39.0
mkfs.acfs: volume                    = /dev/asm/vol1-29
mkfs.acfs: volume size               = 12884901888  (  12.00 GB )
mkfs.acfs: Format complete.
[oracle@rac1-12c ~]$

[oracle@rac1-12c ~]$ su - root
Password:
[root@rac1-12c ~]# cd /
[root@rac1-12c /]# mkdir vol1

[root@rac1-12c /]# acfsutil registry -a /dev/asm/vol1-29 /vol1
acfsutil registry: mount point /vol1 successfully added to Oracle Registry

[root@rac1-12c /]# acfsutil registry -c /dev/asm/vol1-29 /vol1 -u oracle
acfsutil registry: successfully modified ACFS registration for '/dev/asm/vol1-23'

[root@rac1-12c /]# mount -t acfs /dev/asm/vol1-29 /vol1

[root@rac1-12c /]# df -h
Filesystem                   		Size  	Used 	Avail 	Use% 	Mounted on
/dev/mapper/vg_rac1-lv_root   	35G   	23G   	11G  	68% 		/
tmpfs                        		3.9G  	630M  	3.3G  	16%	/dev/shm
/dev/sda1                    		477M   	55M  	397M  	13% 	/boot
/dev/asm/vol1-29              	12G  	101M   	12G   	1% 		/vol1

[root@rac1-12c /]# chown -R oracle:oinstall /vol1
[root@rac1-12c /]# mount | grep acfs
/dev/asm/vol1-29 on /vol1 type acfs (rw)


Logue-se no rac2-12c node e verifique se o volume ‘vol1’ está montado

[root@rac1-12c /]# ssh rac2-12c
root@rac2-12c's password:
Last login: Tue Jun  6 05:46:28 2017 from rac1-12c.localdomain

[root@rac2-12c ~]# df -h
Filesystem                   		Size  	Used 	Avail 	Use% 	Mounted on
/dev/mapper/vg_rac1-lv_root   	35G   	18G   	16G  	54% 		/
tmpfs                        		3.9G  	631M  	3.3G  	16%	 /dev/shm
/dev/sda1                    		477M   	55M  	397M  	13% 	/boot
/dev/asm/vol1-29              	12G  	101M   	12G   	1% 		/vol1
[root@rac2-12c ~]#

[root@rac2-12c ~]# vi /etc/fstab
[root@rac2-12c ~]# cat /etc/fstab

# /etc/fstab
# Created by anaconda on Thu May  8 15:50:02 2014
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_rac1-lv_root /                       		ext4    defaults        1 1
UUID=7a3d2b88-72a1-487b-90e0-8e0415ea454f /boot                 ext4    defaults        1 2
/dev/mapper/vg_rac1-lv_swap swap                    		swap   	defaults        0 0
tmpfs                   	/dev/shm                	tmpfs   defaults        0 0
devpts                  	/dev/pts                	devpts  gid=5,mode=620  0 0
sysfs                   	/sys                    	sysfs   defaults        0 0
proc                    	/proc                   	proc    defaults        0 0
/dev/asm/vol1-29       		/vol1                   	acfs   	defaults        0 0

Nota: Coloque a mesma entrada no arquivo ‘/etc/fstab’ do node rac1-12c.




Cenário-1: Criando um Clone Database ‘mproddb’ para ‘proddb’ database


[root@rac1-12c gDBClone]# ./gDBClone clone -sdbname proddb -sdbscan rac-scan 
-tdbhome OraDB12Home1 -tdbname mproddb -dataacfs /vol1 -racmod 2

INFO: 2017-06-08 00:41:38: Please check the logfile '/opt/gDBClone/out/log/gDBClone_32545.log' 
for more details

MacroStep1 - Getting information and validating setup...

Please enter the 'SYS' User password for the database proddb:
Please re-enter the 'SYS' user password for the database proddb:
INFO: 2017-06-08 00:41:42: Validating environment
INFO: 2017-06-08 00:41:42: Checking superuser usage
INFO: 2017-06-08 00:41:42: Checking ping to host 'rac-scan'
INFO: 2017-06-08 00:41:42: Checking if target database name 'mproddb' is a valid name
INFO: 2017-06-08 00:41:42: Checking if target database home 'OraDB12Home1' exists
WARNING: 2017-06-08 00:41:42: ORACLE_BASE is not set
INFO: 2017-06-08 00:41:42: Got Oracle Base from orabase
INFO: 2017-06-08 00:41:42: Checking if target database 'mproddb' exists
INFO: 2017-06-08 00:41:43: Checking 'mproddb' snapshot existence on '/vol1'
INFO: 2017-06-08 00:41:43: Checking registered instance 'mproddb'
INFO: 2017-06-08 00:41:45: Checking listener on 'rac1-12c:1521'
INFO: 2017-06-08 00:41:45: Checking source and target database version
INFO: 2017-06-08 00:41:48: Checking source log mode
INFO: 2017-06-08 00:41:48: Checking Flash Cache setting
INFO: 2017-06-08 00:41:48: Checking ACFS command options
INFO: 2017-06-08 00:41:48: Checking if '/vol1' is an ACFS file system
SUCCESS: 2017-06-08 00:41:48: Environment validation complete

MacroStep2 - Setting up clone environment...
INFO: 2017-06-08 00:41:48: Creating local pfile
INFO: 2017-06-08 00:41:49: Creating local password file
INFO: 2017-06-08 00:41:49: Creating local Audit folder
INFO: 2017-06-08 00:41:49: Creating local auxiliary listener
INFO: 2017-06-08 00:41:49: Starting auxiliary listener
INFO: 2017-06-08 00:42:09: Sleeping 60 secs, please wait
INFO: 2017-06-08 00:43:09: Setting up ACFS storage
INFO: 2017-06-08 00:43:09: Creating dynamic scripts
INFO: 2017-06-08 00:43:21: Cloning to target ACFS from host 'rac-scan'
INFO: 2017-06-08 00:43:21: Creating RMAN script for spfile target to ACFS
INFO: 2017-06-08 00:43:21: Instantiating clone database
SUCCESS: 2017-06-08 00:43:21: Environment setup complete

MacroStep3 - Cloning database 'proddb'...
INFO: 2017-06-08 00:43:21: please wait (this can take a while depending on database 
size and/or network speed)
INFO: 2017-06-08 00:47:02: Moving spfile
INFO: 2017-06-08 00:47:42: Updating local dbs pfile/spfile
INFO: 2017-06-08 00:47:42: Register 'mproddb' database as cluster resource
INFO: 2017-06-08 00:47:43: Checking database name
INFO: 2017-06-08 00:47:43: Changing database ID name - 1st Step
INFO: 2017-06-08 00:48:19: Successfully changed the Database ID
INFO: 2017-06-08 00:48:19: Changing DB_NAME in spfile
INFO: 2017-06-08 00:49:46: Changing database ID name - 2nd Step
INFO: 2017-06-08 00:50:21: Successfully changed the Database ID
INFO: 2017-06-08 00:50:21: Changing DB_NAME in spfile
INFO: 2017-06-08 00:51:45: Modifying DB instance
INFO: 2017-06-08 00:51:46: Setup ACFS dependency
INFO: 2017-06-08 00:51:48: Database 'mproddb' dependency to '/vol1/.ACFS/snaps' 
done successfully

MacroStep4 - Converting clone database 'mproddb' to cluster mode...
INFO: 2017-06-08 00:52:01: Getting DG or mount point dependency
INFO: 2017-06-08 00:52:04: Database conversion started, it will take some time
INFO: 2017-06-08 01:01:03: Setup ACFS dependency back
INFO: 2017-06-08 01:01:04: Database 'sdbname' dependency to '/vol1' done successfully
SUCCESS: 2017-06-08 01:01:57: Database 'mproddb' converted to RAC succesfully
INFO: 2017-06-08 01:01:57: Starting database 'mproddb'
SUCCESS: 2017-06-08 01:02:20: Successfully created clone database 'mproddb'
INFO: 2017-06-08 01:02:20: Cleaning up the setup
[root@rac1-12c gDBClone]#





[root@rac1-12c gDBClone]# ./gDBClone listdbs -tree

Parent  	Child
----------  	--------
mproddb

------------------------------------------------------------------------------------
Nota: Uma árvore irá ser mostrada apenas se existirem filhos!
------------------------------------------------------------------------------------

[oracle@rac1-12c ~]$.oraenv
ORACLE_SID = [proddb] ? mproddb
The Oracle base remains unchanged with value /u01/app/oracle

[oracle@rac1-12c ~]$ sqlplus /nolog
SQL*Plus: Release 12.1.0.2.0 Production on Thu Jun 8 01:18:05 2017
Copyright(c) 1982, 2014, Oracle.  All rights reserved.

SQL> connect sys/oracle@mproddb as sysdba
Connected.

SQL> show pdbs
	
CON_ID 		CON_NAME                     	OPEN MODE  		RESTRICTED
---------- 	------------------------------ 	------------------ 	------------------
         2 	PDB$SEED                       	READ ONLY  		NO
         3 	PDB1                           	MOUNTED

SQL> alter pluggable database pdb1 open instances=all;
Pluggable database altered.

SQL> show pdbs

CON_ID 		CON_NAME                      	OPEN MODE  		RESTRICTED
---------- 	------------------------------ 	---------------- 	----------------
         2 	PDB$SEED                       	READ ONLY  		NO
         3 	PDB1                           	READ WRITE 		NO

SQL> exit



Cenário-2: Database 'mproddb' é um CDB. Atualmente o gDBclone não suporta snap de um CDB


[root@rac1-12c gDBClone]# ./gDBClone snap -sdbname mproddb -tdbname cproddb -racmod 2
INFO: 2017-06-08 01:04:28: Please check the logfile '/opt/gDBClone/out/log/gDBClone_17416.log' 
for more details

MacroStep1 - Getting information and validating setup...

Please enter the 'SYS' User password for the database mproddb:
Please re-enter the 'SYS' user password for the database mproddb:
INFO: 2017-06-08 01:04:33: Validating environment...
INFO: 2017-06-08 01:04:33: Superuser usage check
INFO: 2017-06-08 01:04:33: Clusterware running check
INFO: 2017-06-08 01:04:33: Minimun crs activeversion check
INFO: 2017-06-08 01:04:33: Database 'mproddb' existence check
INFO: 2017-06-08 01:04:33: Database 'mproddb' running check
WARNING: 2017-06-08 01:04:35: ORACLE_BASE is not set
INFO: 2017-06-08 01:04:35: Got Oracle Base from orabase
INFO: 2017-06-08 01:04:35: Checking if target database name cproddb is a valid name
INFO: 2017-06-08 01:04:35: Checking database 'mproddb' connectivity
INFO: 2017-06-08 01:05:04: Checking whether the database 'mproddb' is in ACFS snapshot
INFO: 2017-06-08 01:05:04: Checking source database 'mproddb' and target dbhome version
INFO: 2017-06-08 01:05:09: Checking if target database 'cproddb' exists
INFO: 2017-06-08 01:05:09: Checking registered instance 'cproddb'
INFO: 2017-06-08 01:05:14: Checking if cproddb exists as snapshot in '/vol1'
INFO: 2017-06-08 01:05:14: Checking if source database mproddb is snapable
INFO: 2017-06-08 01:05:28: ...Checking whether the database 'mproddb' is entirely on ACFS
INFO: 2017-06-08 01:05:43: ...Checking whether the database 'mproddb' is a primary/physical 
standby database.
INFO: 2017-06-08 01:05:45: ...Checking whether the database 'mproddb' is in READ WRITE mode
INFO: 2017-06-08 01:06:00: ...Checking whether the database 'mproddb' is a CDB
WARNING: 2017-06-08 01:06:29: Database 'mproddb' is a CDB. Currently we do not support taking 
snap from a CDB
ERROR: 2017-06-08 01:06:29: Unable to create snap database from 'mproddb'
[root@rac1-12c gDBClone]#



Cenário-3: Deletando o database mprodb usando gDBclone


[root@rac1-12c gDBClone]# ./gDBClone deldb -tdbname mproddb -force
INFO: 2017-06-08 01:50:59: Please check the logfile '/opt/gDBClone/out/log/gDBClone_7834.log' 
for more details

You are going to drop the database mproddb, are you sure (Y/N)? Y
WARNING: 2017-06-08 01:51:01: ORACLE_BASE is not set
INFO: 2017-06-08 01:51:01: Got Oracle Base from orabase
SUCCESS: 2017-06-08 01:51:30: ACFS snapshot 'mproddb' on '/vol1' has been deleted



Cenário-4: Criando um Physical Standby Database ‘sproddb’ para ‘proddb’ database


[root@rac1-12c gDBClone]# ./gDBClone clone -sdbname proddb -sdbscan rac-scan -tdbname sproddb 
-tdbhome OraDB12Home1 -dataacfs /vol1 -racmod 2 -standby

Nota: Se precisar aumentar o diminuir a SGA, exemplo se o sistema destino não pode acomodar o tamanho da SGA de origem, você pode se beneficiar dos parâmetros “-sga_max_size” e “-sga_target”..

INFO: 2017-06-08 01:51:43: Please check the logfile '/opt/gDBClone/out/log/gDBClone_8109.log' 
for more details

MacroStep1 - Getting information and validating setup...

Please enter the 'SYS' User password for the database proddb:
Please re-enter the 'SYS' user password for the database proddb:
INFO: 2017-06-08 01:51:47: Validating environment
INFO: 2017-06-08 01:51:47: Checking superuser usage
INFO: 2017-06-08 01:51:47: Checking ping to host 'rac-scan'
INFO: 2017-06-08 01:51:47: Checking if target database name 'sproddb' is a valid name
INFO: 2017-06-08 01:51:47: Checking if target database home 'OraDB12Home1' exists
WARNING: 2017-06-08 01:51:48: ORACLE_BASE is not set
INFO: 2017-06-08 01:51:48: Got Oracle Base from orabase
INFO: 2017-06-08 01:51:48: Checking if target database 'sproddb' exists
INFO: 2017-06-08 01:51:48: Checking 'sproddb' snapshot existence on '/vol1'
INFO: 2017-06-08 01:51:48: Checking registered instance 'sproddb'
INFO: 2017-06-08 01:51:50: Checking listener on 'rac1-12c:1521'
INFO: 2017-06-08 01:51:50: Checking source and target database version
INFO: 2017-06-08 01:51:53: Checking source log mode
INFO: 2017-06-08 01:51:54: Checking source undo tablespaces
INFO: 2017-06-08 01:51:54: Checking FLASHBACK mode
WARNING: 2017-06-08 01:51:54: Source database 'proddb' is not in FLASHBACK mode
INFO: 2017-06-08 01:51:54: Checking LOG_ARCHIVE_DEST settings
INFO: 2017-06-08 01:51:54: Checking Flash Cache setting
INFO: 2017-06-08 01:51:55: Checking ACFS command options
INFO: 2017-06-08 01:51:55: Checking if '/vol1' is an ACFS file system
SUCCESS: 2017-06-08 01:51:55: Environment validation complete

MacroStep2 - Setting up clone environment...
INFO: 2017-06-08 01:51:55: Creating local pfile
INFO: 2017-06-08 01:51:55: Creating local password file
INFO: 2017-06-08 01:51:55: Creating local Audit folder
INFO: 2017-06-08 01:51:55: Creating local auxiliary listener
INFO: 2017-06-08 01:51:55: Starting auxiliary listener
INFO: 2017-06-08 01:52:15: Sleeping 60 secs, please wait
INFO: 2017-06-08 01:53:15: Setting up ACFS storage
INFO: 2017-06-08 01:53:15: Creating dynamic scripts
INFO: 2017-06-08 01:53:27: Cloning to target ACFS from host 'rac-scan' as standby database
INFO: 2017-06-08 01:53:27: Creating RMAN script for spfile target to ACFS
INFO: 2017-06-08 01:53:27: Instantiating standby database
INFO: 2017-06-08 01:53:27: Enabling force logging
INFO: 2017-06-08 01:53:28: Getting standby logs on source database proddb
INFO: 2017-06-08 01:53:28: Standby logs exist on source database proddb
SUCCESS: 2017-06-08 01:53:28: Environment setup complete

MacroStep3 - Cloning database 'proddb'...
INFO: 2017-06-08 01:53:28: please wait (this can take a while depending on database size 
and/or network speed)
INFO: 2017-06-08 01:55:53: Moving spfile
INFO: 2017-06-08 01:56:14: Updating local dbs pfile/spfile
INFO: 2017-06-08 01:56:14: Register 'sproddb' database as cluster resource
INFO: 2017-06-08 01:56:16: Modifying DB instance
INFO: 2017-06-08 01:56:17: Setup ACFS dependency
INFO: 2017-06-08 01:56:19: Database 'sproddb' dependency to '/vol1/.ACFS/snaps'
done successfully

MacroStep4 - Converting clone database 'sproddb' to cluster mode...
INFO: 2017-06-08 01:56:31: Getting DG or mount point dependency
INFO: 2017-06-08 01:56:34: Database conversion started, it will take some time
INFO: 2017-06-08 02:00:59: Setup ACFS dependency back
INFO: 2017-06-08 02:01:01: Database 'sdbname' dependency to '/vol1' done successfully
SUCCESS: 2017-06-08 02:01:02: Database 'sproddb' converted to RAC succesfully

MacroStep5 - Standby setup...
INFO: 2017-06-08 02:01:34: Starting redo apply
INFO: 2017-06-08 02:01:41: Configuring primary database 'proddb'
SUCCESS: 2017-06-08 02:01:41: Successfully created clone "sproddb" database as standby
INFO: 2017-06-08 02:01:41: Cleaning up the setup
[root@rac1-12c gDBClone]#





[oracle@rac1-12c ~]$.oraenv
ORACLE_SID = [mproddb] ? sproddb
The Oracle base remains unchanged with value /u01/app/oracle

[oracle@rac1-12c ~]$ sqlplus /nolog
SQL*Plus: Release 12.1.0.2.0 Production on Thu Jun 8 02:31:28 2017
Copyright(c) 1982, 2014, Oracle. All rights reserved.

SQL> connect sys/oracle@sproddb as sysdba
Connected.

SQL> select open_mode,database_role from gv$database;

OPEN_MODE            	DATABASE_ROLE
-------------------- 	-----------------------
MOUNTED              	PHYSICAL STANDBY
MOUNTED              	PHYSICAL STANDBY

SQL> archive log list;
Database log mode		Archive Mode
Automatic archival             	Enabled
Archive destination            	USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     	0
Next log sequence to archive   	0
Current log sequence           	0
SQL> exit



[oracle@rac1-12c ~]$ srvctl config database -db proddb -all
Database unique name: proddb
Database name: proddb
Oracle home: /u01/app/oracle/product/12.1.0.2/db_1
Oracle user: oracle
Spfile: +DATA/PRODDB/PARAMETERFILE/spfile.313.946073901
Password file: +DATA/PRODDB/PASSWORD/pwdproddb.276.946073579
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: DATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
Database is enabled
Database is individually enabled on nodes:
Database is individually disabled on nodes:
OSDBA group: dba
OSOPER group:
Database instances: proddb1,proddb2
Configured nodes: rac1-12c,rac2-12c
Database is administrator managed
[oracle@rac1-12c ~]$

[oracle@rac1-12c ~]$ srvctl config database -db sproddb -all
Database unique name: sproddb
Database name: proddb
Oracle home: /u01/app/oracle/product/12.1.0.2/db_1
Oracle user: oracle
Spfile: /vol1/.ACFS/snaps/sproddb/sproddb/spfilesproddb.ora
Password file: /vol1/.ACFS/snaps/sproddb/orapwsproddb
Domain:
Start options: mount
Stop options: immediate
Database role: PHYSICAL_STANDBY
Management policy: AUTOMATIC
Server pools:
Disk Groups:
Mount point paths: /vol1
Services:
Type: RAC
Start concurrency:
Stop concurrency:
Database is enabled
Database is individually enabled on nodes:
Database is individually disabled on nodes:
OSDBA group: dba
OSOPER group:
Database instances: sproddb1,sproddb2
Configured nodes: rac1-12c,rac2-12c
Database is administrator managed
[oracle@rac1-12c ~]$



Cenário-5: Criando um Active Data Guard (ADG) com Real-Time Apply usando o gDBclone


[root@rac1-12c gDBClone]# ./gDBClone clone -sdbname proddb -sdbscan rac-scan -tdbname pstandby 
-tdbhome OraDB12Home1 -dataacfs /vol1 -racmod 2 -standby -activedg –rtapply

INFO: 2017-06-09 00:13:21: Please check the logfile '/opt/gDBClone/out/log/gDBClone_30523.log' 
for more details

MacroStep1 - Getting information and validating setup...

Please enter the 'SYS' User password for the database proddb:
Please re-enter the 'SYS' user password for the database proddb:
INFO: 2017-06-09 00:13:25: Validating environment
INFO: 2017-06-09 00:13:25: Checking superuser usage
INFO: 2017-06-09 00:13:25: Checking ping to host 'rac-scan'
INFO: 2017-06-09 00:13:25: Checking if target database name 'pstandby' is a valid name
INFO: 2017-06-09 00:13:25: Checking if target database home 'OraDB12Home1' exists
WARNING: 2017-06-09 00:13:25: ORACLE_BASE is not set
INFO: 2017-06-09 00:13:25: Got Oracle Base from orabase
INFO: 2017-06-09 00:13:25: Checking if target database 'pstandby' exists
INFO: 2017-06-09 00:13:26: Checking 'pstandby' snapshot existence on '/vol1'
INFO: 2017-06-09 00:13:26: Checking registered instance 'pstandby'
INFO: 2017-06-09 00:13:28: Checking listener on 'rac1-12c:1521'
INFO: 2017-06-09 00:13:28: Checking source and target database version
INFO: 2017-06-09 00:13:31: Checking source log mode
INFO: 2017-06-09 00:13:31: Checking source undo tablespaces
INFO: 2017-06-09 00:13:32: Checking FLASHBACK mode
WARNING: 2017-06-09 00:13:32: Source database 'proddb' is not in FLASHBACK mode
INFO: 2017-06-09 00:13:32: Checking LOG_ARCHIVE_DEST settings
INFO: 2017-06-09 00:13:32: Checking Flash Cache setting
INFO: 2017-06-09 00:13:32: Checking ACFS command options
INFO: 2017-06-09 00:13:32: Checking if '/vol1' is an ACFS file system
SUCCESS: 2017-06-09 00:13:32: Environment validation complete

MacroStep2 - Setting up clone environment...
INFO: 2017-06-09 00:13:32: Creating local pfile
INFO: 2017-06-09 00:13:33: Creating local password file
INFO: 2017-06-09 00:13:33: Creating local Audit folder
INFO: 2017-06-09 00:14:13: Creating local auxiliary listener
INFO: 2017-06-09 00:14:13: Starting auxiliary listener
INFO: 2017-06-09 00:14:33: Sleeping 60 secs, please wait
INFO: 2017-06-09 00:15:33: Setting up ACFS storage
INFO: 2017-06-09 00:15:33: Creating dynamic scripts
INFO: 2017-06-09 00:15:45: Cloning to target ACFS from host 'rac-scan' as standby database
INFO: 2017-06-09 00:15:45: Creating RMAN script for spfile target to ACFS
INFO: 2017-06-09 00:15:45: Instantiating standby database
INFO: 2017-06-09 00:15:45: Enabling force logging
INFO: 2017-06-09 00:15:46: Getting standby logs on source database proddb
INFO: 2017-06-09 00:15:46: Standby logs exist on source database proddb
SUCCESS: 2017-06-09 00:15:46: Environment setup complete

MacroStep3 - Cloning database 'proddb'...
INFO: 2017-06-09 00:15:46: please wait (this can take a while depending on database size 
and/or network speed)
INFO: 2017-06-09 00:18:10: Moving spfile
INFO: 2017-06-09 00:18:32: Updating local dbs pfile/spfile
INFO: 2017-06-09 00:18:32: Register 'pstandby' database as cluster resource
INFO: 2017-06-09 00:18:34: Modifying DB instance
INFO: 2017-06-09 00:18:35: Setup ACFS dependency
INFO: 2017-06-09 00:18:37: Database 'pstandby' dependency to '/vol1/.ACFS/snaps' 
done successfully

MacroStep4 - Converting clone database 'pstandby' to cluster mode...
INFO: 2017-06-09 00:19:00: Getting DG or mount point dependency
INFO: 2017-06-09 00:19:03: Database conversion started, it will take some time
INFO: 2017-06-09 00:23:46: Setup ACFS dependency back
INFO: 2017-06-09 00:23:47: Database 'sdbname' dependency to '/vol1' done successfully
SUCCESS: 2017-06-09 00:23:48: Database 'pstandby' converted to RAC succesfully

MacroStep5 - Standby setup...
INFO: 2017-06-09 00:24:22: Starting redo apply
INFO: 2017-06-09 00:24:29: Configuring primary database 'proddb'
SUCCESS: 2017-06-09 00:24:29: Successfully created clone "pstandby" database as standby
INFO: 2017-06-09 00:24:29: Cleaning up the setup
[root@rac1-12c gDBClone]#











Cenário-6: Criando um Clone Active Data Guard (ADG) com Real-Time Apply usando o gDBclone


[root@rac1-12c gDBClone]# ./gDBClone clone -sdbname proddb -sdbscan rac-scan -tdbname pstandby 
-tdbhome OraDB12Home1 -dataacfs /vol1 -racmod 2 -standby -activedg –rtapply

[root@rac1-12c ~]# cd /opt//gDBClone/
[root@rac1-12c gDBClone]# ./gDBClone clone -sdbname orcldb -sdbscan rac-scan1 -tdbname corcldb 
-tdbhome OraDB12Home1 -dataacfs /vol1 -racmod 2
INFO: 2017-06-29 01:47:20: Please check the logfile '/opt/gDBClone/out/log/gDBClone_9818.log' 
for more details

MacroStep1 - Getting information and validating setup...

Please enter the 'SYS' User password for the database orcldb:
Please re-enter the 'SYS' user password for the database orcldb:
INFO: 2017-06-29 01:47:26: Validating environment
INFO: 2017-06-29 01:47:26: Checking superuser usage
INFO: 2017-06-29 01:47:26: Checking ping to host 'rac-scan1'
INFO: 2017-06-29 01:47:26: Checking if target database name 'corcldb' is a valid name
INFO: 2017-06-29 01:47:26: Checking if target database home 'OraDB12Home1' exists
INFO: 2017-06-29 01:47:27: Got Oracle Base from env variable: /u01/app/oracle
INFO: 2017-06-29 01:47:27: Checking if target database 'corcldb' exists
INFO: 2017-06-29 01:47:27: Checking 'corcldb' snapshot existence on '/vol1'
INFO: 2017-06-29 01:47:27: Checking registered instance 'corcldb'
INFO: 2017-06-29 01:47:30: Checking listener on 'rac1-12c:1521'
INFO: 2017-06-29 01:47:30: Checking source and target database version
INFO: 2017-06-29 01:47:35: Checking source log mode
INFO: 2017-06-29 01:47:35: Checking Flash Cache setting
INFO: 2017-06-29 01:47:36: Checking ACFS command options
INFO: 2017-06-29 01:47:36: Checking if '/vol1' is an ACFS file system
SUCCESS: 2017-06-29 01:47:36: Environment validation complete

MacroStep2 - Setting up clone environment...
INFO: 2017-06-29 01:47:36: Creating local pfile
INFO: 2017-06-29 01:47:36: Creating local password file
INFO: 2017-06-29 01:47:36: Creating local Audit folder
INFO: 2017-06-29 01:48:16: Creating local auxiliary listener
INFO: 2017-06-29 01:48:16: Starting auxiliary listener
INFO: 2017-06-29 01:48:36: Sleeping 60 secs, please wait
INFO: 2017-06-29 01:49:36: Setting up ACFS storage
INFO: 2017-06-29 01:49:36: Creating dynamic scripts
INFO: 2017-06-29 01:49:49: Cloning to target ACFS from host 'rac-scan1'
INFO: 2017-06-29 01:49:49: Creating RMAN script for spfile target to ACFS
INFO: 2017-06-29 01:49:49: Instantiating clone database
SUCCESS: 2017-06-29 01:49:49: Environment setup complete

MacroStep3 - Cloning database 'orcldb'...
INFO: 2017-06-29 01:49:49: please wait (this can take a while depending on database size 
and/or network speed)
INFO: 2017-06-29 01:54:09: Moving spfile
INFO: 2017-06-29 01:54:36: Updating local dbs pfile/spfile
INFO: 2017-06-29 01:54:36: Register 'corcldb' database as cluster resource
INFO: 2017-06-29 01:54:39: Checking database name
INFO: 2017-06-29 01:54:39: Changing database ID name - 1st Step
INFO: 2017-06-29 01:55:15: Successfully changed the Database ID
INFO: 2017-06-29 01:55:15: Changing DB_NAME in spfile
INFO: 2017-06-29 01:56:25: Changing database ID name - 2nd Step
INFO: 2017-06-29 01:56:57: Successfully changed the Database ID
INFO: 2017-06-29 01:56:57: Changing DB_NAME in spfile
INFO: 2017-06-29 01:58:14: Modifying DB instance
INFO: 2017-06-29 01:58:15: Setup ACFS dependency
INFO: 2017-06-29 01:58:18: Database 'corcldb' dependency to '/vol1/.ACFS/snaps' 
done successfully

MacroStep4 - Converting clone database 'corcldb' to cluster mode...
Use of uninitialized value in split at /opt/gDBClone/lib/gDBClone_Utils.pm line 579.
Use of uninitialized value $data in scalar chomp at /opt/gDBClone/lib/gDBClone_Utils.pm 
line 1291.
Use of uninitialized value $data in substitution (s///) at /opt/gDBClone/lib/gDBClone_Utils.pm 
line 1292.
Use of uninitialized value $data in substitution (s///) at /opt/gDBClone/lib/gDBClone_Utils.pm 
line 1292.
Use of uninitialized value $uid in getpwuid at /opt/gDBClone/lib/gDBClone_Utils.pm line 609.
Use of uninitialized value in split at /opt/gDBClone/lib/gDBClone_Utils.pm line 358.
Use of uninitialized value $data in scalar chomp at /opt/gDBClone/lib/gDBClone_Utils.pm 
line 1291.
Use of uninitialized value $data in substitution (s///) at /opt/gDBClone/lib/gDBClone_Utils.pm 
line 1292.
Use of uninitialized value $data in substitution (s///) at /opt/gDBClone/lib/gDBClone_Utils.pm 
line 1292.
INFO: 2017-06-29 01:58:31: Getting DG or mount point dependency
INFO: 2017-06-29 01:58:35: Database conversion started, it will take some time
INFO: 2017-06-29 02:07:59: Setup ACFS dependency back
INFO: 2017-06-29 02:08:01: Database 'sdbname' dependency to '/vol1' done successfully
SUCCESS: 2017-06-29 02:08:44: Database 'corcldb' converted to RAC succesfully
INFO: 2017-06-29 02:08:44: Starting database 'corcldb'
SUCCESS: 2017-06-29 02:09:09: Successfully created clone database 'corcldb'
INFO: 2017-06-29 02:09:09: Cleaning up the setup
[root@rac1-12c gDBClone]#






Limitações e considerações sobre o gDBClone

  • gDBClone trabalha com o Oracle Grid Infrastructure (GI) somente .
  • O database deve estar em archivelog mode.
  • Multitenant database snapshot não é suportado atualmente.
  • gDBClone snap precisa da funcionalidade do  Oracle Enterprise Edition (EE) Databases, RMAN snapshot time recovery e o Grid Infrastructure (GI) version 12.1 ou superior.
  • Grid Infrastructure (GI) version 11g não é suportado por causa da falta da funcionalidade ACFS snapshot-of-snapshot.



Desinstalação do gDBClone

O gDBClone pode ser removido via RPM (RedHat Package Manager) usando o comando:

  • rpm -e gDBClone-3-0.2.noarch.rpm


Por favor leia para mais detalhes: gDBClone Database Clone/Snapshot Management Script (Doc ID 2099214.1)




Conclusão:  Usando o gDBclone nós podemos configurar vários cenários com simples comandos:


  1. Criar um clone do database usando Recovery Manager (RMAN) backupsets.
  2. Criar um  snapshot RAC database de um standby database.
  3. Upgrade de Database usando Transient Logical Standby (TLS).
  4. Clonar um database de um Recovery Manager (RMAN) full backup para um  ACFS standby database.
  5. Clonar um database criptografado com Transparent Data Encryption (TDE).
  6. Converter Single Instance database, RACONE Node database para um RAC database.
  7. Clonar um Remote/Local database para ACFS.
  8. Converter um Non-CDB database para um Pluggable Database (PDB) de um determinado Container Database (CDB).



Y V Ravi Kumar é um Oracle ACE e Oracle Certified Master (OCM) com 18 anos de experiência em  instituições financeiras, serviços financeiros e seguros (BFSI) e atuou em diversos papeis como Senior Database Architect e Production DBA.  Ele também é OCP em Oracle 8i, 9i, 10g, 11g & 12c e Certificado em Golden Gate, RAC, Performance Tuning & Oracle Exadata. Ele continua motivando muitos DBAs e ajudando a Oracle Community publicando suas dicas /ideias/sugestões/soluções em seu blog. Ele escreveu 90+ artigos OTN sobre Oracle Exadata, Oracle RAC e Oracle GoldenGate para a OTN em Espanhol, OTN em Português e OTN em inglês e 19 artigos para a TOAD World, 2 Artigos para o UKOUG, 3 Artigos para OTech Magazine e 2 Artigos para a Redgate. Ele é membro do All India Oracle User Group (AIOUG) e frequente Oracle speaker in @NYOUG, @OTN, AIOUG, Sangam e IOUG. Ele desenha, projeta e implementa Core Banking System (CBS) Databases para o Central Banks em dois países – India e Mahe, Seychelles. 
Ele é Co-Founder do OraWorld (www.oraworld.com). Leia mais sobre o seu perfil na LaserSoft

Basha Nassyam é um DBA. É um OCM 11g, com experiência em tecnologias como Oracle Data Guard, RMAN, RAC. Ele já fez mais de 90 configurações do Data Guard em diferentes plataformas, de não-RAC RAC e vice-versa. Ele fez migrações bem-sucedidas com "switchovers" e "failovers" a vários bancos de dados de produção crítica. Ele participa ativamente de fóruns Oracle utilizando o usuário "CKPT" e ganhou mais de 10.000 pontos (nível guru). Publica regularmente artigos em seu blog www.oracle-ckpt.com e é co-autor do livro "Guia de Administração do Oracle Data Guard 11gR2".

Rodrigo Mufalani é um Oracle ACE e Oracle Certified Master (OCM) com mais de 14 anos de experiência, começou com o Oracle 8i, mas teve a oportunidade de dar suporte a Oracle 7.3.4 em diante. É especialista em banco de dados Oracle com foco principal em Performance & Tuning e RAC. É palestrante em eventos de Oracle como: OTN LAD TOUR e outros. Atualmente trabalha como consultor diversas empresas no segmento de variados ramos como: Educação, Saúde, Tecnologia, Seguros e etc. Foi o terceiro Oracle ACE a ser nomeado no Brasil e é OCP nas versões 10g, 11g e 12c. Atualmente é DBA na eProseed. Twitter @mufalani / blog www.mufalani.com.br/blog

Este artigo foi revisto pela equipe de produtos Oracle e está em conformidade com as normas e práticas para o uso de produtos Oracle.