Enable Docker On Linux

Oracle Linux Released Before 2 week, i already blogged about this and mean while i was testing new features for Oracle Linux 6.5 which is simply amazing i will start writing about it.

Enable Docker , What is the Docker you can check the official Website to take look what i mean by Docker here .

If you tried to install Docker Directly you will get the below error :

[root@OEL6 u01]# rpm -ivh docker-io-0.7.0-14.el6.x86_64.rpm

warning: docker-io-0.7.0-14.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
error: Failed dependencies:
lxc is needed by docker-io-0.7.0-14.el6.x86_64

and if you need to install lxc package :

[root@OEL6 Packages]# rpm -ivh lxc-0.9.0-2.0.5.el6.x86_64.rpm 

warning: lxc-0.9.0-2.0.5.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
error: Failed dependencies:
libvirt is needed by lxc-0.9.0-2.0.5.el6.x86_64

So Let’s Start :

root@OEL6 Packages]# rpm -ivh libvirt-0.10.2-29.0.1.el6.x86_64.rpm 

warning: libvirt-0.10.2-29.0.1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
error: Failed dependencies:
/usr/bin/qemu-img is needed by libvirt-0.10.2-29.0.1.el6.x86_64
ebtables is needed by libvirt-0.10.2-29.0.1.el6.x86_64
libnetcf.so.1()(64bit) is needed by libvirt-0.10.2-29.0.1.el6.x86_64
libnetcf.so.1(NETCF_1.0.0)(64bit) is needed by libvirt-0.10.2-29.0.1.el6.x86_64
libnetcf.so.1(NETCF_1.2.0)(64bit) is needed by libvirt-0.10.2-29.0.1.el6.x86_64
libnetcf.so.1(NETCF_1.3.0)(64bit) is needed by libvirt-0.10.2-29.0.1.el6.x86_64
libnetcf.so.1(NETCF_1.4.0)(64bit) is needed by libvirt-0.10.2-29.0.1.el6.x86_64
lzop is needed by libvirt-0.10.2-29.0.1.el6.x86_64
numad is needed by libvirt-0.10.2-29.0.1.el6.x86_64
radvd is needed by libvirt-0.10.2-29.0.1.el6.x86_64

First:

[root@OEL6 Packages]# rpm -ivh lzo

lzo-2.03-3.1.el6.x86_64.rpm       lzop-1.02-0.9.rc1.el6.x86_64.rpm
[root@OEL6 Packages]# rpm -ivh lzop-1.02-0.9.rc1.el6.x86_64.rpm 
warning: lzop-1.02-0.9.rc1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:lzop                   ########################################### [100%]

Second :

[root@OEL6 Packages]# rpm -ivh numa

numactl-2.0.7-8.el6.i686.rpm
numactl-2.0.7-8.el6.x86_64.rpm
numactl-devel-2.0.7-8.el6.i686.rpm
numactl-devel-2.0.7-8.el6.x86_64.rpm
numad-0.5-9.20130814git.el6.x86_64.rpm

[root@OEL6 Packages]# rpm -ivh numad-0.5-9.20130814git.el6.x86_64.rpm 

warning: numad-0.5-9.20130814git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:numad                  ########################################### [100%]

Third:
[root@OEL6 Packages]# rpm -ivh radvd-1.6-1.el6.x86_64.rpm 
warning: radvd-1.6-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:radvd                  ########################################### [100%]
Fourth :

[root@OEL6 Packages]# rpm -ivh augeas-libs-1.0.0-5.el6.x86_64.rpm
warning: augeas-libs-1.0.0-5.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:augeas-libs            ########################################### [100%]

[root@OEL6 Packages]# rpm -ivh netcf-libs-0.1.9-4.el6.x86_64.rpm
warning: netcf-libs-0.1.9-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:netcf-libs             ########################################### [100%]

Now you need to enable qemu-img like the below :

[root@OEL6 Packages]# rpm -ivh libgfortran-4.4.7-4.el6.x86_64.rpm
warning: libgfortran-4.4.7-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key                                                                              ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
        package libgfortran-4.4.7-4.el6.x86_64 is already installed

