Steps to Create Linux Container

After my last post about Docker Project, i start testing Linux Container but this time for lxc which is another amazing Package and should be used, if you installed and follow my steps in Previous steps here  then you can use lxc command without any suffer of installation 🙂

lxc stand for Linux Container.

Now i will start to describe how to create container using this command 

  • You need to know when lxc installed, it’s create file under /etc/lxc/ called default.conf this file should contain your network interface name and you need to add it.

[root@OEL6 ~]# cat /etc/lxc/default.conf
lxc.network.type = veth
lxc.network.link = docker0
lxc.network.flags = up

Sample output for ifconfig command :

docker0   Link encap:Ethernet  HWaddr 00:00:00:00:00:00
          inet addr:172.17.42.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::28ce:eeff:fe80:1fc8/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:17 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1112 (1.0 KiB)  TX bytes:408 (408.0 b)

I used docker0 Interface because i already installed it , and configure the IP Address, if you don’t modify this file when you start container you will receive error :

[root@OEL6 container]# lxc-start –name test-container
lxc-start: failed to attach ‘vethaITNmu’ to the bridge ‘virbr0’ : No such device
lxc-start: failed to create netdev
lxc-start: failed to create the network
lxc-start: failed to spawn ‘test-container’

Anyway now after add the file with the right Interface name, you will be able to run and start working on lxc just follow the below steps :
  • Before Create any container you need to create Directory under /, if you don’t do this step another error will be appeared asking for this directory and telling you /container not found.

mkdir /container will solve the problem.

Now Let’s Start Creating new container called Test-container :

[root@OEL6 lxc]# lxc-create -n test-container -t oracle — -R 6.5

lxc-create: No config file specified, using the default config /etc/lxc/default.conf
Host is OracleServer 6.5
Create configuration file /container/test-container/config
Downloading release 6.5 for x86_64
Loaded plugins: refresh-packagekit, security
ol6_u5_base                                                     | 1.4 kB     00:00
ol6_u5_base/primary                                             | 3.2 MB     00:32
ol6_u5_base                                                                  8573/8573
Setting up Install Process

the above command will take some while to finish the configuration, it’s installing some packages needed by container you can have more than one container with different name.
After the creation is done you should be notice the below line :

Complete!
Rebuilding rpm database
Configuring container for Oracle Linux 6.5
Added container user:oracle password:oracle
Added container user:root password:root

Container : /container/test-container/rootfs
Config    : /container/test-container/config
Network   : eth0 (veth) on virbr0
‘oracle’ template installed
‘test-container’ created

the container is not started yet !!! so we need to do this using the below command :

[root@OEL6 lxc]# lxc-start -n test-container
                Welcome to Oracle Linux Server
Setting hostname test-container:                        [  OK  ]
Checking filesystems
                                                                        [  OK  ]
Mounting local filesystems:                                [  OK  ]
No such file or directory
Enabling /etc/fstab swaps:                                 [  OK  ]
Entering non-interactive startup
Bringing up loopback interface:                         [  OK  ]
Bringing up interface eth0:
Determining IP information for eth0… failed.
                                                                      [FAILED]
Starting system logger:                                    [  OK  ]
Mounting filesystems:                                      [  OK  ]
Generating SSH1 RSA host key: No such file or directory
                                                                      [  OK  ]
Generating SSH2 RSA host key: No such file or directory
                                                                     [  OK  ]
Generating SSH2 DSA host key: No such file or directory
                                                                     [  OK  ]
Starting sshd:                                                 [  OK  ]
Oracle Linux Server release 6.5
Kernel 3.8.13-16.2.1.el6uek.x86_64 on an x86_64
test-container login:

I will fix FAILED Later now you need to connect to the container using the above User name and password given to you in the above line.
After this 
[root@test-container ~]#
I am connected 🙂 

You can delete the container using command 

lxc-destroy -n test-container  

Reference :
1- Oracle Linux containers Here 
2- Oracle Linux 6.5 and Docker Here

Thank you
Osama mustafa

Oracle Linux 6.5 released

Oracle Announced the release of Oracle Linux 6.5, The Latest Version Of Oracle Linux, It’s only Other Operating System Because this version Contain Some New Features :

  • Unbreakable Enterprise Kernel Release 3
  • Support DTrace.
  • Delivering Better Performance, scalability   and reliability For Companies.
  • New File System : btrfs enable administrators to implement an efficient incremental backup mechanism using file system snapshots.
