OCCS: Reset admin password

To reset the admin password for an Oracle Container Cloud Service

#1 ssh the CCS node (both the IP and ssh information are provided from the service console).

#2 Run the following command:

-bash-4.1$ change-admin-password.sh admin
password : 
2018/12/17 08:17:54 Reset account: admin
-bash-4.1$
Advertisements

OCI-c: Project Fn setup

Basically following the instructions posted in the fn project page:

 

#1 Setup a VM running OL7.2 with 50GB

Preferably pick OL72 over OL68 as fn require docker > 17.5

 

#2 Setup security policy (OL7)

# setenforce permission

 

#3 Install docker (root)

Follow the instructions posted in the documentation.

Update /etc/yum.repos.d/public-yum-ol7.repo to enable the ol7_addons then

# yum install docker-engine wget tree
# chkconfig docker on
# yum update
# service docker start

 

#4 Install fn (as root)

curl -LSs https://raw.githubusercontent.com/fnproject/cli/master/install | sh

 

 

#5 Create a runtime user and add it to the docker group

# useradd -g 500 -d /home/oracle oracle
# sudo usermod -a -G docker oracle

 

#6 Login as oracle and start the fn server

$ fn start

 

#5 Login again as oracle in a second window and configure a demo project

$ mkdir project
$ cd project
$ fn init --runtime go hello
$ cd hello
$ fn run
$ fn deploy --app myapp --local
$ fn invoke myapp hello

Update the file func.go, changing Hello with bonjour, deploy and test again

$ fn deploy --app myapp --local
$ fn invoke myapp hello
{"message":"Bonjour World"}

 

 

 

Copying and moving a PDB from a container database located on Container Cloud Service into a container database located on Database Cloud Service

Two Cloud services must be provisioned:

  • One multitenant 12cR2 database located on Database Cloud Services
  • One Container Cloud service

 

Once these services are provisioned:

  • A 12cR2 docker image must be deployed on the container. Once a container with this images is started, together with the ‘ccs’ multitenant database with a first ccsa pdb, the multitenant database  must be switched to archive log, and a new schema must be created to connect to via the database located on dbcs.
  • Security rules must setup in such a way to allow SQL*Net connectivity between both database hosts.
  • From the container database located on DBcs, a database link must be created to access the container database.

To deploy the 12cR2 image, first added the oracle container registry

ccs01

Then, when deploying the container, map the default listener port 1521 to the host port 1531. Also specify the container name and initial PDB.

ccs2

To switch in archivelog the container database located on the container cloud service, login on the container worker host and launch the following sqlplus command, then proceed as usual to move the database in archivelog

$ docker exec -it <imagename> bash -c "source /home/oracle/.bashrc; sqlplus /nolog"

 

Login with sys on the container database located on docker, to create a new user with sysoper and create pluggable database privilege:

sqlplus sys/<passwd>@<ccs_worker_host>:1531/ccs.localdomain AS SYSDBA

SQL> CREATE USER c##ccs IDENTIFIED BY <password> CONTAINER=ALL;
SQL> GRANT CREATE SESSION, DBA, SYSOPER, CREATE PLUGGABLE DATABASE TO c##ccs CONTAINER=ALL;

 

From the multitenant database located on DBcs, create a database link

$ sqlplus sys/<password>@<dbcs_host>:1521/dbcs.aXXX.oraclecloud.internal AS SYSDBA

SQL> CREATE PUBLIC DATABASE LINK ccs_link
     CONNECT TO c##ccs IDENTIFIED BY <passwd>
     USING '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<ip_adress_of_the_container_worker>)(PORT = 1531))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ccs.localdomain)))';

 

Still from the multitenant database located on DBcs, launch the command to create a copy of the database:

SQL> CREATE PLUGGABLE DATABASE ccsa_clone1 FROM ccsa@ccs_link;

 

To instead relocate the db:

SQL> CREATE PLUGGABLE DATABASE ccs_clone2 FROM ccsa@ccs_link RELOCATE;

 

Then open the new local PDB in read-write

SQL> ALTER PLUGGABLE DATABASE ccs_clone1 OPEN;
SQL> ALTER PLUGGABLE DATABASE ccs_clone2 OPEN;

OCI: Installing docker on OCI-c OL6

Installing docker on OPC

Provision an instance with EL 6.8 uek4 (uek4.1 or higher is a requirement for the docker package to install) with 50GB additional block storage.

Installation prerequisites

Login with opc

Update /etc/yum.repos.d/public-yum-ol6repo to enable ol6_addons

Create an oracle:oinstall user

Configure the extra volume on /u01, owned by oracle:oinstall

 

Docker installation and setup

Install docker and md5:

sudo yum install docker-engine md5

 

Change the following settings in the file /etc/sysconfig/docker for the 12.2 database to properly install:

[vi /etc/sysconfig/docker]
other_args="-g /u01/docker --storage-opt dm.basesize=40G"

Start docker:

sudo service docker start

Check that the system is property configured ‘in particular the ‘Data loop file’ and ‘Base Devise Size’ parameters.

docker info

Connected with oracle,download the docker build images on /u01, unzip the file, then download the 12.2 standard edition installation media into the 12.2 directory

cd /u01
wget https://github.com/oracle/docker-images/archive/master.zip
unzip master.zip
cd /u01/docker-images-master/OracleDatabase/dockerfiles/12.2.0.1
wget http://download.oracle.com/otn/linux/oracle12c/122010/linuxx64_12201_database.zip

 

Create the Oracle database docker image for 12.2

Build the docker image for the standard edition (this is the -s)

cd /u01/docker-images-master/OracleDatabase/dockerfiles
sudo ./buildDockerImage.sh -v 12.2.0.1 -s
 
. . .
Oracle Database Docker Image for 'se2' version 12.2.0.1 is ready to be extended:
--> oracle/database:12.2.0.1-se2
Build completed in 2186 seconds.

 

Create the containers

Create the first database container. Note that the password get generated automatically. Take a note of the displayed passwords:

sudo docker run -p 1531:1521 --name db01 -e oracle_pdb=pdb01 oracle/database:12.2.0.1-se2
ORACLE AUTO GENERATED PASSWORD FOR SYS, SYSTEM AND PDBAMIN: /N1H6CgQZV70=1
...
...

Create a second database container for process validation purpose:

sudo docker run -p 1532:1521 --name db01 -e oracle_pdb=pdb02 oracle/database:12.2.0.1-se2
ORACLE AUTO GENERATED PASSWORD FOR SYS, SYSTEM AND PDBAMIN: /N1H6CgQZV70=1
...
...

 

Change the password to respectively welcome1 and welcome2

sudo docker exec db01 ./setPassword.sh welcome1

sudo docker exec db02 ./setPassword.sh welcome2

 

Login to each database with the instant client by referencing the external port.

export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib
export PATH=/usr/lib/oracle/12.2/client64/bin:$PATH

 

sqlplus system/welcome1@localhost:1531/pdb01

sqlplus system/welcome1@localhost:1532/pdb02