Tuesday, May 31, 2022

Migrating SQL Server to Oracle Cloud database offline

This blog covers the basic steps in migrating a SQL Server 2016 database to Autonomous Database 19c via SQL Developer migration tool offline. 


What I used:
  • SQL Server 2016 running on a Windows server in OCI as the source in online mode
  • Autonomous Database on Shared infrastructure as the target in offline mode
  • SQL Developer 21.4.3 running on the same server as SQL Server
  • SQL Developer documentation

Basic steps all within SQL Developer:
  • create connection to the source (SQL Server 2016) 
  • Setup migration repository,  I used a different schema within the target Autonomous Database
  • capture source information online
  • review convert/translate options for meta info, procedures, triggers, views, ...
  • select offline mode for DDL and data
  • run the job
  • after job is completed run the DDL, extract data from source and load the data to the target
Almost always you will use offline in which SQL Developer creates the scripts which you will use to move a production database.  Online is nice for testing.   

After creating connections within SQL Developer to the source and target as well as setting up the migration repository select Tools->Migration->Migrate.   


Step 1 -- Overview of migration steps

Step 2 -- Select migration repository
Step 3 -- Create project, note that this is where the scripts and
data will be stored so make sure you have enough storage
as well as where to place the files perhaps on a NFS mount
that both could access.

Step 4:  Select Source in online mode

Step 5:  Select Database(s)

Step 6: Review data type convert options

Step 7:  Select Objects to migrate, default is all

Step 8:  Select offline to move DDL

Step 9:  Select data to be moved offline

Step 10: Summary and Start job to migrate

After the job is completed successfully you will want to run the scripts to create the DDL and copy the data to the target database.  

In the project directory you will find the DDL and data scripts

Run the master.sql script on the target which creates the DDL


These are the scripts to extract and load the data

command parameters are IP address of source database, 
userid and password to connect to source.  This command
exports the data from source database to files


command parameters are connect string , user and password
to the target database.   This commands loads the data from
the files to the target database.


Migrating SQL Server to Oracle Cloud database online

This blog covers the basic steps in migrating a SQL Server 2016 database to Autonomous Database 19c via SQL Developer online migration tool. 


What I used:
  • SQL Server 2016 running on a Windows server in OCI as the source
  • Autonomous Database on Shared infrastructure as the target
  • SQL Developer 21.4.3 running on the same server as SQL Server
  • SQL Developer documentation

Basic steps all within SQL Developer:
  • create connections to the source (SQL Server 2016) and target (Autonomous Database)
  • Setup migration repository,  I used  a different schema within the target Autonomous Database
  • capture source information
  • review convert/translate options for meta info, procedures, triggers, views, ...
  • create target
  • submit the job to create the DDL and move the data
Almost always you will use offline in which SQL Developer creates the scripts which you will use to move a production database.  Online is nice for testing.   

After creating connections within SQL Developer to the source and target as well as setting up the migration repository select Tools->Migration->Migrate.   

Step 1 -- Info on steps



Step 2 -- Select repository

Step 3 -- Create project



Step 4 -- Select source




Step 5 -- Select database(s) 

Step 6 -- Convert data types

Step 7 -- Select objects to be converted

Step 8 -- Select target 

Step 9 -- Select move data online

Step 10 -- Start job to migrate


After job is completed using SQL Developer to view the migrated objects and data.  Image below shows the source and new target. 
















Tuesday, May 24, 2022

Connecting Oracle Analytics Cloud to an Oracle cloud database with a private endpoint

This blog is one example on how to connect OAC to an Oracle Cloud database with a private endpoint  using OAC's private access channel. The basic steps are:

  1. Use Oracle Cloud Infrastructure Console to configure a private access channel within your OAC instance.
  2. From your OAC instance create a data connection to the private database.
Refer to the documentation for all of the detail regarding setting this up, in particular the prerequisites. 