And More Features.
You Can download Oracle Linux 6.5 Here
It will be Available soon On Oracle Software Delivery Here

Change AdminServer Port Using WLST.SH

Sometimes AdminServer not working Regarding to Wrong configuration or using Wrong Port which mean No Console will be available so is this mean delete domain and Configure it again !!!

Absolutely  Not  When you install Weblogic any Version Oracle Provide you with Command Line Utility to administrate weblogic, what you can do it using Console can be done with this tool.

change to weblogic-directory/common/bin
./wlst.sh

Now follow the below Steps to change port :

wls:/offline> readDomain (‘/u01/app/fmw/domains/IDDomains’)
wls:/offline/IDDomains> cd (‘Server’)
wls:/offline/IDDomains/Server> ls ()

Choose your Server Here

wls:/offline/IDDomains/Server> cd (‘AdminServer’)
wls:/offline/IDDomains/Server/AdminServer> ls ()

Search for Old Port ListenPort 

wls:/offline/IDDomains/Server/AdminServer> set (‘ListenPort’,New Port)
wls:/offline/IDDomains/Server/AdminServer> updateDomain ()
wls:/offline/IDDomains/Server/AdminServer> exit () 

Done you can now Test your new port
http://Server-ip:/console


Thank you
Osama Mustafa 

ODI-1545: Missing odi supervisor credentials in credential store map

This Error appear because missing SuperVisor User Credentials, and you need to create it using wls.sh command, And Since we are working On Oracle_ODI So you have to use WLST.sh from there.

cd /u01/app/fmw/Oracle_ODI1/common/bin
./wlst.sh

and do the below

Jython scans all the jar files it can find at first startup. Depending on the system, this process may take a few minutes to complete, and WLST may not return a prompt right away.

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

