Wednesday, February 15, 2017

Replicate Oracle data to Amazon RDS using AWS DMS services

Below are the steps to migrate to replicate Oracle tables to Amazon RDS Oracle database:

Setup Source database
1.       Mount the database
SQL> startup mount
ORACLE instance started.

Total System Global Area 1071333376 bytes
Fixed Size                  1341312 bytes
Variable Size             427821184 bytes
Database Buffers          629145600 bytes
Redo Buffers               13025280 bytes
Database mounted.
SQL>
2.       Enable Archive Log feature:
SQL> alter database archivelog;
Database altered.
SQL>
3.       Modify init.ora file to set below parameter:
                  log_archive_start             = true
4.       Open the database:
SQL> alter database open;
Database altered.
5.       Enable Supplemental log data:
SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
Database altered.
6.       Enable Table level identification key supplemental logging for specific tables:
SQL> alter table ONT.OE_ORDER_LINES_ALL add supplemental log data (unique) columns;
Table altered.
7.       Create a tablespace AWSDMS_DATA
Create a database user account AWSDMS:
create user AWSDMS identified by awsdms default tablespace awsdms_data quota unlimited on awsdms_data temporary tablespace temp1;
8.       Grant below privileges to AWSDMS user.
grant CREATE SESSION  to awsdms;
grant SELECT ANY TRANSACTION  to awsdms;
grant SELECT on V_$ARCHIVED_LOG  to awsdms;
grant SELECT on V_$LOG  to awsdms;
grant SELECT on V_$LOGFILE  to awsdms;
grant SELECT on V_$DATABASE  to awsdms;
grant SELECT on V_$THREAD  to awsdms;
grant SELECT on V_$PARAMETER  to awsdms;
grant SELECT on V_$NLS_PARAMETERS  to awsdms;
grant SELECT on V_$TIMEZONE_NAMES  to awsdms;
grant SELECT on V_$TRANSACTION  to awsdms;
grant SELECT on ALL_INDEXES  to awsdms;
grant SELECT on ALL_OBJECTS  to awsdms;
grant SELECT on ALL_TABLES  to awsdms;
grant SELECT on ALL_USERS  to awsdms;
grant SELECT on ALL_CATALOG  to awsdms;
grant SELECT on ALL_CONSTRAINTS  to awsdms;
grant SELECT on ALL_CONS_COLUMNS  to awsdms;
grant SELECT on ALL_TAB_COLS  to awsdms;
grant SELECT on ALL_IND_COLUMNS  to awsdms;
grant SELECT on ALL_LOG_GROUPS  to awsdms;
grant SELECT on SYS.DBA_REGISTRY  to awsdms;
grant SELECT on SYS.OBJ$  to awsdms;
grant SELECT on DBA_TABLESPACES  to awsdms;
grant SELECT on ALL_TAB_PARTITIONS  to awsdms;
grant SELECT on ALL_ENCRYPTED_COLUMNS  to awsdms;
grant SELECT on ont.oe_order_lines_all   to awsdms;
grant EXECUTE on DBMS_LOGMNR  to awsdms;
grant SELECT on V_$LOGMNR_LOGS to awsdms;
grant SELECT on V_$LOGMNR_CONTENTS to awsdms;

Setup Target RDS Database:
1.       Go to AWS RDS console and click on “Get Started Now”
2.       Select Oracle -> “Oracle SE Two”
3.       Select “Dev/Test” option on next page
4.       Specify DB details as below:

5.       Configure Advanced Settings:

6.       Click on Launch DB Instance button
7.       Create replication instance
Open browser with url https://console.aws.amazon.com/dms
Click on “Create Migration”
Click Next

Create Source and target database endpoints
Click Next
 



Create on “Create Task”

Now, you can test making a change in the table at source database and see it populated in target database.

Monday, January 30, 2017