[root@OEL6 Packages]# rpm -ivh qemu-img-0.12.1.2-2.415.el6.x86_64.rpm
warning: qemu-img-0.12.1.2-2.415.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature,                                                                              key ID ec551f03: NOKEY
error: Failed dependencies:
        libgfapi.so.0()(64bit) is needed by qemu-img-2:0.12.1.2-2.415.el6.x86_64
        libusbredirparser.so.1()(64bit) is needed by qemu-img-2:0.12.1.2-2.415.e                                                                             l6.x86_64
[root@OEL6 Packages]# rpm -ivh glusterfs-api-3.4.0.36rhs-1.0.1.el6.x86_64.rpm
warning: glusterfs-api-3.4.0.36rhs-1.0.1.el6.x86_64.rpm: Header V3 RSA/SHA256 Si                                                                             gnature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:glusterfs-api          ########################################### [100%]
[root@OEL6 Packages]# rpm -ivh qemu-img-0.12.1.2-2.415.el6.x86_64.rpm
warning: qemu-img-0.12.1.2-2.415.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature,                                                                              key ID ec551f03: NOKEY
error: Failed dependencies:
        libusbredirparser.so.1()(64bit) is needed by qemu-img-2:0.12.1.2-2.415.e                                                                             l6.x86_64
[root@OEL6 Packages]# rpm -ivh usbredir-0.5.1-1.el6.x86_64.rpm
warning: usbredir-0.5.1-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, ke ID                                                                              ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:usbredir               ########################################### [100%]

[root@OEL6 Packages]# rpm -ivh qemu-img-0.12.1.2-2.415.el6.x86_64.rpm
warning: qemu-img-0.12.1.2-2.415.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature,                                                                              key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:qemu-img               ########################################### [100%]

Finally the last Package :

[root@OEL6 Packages]# rpm -ivh ebtables-2.0.9-6.el6.x86_64.rpm
warning: ebtables-2.0.9-6.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:ebtables               ########################################### [100%]

[root@OEL6 Packages]# rpm -ivh libvirt-0.10.2-29.0.1.el6.x86_64.rpm

warning: libvirt-0.10.2-29.0.1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:libvirt                ########################################### [100%]

we have to download two more package 

[root@OEL6 Packages]# rpm -ivh lxc-0.9.0-2.0.5.el6.x86_64.rpm

warning: lxc-0.9.0-2.0.5.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:lxc                    ########################################### [100%]

[root@OEL6 u01]# rpm -ivh docker-io-0.7.0-14.el6.x86_64.rpm
warning: docker-io-0.7.0-14.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing…                ########################################### [100%]
   1:docker-io              ########################################### [100%]

Now you Can Use Docker 🙂 I will post more blog about this Package and how to use.
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

Point-In-Time Recovery for a Pluggable Database

Check Pluggable database that you have :

SQL> select name from v$pdbs ;

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

Shutdown database , to configure database archivelog

SQL> shutdown immediate ;

Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount ;

 ORACLE instance started.

Total System Global Area 1252663296 bytes
Fixed Size    2287864 bytes
Variable Size  838862600 bytes
Database Buffers  402653184 bytes
Redo Buffers    8859648 bytes
Database mounted.

SQL> alter database archivelog ;

Database altered.

SQL> alter database open 

Database altered.

SQL> alter pluggable database all open; 

Pluggable database altered.

SQL> alter system set db_recovery_file_dest_size = 2G scope=both; 

System altered.

SQL> alter pluggable database all open; 

Pluggable database altered.

Export ORACLE_SID for container database and enter rman to backup  like below

[oracle@test12c backup]$ export ORACLE_SID=db12c
[oracle@test12c backup]$ rman target ‘”/ as sysbackup”‘

Recovery Manager: Release 12.1.0.1.0 – Production on Sat Jul 13 17:13:42 2013
Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.
connected to target database: DB12C (DBID=1274669151)

Auto Backup controlfile :

RMAN> configure controlfile autobackup on;

using target database control file instead of recovery catalog
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

Backup Script that we need :

