Tuesday, August 19, 2014

Setup SSH with DSA public key authentication (password less login)

Step #1: Generate DSA Key Pair
Use ssh-keygen command as follows:


$ ssh-keygen -t dsa
Output:

[root@hadoop01 ~]# ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
63:c2:66:e8:b2:c4:49:cf:1c:6a:17:bb:4f:88:2f:b3 root@hadoop01.localdomain.com
[root@hadoop01 ~]#

Caution:
a) Please enter a passphrase different from your account password and confirm the same.
b) The public key is written to /home/you/.ssh/id_dsa.pub.
c) The private key is written to /home/you/.ssh/id_dsa.
d) It is important you never-ever give out your private key.

Step #2: Set directory permission
Next make sure you have correct permission on .ssh directory:
[root@hadoop01 ~]# cd
[root@hadoop01 ~]# chmod 755 .ssh
[root@hadoop01 ~]#

Step #3: Copy public key
Now copy file ~/.ssh/id_dsa.pub on Machine #1 (hadoop1) to remote server hadoop2 as ~/.ssh/authorized_keys:
[root@hadoop01 ~]# scp ~/.ssh/id_dsa.pub root@192.168.1.111:.ssh/authorized_keys
root@192.168.1.111's password:
id_dsa.pub                                                                     100%  619     0.6KB/s   00:00
[root@hadoop01 ~]#
Command to type on your remote server called 192.168.1.111(hadoop2)
Login to your remote server and make sure permissions are set correct:
drwxr-xr-x  2 root root  4096 Aug 19 23:25 .ssh
[root@hadoop02 ~]# chmod 600 ~/.ssh/authorized_keys

Step #4: How do I login from client to server with DSA key?

Use ssh as follows from the first machine(hadoop1)

[root@hadoop01 ~]# ssh root@192.168.1.111
Last login: Tue Aug 19 23:19:52 2014 from 192.168.1.103
drwxr-xr-x  2 root root  4096 Aug 19 23:25 .ssh
[root@hadoop02 ~]# cd .ssh
[root@hadoop02 .ssh]# ls -latr
total 16
drwxr-x--- 16 root root 4096 Aug 19 23:25 ..
-rw-------  1 root root  619 Aug 19 23:25 authorized_keys
drwxr-xr-x  2 root root 4096 Aug 19 23:25 .
[root@hadoop02 .ssh]#


[Errno 4]IOError: urlopen error (97, ‚Address family not supported by protocol’)


Yum Configuration

Issue:
[root@root]# yum update
Loaded plugins: fastestmirror, security
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=os error was
[Errno 4] IOError:
Error: Cannot find a valid baseurl for repo: base
[root@root]#


If you have above problem, enable proxy in yum.conf file.

Solution:

Update the yum configuration file.

eg: 10.0.0.1:8080

[root@root]# cd /etc/yum/
[root@root]# vi yum.conf
Add following lines
[main]
proxy=http://10.0.0.1:8080
[root@root]#

where 10.0.0.1 is your Proxy Server.

Sunday, August 17, 2014

R12.2 Installation Log Files Locations

 

List of all the log files:


Before the installation starts:
$TMP//.log
$TMP//_.xml
$TMP//__apps.xml
The Rapidwiz Configuration File is saved in 4 locations:-
$TMP//conf_.txt
Primary $INST_TOP/conf_.txt
Secondary $INST_TOP/conf_.txt
/appsutil/conf_.txt
Preinstall System Check logs:
$TMP//.log 
$TMP/dbPreInstCheck.xxxxx.log
$TMP/wtprechk.xxxx/wtprechk.xxxx.log 

/logs/installActions.log

Database Tier:

Main installation log:
RDBMS $ORACLE_HOME/appsutil/log/$CONTEXT_NAME/.log
Oracle Home installation logs:
RDBMS $ORACLE_HOME/temp/$CONTEXT_NAME/logs/oracle.apps.fnd.txk.install0.log
RDBMS $ORACLE_HOME/temp/$CONTEXT_NAME/logs/oracle.apps.fnd.txk.default0.log
/logs/.log
/logs/cloneActions.log
/logs/install.log
/logs/installActions.log
/logs/installProfile.log
/logs/installSummary.log
/logs/OPatch.log
/logs/oraInstall.log
/logs/silentInstall.log
RMAN restore scripts (Install mode only):
/appsutil/out/$CONTEXT_NAME/restore-rac1.rman
/appsutil/out/$CONTEXT_NAME/restore-rac2.sql
/appsutil/out/$CONTEXT_NAME/restore-single2.sql
/appsutil/out/$CONTEXT_NAME/restore-rac21.sql
/appsutil/out/$CONTEXT_NAME/restore-single21.sql
/appsutil/out/$CONTEXT_NAME/restore-rac3.rman
RMAN restore logs (Install mode only):
/appsutil/out/$CONTEXT_NAME/restore-rac1.log
/appsutil/out/$CONTEXT_NAME/restore-rac2.log
/appsutil/out/$CONTEXT_NAME/restore-rac3.log
/appsutil/out/$CONTEXT_NAME/restore-single1.log
/appsutil/out/$CONTEXT_NAME/restore-single2.log
/appsutil/out/$CONTEXT_NAME/restore-single3.log
/appsutil/out/$CONTEXT_NAME/LogOff.sql
/appsutil/out/$CONTEXT_NAME/fndClean.sql
Database characterset conversion (Install mode only):
/appsutil/log//addbccnv.txt
AutoConfig context file:
/appsutil/.xml
AutoConfig logs:
/appsutil/log///adconfig.log
/appsutil/log///NetServiceHandler.log
/temp/$CONTEXT_NAME/RACAutoConfig_nnnnn.log
Listener log:
/appsutil/log/$CONTEXT_NAME/addlnctl.txt

Applications Tier(s):

Both Primary (Run) and Secondary Edition (Patch) file systems will each contain these logs:
Main installation log:
$INST_TOP/logs/.log
FMW and OHS TechStack Installation/Patching logs:
$APPL_TOP/admin/$CONTEXT_NAME/log/installAppl.log
$APPL_TOP/admin/$CONTEXT_NAME/log/ebsfmwlayout.log
$APPL_TOP/admin/$CONTEXT_NAME/log/NetServiceHandler.log
$APPL_TOP/admin/$CONTEXT_NAME/log/adcvmlog.xml
$APPL_TOP/admin/$CONTEXT_NAME/log/executeac.log
$APPL_TOP/admin/$CONTEXT_NAME/log/deploytech.log

$APPL_TOP/admin/$CONTEXT_NAME/logs/wls1036.log
$APPL_TOP/admin/$CONTEXT_NAME/logs/oracle.apps.fnd.txk.default0.log
$APPL_TOP/admin/$CONTEXT_NAME/logs/oracle.apps.fnd.txk.install0.log
/logs/.log
/logs/cloneActions.log
/logs/install.log
/logs/installActions.log
/logs/installProfile.log
/logs/installSummary.log
/logs/OPatch.log
/logs/oraInstall.log
/logs/silentInstall.log
Forms Oracle Home installation logs:
$APPL_TOP/admin/$CONTEXT_NAME/log/ApplyAppsTechStack.log
$INST_TOP/admin/log/ohclone.log
$INST_TOP/admin/log/ApplyAppsTechStack_.log
Service Control logs :
$INST_TOP/logs/appl/admin/log/adadminsrvctl.txt
$INST_TOP/logs/appl/admin/log/adalnctl.txt
$INST_TOP/logs/appl/admin/log/adapcctl.txt
$INST_TOP/logs/appl/admin/log/adcmctl.txt
$INST_TOP/logs/appl/admin/log/adforms-c4wsctl.txt
$INST_TOP/logs/appl/admin/log/adformsctl.txt
$INST_TOP/logs/appl/admin/log/adnodemgrctl.txt
$INST_TOP/logs/appl/admin/log/adoacorectl.txt
$INST_TOP/logs/appl/admin/log/adoafmctl.txt
$INST_TOP/logs/appl/admin/log/adopmnctl.txt
$INST_TOP/logs/appl/admin/log/adstpall.log
$INST_TOP/logs/appl/admin/log/adstrtal.log
$INST_TOP/logs/appl/admin/log/jtffmctl.txt

Monday, August 11, 2014

Step by Step installing Oracle 11g R2 on Oracle Solaris 10



1) Create necessary groups and a user