wls:/offline> connect (‘weblogic’,’welcome1′,’t3://localhost:7001′)

 Connecting to t3://10.40.74.210:7001 with userid weblogic …
Successfully connected to Admin Server ‘AdminServer’ that belongs to domain ‘IDDomains’.

Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.

wls:/IDDomains/serverConfig> createCred(map=”oracle.odi.credmap”, key=”SUPERVISOR”, user=”SUPERVISOR”, password=”sysadmin1″, desc=”Key for Supervisor”)
Location changed to domainRuntime tree. This is a read-only tree with DomainMBean as the root.
For more help, use help(domainRuntime)

wls:/IDDomains/serverConfig> createCred(map=”oracle.odi.credmap”, key=”odi11g”, user=”weblogic”, password=”welcome1″, desc=”WLS SUPERVISOR Credential”)

wls:/IDDomains/serverConfig> disconnect()
Disconnected from weblogic server: AdminServer
wls:/offline>
wls:/offline>
wls:/offline>
wls:/offline> exit()

The Red Line for to define 3 command you will use.

Some Link :
1- How To Configure The ODI JavaEE Agent and ODI Console On WebLogic Server (Doc ID 1300550.1)
2- Working with ODI Here

Thank you
Osama Mustafa

API5036: Client version 11.2.0.3.0 is not compatible with repository version 11.2.0.4.0

To Solve this error Follow the below Steps :

  • Edit /owb/bin/admin/Preference.properties
  • And set the following parameter :-
    • OverrideRepositoryVersionCheck=true
    • OverrideRuntimeVersionCheck=true
Thank you
Osama Mustafa

Segmentation Fault(coredump) when Trying to Start Siebel Server

Today i was working with SIEBEL On Solaris , And as usually it was working without any issue , after modified images on SIEBEL as Oracle Support Document

Images Files on Screen Tabs Required for High Interactivity Clients in Innovation Pack 2012 (Doc ID 1511448.1).

But when i tried to start SIEBEL Server the below errors appear :

/u01/app/siebel/8.2.2.0/ses/siebsrvr/bin/start_server: line 212: 6488: Memory fault(coredump) 

it’s confusing because SIEBEL was working without any problem, After tried more than one solution i would like to share the below Solution ( at least it’s works for me)

cd $SIEBEL_ROOT/sys

you will find File called osdf_ENTERPRISE_NAME

This file Will be Read by SIEBEL when you trying to start_server and if doesn’t exists it will recreate it again.

 Delete this file and try to start Siebel Server Again using

start_server ALL

Thank you
Osama Mustafa 

Clone Pluggable Database

If you want to Clone One Of Pluggable database , How can you do that :

SQL> select name from v$pdbs ;

NAME
——————————
PDB$SEED
TEST_1
TEST_2

Let’s Clone Test_1 , Create folder on os level to move test_1 data. 

[oracle@test12c u01]$ mkdir clone
[oracle@test12c u01]$ cd clone/
[oracle@test12c clone]$ pwd
/u01/clone

Open Test_1 Read Only : 

SQL> alter pluggable database test_1 close immediate;Pluggable database altered.

SQL> alter pluggable database test_1 open read only ;Pluggable database altered.

Set this parameter to our created directory above : 

SQL> show parameter db_create_file_dest ;

NAME     TYPE VALUE
———————————— ———–
db_create_file_dest     string

SQL> alter system set db_create_file_dest=’/u01/clone’;             System altered.

SQL> show parameter db_create_file_dest ;

NAME     TYPE VALUE
———————————— ———–
db_create_file_dest     string /u01/clone

SQL> create pluggable database clone from test_1 ;Pluggable database created.

SQL> alter pluggable database clone open ;Pluggable database altered.

Test Clone Pluggable database 

[oracle@test12c ~]$ sqlplus sys/sys@test12c:1521/clone as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Sat Jul 13 20:20:24 2013
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics, Real Application Testing
and Unified Auditing options

SQL> show con_name ;CON_NAME
——————————
CLONE

SQL> select name from v$pdbs ;

NAME
——————————
PDB$SEED
TEST_1
TEST_2
CLONE

You can drop Clone Database using the below command

SQL > Alter Pluggable database Clone Including Datafiles ;

Thank you 
Osama mustafa

Pluggable Database Tutorial (12c) Part 2

In my Part 1 Tutorial for how to deal with Pluggable database 12c I mentioned how to use pluggable database , How to create pluggable database , how to create tablespace , and how to open/close pluggable database .

Please check the Part ( 1 ) before continue reading this article here.

Welcome to Pluggable database Part 2 

  • Rename Pluggable Database 
  • Manage Pluggable database
  • Drop Pluggable database
  • Security In Pluggable database


SQL> select name, con_id from v$active_services order by 1;

NAME     CON_ID
—————————– ———-
TEST  3

as you see in the above query, I already created pluggable database called test. and it’s in Read write Mode.
Rename Pluggable database 

SQL> alter pluggable database TEST close immediate ;Pluggable database altered.

SQL> alter pluggable database TEST open restricted ;Pluggable database altered.

SQL> select name, open_mode from v$pdbs;

NAME                OPEN_MODE
—————————— ———-
TEST       READ WRITE

SQL> alter pluggable database TEST rename global_name to new ;Pluggable database altered.

SQL> select name, con_id from v$active_services order by 1;

NAME      CON_ID
————————————— ———-
new   3

if you are not connected to pluggable database or set session container then you will recicve error message  

ORA-65046: operation not allowed from outside a pluggable 

SQL> alter pluggable database new close immediate ;Pluggable database altered.

SQL> alter pluggable database new open ;Pluggable database altered.

Manage Pluggable Database

Back to root container using / as sysdba like below :

SQL> conn / as sysdba
Connected.

SQL> select name, con_id from v$active_services order by 1;NAME     CON_ID
————————————————— ———-
SYS$BACKGROUND   1
SYS$USERS  1
db12c  1
db12cXDB  1
new           3

We Control which list for for tablespace & datafiles by using con_id.

  • List tablespace in root container 

SQL> select tablespace_name, con_id from cdb_tablespaces where con_id=1; 

TABLESPACE_NAME       CON_ID
—————————— ———-
SYSTEM 1
SYSAUX 1
UNDOTBS1 1
TEMP 1
USERS 1
CDATA 1

  • List Database In root Container 

 SQL> select file_name, con_id from cdb_data_files where con_id=1;

FILE_NAME CON_ID
————————————————————————— ———-
/u01/app/oracle/oradata/db12c/users01.dbf      1
/u01/app/oracle/oradata/db12c/undotbs01.dbf      1
/u01/app/oracle/oradata/db12c/sysaux01.dbf      1
/u01/app/oracle/oradata/db12c/system01.dbf      1
/u01/app/oracle/oradata/db12c/gls/test.dbf      1

  • Temp Tablespace  in root container 

SQL> select file_name, con_id from cdb_temp_files where con_id=1; 

FILE_NAME CON_ID
—————————————————————————– ———-
/u01/app/oracle/oradata/db12c/temp01.dbf      1

  • Create Tablespace  ( already mentioned in Part (1)) 

SQL> create tablespace test datafile ‘/u01/app/oracle/oradata/db12c/gls/test03.dbf’ size 20M; Tablespace created.

SQL> select tablespace_name, con_id from cdb_tablespaces order by con_id;

TABLESPACE_NAME   CON_ID
—————————— ———-
SYSTEM 1
TEST 1
CDATA 1
SYSAUX 1
TEMP 1
UNDOTBS1 1
USERS 1
SYSAUX 2
TEMP 2
SYSTEM 2
TEMP 3
SYSAUX 3
PDB_TEST 3
SYSTEM 3
14 rows selected.

  •  Create temp tablespace 

SQL> create temporary tablespace temp_test tempfile ‘/u01/app/oracle/oradata/db12c/gls/temp_test.dbf’ size 20M ;
Tablespace created.

SQL> select file_name, con_id from cdb_temp_files where con_id=1;

FILE_NAME CON_ID
————————————————————————— ———-
/u01/app/oracle/oradata/db12c/temp01.dbf      1
/u01/app/oracle/oradata/db12c/gls/temp_test.dbf      1

The Same Steps in root container for create tablespace and temp tablespace for pluggable database.
Security In Pluggable Database

In This Section we will discuss how to manage Users, roles and privileges.
before Demonstration you need to know what is the difference between two users  type :
  • Common  : when you create this kind of users in root it’s automatically replicated in all Pluggable database.
  • Local : this kind of users only created on pluggable database that you are connected to it now. and dose not effect on others pluggable database.
To Create Common Users you need to be connected to root container.

SQL> conn / as sysdba
Connected.

SQL> create user c##osama identified by osama ;User created.

SQL> select username, common, con_id from cdb_users where username like ‘C##%’;

USERNAME COM CON_ID
———————————— — ———-
C##TEST YES      1
C##OSAMA YES      1
C##TEST YES      3
C##OSAMA YES      3

SQL> grant create session to c##osama ;Grant succeeded.

SQL> conn c##osama/osama@test12c:1521/db12c ;
Connected.

Let’s connect to pluggable database :

The user i will created it here will not appear in root container.

SQL> conn sys/sys@test12c:1521/new as sysdba
Connected.

SQL> create user test identified by test ;User created.

SQL> grant create session to test ;Grant succeeded.

 SQL> select username, common, con_id  from cdb_users where username =’TEST’;

USERNAME      COM CON_ID
—————— ———-
TEST  NO      3

 SQL> conn test/test@test12c:1521/new ;
Connected.

 Same rules and conditions applied on Roles if you created in Root Container it will be replicated to pluggable database, on other hand if you created in Pluggable database it will be local without effecting Container.

Let’s connect to Root Container

SQL> conn / as sysdba
Connected.

SQL> create role c##root_role ;Role created.

SQL> select role, common, con_id from cdb_roles where role=’C##ROOT_ROLE’;

ROLE  COM CON_ID
——————— — ———-
C##ROOT_ROLE  YES      1
C##ROOT_ROLE  YES      3

SQL> conn sys/sys@test12c:1521/new as sysdba
Connected.

SQL> create role test2;Role created.

 SQL> select role, common, con_id from cdb_roles where role=’TEST2′;

ROLE COM CON_ID
—————- — ———-
TEST2 NO      3

SQL> create role hr container=all ;
create role hr container=all
*
ERROR at line 1:
ORA-65050: Common DDLs only allowed in CDB$ROOT

SQL> create user hr identified by hr container=all ;
create user hr identified by hr container=all
                             *
ERROR at line 1:
ORA-65050: Common DDLs only allowed in CDB$ROOT

—> you cannot create a common role inside a PDB.
Check user privileges :

SQL> select grantee, privilege, common, con_id from cdb_sys_privs
where privilege=’CREATE SESSION’ and grantee=’TEST’; 

GRANTEE PRIVILEGE  COM  CON_ID
————– —————————————
TEST CREATE SESSION  NO       3

Drop Pluggable Database

SQL > drop pluggable database new  including datafiles;
Pluugable database dropped.

This document also available on slidshare here

Thank you
Osama mustafa