Run {
ALLOCATE CHANNEL disk1 DEVICE TYPE DISK FORMAT ‘/u01/backup/db12c/%U’;
backup database plus archivelog;
}

 Where 
Format ‘/u01..’:  Location for backup

now move to our pluggable database

SQL>alter session set container=test_1 ;

SQL>create tablespace test_1  datafile ‘/u01/app/oracle/oradata/db12c/test_1/test_1.dbf’ size 10m;

SQL>create user test identified by test temporary tablespace temp default tablespace test_1;

SQL>grant create session, create table, unlimited tablespace to test ;

SQL>create table data (id varchar2(100)) tablespace test_1;

Enter Data using The Below code in above table :

begin
 for i in 1.. 10000 loop
    insert into data values (‘osama’);
 end loop;
 commit;
end;

After you insert data close pluggable database to start restore.

alter pluggable database test_1 CLOSE ;

Restore script :

run {
set until SCN = 1832026 ;
restore pluggable database test_1;
recover pluggable database Test_1 auxiliary destination=’/u01/backup/db12c’;
alter pluggable database TEST_1 open resetlogs;
}

Note :  To get SCN for database before insert use the query below :

SQL > select timestamp_to_scn(sysdate) from v$database;

After Restore :

sqlplus sys/sys@test12c:1521/test_1 ;
SQL> select count(*) from data ;
select count(*) from data
                     *
ERROR at line 1:
ORA-00942: table or view does not exist

Thank you
Osama Mustafa

Security Features 12c

As Any Newer Version of database oracle Enhance Security This time Oracle create new users for administration purpose

Separate user duties : 

SQL> select username from dba_users where username like ‘%SYS%’;

USERNAME
———————————-
SYS  : Super user
SYSKM : Key magament tasks
SYSDG : Data Guard Managment
SYSBACKUP : backup management

DBMS_PRIVILEGE_CAPTURE

The Privilege Analysis feature allows you to: 
  • Define a privilege capture
  • Start a privilege analysis during a period of time
  • Delete capture analysis
The Capture can be Done on Three level :
  • User
  • Role
  • Context
to understand this new package check the below examples :
sqlplus / as sysdba
SQL> create user test identified  by test ;
SQL> grant create session to test ;
Grant succeeded.
SQL> grant select any table to test ;
Grant succeeded.
Create new Capture using this package :

exec SYS.DBMS_PRIVILEGE_CAPTURE.CREATE_CAPTURE ( –
        name           =>  ‘test_capture’, –
        description    =>  ‘Capture_all_thing’, –
        type           =>   dbms_privilege_capture.g_database)

Where 

Name : Package name
Description : What this package fo
type : depend on level users ( g_database ) , role (g_role )  , Context : (g_role_and_context)

we need to enable this package to start capture :

SQL> exec SYS.DBMS_PRIVILEGE_CAPTURE.ENABLE_CAPTURE (name => ‘test_capture’);
 PL/SQL procedure successfully completed.

until everything goes fine now to start capture you have to logout from sqlplus and start do what you need to do.
SQL> conn test/test ;
Connected.
SQL> select * from osama.test ;
no rows selected
SQL> select * from osama.test2 ;
   TEST_ID TEST_NAME
———- ——————–
1 JENNIFER
2 STEVE
3 USER
again reconnect as / as sysdba to disable capture then generate results like the following :
SQL> exec SYS.DBMS_PRIVILEGE_CAPTURE.DISABLE_CAPTURE (name => ‘test_capture’);
PL/SQL procedure successfully completed.
SQL> exec SYS.DBMS_PRIVILEGE_CAPTURE.GENERATE_RESULT (name => ‘test_capture’);
PL/SQL procedure successfully completed.

SQL> select username, object_owner, object_name, obj_priv
from   dba_used_objprivs
where  username in (‘OSAMA’, ‘TEST’) 