groupadd oinstall
groupadd dba
useradd -g oinstall -G dba -d /home/oracle -s /usr/bin/bash oracle
passwd oracle

2) Create necessary folder for the installation

mkdir -p /u01/oracle/product/11.2.0/db_1
mkdir /u01/oracle/tmp
chown -R oracle:oinstall /u01/oracle

3) Change kernel parameters

projadd -U oracle -K "project.max-shm-memory=(priv,4g,deny)" oracle
projmod -sK "project.max-sem-nsems=(priv,256,deny)" oracle
projmod -sK "project.max-sem-ids=(priv,100,deny)" oracle
projmod -sK "project.max-shm-ids=(priv,100,deny)" oracle
echo "set maxuprc=16384" >> /etc/system
echo "set max_nprocs=30000" >> /etc/system
echo "set shmsys:shminfo_shmmax=4294967295" >> /etc/system

Now reboot the machine and login with an oracle user.
Let’s create a new swap file with 1Gb size, as it’s required for the Oracle installation

mkfile 1024m /u01/oracle/orcl_swap
swap -a /u01/oracle/orcl_swap

Now change the .profile file of the oracle user and set necessary environment variables:
edit /home/oracle/.profile

export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export PATH=$ORACLE_HOME/bin:$PATH
export TMP=/u01/oracle/tmp
export TMPDIR=/u01/oracle/tmp
export DISPLAY=:0.0

Now create an “installation” directory under /u01/oracle
Then mount the cdrom device and copy the installation files to that directory
Extract both files uzing unzip utility, and start the installation

unzip solaris.x64_11gR2_database_1of2.zip
unzip solaris.x64_11gR2_database_2of2.zip
cd database

./runInstaller


Sunday, August 10, 2014

How to Find the Size of a DB2 Database

DB2′s get_dbsize_info Function

db2 => connect to dd
 
   Database Connection Information
   Database server        = DB2/LINUX 8.2.8
   SQL authorization ID   = DB2UDB
   Local database alias   = dd

db2 => call get_dbsize_info(?,?,?,-1)
 
  Value of output parameters
  --------------------------
  Parameter Name  : SNAPSHOTTIMESTAMP
  Parameter Value : 2014-08-10-15.53.40.550222
 
  Parameter Name  : DATABASESIZE
  Parameter Value : 216819380224
 
  Parameter Name  : DATABASECAPACITY
  Parameter Value : 439644852736
 
  Return Status = 0
 
db2 =>
 
With a bit of math,  we can see that the size of the database is 201.92 GB. These numbers include only used pages  in the tablespace. This means that it essentially covers table data and index data and not much else. It also means that if you have DMS tablespaces with a large amount of free space, you may have more space actually taken up on disk than the value of DATABASESIZE as reported here.
 
The DATABASECAPACITY is calculated by adding up pages that have been allocated but not used in DMS tablespaces and filesystem free space for filesystems that hold SMS tablespaces. There are problems inherent in that, of course – you may have a lot of filesystem space where DMS containers reside that would not be reflected in DATABASECAPACITY until you extend the tablespace(s) to use them, and you may also have SMS tablespaces in a filesystem where you really shouldn’t use the filesystem up to 100%.

Friday, June 19, 2009

Oracle Scripts

Reports users waiting for locks

SELECT sn.username, m.sid, m.type,
DECODE(m.lmode, 0, 'None',
1, 'Null',
2, 'Row Share',
3, 'Row Excl.',
4, 'Share',
5, 'S/Row Excl.',
6, 'Exclusive',
lmode, ltrim(to_char(lmode,'990'))) lmode,
DECODE(m.request,0, 'None',
1, 'Null',
2, 'Row Share',
3, 'Row Excl.',
4, 'Share',
5, 'S/Row Excl.',
6, 'Exclusive',
request, ltrim(to_char(m.request,
'990'))) request, m.id1, m.id2
FROM v$session sn, v$lock m
WHERE (sn.sid = m.sid AND m.request != 0)
OR (sn.sid = m.sid
AND m.request = 0 AND lmode != 4
AND (id1, id2) IN (SELECT s.id1, s.id2
FROM v$lock s
WHERE request != 0
AND s.id1 = m.id1
AND s.id2 = m.id2)
)
ORDER BY id1, id2, m.request;

