Tuesday, May 31, 2016

Install Oracle Database 11.2.0.2 on OEL6

a. Copy Software to /stage

b. Minimum Hardware Requirements
 Ensure that your system meets the following Physical Memory requirements:
 Minimum: 1 GB of RAM
 Recommended: 2 GB of RAM or more

c.Swap disk space proportional to the system's physical memory as follows:

RAM                              Swap Space

Between 1 GB and 2 GB       1.5 times the size of RAM

Between 2 GB and 16 GB      Equal to the size of RAM

More than 16 GB                      16 GB

NOTE: The above recommendations (from the Oracle® Database Installation Guide 12c Release 1 (12.1) for Linux) are MINIMUM recommendations for installations. Further RAM and swap space may be required to tune/improve RDBMS performance.

d. 1.0 GB (1024MB) of disk space (and less than 2TB of disk space) in the /tmp directory.

 If the free space available in the /tmp directory is less than what is required, then complete one of the following steps:

Delete unnecessary files from the /tmp directory to meet the disk space requirement.
 Set the TMP and TMPDIR environment variables when setting the oracle user's environment.

e. Approximately 6.5 GB of local disk space for the Database Software Files.

f.Install oracle-validated rpm which will take care of all pre-req steps.

yum install oracle-validated

1.It will install all required rpms.
2.change kernel parameters.
3.change /etc/security/limits.conf flle.

g.Make sure umask is 022.

h.Verify the latest version of PAM is loaded, then add or edit the following line in the /etc/pam.d/login file, if it does not already exist:
session required pam_limits.so


i. Start Run installer


Issues faced while installing :

11.2.0.2: The installer should only show a single "missing package" failure for the "pdksh" package. It can be ignored because we installed the "ksh" package in its place.

j.Run root.sh and verify by logging in database

Wednesday, May 18, 2016

Decrypt Weblogic password from config files

Today I have installed weblogic  server and tried to start after installation.But it didn't start and  threw below error

weblogic.security.SecurityInitializationException: Authentication for user weblogic denied.


I have given the same password(YXXGEDIUJLIKEBC1) which I had given during installation. Now situation became bit tricky. I had a dilemma whether to reinstall or not. Then I started to debug like below.

Decrypt weblogic password from config files & proceed with the configuration.


Below are the steps to decrypt weblogic password.

Save below code in /tmp/decrypt.py


import os
import weblogic.security.internal.SerializedSystemIni
import weblogic.security.internal.encryption.ClearOrEncryptedService

def decrypt(agileDomain, encryptedPassword):
    agileDomainPath = os.path.abspath(agileDomain)
    encryptSrv = weblogic.security.internal.SerializedSystemIni.getEncryptionService(agileDomainPath)
    ces = weblogic.security.internal.encryption.ClearOrEncryptedService(encryptSrv)
    password = ces.decrypt(encryptedPassword)

    print "Plaintext password is:" + password

try:
    if len(sys.argv) == 3:
        decrypt(sys.argv[1], sys.argv[2])
    else:
                print "Please input arguments as below"
                print "         Usage 1: java weblogic.WLST decryptWLSPwd.py  "
                print "         Usage 2: decryptWLSPwd.cmd "
                print "Example:"
                print "         java weblogic.WLST decryptWLSPwd.py C:\Agile\Agile933\agileDomain {AES}JhaKwt4vUoZ0Pz2gWTvMBx1laJXcYfFlMtlBIiOVmAs="
                print "         decryptWLSPwd.cmd {AES}JhaKwt4vUoZ0Pz2gWTvMBx1laJXcYfFlMtlBIiOVmAs="
except:
    print "Exception: ", sys.exc_info()[0]
    dumpStack()
    raise


Get the encrypted password for weblogic. since it is a fresh installation,we don't have boot.properties files.To search encrypted password,grep like below

cd $DOMAIN_HOME
grep -R "{AES}"   *

so we need to get it from below locaiton.

Weblogic password: $DOMAIN_HOME/init-info/security.xml

init-info/security.xml:  <user name="weblogic" password="{AES}418Va/Twg/g5sc0ycaV+isOtn3sm1yukOS6MfLS4ynltAsRSE6UcRWwtBn42EZLB" description="This user is the default administrator." isAdmin="true">


Node Manager password : $DOMAIN_HOME/init-info/config-nodemanager.xml

<nod:password>{AES}g3OWmrfYmB4CREgL8WATHkeF8dHZKkDzbCBEmojBipvPrS+77r3otrjlMk0EsLiE</nod:password>


