– Volume 2011-03 Volume 2011-03 Published: March 30, 2010 Newsletter www.dbaOnline.org Email: admin@dbaOnline.org Current Vol. Editor: Carol Sheng DBA Online – On the front line of database administration DBA Online powers Oracle DBA DBA Online Contents Summary of DBA Online’s March 2011 Seminar .……………...... 1 Oracle Flashback ……...…………..….………...……………..….. 4 Oracle Advanced Compression ……...…………..….………...….. 5 Oracle E-Business Suite Cloning Procedure RAC to Non-RAC …..6 DBA Online’s March 2011 Seminar Speakers and committee members On March 26th, American DBA Online successfully hosted another technical seminar, featuring many strong speakers at Crown Plaza in Edison, NJ. The main theme of the seminar was all about the Oracle 11g R2 – the hottest technical topic among Oracle professionals, since many are thinking of upgrading their database to Oracle 11g R2 and using RAC. The seminar was hosted by committee member Carol Sheng, who first introduced the President of DBA Online, David Wang. As usual, David shared his one-minute tip. This time, the real world tip he shared was Advanced Compression. Oracle Advanced Compression in Oracle Database 11g Release 2 helps manage more data in a cost-effective manner. With data volumes tripling every two years on average, Oracle Advanced Compression delivers compression 1 – Published: March 30, 2010 DBA Online rates of 2-4 times faster across all types of data and applications. Storage savings from compression will cascade throughout the data center, reducing network traffic and data backups as well. In addition, by reading fewer blocks off disk, Oracle Advanced Compression also improves query performance. The speaker for the first presentation was Mr. Sean Kim. He is currently a Senior Principal Core Delivery Instructor in Oracle University and has over 14 years of industry experience in IT as a DBA, IT administrator, author, and instructor. Sean has expertise in Oracle core technologies and teaches a broad spectrum of high-end core technology courses including Exadata Database Machine, Linux / Solaris Administration, Oracle Grid Infrastructure & RAC, Streams, Data Guard, Data warehousing and more. Furthermore, he is a lead for tuning courses, technical reviewer for Oracle coursewares & certification exams. Mr. Sean Kim is an Oracle Certified Professional (OCP) from release 8i to 11g, Oracle Certified Expert (OCE) for RAC and Linux, Solaris Certified System Administrator (SCSA), Solaris Certified Network Administrator (SCNA), Linux System Administrator (LPI-1), Linux Network Administrator (LPI-2), Certified Internet Webmaster (CIW). He was named to the Oracle University Leadership Circle in 2007, an internal award for the best Oracle Instructors from around the globe and a consistent member of the OU Quality Club. As a matter of fact, our members had recommended him as a speaker after having taken his courses. He was even recognized by many of his students in the audience. Everybody was impressed. Being one of the best instructors in Oracle University, Mr. Kim could explain the complicated technology concept in a way that audience can easily understand. He introduced the Oracle Grid infrastructure, starting with Oracle Database 11g Release 2. Oracle Clusterware and Oracle ASM are installed into a single home directory, which is called the Grid home. It can be installed to support RAC and as “restart” for standalone server to handle restart oracle resource in the event some of the services on the server fail. For example, without “restart”, if one instance crash in one server, DBA has to login and manually restart that instance, if “restart” is installed, this operation can be set up automatically for HA purpose. He also described Oracle Clusterware Process Architecture, the order and relationship of these processes (the lower and upper stack processes), the difference between 10g RAC and 11g RAC and some new 2 – Published: March 30, 2010 features in Grid Infrastructure in 11 R2 and really painted a very clear picture. After the presentation, many members asked Sean for his course schedule as they want to take his courses. After Mr. Kim introduced the overall Oracle Grid infrastructure, Mr. Indy Johal went to one area in more detail: Oracle 11g R2 ASM related technology. Inderpal S. Johal has been working as a lead database administrator and architect for more than 13 years. He is the CEO of Data Softech Inc., a New Jersey based company that specializes in providing complete database support solutions and training to many Fortune 500 companies. Mr. Johal has written numerous Oracle technical articles for journals and magazines including Oracle Magazine, and has been a frequent speaker in many Oracle events and user community organizations like Oracle OpenWorld, IOUG, UKOUG, NYOUG, and NJOUG. He is one of our favorite speakers for DBA Online members He has a Masters Degree in Computer Science from Punjabi University and has worked as a Lead DBA and Architect for AT&T, UPS, Chase Bank, Citicorp, PR Newswire, HCL and IBM etc. In his presentation, Mr. Johal not only introduced many ASM related new enhancements, but also the advantages of using ASM, the ASM instance, and processes. He described the ASM rdbms file creations flow and the different security user role to manage ASM etc. Mr. Johal also showed a live demo on how to use the new utility ASMCA to create an ASM disk group, create volume on top of the disk group, and then create and mount the ACFS file system. Later, he demonstrated how to create snapshots to track/backup changes of ACFS and much more. The last part of the seminar was the panel discussion and real-world DBA examples. Our panelists for this session were our two speakers, President David Wang and two other committee members: Stand Ma and Qi Wang. They are all highly experienced Oracle experts that have being working in the industries for many years. Stan Ma, who is currently a senior Lead DBA for a major financial firm, 3 – Published: March 30, 2010 DBA Online introduced his real case using flash recovery area for restore during a database upgrade. The operation would conventionally take 4 hours to restore but instead it only took 20 minutes to recover to the point before the upgrade. After Stan’s real world case, our panelists were asked many questions, all of which were answered. Additionally, the audience stayed to seek advice from our panelists and speakers after the session was finished. We have already received very good feedback from our members that the seminar was a success. They learned a lot about these new technologies and the speakers were phenomenal. The audience even each received a backpack from Oracle! As always, DBA Online appreciates the effort of our committee, continuous support from our members, and Oracle Corporation for their sponsorship. With their support, we are able to focus on technical seminars like these that help our member community continue to grow by sharing the most recent technology. DBA Online Committee Flashback Presentation file provided by Stan Ma • Requirement 1. Database must be in archive log mode 2. Must have flash recovery area enabled • 1. 2. 3. 4. 5. Flashback recovery Flashback database Flashback drop Flashback table Flashback query Flashback transaction query 1. 2. 3. Views V$FLASHBACK_DATABASE_LOG V$FLASHBACK_DATABASE_LOGFILE V$FLASHBACK_DATABASE_STAT 1. 2. 3. Flashback vs. Full backup Save space Save time Short or no database downtime • • 4 – Published: March 30, 2010 • • • • • • • • Use init.ora or configure flashback parameter dynamically • DB_RECOVERY_FILE_DEST_SIZE = 25G DB_RECOVERY_FILE_DEST =‘ /backup/PRG/flashback‘ DB_FLASHBACK_RETENTION_TARGET = 600 SQL> ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET = 600; SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE=25G; SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST='/backup/GDPFPRG/flashback'; SQL> SHUTDOWN SQL> STARTUP MOUNT EXCLUSIVE; SQL> ALTER DATABASE FLASHBACK ON; SQL> ALTER DATABASE OPEN; SQL> CREATE RESTORE POINT VTM_flashback GUARANTEE FLASHBACK DATABASE; Keep records • SQL> SELECT NAME, SCN, TIME FROM V$RESTORE_POINT; • SQL> SELECT MAX(SEQUENCE#) FROM V$ARCHIVED_LOG; If the VTM is successful • SQL> STARTUP MOUNT FORCE; • SQL> DROP RESTORE POINT vtm_flashback; • SQL> ALTER DATABASE FLASHBACK OFF; • SQL> ALTER DATABASE OPEN; If the VTM fails • SQL> STARTUP MOUNT FORCE; • SQL> FLASHBACK DATABASE TO RESTORE POINT vtm_flashback; • SQL> ALTER DATABASE OPEN; • SQL> DROP RESTORE POINT vtm_flashback; • SQL> ALTER DATABASE FLASHBACK OFF; • SQL> ALTER DATABASE OPEN; Note: Oracle VTM patch • All Oracle VTM patches update only 2 components – Binaries and/or Data Dictionary. They do not change application data • Do not use it for Oracle VTM patch • To rollback the Data Dictionary changes, run lcatcpu_rollback.sql (/optware/oracle/10.2.0.4_Q310/cpu/CPUJan2011 Oracle Advanced Compression - Sharing Oracle New Feature Oracle Advanced Compression, an option introduced in Oracle Database 11 g Enterprise Edition, offers a comprehensive set of compression capabilities to help organizations reduce costs, while maintaining or improving performance. It significantly reduces the storage footprint of databases through compression of structured data (numbers, characters) as well as unstructured data (documents, spreadsheets, XML and other files). It provides enhanced compression for database backups and also includes network 5 – Published: March 30, 2010 DBA Online compression capabilities for faster synchronization of standby databases • 2-4X reduction in storage across all environments such as production, standby, test, development, backup, etc. • Improved memory efficiency as data remains compressed in memory • Minimal or no performance impact on DML operations due to performance optimized compression technology • Faster queries in many cases, due to improved I/O and memory efficiency • Better network bandwidth utilization • Transparent to applications - no application changes required Some examples of Advanced Compression: 1. Compression for OLTP: CREATE TABLE Acct ( acct_id NUMBER, first_name VARCHAR2(30) , last_name VARCHAR2(30) ) COMPRESS FOR OLTP; 2. Compression in RMAN: RMAN> SET COMPRESSION ALGORITHM ‘LOW|MEDIUM|HIGH’; RMAN> backup as COMPRESSED BACKUPSET database archivelog all; 3. Compression in Data Pump: expdp myuser FULL=y DUMPFILE=dpump_dir:full.dmp COMPRESS; Oracle E-Business Suite Cloning Procedure RAC to Non-RAC By John Gao 1. Background Info While many Oracle E-Business Suite customers use RAC in their production system, they usually use single instance databases for their test and development environments. Thus, cloning a RAC enabled EBS to a non-RAC system is a common practice. This document provides a cloning procedure for this scenario. Viewers of this document are recommended to review the metalink note 559518.1, before you carry on cloning activities. The document is written based on the cloning of two actual Oracle EBS systems in my current project. Following are some info about the systems, 1. Source System - R12PRD 6 Oracle EBS Suite R12.1.1 (Oracle database 11.1.0.7 RAC on ASM) – Published: March 30, 2010 2. Target System – R12DEV Oracle EBS Suite R12.1.1 (single instance database at the backend) 3. Both Oracle EBS system use different database servers 4. Base Directory of both RDBMS /u01/app/<System Name> 5. Base directory for apps tier /u02/shared/<System Name> Non-shared file system on apps tier for INST_TOP /u02/local/<System Name> 6. The ‘oracle’ account mentioned in this document refers to the account that owns the Oracle EBS RDBMS and the database. The ‘applmgr’ account refers to the account that owns the Oracle EBS application tier binaries 2. Pre-cloning Steps on the source servers No Step Summary Command Details Note 2.1 cd Run adpreclone $ORACLE_HOME/appsutil/scripts/$CONTEXT_ on the DB NAME tier DB should be up and running cd $ADMIN_SCRIPTS_HOME Run adpreclone on the apps perl adpreclone.pl appsTier tier DB should be up and running perl adpreclone.pl dbTier 2.2 3. Copy binaries from the source servers (execute the steps from the target servers) No 3.1 Step Summary Copy 11g RDBMS Binaries from the source servers Command Details Note Logon as corresponding Oracle account Backup the existing context file and init files (copy the files to ~/BKUP) 7 – Published: March 30, 2010 (Only when Oracle RDBMS needs to be refreshed) DBA Online [ ! -f ~/BKUP ] && mkdir ~/BKUP cp $CONTEXT_FILE ~/BKUP cp $ORACLE_HOME/dbs/*.ora ~/BKUP Remove the existing Oracle binaries and the DBF files Remove the Oracle Binaries, cd $ORACLE_HOME/.. rm –rf * Create a script cpOraBinariesFromSource.sh to include following info # Copy Oracle Binaries echo 'Start to copy Oracle Binaries ...' PIPE_FILE=/tmp/cpio_pipe.$$ mkfifo $PIPE_FILE cat $PIPE_FILE |(cd /u01/app/<target DB name>/db/tech_st; cpio -idum) & ssh <source oracle account>@<source DB server> "(cd /u01/app/<source DB name>/db/tech_st; find * depth -print|cpio -o )" >$PIPE_FILE rm $PIPE_FILE echo 'Oracle Binary Copy is done!' - Run cpOraBinariesFromSource.sh $ cpOraBinariesFromSource.sh 8 – Published: March 30, 2010 3.2 Copy Apps binaries from the source server Logon as corresponding applmgr account, on the target Apps server Backup the existing context file (copy the file to ~/BKUP) Remove the existing Application Binaries (do NOT touch TechStack) cd $APPL_TOP/.. rm –rf * - cd /common_data/ARCS/clone Create a script cpFromSource_AppsTech.sh to include the following info #!/bin/ksh PIPE_FILE=/tmp/cpio_pipe.$$ mknod $PIPE_FILE p cat $PIPE_FILE |(cd /u002/shared/<target DB name>/apps/apps_st; cpio -idum) & ssh <source applmgr account>@<first source apps server name> "(cd /u002/shared/<source DB name>/apps/apps_st; find * -depth -print|cpio -o -H newc )" >$PIPE_FILE rm $PIPE_FILE - Run cpFromSource_AppsTech.sh $ cpFromSource_AppsTech.sh 3.3 Copy Application Tech Stack (10.1.2, 10.1.3 Oracle RDBMS) from the source server Important: If the source and the target systems are not on the same OS level, please do NOT copy the apps tech stack from the source to the target system Even when the source and the target systems are on the same OS level, there is NO need to copy Tech Stack to the target system, unless there were tech stack patches applied to the source system, since last instance cloning Execute the following steps, if Tech Stack 9 – Published: March 30, 2010 DBA Online cloning is required, Logon to the target apps tier as corresponding applmgr account Create the cpFromSource_TechStack.sh script to include the following info, #!/bin/ksh PIPE_FILE=/tmp/cpio_pipe.$$ mknod $PIPE_FILE p cat $PIPE_FILE |(cd /u002/shared/<target DB name>/apps/tech_st; cpio -idum) & ssh <source applmgr account>@<first source apps server> "(cd /u002/shared/<source DB name>/apps/tech_st; find * -depth -print|cpio -o -H newc )" >$PIPE_FILE rm $PIPE_FILE - Execute the script $ cpFromSource_TechStack.sh 4. Run adcfgclone.pl on the target DB server No Step Summary Command Details 4.1 Run adcfgclone.pl on the target DB server - Restore the backed up context file (in $HOME/BKUP) to $ORACLE_HOME/appsutil - Restore the backed up init files (in $HOME/BKUP) to $ORACLE_HOME/dbs - Run adcfgclone.pl with the restored context file cd $ORACLE_HOME/appsutil/clone/bin perl adcfgclone.pl dbTechStack <Full path to the context file> 4.2 Turn off RAC - Run the following on the target database server cd $ORACLE_HOME/rdbms/lib on the target make -f ins_rdbms.mk rac_off instance make -f ins_rdbms.mk ioracle 10 Note – Published: March 30, 2010 5. Migrate the database to the target server using RMAN (with reference to metalink note 382669.1) All steps in the table below should be run as the oracle database owner No Step Summary 5.1 Create database image (4.2 of note 559518.2) of the source database Command Details Note - On a DB server of the source database, use adclone-crdbimage.sh as a template to create a script to create DB image of the source database cd /common_data/ARCS/clone cp adclone-crdbimage.sh adclone-crdbimage-<Source DB name>.sh Edit adclone-crdbimage-<Source DB name>.sh to include correct info - Execute the script $ adclone-crdbimage-<Source DB name>.sh 5.2 Copy the DB image (all files under /export/BKUP ) to the target DB server 5.3 Restore and rename database on the target system (5.1.4.1 of note 559518.2) Execute the following on the target DB server as the target database owner, cd /export/BKUP ccp –r oraarcq@vahpqa11:/export/BKUP/* . On the initial node of the target Database tier, - Create a file named adclone_restore_DB_<DBName>.sh with the following contents (edit to enter corresponding info for the target instance) export ORACLE_HOME=<Oracle Home of the target DB> export PATH=$ORACLE_HOME/bin:$PATH perl $ORACLE_HOME/appsutil/clone/bin/adclone.pl \ java=/opt/java1.5 \ component=dbTier \ mode=apply \ stage=$ORACLE_HOME/appsutil/clone \ method=CUSTOM \ dbctxtg=$ORACLE_HOME/appsutil/<SID>_<hostname>.xml \ rmanstage=/export/BKUP/data/stage \ rmantgtloc=< location for datafiles file on the target system> \ srcdbname=<Source system Global DB name> \ pwd=<apps password for the Source system>\ showProgressode Note: Double check the entries before you execute the script. Rman stage is the location of the source RMAN dump files, i.e. /export/BKUP/data/stage - Run the above script $ adclone_restore_DB_<DBName>.sh 11 – Published: March 30, 2010 DBA Online This script will run autoconfig on Oracele Home and also restore/replicate the database using RMAN scripts (included in the backup files) - Verify that the target database and listener are up and running - Setup and call $HOME/<Ora ID>.env to source the environment 5.4 Run adcfgclone again on the target server option dbconfig 5.5 Verify the database and its listener 6. Run the following on the target server, Shutdown the listener cd $ORACLE_HOME/appsutil/scripts/[CONTEXT_NAME] adautocfg.sh appspass=[apps password] Verify the database and the listener Configure Apps server All the steps in the table below should be run as the applmgr account who owns the apps binaries, on the target apps server No 12 Step Summary Command Details Note – Published: March 30, 2010 6.1 Run adcfgclon.pl on the first node of the apps tier $cd <COMMON_TOP>/clone/bin (COMMON_TOP is /u002/shared/<DB Name>/apps/apps_st/comn) $ perl adcfgclone.pl appsTier Note: When prompted for Target Database, please enter the SID of the first DB node Sample from R12DEV, Provide the values required for creation of the new APPL_TOP Context file. Target System Hostname (virtual or normal) [varhdv85] : Target System Database SID : R12DEV Target System Database Server Node [varhdv85] : vahpdv16 Target System Database Domain Name [cusa.canon.com] : Target System Base Directory : /u002/shared/R12DEV Target System Tools ORACLE_HOME Directory [/u002/shared/R12DEV/apps/tech_st/10.1.2] : Target System Web ORACLE_HOME Directory [/u002/shared/R12DEV/apps/tech_st/10.1.3] : Target System APPL_TOP Directory [/u002/shared/R12DEV/apps/apps_st/appl] : Target System COMMON_TOP Directory [/u002/shared/R12DEV/apps/apps_st/comn] : Target System Instance Home Directory [/u002/shared/R12DEV/inst] : /u002/local/R12DEV/inst …… Do you want the the target system to have the same port values as the source system (y/n) [y] ? : n Target System Port Pool [0-99] : 40 UTL_FILE_DIR on database tier consists of the following directories. 1. /usr/tmp 2. /usr/tmp 3. /u01/app/R12DEV/tmp 4. /u01/app/R12DEV/db/tech_st/11.1.0/appsutil/outbound/R12DEV_vahpdv16 5. /u01/app/R12DEV/db/tech_st/11.1.0/appsutil/outbound/R12DEV1_vahpdv16 6. /usr/tmp Choose a value which will be set as APPLPTMP value on the target node [1] : 3 6.2 6.3 Start the Start the application and perform regular health check applications and verify Change Reset passwords for the following accounts, passwords for apps/sysadmin/system/sys/canon system and other special accounts 13 – Published: March 30, 2010 DBA Online 6.4 Shutdown concurrent managers and Update concurrent manager setup (PCP->no PCP) Change the setup of the following managers (remove primary node/secondary node definition), Inventory Manager FastFormula Transaction Manager PO Document Approval Manager 6.5 Change the definition of database directories Select * from dba_directories 6.6 create or replace directory apps_data_file_dir as '/u001/app/oracle/OFR12/db/tech_st/11.1.0/appsutil/outbound/OFR12_ vahpdv05' Turn off archive SQL> shutdown immediate log Database closed. Database dismounted. ORACLE instance shut down. SQL> Startup mount ORACLE instance started. SQL> alter database noarchivelog; SQL> alter database open; 6.7 14 Change System profiles Change the following system profiles to reflect the new system info, Site Name BNE Server Log Path BNE UIX Physical Directory BNE Upload Import Directory BNE Upload Staging Directory BNE Upload Text Directory POR: Hosted Images Directory …..