I used the following OCI Services:
  • Oracle Analytics Cloud (OAC) with the Enterprise Analytics feature.
  • Exadata Cloud Service (ExaCS) with an 19c pluggable database. 

Step 1 -- Creating private access channel

Using the OCI Console access your OAC instance, navigate to the Resources section, click Private Access Channel, and then click Configure Private Access Channel.


The private access channel above and the ExaCS were in the same private subnet which makes it easier.  Private access channel requires four IP addresses, two IP addresses are required for network traffic egress, one IP address for the private access channel, and one reserved for future use. 

After about 30 minutes you can click on the created private access channel and note the ip addresses it is using within the subnet. 

Step 2 -- Creating private access channel


OAC can't access private data sources on an Oracle Database that uses a Single Client Access Name (SCAN). If you want to connect Oracle Analytics Cloud to an Oracle Database that uses a SCAN, use one of the following methods to set up the connection in Oracle Analytics Cloud: connect directly to the Oracle Database nodes, instead of SCAN or configure an Oracle Connection Manager in front of SCAN.

From your OAC Home Page, click Create, and then click Connection,  and Oracle Database.

When using ExaCS the default connection strings all use SCAN.  Below are three examples connecting to a PDB on ExaCS that uses the compute node names instead. 


Basic connection to a single compute node

Advanced with long connection string
(DESCRIPTION=(ENABLE=BROKEN)
(ADDRESS_LIST= (LOAD_BALANCE=on)(FAILOVER=ON)
(ADDRESS=(PROTOCOL=tcp)(HOST=exacsphx1-8abcd1.sub1111112222.exacsvcnphx1.oraclevcn.com)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=exacsphx1-8abcd2.sub111111222.exacsvcnphx1.oraclevcn.com)(PORT=1521)))
(CONNECT_DATA=(SERVICE_NAME=GFSwing_SCALE100.paas.oracle.com)))

Advanced with easy connection string
exacsphx1-8abcd2.sub111111222.exacsvcnphx1.oraclevcn.com:1521/GFSwing_SCALE100.paas.oracle.com


Thanks.

Wednesday, February 24, 2021

Setting up ExaCLI with ExaCS

What is needed:

First,  on your ExaCS:
  1. Get your cluster name as OS user grid via the command "crsctl get cluster name"

  2. Get IP address of a storage cell via "cat /etc/oracle/cell/network-config/cellip.ora"

  3. Test that you can login via ExaCLI as OS user oracle.   The exacli user id = "cloud_user_" + your cluster name from above and the password is what was used when provisioning the ExaCS.

    exacli -l cloud_user_cl-akhkpexa-11f -c 192.168.136.6




Now using Enterprise Manager:
  1. Create named credential using the userid and password tested above as EM user sysman


Now using EMCLI:
  1. Login as OS user oracle via the command "emcli login -username=sysman"


  2. Create a property file similar to below, substituting your values for each line

    configMap.targetName=ExaCS_PHX
    configMap.region=us-phoenix-1
    configMap.tenancy=natdsepltfrmanalyticshrd1
    configMap.serviceType=ExaCS
    configMap.monitorAgentUrl.0=https://exacsphx1-8mxxq1.sub10261618181.exacsvcnphx1.oraclevcn.com:3872/emd/main/

    credMap.cellCredSet=SYSMAN:EXACLI

    host.name.0=exacsphx1-8mxxq1.sub10261618181.exacsvcnphx1.oraclevcn.com
    host.name.1=exacsphx1-8mxxq2.sub10261618181.exacsvcnphx1.oraclevcn.com



  3. Run the following emcli command by specifying the property file

Finally go back to Enterprise Manager:
  1. Check the job submitted previously and verify it was successful via EM Home Page -> Enterprise icon -> Provisioning and Patching -> Procedure Activity


  2. Your exadata storage cell targets should now be discovered and able to see the cell metrics.


  3. Note that it takes about ~15 minutes before you will see the "Exadata" target in the menu.