cd $DOMAIN_HOME

/as12c/jaytrn/product/middleware/12.1.3/user_projects/domains/CustAppDom
. /as12c/jaytrn/product/middleware/12.1.3/user_projects/domains/CustAppDom/bin/setDomainEnv.sh

/as12c/jaytrn/product/middleware/12.1.3/user_projects/domains/CustAppDom

Script usage : java weblogic.WLST /tmp/decrypt.py  $DOMAIN_HOME <ENCRYPTED_PWD>

output:

jay::raapjay1trn1> java weblogic.WLST /tmp/decrypt.py .  {AES}418Va/Twg/g5sc0ycaV+isOtn3sm1yukOS6MfLS4ynltAsRSE6UcRWwtBn42EZLB

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

Plaintext password is:????????????????


Strange,I have given characters,but it shows questionmarks above.But it worked ,Now I am able to start weblogic with the password ????????????????


We will try to decrypt nodemanger password as well

/as12c/jaytrn/product/middleware/12.1.3/user_projects/domains/CustAppDom
jay::raapjay1trn1> java weblogic.WLST /tmp/decrypt.py .  {AES}g3OWmrfYmB4CREgL8WATHkeF8dHZKkDzbCBEmojBipvPrS+88r3otrjiMk0EsYiE

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

Plaintext password is: YZZGEDIUJLIKEBC1



Change Weblogic password from ???????????????? to YXXGEDIUJLIKEBC1:

a) Start Webloigc with password ???????????????? and login to console

b) Access the Admin server console with the URL https://<machine.domain>:<port>/console

C) Login to Admin server console as user weblogic and provide its password.

d) Navigate to Security Realms->myrealm->Users and Groups->choose weblogic->Passwords

e) Provide the new password and save it.

f)  Navigate to Security Realms->myrealm->Users and Groups->choose OracleSystemUser->Passwords
    Provide same password as for the weblogic user and save it.

g)  Navigate to Security Realms->myrealm->Users and Groups->choose weblogic_mntr->Passwords
    Provide same password as for the weblogic user and save it.

h)  Click on 'Activate Changes' in the left panel.

i)  Modify boot.properties file also (since it is fresh installation,I didn't setup boot.properties file)

j) Restart weblogic server

Thursday, May 12, 2016

Steps to Refresh RAC Database using RMAN Backup

Environment Details:

Source : (Two Node RAC)
Database  :   RJ1PRD
ASM DG :  +RJ1PRD_DG

Target: (Two Node RAC)
Database  :  RJ1UAT
ASM DG :  +RJ1UAT_DG


1. Copy the RMAN backup pieces to Target Database Server.

2. Take a backup of db_link and proxy users etc...from Target Database.

3. Shut-down the Target Database RJ1UAT .(Both instances)

4.  Please Add below *convert* parameters and modify cluster_database parameter from true to false on first node.

Ex:
# added for cloning
db_file_name_convert=('+RJ1PRD_DG','+RJ1UAT_DG')
log_file_name_convert=('+RJ1PRD_DG','+RJ1UAT_DG')
*.cluster_database=FALSE

5. Start the database on first node.

6. Make sure we have enough space on Target ASM diskgroup.

SELECT name, total_mb/1024/1024 TOTAL_TB,free_mb/1024/1024 FREE_TB, free_mb/total_mb*100 as percentage  FROM v$asm_diskgroup where name='RJ1UAT_DG';

7.Drop Target Database.

shurtdown the database and startup mount in restrict mode.

SQL> startup mount exclusive restrict
ORACLE instance started.

Total System Global Area 2.9931E+10 bytes
Fixed Size                  2267792 bytes
Variable Size            1.2885E+10 bytes
Database Buffers         1.6979E+10 bytes
Redo Buffers               64827392 bytes
Database mounted.

SQL> select logins,parallel from v$instance;

LOGINS     PAR
---------- ---
RESTRICTED NO

SQL> select name from v$database;

NAME
---------
RJ1UAT

SQL> drop database;

Database dropped.

Then make sure all the data& control files are deleted properly or not.you can check the free space using below query .

SELECT name, total_mb/1024/1024 TOTAL_TB,free_mb/1024/1024 FREE_TB, free_mb/total_mb*100 as percentage  FROM v$asm_diskgroup where name='RJ1UAT_DG';



8.Startup nomount and issue duplicate command on first node.

 startup nomount;

Save the file restore.rman with below commands.