USERNAME   OBJECT_OWNER OBJECT_NAME       OBJ_PRIV
———- ———— —————————— ————————-
TEST   SYS ORA$BASE                                      USE
TEST   SYS DBMS_APPLICATION_INFO       EXECUTE
TEST   SYS DUAL                                              SELECT
TEST   SYS DUAL                                               SELECT
TEST   SYSTEM PRODUCT_PRIVS                     SELECT
Drop Capture :
exec SYS.DBMS_PRIVILEGE_CAPTURE.DROP_CAPTURE (name => ‘test_capture’)
Thank you 
Osama mustafa

Another New Features 12c : generated as identity / Sequence Replacement

in old version of oracle database if you want to create automatic generated number you have to create sequence and use attribute nextval.

But with oracle database 12c this concept is changed new features add when you create table called generated as identity.

Check the Below Demonstration which explain this new features :

SQL> create table test (test_id number generated as identity , test_name varchar2(20));

SQL> desc test ;
 Name   Null?      Type
 —————————————–   ——– ————–
 TEST_ID   NOT      NULL NUMBER
 TEST_NAME          VARCHAR2(20)

SQL> insert into test values (1,’osama’);
insert into test values (1,’osama’)
*
ERROR at line 1:
ORA-32795: cannot insert into a generated always identity column

The TEST_ID Column will be inserting automatically  no need to use in insert command.

SQL> insert into test (TEST_NAME) values ( ‘Jennifer’ );
1 row created.

SQL> select * from test ;
   TEST_ID TEST_NAME
———- ——————–
1       Jennifer 

Check another example :

SQL> create table test2 (TEST_ID NUMBER generated as identity (start with 1 increment by 1 cache 30 order), TEST_NAME varchar2(20));
Table created.

SQL> insert into test2 (test_name) values (‘JENNIFER’);
SQL> insert into test2 (test_name) values (‘STEVE’);
SQL> insert into test2 (test_name) values (‘USER’);

SQL> select * from test2 ;

   TEST_ID TEST_NAME
———- ——————–
1 JENNIFER
2 STEVE
3 USER

Thank you 
Osama mustafa

Oracle Enterprise Manager unable to Start

When I checked the log Located $ORACLE_HOME/SID_HOSTNAME/sysman/log

I found the below errors :

app.ContextInitializer contextInitialized.420 – Integration Class not found

and

ERROR main: nmectla_agentctl: Error connecting to

First you need to make sure that the link in emd.properties and ports and configured right and hostname is correct, restrat dbconsole if this not works then check the below

On Host :

oracle@TEST:/u01/app/$ echo $TZ
localtime

oracle@TEST:/u01/app/$ export TZ=Etc/GMT+2

emctl config agent updateTZ

emctl resetTZ agent 

Restart Dbconsole

Emctl start dbconsole 

 Thank you
Osama mustafa

BarCode Fonts

If you look for bar code fonts to make your reports Look more nicer , I uploaded Fonts and you can download them On the Below Link , Hope its useful

BarCode Fonts Download Here

And For Tadqeet Code That Use for Arabic , Called Tafqeet :

Tarqeet You can Dowload it Here

Thank you
Osama Mustafa

ORA-01151: use media recovery to recover block, restore backup if needed

SQL> startup
ORACLE instance started.

Total System Global Area 599785472 bytes
Fixed Size 1288820 bytes
Variable Size 192939404 bytes
Database Buffers 402653184 bytes
Redo Buffers 2904064 bytes
Database mounted.
ORA-01172: recovery of thread 1 stuck at block 4545 of file 1
ORA-01151: use media recovery to recover block, restore backup if needed
SQL>

Cause :
  There is block corruption in tablespace.

Solution :

 SQL> shutdown immediate;
SQL> startup mount;
SQL> recover database;
SQL> alter database open;

 

Startup/Shutdown Logical Standby Database

Simple Steps to do that


Shutdown Steps :

On Primary do the following :

SQL > alter system switch logfile ;
SQL > alter system archive log current ; 

Go to Standby :

SQL> ALTER DATABASE STOP LOGICAL STANDBY APPLY;
SQL> shutdown immediate;

Primary Database :

SQL> shutdown immediate;

Startup Steps :

Primary Database

SQL>startup;

 Standby Database:

SQL > startup
SQL > alter database start logical standby apply immediate ;

Thank you
Osama Mustafa