Start your own Oracle Vision (Demo) instance R12.2.4 by transferring Oracle VM Virtual appliance image to Amazon AWS services

  • Start a Windows instance from AWS Console using AMI "Windows_Server-2016-English-Full-Base-2017.01.11 (ami-7f2e031f)" with 500GB space.
  • Download and start Firefox.
  • Sign up or log on to edeliver.oracle.com

  • Search for “Oracle VM Virtual Appliances for Oracle E-Business Suite 12.2.4”
  • Select all files with the description "Oracle E-Business Suite Release 12.2.4 Single Node Vision Install X86 (64bit)".
  • Once above files are downloaded, unzip all the files and run below command from Dos prompt to concatenate above files into one single ova file.  List all the file names separated by a space in below command.
                  type Oracle-E-Business-Suite-12.2.4_VISION_INSTALL.ova.00 Oracle-E-Business-Suite-12.2.4_VISION_INSTALL.ova.01 Oracle-E-Business-Suite-12.2.4_VISION_INSTALL.ova.02 Oracle-E-Business-Suite-12.2.4_VISION_INSTALL.ova.03 Oracle-E-Business-Suite-12.2.4_VISION_INSTALL.ova.04 Oracle-E-Business-Suite-12.2.4_VISION_INSTALL.ova.05 Oracle-E-Business-Suite-12.2.4_VISION_INSTALL.ova.06 Oracle-E-Business-Suite-12.2.4_VISION_INSTALL.ova.07 Oracle-E-Business-Suite-12.2.4_VISION_INSTALL.ova.08 Oracle-E-Business-Suite-12.2.4_VISION_INSTALL.ova.09 Oracle-E-Business-Suite-12.2.4_VISION_INSTALL.ova.10 Oracle-E-Business-Suite-12.2.4_VISION_INSTALL.ova.11 Oracle-E-Business-Suite-12.2.4_VISION_INSTALL.ova.12 Oracle-E-Business-Suite-12.2.4_VISION_INSTALL.ova.13 Oracle-E-Business-Suite-12.2.4_VISION_INSTALL.ova.14 Oracle-E-Business-Suite-12.2.4_VISION_INSTALL.ova.15>R1224.ova

  • Log on to AWS and choose S3 service.

  • Create a bucket with the name "r1224ovm" to store R1224.ova

  • Upload R1224.ova  file to S3 Bucket r1224ovm.     

  • Import the VM into AWS by following steps :
              1.  Create a file called contain.json with below contents:
                        [ 

                         {

                            "Description": "Oracle Demo Vision Instance R12.2.4",

                            "Format": "ova",

                            "UserBucket": {

                            "S3Bucket": "r1224ovm",

                            "S3Key": "R1224EBS.ova"

                          }

                         }]
               2.  On Windows Server, go to Start->Windows Powershell for AWS
               3.   Provide your Access key and secret access key (your AWS Account) at the prompts from "Windows Powershell for AWS".
               4.   Take care of creating role and policy as per steps given in http://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-image-import.html#vmimport-iam-permissions
               5.   Run below command:
                        aws ec2 import-image --description "Oracle Demo Vision Instance R12.2.4" --disk-containers file://containers.json
               6.   Check the status of import with below command:
                       aws ec2 describe-import-image-tasks --import-task-ids import-ami-xxxxxx

  • Go to EC2 service in Amazon AWS console.
  • At this point, you can terminate your Windows instance in AWS, since we have the image imported into AWS.  You may also want to remove any storage associated with this Windows instance.
  • Start an instance using the image imported in above steps.  I suggest using at minimum t2-large instance type.
  • Login to root using below command:
                su -

                You will be prompted to change the password of oracle, root and applmgr users.

  • Note down the private IP Address on your ec2 instance. 
  • Open /etc/hosts file in vi editor and add below entry:
  • Your private ip_address ebs.example.com ebs
  • Type below command to change your host name.
  • hostname ebs
  • Login as oracle
  • ln –s /u01/install/VISION/EBSapps.env .
  • Steps to startup the database:
              cd /u01/install/VISION/11.2.0

              . ./EBSDB_ebs.env

              sqlplus '/ as sysdba'<<EOF

              startup

              EOF

              lsnrctl start EBSDB

  • Steps to startup the application:
              cd /u01/install/VISION

              . ./EBSapps.env run

              cd $ADMIN_SCRIPTS_HOME

              ./adstrtal.sh apps/apps

              Default password for weblogic is ‘welcome1’
  • On your computer, open C:\Windows\System32\drivers\etc\hosts file in a notepad and add below entry so that your computer can reach ebs.example.com:
                xx.xx.xxx.xxx ebs.example.com ebs

                xx.xx.xxx.xxx is an ip address attached to your EC2 instance.

  •  You are all set.