Monday, September 26, 2016

Oracle 12c find the current Cluster Health Monitor (CHM) Repository master node in RAC

Log in as Grid user or the OS user use to manage GI and run the command below:


[grid@rac01 ~]$ oclumon manage -get master

Master = rac02
[grid@rac01 ~]$


[grid@rac01 ~]$ which oclumon
/u01/app/12.1.0/grid/bin/oclumon
[grid@rac01 ~]$



Thursday, September 15, 2016

pse util to get the proccsses

Create the .aliases file
Added below lines in .aliases at oracle home directory in my case it was /home/oracle
alias pse='ps -ef | grep -v grep | grep '
alias psg='ps -ef | grep -v grep | grep '
Modify .bashrc
Modified the .bashrc file so that new .aliases is there. My file is 
[oracle@o12c (cdb1) ~]$ cat .bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
# User specific aliases and functions
if [ -f $HOME/.aliases ]
then
  . $HOME/.aliases
fi
[oracle@o12c (cdb1) ~]$ 
Now simply run pse command with process name it saves some time.

[oracle@o12c (cdb1) ~]$ pse tns
root        13     2  0 16:03 ?        00:00:00 [netns]
oracle    2758     1  0 16:05 ?        00:00:00 /u01/app/oracle/product/12.1.0.2/db_1/bin/tnslsnr listener -inherit
[oracle@o12c (cdb1) ~]$ 
[oracle@o12c (cdb1) ~]$ pse smon
oracle    2507     1  0 16:04 ?        00:00:00 ora_smon_cdb1

[oracle@o12c (cdb1) ~]$ 


Tuesday, September 13, 2016

Making up arrow key work for sqlplus, rman, dgmgrl, adrci

It is nice to have up arrow key working in sqlplus, rman, dgmgrl, adrci. But can this work.

YES !!! of course it can, I have tried it on Redhat.

Below are the steps to do this.
  1. Download the rlwrap package 
  2. Install the package
  3. Create the .aliases file
  4. Modify .bashrc
  5. WALLAH !!!
Download the rlwrap package 
I have downloaded rlwrap-0.42.tar.gz from http://utopia.knoware.nl/~hlub/uck/rlwrap/#rlwrap
or download the file by clicking link below

Install the package
the installation is done using 
su -
gunzip rlwrap*.gz
tar -xvf rlwrap*.tar
cd rlwrap*
./configure
make
make check
make install
Create the .aliases file
Added below lines in .aliases at oracle home directory in my case it was /home/oracle
alias adrci='/usr/local/bin/rlwrap $ORACLE_HOME/bin/adrci'
alias sqlplus='/usr/local/bin/rlwrap $ORACLE_HOME/bin/sqlplus'
alias dgmgrl='/usr/local/bin/rlwrap $ORACLE_HOME/bin/dgmgrl'
alias rman='/usr/local/bin/rlwrap $ORACLE_HOME/bin/rman'
Modify .bashrc
Modified the .bashrc file so that new .aliases is there. My file is 
[oracle@o12c (cdb1) ~]$ cat .bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
# User specific aliases and functions
if [ -f $HOME/.aliases ]
then
  . $HOME/.aliases
fi
[oracle@o12c (cdb1) ~]$ 
WALLAH !!!

Once above is done then create a new oracle connection to unix server and you are done. The up arrow key will start working.




Monday, September 12, 2016

Adding swap file

In case we need to increase the size of the swap we can add a file to the file system and use it as a swap


[root@o12c ~]# swapon -s
Filename                                Type            Size    Used    Priority
/dev/dm-1                               partition       4620284 0       -1
[root@o12c ~]#
[root@o12c ~]#
[root@o12c ~]# cat /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/dm-1                               partition       4620284 0       -1
[root@o12c ~]#
[root@o12c ~]# cat /etc/fstab|grep swap
/dev/mapper/vg_o12c-lv_swap swap                    swap    defaults        0 0
[root@o12c ~]# 