Tuesday, August 25, 2020

Create non-cdb into existing home on Exadata Cloud Service

Here is an example json config which creates a new non-cdb database using an existing database home.

 

/var/opt/oracle/dbaasapi/dbaasapi -i createdb2.json

 

 

[root@exacsphx-z0pvn-pehrf1 dbinput]# cat createdb2.json

{

    "object": "db",

    "action": "start",

    "operation": "createdb",

    "params": {

        "nodelist": "",

        "cdb": "no",

        "ohome_name": "OraHome101_12102_dbbp200114_0",

        "bp": "JAN2020",

        "dbname": "gregfz2",

        "edition": "EE_EP",

        "version": "12.1.0.2",

        "adminPassword": "YourSysPasswordHere",

        "charset": "AL32UTF8",

        "ncharset": "AL16UTF16",

        "backupDestination": "NONE"

    },

    "outputfile": "/home/oracle/gregf/dbinput/createdb2.out",

    "FLAGS": ""

}

 

Monday, August 24, 2020

Create non-cdb on Exadata Cloud Service

 Please review MOS Note:  Creating non-CDB databases using Oracle Database 12c on the Exadata Cloud Service (Doc ID 2528257.1)

 

My environment:

  • ExaCS quarter rack in Phoenix. 
 

Step 1:  You may need to update your cloud tooling

Step 2:  You may need to download the non-cdb images

  • Sudo su -
  • dbaascli cswlib list
  • dbaascli cswlib download --version 19000 --bp JAN2020 --cdb no

Step 3:  Create  you non-cdb database

  • /var/opt/oracle/dbaasapi/dbaasapi -i createdb.json

 

[root@exacsphx-z0pvn-pehrf1 dbinput]# cat createdb.json

{

    "object": "db",

    "action": "start",

    "operation": "createdb",

    "params": {

        "nodelist": "",

        "cdb": "no",

        "bp": "JAN2020",

        "dbname": "gregfz1",

        "edition": "EE_EP",

        "version": "19.0.0.0",

        "adminPassword": "YourSysPasswordHere",

        "charset": "AL32UTF8",

        "ncharset": "AL16UTF16",

        "backupDestination": "NONE"

    },

    "outputfile": "/home/oracle/gregf/dbinput/createdb.out",

    "FLAGS": ""

}

Wednesday, August 12, 2020

JSON Search Index on Autonomous Database

 Just a quick test to validate JSON Search Index on ADB.   My environment:

  • ADB Shared 19c

 Below are the commands to create a simple table, insert a row, create the search index and validate the execution plan.

 

create table departments_json (
  department_id   integer not null primary key,
  department_data blob not null
);

alter table departments_json
  add constraint dept_data_json
  check ( department_data is json );
 