run
{
 allocate auxiliary channel ch1 type disk;
allocate auxiliary channel ch2 type disk;
allocate auxiliary channel ch3 type disk;
allocate auxiliary channel ch4 type disk;
allocate auxiliary channel ch5 type disk;
allocate auxiliary channel ch6 type disk;
allocate auxiliary channel ch7 type disk;
allocate auxiliary channel ch8 type disk;
duplicate database to RJ1UAT
BACKUP LOCATION '/backup/RMAN_BACKUPS/Sat/'
 logfile
    group 1 ('+RJ1UAT_DG', '+RJ1UAT_DG') size 500M REUSE,
    group 2 ('+RJ1UAT_DG', '+RJ1UAT_DG') size 500M REUSE,
    group 3 ('+RJ1UAT_DG', '+RJ1UAT_DG') size 500M REUSE,
    group 4 ('+RJ1UAT_DG', '+RJ1UAT_DG') size 500M REUSE,
    group 5 ('+RJ1UAT_DG', '+RJ1UAT_DG') size 500M REUSE
 ;
}

rman auxiliary / nocatalog log=/backup/RMAN_BACKUPS/logs/RJ1UAT.log
@restore.rman

9. Once the dupicate command completed,remove the below parameters from init.ora and change the cluster_database value on first node.

# Remove after cloning
db_file_name_convert=('+RJ1PRD_DG','+RJ1UAT_DG')
log_file_name_convert=('+RJ1PRD_DG','+RJ1UAT_DG')
#change after cloning
*.cluster_database=TRUE

Recycle the database


10.  Add the redo log thread for instacne 2.

alter database add logfile thread 2 group 6 ('+RJ1UAT_DG') size 500m reuse;
alter database add logfile thread 2 group 7 ('+RJ1UAT_DG') size 500m reuse;
alter database add logfile thread 2 group 8 ('+RJ1UAT_DG') size 500m reuse;
alter database add logfile thread 2 group 9 ('+RJ1UAT_DG') size 500m reuse;
alter database add logfile thread 2 group 10 ('+RJ1UAT_DG') size 500m reuse;
alter database enable public thread 2;


11.Then start the database on second node and verify gv$instance & Start the listener



Note : In case if you want to find out the time of restored data,you can grep "set until scn" from /backup/RMAN_BACKUPS/logs/RJ1UAT.log .Based on that SCN,you can find the timestamp.

select scn_to_timestamp(2880392)from dual;

Wednesday, May 11, 2016

How to start weblogic server after improper shutdown

Today one of my application server got rebooted automatically due to insufficient memory.When we tried to start weblogic ,we were getting below exception in logs.

"Reason: weblogic.store.PersistentStoreFatalException: [Store:280105]The persistent file store "UMSJMSFileStore_auto_2" cannot open file UMSJMSFILESTORE_AUTO_2000000.DAT.> 
weblogic.management.DeploymentException: java.io.IOException: Error from fcntl() for file locking, Resource temporarily unavailable, errno=11"



We  need to do below steps to start weblogic.


1. From your ...domains/[DOMAIN] directory (and below) find and move all *.DAT files

mkdir /tmp/bkup
export BKUP_DIR=/tmp/bkup
cd $DOMAIN_HOME
find . -name *.DAT
find . -name *.DAT   -exec mv -t $BKUP_DIR  {} \;



2. Find and move all lok files in a similar method

cd $DOMAIN_HOME
find . -name *.lok
find . -name *.lok   -exec mv -t $BKUP_DIR  {} \;


3. In case if you configured JMS,we need to remove *.DAT files from the jms location as well.We have SOA managed server with clustering.our second node got rebooted.so we need to find the files which contains *AUTO_2000000* in name and move


cd /u01/oracle/config/domains/soa_domain
find . -name *AUTO_2000000*
find . -name *AUTO_2000000*  -exec mv -t $BKUP_DIR  {} \;


4.Mostly persistent store location will be inside domain_home.But in our case(SOA) we stored it in the different location.so we had to  move the *.DAT file from default persistent stores  location.

cd /u01/oracle/config/domains/soa_domain
find . -name _WLS*2000000*DAT
find . -name _WLS*2000000*DAT -exec mv -t $BKUP_DIR  {} \;

5.Now try to start Weblogic,Hopefully it will start.














How to Compile Forms , Reports & Custom.pll in R12.2

How to Compile Custom.pll   cd $AU_TOP/resource  cp CUSTOM.plx CUSTOM.plx_bkup  cp CUSTOM.pll CUSTOM.pll_bkup  frmcmp_batch module=CUSTOM.pl...