Crear una Snapshot Database en Oracle Database Appliance (ODA) X5-2
Por Y V Ravi Kumar , Rita Nuñez , Shireesha Baddam.Publicado en octubre 2017
Introducción
Las Snapshot Database en ODA (Oracle Database Appliance) pueden ser creadas usando OAKCLI (Oracle Appliance Kit Command Line Interface). La Base de Datos Origen puede ser RAC, RAC One Node o Single Instance y la Destino (Snapshot Database) puede ser RAC o RAC One Node o Single Instance. Crear una Snapshot Database no requiere bajar la base de datos origen. Usando OAKCLI en ODA se puede crear una Snapshot Database en muy poco tiempo, va a tener mucho menor tamaño y puede tener distinta clase y tipo que la base de datos origen.
Configuración del Ambiente:
Sistema Origen:
Modelo ODA: BM Oracle Database Appliance (ODA) X5-2 Public interface: COPPER Version de ODA: 12.1.2.9.0 Sistema Operativo: Linux version 2.6 (Red Hat 4.4.7-16) Version Base de Datos: Oracle Database 12c R1 (12.1.0.2.0) Hostnames: DBServer01, DBServer02 Base de Datos: test01db
Sistema Destino:
Modelo ODA: BM Oracle Database Appliance (ODA) X5-2 Public interface: COPPER Version de ODA: 12.1.2.9.0 Sistema Operativo: Linux version 2.6 (Red Hat 4.4.7-16) Version de Base de Datos: Oracle Database 12c R1 (12.1.0.2.0) Hostnames: DBServer01, DBServer02 Snapshot Database: test02db
Prerequisitos:
Las Snapshot Databases necesitan cumplir los siguientes requisitos
- La Base de Datos Origen y la Snapshot deben estar en Archive Log Mode.
- La Base de Datos Origen y la Snapshot no deben ser Container Database (CDB) ni Standby Database.
- Los datafiles de la Base de Datos Origen deben estar online y disponibles
- La Base de Datos Origen y la Snapshot Database no deben estar en modo Read Only o Restricted o Modo Online Backup.
- El horario de los relojes de los ODA debe ser el mismo ante de crear la Snapshot Database.
- Creación de la Base Origen test01db usando OAKCLI en ODA
1.1 Oakcli show dbhomes : lista los homes de bases de datos disponibles
1.2 Conectarse a una sesion de putty en node1(i.e DBServer01) con el usuario ‘ROOT’. Usar el comando de abajo para crear la base test01db usando oakcli.
- oakcli create database -db test01db -oh OraDb12102_home1
[root@DBServer01: Mon June 14, 02:24 PM : /root ]
$ oakcli create database -db test01db -oh OraDb12102_home1
INFO: 2017-06-14 14:27:04: Please check the logfile '/opt/oracle/oak/log/DBServer01/tools/12.1.2.10.0/createdb_test01db_31350.log' for more details
INFO: 2017-06-14 14:27:06: Database parameter file is not provided. Will be using default parameters for DB creation Please enter the 'SYSASM' password : (During deployment we set the SYSASM password to 'welcome1'):
Please re-enter the 'SYSASM' password:
Please select one of the following for Database type [1 .. 3] :
1 => OLTP 2 => DSS 3 => In-Memory 1
The selected value is : OLTP
Please select one of the following for Database Deployment [1 .. 3] :
1 => EE : Enterprise Edition 2 => RACONE 3 => RAC 3
The selected value is : RAC
Please select one of the following for Database Class [1 .. 6] :
1 => odb-01s ( 1 cores , 4 GB memory) 2 => odb-01 ( 1 cores , 8 GB memory) 3 => odb-02 ( 2 cores , 16 GB memory) 4 => odb-04 ( 4 cores , 32 GB memory) 5 => odb-06 ( 6 cores , 48 GB memory) 6 => odb-12 ( 12 cores , 96 GB memory) 1
The selected value is : odb-01s ( 1 cores , 4 GB memory)
INFO : Logging all actions in the file /opt/oracle/oak/log/DBServer01/patch/12.1.2.10.0/DBServer01-20170614142755.log and traces in the file /opt/oracle/oak/log/DBServer01/patch/12.1.2.10.0/DBServer01-20170614142755.trc
INFO : Loading the configuration file /opt/oracle/oak/onecmd/create_database.params...
INFO : Creating the node list files...
INFO : Setting up ssh for root...
INFO : Setting up SSH across the Private Network...
...INFO : Running as root: /usr/bin/ssh -l root 192.168.1.36 /root/DoAllcmds.sh
INFO : Running as root: /usr/bin/ssh -l root 192.168.1.37 /root/DoAllcmds.sh
INFO : Background process 37150 (node: 192.168.1.36) gets done with the exit code 0
INFO : Background process 37182 (node: 192.168.1.37) gets done with the exit code 0
INFO : Setting up SSH completed successfully
INFO : Running the command /usr/bin/rsync -tarqvz /opt/oracle/oak/onecmd/ root@192.168.1.37:/opt/oracle/oak/onecmd --exclude=*zip --exclude=*gz --exclude=*log --exclude=*trc --exclude=*rpm to sync directory< /opt/oracle/oak/onecmd> on node < 192.168.1.37>
SUCCESS: Ran /usr/bin/rsync -tarqvz /opt/oracle/oak/onecmd/ root@192.168.1.37:/opt/oracle/oak/onecmd --exclude=*zip --exclude=*gz --exclude=*log --exclude=*trc --exclude=*rpm and it returned: RC=0
...INFO : Did not do scp for node : DBServer01
INFO : Running as root: /usr/bin/ssh -l root DBServer01 /root/DoAllcmds.sh
INFO : Running as root: /usr/bin/ssh -l root DBServer02 /root/DoAllcmds.sh
INFO : Background process 38458 (node: DBServer01) gets done with the exit code 0
INFO : Background process 38536 (node: DBServer02) gets done with the exit code 0
INFO : Did not do scp for node : DBServer01
INFO : Running as root: /usr/bin/ssh -l root DBServer01 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20170614142836.sh
INFO : Running as root: /usr/bin/ssh -l root DBServer02 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20170614142836.sh
INFO : Background process 38625 (node: DBServer01) gets done with the exit code 0
INFO : Background process 38656 (node: DBServer02) gets done with the exit code 0
INFO : Setting up SSH for user oracle...
...INFO : checking nodes in /opt/oracle/oak/onecmd/tmp/db_nodes...
...
SUCCESS: All nodes in /opt/oracle/oak/onecmd/tmp/db_nodes are pingable and alive.
INFO : Checking SSH setup for user (oracle) on nodes in /opt/oracle/oak/onecmd/tmp/db_nodes...
INFO : Did not do scp for node : DBServer01
INFO : This is root, will become oracle and run: /bin/su oracle -c /usr/bin/ssh -l oracle DBServer01 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20170614142905.sh
INFO : Running on the local node: /bin/su oracle -c /opt/oracle/oak/onecmd/tmp/DoAllcmds-20170614142905.sh
INFO : Background process 40495 (node: DBServer01) gets done with the exit code 0
INFO : This is root, will become oracle and run: /bin/su oracle -c /usr/bin/ssh -l oracle DBServer02 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20170614142905.sh
INFO : Background process 40526 (node: DBServer02) gets done with the exit code 0
INFO : Setting up ACFS storage
INFO : Did not do scp for node : DBServer01
INFO : Running as root: /usr/bin/ssh -l root DBServer01 /opt/oracle/oak/onecmd/tmp/acfsm_31350.sh
INFO : Running as root: /usr/bin/ssh -l root DBServer02 /opt/oracle/oak/onecmd/tmp/acfsm_31350.sh
INFO : Background process 40719 (node: DBServer01) gets done with the exit code 0
INFO : Background process 40750 (node: DBServer02) gets done with the exit code 0
INFO: 2017-06-14 14:29:29: Successfully setup the storage structure for the database 'test01db'
SUCCESS: Successfully setup ACFS storage for the database test01db
INFO : Creating Database using DBCA...
INFO : Did not do scp for node : DBServer01
INFO : Running as root: /usr/bin/ssh -l root DBServer01 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20170614142929.sh
INFO : Running as root: /usr/bin/ssh -l root DBServer02 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20170614142929.sh
INFO : Background process 43752 (node: DBServer01) gets done with the exit code 0
INFO : Background process 43791 (node: DBServer02) gets done with the exit code 0
INFO : Running DBCA using /opt/oracle/oak/onecmd/tmp/dbca-test01db.sh on DBServer01 as oracle...
INFO : Check output in /opt/oracle/oak/onecmd/tmp/dbca-test01db-20170614142755.log on DBServer01
INFO : This is root, will become oracle and run: /bin/su oracle -c /usr/bin/ssh -l oracle DBServer01 /opt/oracle/oak/onecmd/tmp/dbca-test01db.sh
INFO : Running on the local node: /bin/su oracle -c /opt/oracle/oak/onecmd/tmp/dbca-test01db.sh
Instance test01db1 is running on node DBServer01
Instance test01db2 is running on node DBServer02
INFO : One or more Instances running on the cluster nodes.
INFO : Running export ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1;/u01/app/oracle/product/12.1.0.2/dbhome_1/bin/srvctl setenv database -d test01db -t 'TZ=America/New_York' to set DB timezone
INFO : Running the command /u01/app/12.1.0.2/grid/bin/crsctl stat resource ora.test01db.db -p
WARNING: 2017-06-14 14:41:10: Not enough space on flash volume /u02/app/oracle/oradata/flashdata/.ACFS/snaps/flashcache Setting the db_flash_cache_size=0, Manually cleanup some space on this volume and set the flash_size. Recommended value is : 6144 M
.INFO : Did not do scp for node : DBServer01
..
INFO : This is root, will become oracle and run: /bin/su oracle -c /usr/bin/ssh -l oracle DBServer01 /opt/oracle/oak/onecmd/tmp/dbupdates-test01db.sh
INFO : Running on the local node: /bin/su oracle -c /opt/oracle/oak/onecmd/tmp/dbupdates-test01db.sh
INFO : Running export ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1;/u01/app/oracle/product/12.1.0.2/dbhome_1/bin/srvctl stop database -d test01db
INFO : Running export ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1;/u01/app/oracle/product/12.1.0.2/dbhome_1/bin/srvctl start database -d test01db
INFO: 2017-06-14 14:42:31: Successfully set the RMAN SNAPSHOT control file
.INFO : Did not do scp for node : DBServer01
..
INFO : This is root, will become oracle and run: /bin/su oracle -c /usr/bin/ssh -l oracle DBServer01 /opt/oracle/oak/onecmd/tmp/runDatapatch.sh
INFO : Running on the local node: /bin/su oracle -c /opt/oracle/oak/onecmd/tmp/runDatapatch.sh
SUCCESS: 2017-06-14 14:43:08: Successfully created the Database : test01db
[ root@DBServer01 : Wed Jun 14, 02:43 PM : /root ]
1.3 Después de la creación, verificamos si el servicio de base de datos esta online. Se puede usar el comando crsstat.
[oracle@DBServer01 ~]$ crsstat ora.test01db.db ONLINE ONLINE on DBServer01 [oracle@DBServer02 ~]$ crsstat ora.test01db.db ONLINE ONLINE on DBServer02
1.4 Usando el comando oakcli verificamos si la base se creo en el home correcto y la versión de la base de datos. Usamos el comando de abajo:
- oakcli show databases
12.1.0.2.170117(24732082,24828633) (Source database)
1.5 Verificamos que la Base de Datos Origen test01db esta en Archive Log Mode
[oracle@ DBServer01~]$ . oraenv ORACLE_SID = [test01db] ? test01db The Oracle base remains unchanged with value /u01/app/oracle [oracle@ DBServer01~]$ sqlplus sys@test01db as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 14 14:52:19 2017 Copyright (c) 1982, 2014, Oracle. All rights reserved. Enter password: Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, OLAP, Advanced Analytics and Real Application Testing options SQL> select name, log_mode from v$database; NAME LOG_MODE -- -- -- -- -- -- -- - -- -- -- -- -- -- -- -- -- - TEST01DB ARCHIVELOG SQL>exit
1.6 Verificamos si estan las entradas en TNS
Después de la creación las entradas son agregadas en los tnsnames.ora
[oracle@ DBServer01 ~]$ cat /u01/app/oracle/product/12.1.0.2/dbhome_1/network/admin/tnsnames.ora TEST01DB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dbserver-scan)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test01db) ) ) [oracle@ DBServer02 ~]$ cat /u01/app/oracle/product/12.1.0.2/dbhome_1/network/admin/tnsnames.ora TEST01DB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dbserver-scan)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test01db) ) )
- Creamos la Snapshot Database test02db usando OAKCLI en ODA
2.1. Para crear la Snapshot Database test02db, primero configurar db_domain de la base origen test01db en blanco y luego reiniciarla usando el comando srvctl.
[oracle@ DBServer01~]$ . oraenv ORACLE_SID = [test01db] ? test01db The Oracle base remains unchanged with value /u01/app/oracle [oracle@ DBServer01~]$ sqlplus sys@test01db as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 14 14:50:20 2017 Copyright (c) 1982, 2014, Oracle. All rights reserved. Enter password: Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, OLAP, Advanced Analytics and Real Application Testing options SQL> select name from v$database; NAME --------------------------- TEST01DB SQL>alter system set db_domain=’’ scope=spfile sid=’*’; System altered. SQL>exit Los comandos de abajo reinican test01db [oracle@DBServer01 infracdb]$ srvctl stop database -d test01db [oracle@DBServer01 infracdb]$ srvctl start database -d test01db
2.2 Nos conectamos en una sesion de putty de node1(i.e DBServer01) con el usuario ‘ROOT’. Usamos el comando de abajo para crear test02db la Snapshot Database usando oakcli.
- oakcli create snapshotdb -db test02db -from test01db
[root@DBServer01: Mon June 14, 02:51 PM : /root ]
$ oakcli create snapshotdb -db test02db -from test01db
INFO: 2017-06-14 14:51:22: Please check the logfile '/opt/oracle/oak/log/DBServer01/tools/12.1.2.10.0/
createdb_test02db_24166.log' for more details
Please enter the 'SYS' password for the Database test01db: Please re-enter the 'SYS' password: Please select one of the following for Database Deployment [1 .. 2] : 1 => RACONE 2 => RAC 2 The selected value is : RAC Please select one of the following for Database Class [1 .. 6] : 1 => odb-01s ( 1 cores , 4 GB memory) 2 => odb-01 ( 1 cores , 8 GB memory) 3 => odb-02 ( 2 cores , 16 GB memory) 4 => odb-04 ( 4 cores , 32 GB memory) 5 => odb-06 ( 6 cores , 48 GB memory) 6 => odb-12 ( 12 cores , 96 GB memory) 1 The selected value is : odb-01s ( 1 cores , 4 GB memory)
......
SUCCESS: All nodes in /opt/oracle/oak/temp_clunodes.txt are pingable and alive.
......
SUCCESS: All nodes in /opt/oracle/oak/temp_clunodes.txt are pingable and alive.
INFO: 2017-06-14 14:56:19: Creating the SNAP Database 'test02db' from the source Database 'test01db'
INFO: 2017-06-14 14:56:30: Do not perform any Structural change to Database 'test01db' till SNAP Database 'test02db' is created
INFO: 2017-06-14 14:56:51: Taking SNAP of the Database 'test01db'
INFO: 2017-06-14 14:56:54: Successfully took the SNAP of database: test01db
WARNING: 2017-06-14 14:57:47: Not enough space on flash volume /u02/app/oracle/oradata/flashdata/.ACFS/snaps/flashcache Setting the db_flash_cache_size=0, Manually cleanup some space on this volume and set the flash_size. Recommended value is : 6144 M
INFO: 2017-06-14 14:57:47: Creating controlfile for database: test02db
INFO: 2017-06-14 14:57:59: Successfully created the control file for the database : test02db
INFO: 2017-06-14 14:57:59: Adding log files for the second thread for the database : test02db
INFO: 2017-06-14 14:58:03: Successfully added the log files for second thread
INFO: 2017-06-14 14:58:06: Recovering the database: test02db, snapshot time : '2017-06-14:14:56:53' , until time : '2017-06-14:14:57:11'
INFO: 2017-06-14 14:58:09: Successfully recovered the database
INFO: 2017-06-14 14:58:09: Opening the database with resetlogs
INFO: 2017-06-14 14:58:16: Successfully opened the database after recovery
INFO: 2017-06-14 14:58:19: Setting the temporary tablespace for database : test02db
INFO: 2017-06-14 14:58:22: Successfully set the temporary tablespace for the database : test02db
INFO: 2017-06-14 14:59:25: Successfully changed the Database ID
INFO: 2017-06-14 15:00:12: Adding the Database resource to the clusterware
INFO: 2017-06-14 15:00:56: Successfully started the database
INFO: 2017-06-14 15:00:56: Updating the TNS entries for the database test02db
INFO: 2017-06-14 15:01:35: Successfully set the RMAN SNAPSHOT control file
INFO: 2017-06-14 15:01:45: Disabling the external references in the database 'test02db' inherited from 'test01db'
INFO: 2017-06-14 15:01:46: Successfully disabled the external references
INFO: 2017-06-14 15:02:10: Run the SQL script '/u01/app/oracle/product/12.1.0.2/dbhome_1/
enable_external_refs_test02db_k15H.sql' on the database 'test02db' to enable these external references
Also need to restart the database after running the SQL script
SUCCESS: 2017-06-14 15:02:49: Successfully created the Database 'test02db' from 'test01db'
Note: Fix any warnings that are received during the installation. Here I received warnings about flash cache.
2.3 Verificamos las entradas en TNS de la Snapshot Database
Después de la creación las entradas son agregadas en los tnsnames.ora.
[oracle@ DBServer01 ~]$ cat /u01/app/oracle/product/12.1.0.2/dbhome_1/network/admin/tnsnames.ora TEST02DB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dbserver-scan)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test02db) ) ) [oracle@ DBServer02 ~]$ cat /u01/app/oracle/product/12.1.0.2/dbhome_1/network/admin/tnsnames.ora TEST02DB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dbserver-scan)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test02db) ) )
2.4 Nos conectamos a la Base de Datos Destino, Snapshot Database test02db, para asegurarnos que esta en Archive Log Mode.
[oracle@DBServer01 admin]$ . oraenv ORACLE_SID = [test02db] ? test02db The Oracle base remains unchanged with value /u01/app/oracle [oracle@DBServer01 admin]$ sqlplus /nolog SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 14 15:03:50 2017 Copyright (c) 1982, 2014, Oracle. All rights reserved. SQL> connect sys@test02db as sysdba Enter password: Connected. SQL> select name, log_mode from v$database; NAME LOG_MODE -- -- -- -- -- -- -- - -- -- -- -- -- -- -- -- -- - TEST02DB ARCHIVELOG
2.5 Usando el comando oakcli verificamos si la Snapshot Database fue creada en el home correcto y la con la versión de base de datos correcta. Usamos el comando de abajo:
- oakcli show databases
test01db RAC ACFS OraDb12102_home1 /u01/app/oracle/product/12.1.0.2/dbhome_1 12.1.0.2.170117(24732082,24828633) (Source database) test02db RAC ACFS OraDb12102_home1 /u01/app/oracle/product/12.1.0.2/dbhome_1 12.1.0.2.170117(24732082,24828633) (Target (Snapshot) database)
Conclusión:
La Snapshot Database puede ser creada con diferente clase y tipo que la Base de Datos Origen. Con el uso del comando OAKCLI, la creación de una Snapshot Database toma muy poco tiempo comparado con otros métodos de copia de base de datos. La Snapshot Database ocupa menos espacio y no requiere bajar la Base de Datos Origen.
No hay comentarios:
Publicar un comentario