Posted in EM13c, Oracle

OUI-10022:The target area /app/oraInventory cannot be used because it is in an invalid state

I was running a brand new installation of EM13c and this error popped up. Make sure that the /app/oraInventory folder it’s clean after a failed attempt and /etc/oraInst.loc exists.

Posted in Oracle

X11 connection rejected because of wrong authentication.

This is a nice one, while you’re configuring the ssh port forwarding to get your display from the source server onto destination server using SUDO.

In case you don’t know the oracle user’s password on the destination server, but you have sudo privilege, you’re going to do something like this:

On the source:
Change the X11Forwarding from NO to YES in the following file /etc/ssh/sshd_config

ssh server1 -X (using your local user)

On the destination server you get this:

/usr/bin/xauth: file /home/localuser/.Xauthority does not exist
 [localuser@server1 ~]$ ls -l /home/localuser/.Xauthority
 -rw-------. 1 localuser localuser 83 Jan 14 08:41 /home/localuser/.Xauthority
 [localuser@server1 ~]$ xclock

But now you would like to sudo as oracle user and you’ll get this:

[localuser@server1 ~]$ sudo su - oracle
 Last login: Mon Jan 14 03:09:02 UTC 2018
 [oracle@server1 ~]$ xclock
 Error: Can't open display:
 [oracle@server1 ~]$ export DISPLAY=localhost:10.0
 [oracle@server1 ~]$ xclock
 X11 connection rejected because of wrong authentication.
 Error: Can't open display: localhost:10.0
 [oracle@server1 ~]$ exit

One of the solutions would be this:

The reason for not being able to open the display is because on the user oracle we don’t have the same .Xauthority file. So we’re going to add it:

localuser@server1 ~]$ xauth list
 server1/unix:10 MIT-MAGIC-COOKIE-1 0ee9eda295cad0ba2913f8d9df5c61d
-- as oracle user do this:
oracle@server1 ~]$ xauth add server1/unix:10 MIT-MAGIC-COOKIE-1 0ee9eda295cad0ba2913f8d9df5c61d

Problem solved.

Posted in Linux

Some Linux commands I use often

Get the total size of some files:

du -ch /path/patern* | grep total

Get the total number of files being backed up using the log of the RMAN job:

grep -i 'input datafile file number=' rman_BKUP.log | wc -l

Use grep to display the next 2 lines after the pattern you’re looking for (-A= AFTER , B=BEFORE):

grep -i -A 2 'input datafile file number'  rman_BKUP.log
input datafile file number=00001 name=/storage/datafile.dbf
channel ch02: starting piece 1 at 14-MAR-18 15:30:25
channel ch01: finished piece 1 at 14-MAR-18 15:30:32
Posted in Oracle, SQL, Sqlplus

List all running jobs

SET PAUSE 'Press Return to Continue'
SELECT a.job "Job",
       a.failures "Failures",       
       Substr(To_Char(a.last_date,'DD-Mon-YYYY HH24:MI:SS'),1,20) "Last Date",      
       Substr(To_Char(a.this_date,'DD-Mon-YYYY HH24:MI:SS'),1,20) "This Date"             
FROM   dba_jobs_running a
Posted in clone, Oracle

How to clone Oracle Software fast and easy

This is the approach I’m usually taking to clone the Oracle Software from one server to another.

[oracle@PROD product]$ zip -r
 adding: (stored 0%)
 adding: (stored 0%)
 adding: (stored 0%)
 adding: (deflated 2%)


  adding: (stored 0%)  adding: (stored 0%)  adding: warning: Permission denied zip warning: could not open for reading:  adding: (stored 0%)  adding: (deflated 65%)  adding: (stored 0%)


adding: (deflated 68%)
 adding: (deflated 68%)

zip warning: Not all files were readable
 files/entries read: 40416 (4.9G bytes) skipped: 3 (144K bytes)
[oracle@PROD product]$ exit

Now send the zip file to the target server:

[oracle@PROD software]$ scp /u01/app/oracle/product/ DEV:/tmp

Create the same oracle path for the ORACLE_HOME

mkdir -p /u01/app/oracle/product

Unzip the archive to previously created folder:

unzip -d /u01/app/oracle/product/

Navigate to this clone folder within the unzipped oracle software:

cd /u01/app/oracle/product/

[oracle@DEV bin]$ pwd
[oracle@DEV bin]$ perl ORACLE_BASE=/u01/app/oracle ORACLE_HOME=/u01/app/oracle/product/ ORACLE_HOME_NAME=OH_11204
./runInstaller -clone -waitForCompletion "ORACLE_BASE=/u01/app/oracle" "ORACLE_HOME=/u01/app/oracle/product/" "ORACLE_HOME_NAME=OH_11204" -silent -noConfig -nowait 
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB. Actual 20479 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-10-11_03-40-32PM. Please wait ...Oracle Universal Installer, Version Production
Copyright (C) 1999, 2013, Oracle. All rights reserved.

You can find the log of this install session at:
.................................................................................................... 100% Done.

Installation in progress (Wednesday, October 11, 2017 3:40:39 PM UTC)
.............................................................................. 78% Done.
Install successful

Linking in progress (Wednesday, October 11, 2017 3:40:42 PM UTC)
Link successful

Setup in progress (Wednesday, October 11, 2017 3:41:02 PM UTC)
Setup successful

End of install phases.(Wednesday, October 11, 2017 3:41:24 PM UTC)
WARNING:A new inventory has been created in this session. However, it has not yet been registered as the central inventory of this system.
To register the new inventory please run the script '/u01/app/oraInventory/' with root privileges. 
If you do not register the inventory, you may not be able to update or patch the products you installed.
The following configuration scripts need to be executed as the "root" user.
To execute the configuration scripts:
 1. Open a terminal window
 2. Log in as "root"
 3. Run the scripts
The cloning of OH_11204 was successful.
Please check '/u01/app/oraInventory/logs/cloneActions2017-10-11_03-40-32PM.log' for more details.
[oracle@DEV bin]$ /u01/app/oracle/product/ lsinventory
Oracle Interim Patch Installer version
Copyright (c) 2017, Oracle Corporation. All rights reserved.

Oracle Home : /u01/app/oracle/product/
Central Inventory : /u01/app/oraInventory
 from : /u01/app/oracle/product/
OPatch version :
OUI version :
Log file location : /u01/app/oracle/product/

Lsinventory Output file location : /u01/app/oracle/product/

Execute the 2 scripts as root and you’re done:


End of story.