[root@o12c ~]#
[root@o12c ~]# dd if=/dev/zero of=/root/swapfile count=1024 bs=4194304
1024+0 records in
1024+0 records out
4294967296 bytes (4.3 GB) copied, 33.7263 s, 127 MB/s
[root@o12c ~]# mkswap -c /root/swapfile
mkswap: /root/swapfile: warning: don't erase bootbits sectors
        on whole disk. Use -f to force.
Setting up swapspace version 1, size = 4194300 KiB
no label, UUID=92497138-d397-412d-b827-f3c73c91047d
[root@o12c ~]# swapon /root/swapfile
[root@o12c ~]# swapon -s
Filename                                Type            Size    Used    Priority
/dev/dm-1                               partition       4620284 0       -1
/root/swapfile                          file            4194300 0       -2
[root@o12c ~]# 

xauth: file /home/oracle/.Xauthority does not exist

Another issue with xauth. :(

But good thing that I have got the solution.

Logged in as oracle buy xclock is not working

[oracle@o12c sf_vshare]$ xclock
SSH gateway: X11 authentication failed. Error: Can't open display: localhost:11.0
[oracle@o12c sf_vshare]$ echo $DISPLAY
localhost:11.0
[oracle@o12c sf_vshare]$ DISPLAY=localhost:10.0
[oracle@o12c sf_vshare]$ echo $DISPLAY
localhost:10.0
[oracle@o12c sf_vshare]$ xclock
SSH gateway: X11 authentication failed. Error: Can't open display: localhost:10.0
[oracle@o12c sf_vshare]$
[oracle@o12c sf_vshare]$ xauth list
xauth:  file /home/oracle/.Xauthority does not exist
[oracle@o12c sf_vshare]$
But it is working as root. let's see what are the values of display and xauth there

[root@o12c ~]# echo $DISPLAY
localhost:10.0
[root@o12c ~]#
[root@o12c ~]#
[root@o12c ~]# xauth list
o12c.localdomain/unix:12  MIT-MAGIC-COOKIE-1  fc6f5640fe846f9825cb0e121a303517
o12c.localdomain/unix:10  MIT-MAGIC-COOKIE-1  0a9f61e7313ebd9919b03dabe07f9697
o12c.localdomain/unix:11  MIT-MAGIC-COOKIE-1  d34c3a647ff47405f452c4910e7d9a39
[root@o12c ~]#

Now log back to oracle and set the following

[oracle@o12c ~]$ xauth add o12c.localdomain/unix:10  MIT-MAGIC-COOKIE-1  0a9f61e7313ebd9919b03dabe07f9697
xauth:  file /home/oracle/.Xauthority does not exist
[oracle@o12c ~]$ ls -lah /home/oracle/.Xauthority
-rw-------. 1 oracle oinstall 62 Sep 12 14:58 /home/oracle/.Xauthority
[oracle@o12c ~]$
[oracle@o12c ~]$
[oracle@o12c ~]$ xauth list
o12c.localdomain/unix:10  MIT-MAGIC-COOKIE-1  0a9f61e7313ebd9919b03dabe07f9697
[oracle@o12c ~]$
[oracle@o12c ~]$ xclock
SSH gateway: X11 authentication failed. Error: Can't open display: localhost:11.0
[oracle@o12c ~]$ DISPLAY=localhost:10.0
[oracle@o12c ~]$ xclock
Warning: Missing charsets in String to FontSet conversion
[oracle@o12c ~]$
So moral of story. match the number after : under xauth list with the DISPLAY variable plus run xauth add with values from the session where it is working for :10.0 and it should work.




Friday, September 2, 2016

ORA-01630: max # extents (4096) reached in temp segment in tablespace HARVEY

ERROR at line 1:
ORA-01630: max # extents (4096) reached in temp segment in tablespace HARVEY

The solution is

Get the maximum extents and either increase the value to something bigger or make it unlimited.

select tablespace_name, min_extents, max_extents from DBA_TABLESPACES order by 1;

SQL> alter tablespace HARVEY default storage (maxextents unlimited);