-------------------------------------------------------
This script will generate information about Rollback Segments

select segment_name sn, decode(owner,'PUBLIC','Publ','Priv') ow,
tablespace_name ts, name fn
from sys.dba_rollback_segs d, v$datafile f
where d.file_id = f.file#;

prompt
prompt Online Rollback Segments:
select d.segment_name nm,
s.extents ex,
(s.rssize/1024)||'K' rs,
d.initial_extent init,
d.next_extent next,
d.pct_increase pct,
d.min_extents mi,
d.max_extents ma,
optsize op,
decode(d.status,'ONLINE','OnL','OFFLINE','OffL') st
from v$rollname n, v$rollstat s, sys.dba_rollback_segs d
where n.usn = s.usn
and d.segment_name = n.name(+);


-------------------------------------------------------
Datafile Information

select substr(FILE_ID,1,3) "ID#",
substr(FILE_NAME,1,52) "DataFile Name",
substr(TABLESPACE_NAME,1,25) "Related Tablespace",
BYTES "Bytes",
BLOCKS "SQL Blks",
BYTES/512 "VMS Blocks",
STATUS
from sys.dba_data_files
order by TABLESPACE_NAME, FILE_NAME;

-----------------------------------------------------------

Table Information

--- This Gives the tables size information

select substr(OWNER,1,15) "Owner",
substr(TABLESPACE_NAME,1,32) "Tablespace Name",
substr(TABLE_NAME,1,24) "Table Name",
substr(PCT_FREE,1,3) "%F",
substr(PCT_USED,1,3) "%U",
substr(INI_TRANS,1,2) "IT",
substr(MAX_TRANS,1,3) "MTr",
substr(INITIAL_EXTENT,1,10) "INI_Extent",
substr(NEXT_EXTENT,1,10) "Next Exts",
substr(MIN_EXTENTS,1,5) "MinEx",
substr(MAX_EXTENTS,1,5) "MaxEx",
substr(PCT_INCREASE,1,5) "%Incr"
from sys.dba_tables
order by owner, tablespace_name, table_name;


-----------------------------------------------------------

Other Objects Information

--- This Gives the Other Objects Information

select substr(owner,1,10) Owner,
substr(OBJECT_NAME,1,25) Object_Name,
object_type, status, created
from sys.dba_objects
where object_type not in
('INDEX', 'SYNONYM', 'TABLE', 'VIEW')
AND OWNER not in ('SYS', 'SYSTEM')
order by owner, object_type;


Note:

PROOFREAD THIS SCRIPT BEFORE USING IT!

Determine the Locks in Oracle

To list out the Locked Objects

select c.owner, c.object_name, b.sid, b.serial#, b.status, b.osuser, b.machine ,a.process
from v$locked_object a , v$session b, dba_objects c
where
b.sid = a.session_id
and a.object_id = c.object_id;

Session Blocking Other session
Query 1:

select l1.sid, ' IS BLOCKING ', l2.sid
from v$lock l1, v$lock l2
where l1.block =1 and l2.request > 0
and l1.id1=l2.id1
and l1.id2=l2.id2;

Query 2:

select s1.username || '@' || s1.machine
|| ' ( SID=' || s1.sid || ' ) is blocking '
|| s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_status
from v$lock l1, v$session s1, v$lock l2, v$session s2
where s1.sid=l1.sid and s2.sid=l2.sid
and l1.BLOCK=1 and l2.request > 0
and l1.id1 = l2.id1
and l2.id2 = l2.id2

Displaying Information About Running Jobs - Oracle

Displaying Information About Running Jobs

You can also display information about only the jobs currently running. The following query lists the session identifier, job number, user, who submitted the job, and the start times for all currently running jobs:

SELECT SID, r.JOB, LOG_USER, r.THIS_DATE, r.THIS_SEC
FROM DBA_JOBS_RUNNING r, DBA_JOBS j WHERE r.JOB = j.JOB;

Check Job Queue in Oracle

Displaying Information about a Job

The following query creates a listing of the job number, description, next execution time and broken status for each job you have submitted:

SELECT JOB, SUBSTR(WHAT,1,35), NEXT_DATE, NEXT_SEC, BROKEN FROM DBA_JOBS;