insert into departments_json
  values ( 110, utl_raw.cast_to_raw ( '{
  "department": "Accounting",
  "employees": [
    {
      "name": "Higgins, Shelley",
      "job": "Accounting Manager",
      "hireDate": "2002-06-07T00:00:00"
    },
    {
      "name": "Gietz, William",
      "job": "Public Accountant",
      "hireDate": "2002-06-07T00:00:00"
    }
  ]
}' ));

create search index dept_json_i on departments_json ( department_data ) for json;
 
select * from   departments_json d where  json_textcontains ( department_data, '$', 'Public' );

explain plan for select * from   departments_json d where  json_textcontains ( department_data, '$', 'Public' );

SELECT * FROM table(dbms_xplan.display); 

 

Looking at the plan we can see the search index was used.

 

Example came from this helpful blog article. 


Tuesday, August 11, 2020

Mounting OCI Object Storage Bucket as a File System on Exadata Cloud Service

My environment:

  • ExaCS running Oracle Linux 7.7

Step 1:  Install s3fs-fuse rpm

yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/s/s3fs-fuse-1.86-2.el7.x86_64.rpm --nogpgcheck

Step 2A:  Create file with credentials in the format access key:secret key

[root@vm1 bucket1]# cat /root/.passwd-s3fs
a4dzaa8049cbb6e1300b0a9170ff35ddebd50bfc:fYtbmNmp++lomv4z11YX4PuqR9gPbVEe4ZXB00TKUBA=

Step 2B: Change file permissions to 600 

chmod 600 /root/.passwd-s3fs

Step 3: Create directory for mount

mkdir /bucket1

Step 4:   Run the s3fs command

s3fs gregf1 /bucket1 -o endpoint=us-phoenix-1  -o passwd_file=/root/.passwd-s3fs -o url="https://yourtenancyhere.compat.objectstorage.us-phoenix-1.oraclecloud.com" -o nomultipart -o use_path_request_style

Example:

[root@exacsx7phx-023jw2 ~]# s3fs gregf1 /bucket1 -o endpoint=us-phoenix-1  -o passwd_file=/root/.passwd-s3fs -o url="https://yourtenancynamehere.compat.objectstorage.us-phoenix-1.oraclecloud.com" -o nomultipart -o use_path_request_style
[root@exacsx7phx-023jw2 ~]# df
Filesystem                      1K-blocks       Used    Available Use% Mounted on
devtmpfs                        371297736          0    371297736   0% /dev
tmpfs                           742617088    1262064    741355024   1% /dev/shm
tmpfs                           371308876       3044    371305832   1% /run
tmpfs                           371308876          0    371308876   0% /sys/fs/cgroup
/dev/mapper/VGExaDb-LVDbSys1     24639868   11840312     11524884  51% /
/dev/xvda1                         499656      52724       420720  12% /boot
/dev/xvdi                      1135204408  112486384    965029960  11% /u02
/dev/mapper/VGExaDb-LVDbOra1    154687468    6198624    140608140   5% /u01
/dev/xvdb                        51475068   13514280     35322964  28% /u01/app/19.0.0.0/grid
tmpfs                            74261776          0     74261776   0% /run/user/0
/dev/asm/acfsvol01-131          838860800  139691116    699169684  17% /acfs01
/dev/asm/upload_vol-131        8388608000 4577187480   3811420520  55% /scratch
tmpfs                            74261776          0     74261776   0% /run/user/2000
s3fs                         274877906944          0 274877906944   0% /bucket1
tmpfs                            74261776          0     74261776   0% /run/user/1001
[root@exacsx7phx-023jw2 ~]# ls /bucket1
fish121.dmp  fish.dmp  FISH_EXPDAT.DMP

 

Step 5:  Make mount permanent

 

Additional Information:




Monday, August 10, 2020

Mounting OCI Object Storage Bucket as a File System on Oracle Linux VM

My environment:

  • VM on OCI running Oracle Linux 7.8

Step 1:  Install s3fs-fuse rpm

yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/s/s3fs-fuse-1.86-2.el7.x86_64.rpm --nogpgcheck

Step 2A:  Create file with credentials in the format access key:secret key

[root@vm1 bucket1]# cat /root/.passwd-s3fs
a4dzaa8049cbb6e1300b0a9170ff35ddebd50bfc:fYtbmNmp++lomv4z11YX4PuqR9gPbVEe4ZXB00TKUBA=

Step 2B: Change file permissions to 600 

chmod 600 /root/.passwd-s3fs

Step 3: Create directory for mount

mkdir /bucket1

Step 4:   Run the s3fs command

s3fs gregf1 /bucket1 -o endpoint=us-phoenix-1  -o passwd_file=/root/.passwd-s3fs -o url="https://yourtenancyhere.compat.objectstorage.us-phoenix-1.oraclecloud.com" -o nomultipart -o use_path_request_style


Step 5:  Make mount permanent

 

Additional Information: