Successfully reported this slideshow.

Convert single instance to RAC


Published on

Published in: Technology, News & Politics

Convert single instance to RAC

  1. 1.  17+ Years of Experience in Oracle, SQLServer Database Technologies  Have experience on wide range of products such as Oracle Agile, Hyperion, SAP Basis, MySQL, SQLServer, BOXI ,DS, HANA, Tableau,…etc. Written articles for major publications Oracle Certified Professional Oracle 8i,9i,10g Oracle Certified Expert Oracle 10g RAC Oracle ACE   Presented by Satishbabu Gunukula
  2. 2. Disclaimer  This content/views in this slides are those of the author and do not reflect that of Oracle corporation and/or its affiliates, employer, ex-employer, clients. The material in this document is for information purpose only and is published with no warranty, guarantee or implied.  This material should not be reproduced or used with out the author’s written permission.
  3. 3. Agenda  Oracle RAC and its Benefits  Overview of different RAC conversion methods  Overview of different Storage options  Convert Single instance to Oracle RAC Using RMAN  Overview  Prerequisites  Demonstration  Check the logs  Post Conversion Steps  References  Contact Info  Q&A
  4. 4. Why Oracle RAC & Benefits? The Oracle RAC removes the ability of a single point of failure of server in any database application environment.  Scalability  High Availability  Reliability  Recoverability  Continue Operations  Error Detection  Lower in Cost  Ease of Administration  Grid Computing
  5. 5.  Oracle Provides different conversion methods 1. DBCA 2. RCONFIG (From 10g R2) 3. Enterprise Manager 4. Manual (Using RMAN) Different RAC Conversion Methods
  6. 6.  Different storage options available in Oracle RAC  ASM – Automatic Storage Management  RAW – Raw devices  CFS – Vendor Cluster file System (OCFS,QFS,GXFs…Etc.)  NFS - Network File system (Certificated NAS) Refer Oracle documentation for more information Different Storage Options
  7. 7. RMAN is one of the best practice to convert single instance to RAC We are using two phase approach for conversion 1. Duplicate single instance Non-ASM database to ASM - Using RMAN DUPLICATE command copy the single instance database to RAC Server 2. Manually Convert single-instance to RAC – Create undo, redo, init.ora with cluster parameters and start the instances on all the nodes in the cluster Overview: Convert Single instance to RAC
  8. 8. RMAN is a command-line and Enterprise Manager based tool  Advantages  Full control over the conversion process  Optimize the performance of Database duplication  Ability to migration Non-ASM to ASM storage  Disadvantages  Database downtime required.  Manual conversion process Overview: Advantages/Disadvantages
  9. 9.  Oracle RAC  Hardware and Operating System architecture must be same.  Clustware is installed & configured on all the nodes in the cluster.  Same Oracle version installed as source (Single instance).  ASM is installed & configured with required ASM Diskgroups Note: If you want to upgrade to higher version, then the preferred method is fist upgrade your existing single instance database to higher version, test and migrate to RAC. Pre-requisites:
  10. 10. Hostname Database Name Instance Name Database Storage orasrv DBORA DBORA ext3 Demonstration: Overview of Non-RAC environment Overview of RAC environment Hostname Database Name Instance Name Database Storage orarac1 RACDB RACDB1 ASM orarac2 RACDB RACDB2 ASM Oracle Version: 11.2.0. 1 O/S: REHL: 5.4 ASM Disk Groups: +DATA, +FLASH
  11. 11. Estimate used space for Non-RAC Database Run the Query on Non-RAC instance to estimate the used space Select DF.TOTAL/1073741824 "DataFile Size GB", LOG.TOTAL/1073741824 "Redo Log Size GB", CONTROL.TOTAL/1073741824 "Control File Size GB", (DF.TOTAL + LOG.TOTAL + CONTROL.TOTAL)/ 1073741824 "Total Size GB" from dual, (select sum(a.bytes) TOTAL from dba_data_files a) DF, (select sum(b.bytes) TOTAL from v$log b) LOG, (select sum((cffsz+1)*cfbsz) TOTAL from x$kcccf c) CONTROL;
  12. 12. Create init.ora and password file for RAC Take a copy of init.ora parameter from single instance to Node1 on RAC and add update the ASM Disk group information as per your requirement For ex:- # set the location of the duplicate clone control file. control_files =‘+DATA’, ‘+FLASH’ #set the below parameters for default location of data files db_create_file_dest='+DATA' #set the below parameters for default location of recovery area db_recovery_file_dest='+FLASH' # set below parameter to create two members for each redo db_create_online_dest_1=’+DATA’ db_create_online_dest_2=’+FLASH’ # set two destinations if you want to multiplex the archive logs log_archive_dest_1='location=+DATA' log_archive_dest_2='location=+FLASH'
  13. 13. Note: Here we are not using e are not using DB_FILE_NAME_CONVERT, LOG_FILE_NAME_CONVERT parameters. If your data/redo files are not spread across multiple directories then I would recommend to use this option. Create password file [oracle@orarac1]$ export ORACLE_SID=RACDB [oracle@orarac1]$ export ORACLE_HOME=/home/oracle/product/v11201 [oracle@orarac1]$ orapwd file= $ORACLE_HOME/dbs/orapwRACDB password=xxxxxxx Create init.ora and password file for RAC
  14. 14. Create a static listener for on RAC node1 under $ORACLE_HOME/network/admin and reload, because auxiliary database will not register itself with the listener. [oracle@orarac1]$ cat $ORACLE_HOME/network/admin/listener.ora SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = RACDB) (ORACLE_HOME = /home/oracle/product/v11201) (SID_NAME = RACDB) ) ) Configure listener on RAC node1
  15. 15. Add TNS entry in $ORACLE_HOME/network/admin/tnsnames.ora file on Non- RAC Server to connect to Auxiliary instance. [oracle@orasrv]$ cat $ORACLE_HOME/network/admin/tnsnames.ora RACDB= (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = orarac1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = RACDB) ) ) Add TNS Entry on Non-RAC
  16. 16. Take a backup of Non-RAC Database Take a backup of Non-RAC database and archive logs. [oracle@orasrv]$ rman TARGET / CATALOG rman/xxxxx@rmancat RMAN> run{ allocate channel d1 type disk; allocate channel d2 type disk; backup tag 'full_online_backup' database format '/backup/rman/ORADB/dbsdf_online_%d_t%t_s%s_p%p.rmn'; sql "alter system archive log current"; backup archivelog all delete input format '/backup/rman/ORADB/archdf_%d_t%t_s%s_p%p.rmn'; release channel d1; release channel d2; } Here we are backing the database to a NFS file system/ backup/rman/ORADB. Mount this file system on RAC node1 for duplication process.
  17. 17. Start the auxiliary database in NOMOUNT mode on RAC node1 [oracle@orarac1]$ export ORACLE_SID=RACDB [oracle@orarac1]$ exportORACLE_HOME=/home/oracle/product/v11201 [orcle@orarac1] $ sqlplus /nolog SQL*Plus: Release Production on Tue Mar 3 12:59:28 2012 Copyright (c) 1982, 2007, Oracle. All Rights Reserved. SQL> connect / as sysdba Connected to an idle instance. SQL> startup nomount Start the Database in NOMOUNT on RAC
  18. 18. Duplicate Database to RAC Server In order to duplicate you should connect to target database and auxiliary database started in NOMOUNT mode and also RMAN catalog, if using. RMAN restores the data files and performs the recovery using all available backups and archive logs . After recovery is completed RMAN restarts the duplicate database (auxiliary database) and opens with the RESETLOGS option and generates a new DBID for duplicate database.
  19. 19. Duplicate Database to RAC Server Duplicate Database script contents connect catalog rman/xxxxxxxx@rmancat connect target / connect auxiliary sys/xxxxxxx@RACDB run{ allocate channel d1 device type disk; allocate channel d2 device type disk; allocate auxiliary channel a1 device type disk; allocate auxiliary channel a2 device type disk; duplicate target database to RACDB pfile=/home/oracle/product/v11201/dbs/initRACDB.ora logfile group 1 ('+DATA','+FLASH') SIZE 50M reuse, group 2 ('+DATA','+FLASH') SIZE 50M reuse; release channel d1; release channel d2; }
  20. 20. Convert Single Instance to RAC We have duplicated single instance Non-ASM database to ASM on RAC Server. Review Database alert_RACDB.log on RAC node1 We need to Convert single-instance to RAC
  21. 21. Create redo and undo for second instance Create second thread of online redo logs in order to start instance 2 SYS@RACDB> alter database add logfile thread 2 group 3 ('+DATA’,'+FLASH’) size 50m; SYS@RACDB > alter database add logfile thread 2 group 4 ('+DATA’,'+FLASH’) size 50m; enable thread 2 SYS@RACDB > alter database enable public thread 2; Create undo tablesapce for second instance. SYS@RACDB> create undo tablespace UNDOTBS2 datafile '+DATA' size 500M;
  22. 22. Add cluster parameters Add Cluster related parameters based on your configuration to parameter file *.cluster_database_instances=2 *.cluster_database=true *.remote_listener='LISTENERS_RACDB’ RACDB1.instance_number=1 RACDB2.instance_number=2 RACDB1.thread=1 RACDB2.thread=2 RACDB1.undo_tablespace='UNDOTBS1' RACDB2.undo_tablespace='UNDOTBS2‘ update the actual controlfile path *.control_files='+DATA/RACDB/controlfile/current.256.654542941','+FLASH/RACDB/c ontrolfile/current.256.6232312941'
  23. 23. Starts instances on all the nodes in RAC Set the environment variable for each instance, recreate the password & parameter file and start the instances individually on two different nodes [oracle@orarac1]$ export ORACLE_SID=RACDB1 [oracle@orarac1]$ export ORACLE_HOME=/home/oracle/product/v11201 [oracle@orarac1]$ orapwd file= $ORACLE_HOME/dbs/orapwRACDB1 password=xxxxx [oracle@orarac1]$ sqlplus /nolog SQL> Startup [oracle@orarac2]$ export ORACLE_SID=RACDB2 [oracle@orarac2]$ export ORACLE_HOME=/home/oracle/product/v11201 [oracle@orarac2]$ orapwd file= $ORACLE_HOME/dbs/orapwRACDB2 password=xxxxx oracle@orarac2]$ sqlplus /nolog SQL> Startup
  24. 24. Register the RAC instances with CRS Register the database instances with CRS framework [oracle@orarac1]$ srvctl add database -d RACDB -o /home/oracle/product/v11201 [oracle@orarac1]$ srvctl add instance -d RACDB -i RACDB1 -n orarac1 [oracle@orarac1]$ srvctl add instance -d RACDB -i RACDB2 -n orarac2 CRS should able to manage the instances and also it should automatically startup the instances when the servers are rebooted
  25. 25. Start/ Stop database using srvctl After registering the database/instances with CRS, we should able to manage using srvctl. Stop the database [oracle@orarac1]$ srvctl stop database -d RACDB Start the database [oracle@orarac1]$ srvctl start database -d RACDB
  26. 26. Check the logs Check the log files to see the issues/errors, if any. Database ADR_BASE/diag/product_type/product_id/instance_id/alert_RACDB1.log ADR_BASE/diag/product_type/product_id/instance_id/alert_RACDB2.log Cluster CRS_HOME/log/hostname/crsd/ - The log files for the CRS daemon CRS_HOME/log/hostname/cssd/ - The log files for the CSS daemon CRS_HOME/log/hostname/evmd/ - The log files for the EVM daemon CRS_HOME/log/hostname/client/ - The log files for the Oracle Cluster Registry CRS_HOME/log/hostname/racg/ - The log files for the Oracle RAC high availability CRS_HOME/log/hostname/racg - The log files for the Oracle RAC high availability CRS_HOME/log/hostanme/alert.log – The alert.log for Clusterware issues. Note:- CRS_HOME is the directory in which the Oracle Clusterware software was installed and hostname is the name of the node.
  27. 27. Post conversion Steps  Drop the static listener and used for duplication  Configure the listener and tnsnames using NETCA, refer below link  Configure TAF & Load balancing according to application requiement  Setup Database Backup and OCR Backup  More SGA recommended for RAC and size according to work load
  28. 28. Best Practices, Tips & Hints  If you install software in shared Oracle home you cannot able to perform rolling upgrade, So avoid using shared Oracle home  For redundancy Multiplex controlfile, redo logs and archive logs across the disk groups  Use RMAN incrementally updated feature to reduce restoration time especially when Recovery time Objective (RTO) is set for mission critical database.  Prior to installing oracle software validate the cluster infrastructure, it will save considerable time and potential headaches.  Avoid a cross-over cable and use Fastest possible interconnect  Auto backup feature will enable RMAN to recover the database even if the controlfile, catalog and spfile are lost.
  29. 29. References Oracle RAC & ASM 1. Oracle high availability Solutions 2. Oracle Documentation for OS specific Installation and Configuration 3. Oracle Documentation on Convert single instance to RAC 4. Oracle Documentation on ASM 5. ASM Technical Best Practices Metalink Note ID: 265633.1
  30. 30. References Oracle RMAN 1. Oracle Documentation on Oracle Recovery Manager 2. Oracle RMAN New Features in Oracle 11g 3. Understand Oracle RMAN Reporting
  31. 31. Contact info Thanks for attending the Webinar You can reach me at Visit MyBlog
  32. 32. Thank you.