Showing posts with label System Admin. Show all posts
Showing posts with label System Admin. Show all posts

Wednesday, March 11, 2020

How to reset the Weblogic admin server password


In some case we need to change the weblogic password, and then we can follow the below steps to reset it.

Step 1:

Set the following environment variables (update the domain name    as appropriate):

export FMW_HOME=/u01/app/oracle/product/middleware
export DOMAIN_HOME=$FMW_HOME/user_projects/domains/
export CLASSPATH=$CLASSPATH:$MW_HOME/wlserver_10.3/server/lib/weblogic.jar

NOw we will run the env as shown below.
. $DOMAIN_HOME/bin/setDomainEnv.sh

Step 2:

Need to shut down weblogic domain:
$DOMAIN_HOME/bin/stopWebLogic.sh

Step 3:

Rename and backup the DefaultAuthenticatorInit.ldift file as shown below,

cd $DOMAIN_HOME/security
mv DefaultAuthenticatorInit.ldift DefaultAuthenticatorInit.ldift.old

Now run the following command to generate a new DefaultAuthenticatorInit.ldift file. ((here ‘weblogic’ is default username))

java weblogic.security.utils.AdminAccount .

Note: Don't forget the period "." at the end of the this command, otherwise you will get "Error: Invalid arguments"

Rename and backup the following LDAP directory.

mv $DOMAIN_HOME/servers/AdminServer/data/ldap $DOMAIN_HOME/servers/AdminServer/data/ldap.old
(This ldap directory will be recreated once weblogic server startup time)

Step 4:


Back and Edit the boot.properties file and update the new password. (Above new_password)

cd $DOMAIN_HOME/servers/AdminServer/security
cp boot.properties  boot.properties_old

vi boot.properties
password=
username=

(Note: New password will be encrypted once server starts)

Step 5:


Now start your weblogic domain.

[oracle@appserver01 bin]# cd /root/MW_home/user_projects/domains/base_domain/bin/
[oracle@appserver01 bin]# ls
nodemanager  nohup.out  server_migration  service_migration  setDomainEnv.sh 
startManagedWebLogic.sh  startWebLogic.sh  stopManagedWebLogic.sh  stopWebLogic.sh
[oracle@appserver01 bin]# nohup ./startWebLogic.sh &
[oracle@appserver01 bin]# nohup: appending output to `nohup.out'
[oracle@appserver01 bin]# tail -f nohup.out 

Server state during the startup:
 
 
 
 
 
 

Now we can access your weblogic console page.

Wednesday, February 6, 2019

iptables in hp ux



IPTABLES are not used in hpux , iptables used only in linux.



Using Ipfilter to block connections from an external machine to our HPUX box
Wed, 08/12/2009 - 15:04 — liquid
Hi,

This is a quick introduction to Ipfilter on HP-UX:

First we have to start the daemons and load the DLKM module

in the file /etc/rc.config.d/ipfconf

we set the IPF_START to 1

IPF_START=1

Then we load the kernel module

# /sbin/init.d/ipfboot start
Set 0 now inactive
Set 0 now inactive
0 entries flushed from NAT table
0 entries flushed from NAT list

we can check the kernel module is loaded:

# kcmodule| grep ipf
ipf loaded explicit auto-loadable, unloadable

then we check ipf is working ok:

# ipf -V
ipf: HP IP Filter: v3.5alpha5 (A.11.23.15.01) (376)
Kernel: HP IP Filter: v3.5alpha5 (A.11.23.15.01)
Running: yes <---- font="" ok="">
Log Flags: 0 = none set
Default: pass all, Logging: available
Active list: 1

know we can write the firewall rules to our config file:

# vi /etc/opt/ipf/ipf.conf

we are going to use a very easy example, we we block any incoming conections from the server 0189 to our HP-UX box

block in quick on lan0 from 0189 to any
pass in from any to any

using the quick keyword makes the package that matches that rule will be applied inmediatly, no going trough anymore rules.

We load the new config:

#ipf -Fa -f /etc/opt/ipf/ipf.conf

Check if our rules are active:

# ipfstat -io
empty list for ipfilter(out)
block in quick on lan0 from 1.7.2.3/23 to any
pass in from any to any

Now i can't ssh,ping,etc the HPUX_BOX from my pc desktop:

P:\>ping HPUX_BOX

Haciendo ping a HPUX_BOX [1.7.2.23] con 32 bytes de datos:

Tiempo de espera agotado para esta solicitud.
Tiempo de espera agotado para esta solicitud.
Tiempo de espera agotado para esta solicitud.
Tiempo de espera agotado para esta solicitud.

Estadísticas de ping para 1.7.2.23 :
Paquetes: enviados = 4, recibidos = 0, perdidos = 4
(100% perdidos),

We can check out the stats and see how the blocked counter increases:

[root@vmfcont:~]# ipfstat | grep -i blocked
input packets: blocked 7 passed 13677 nomatch 1 counted 0 short 0
output packets: blocked 0 passed 570 nomatch 268 counted 0 short 0

If we wan't to flush the rules and delete them from the active ipf:

# ipf -Fa
# ipfstat -io
empty list for ipfilter(out)
empty list for ipfilter(in)

For more info:

http://www.docs.hp.com/en/B9901-90029/index.html

Wednesday, December 27, 2017

Problem to mount NFS : mount: wrong fs type, bad option, bad superblock

Sometime, we may get error as  mount: wrong fs type, bad option, bad superblock while trying to mount NFS file in ubuntu. For my case, i faced the problem showing the error as:


The reason behind it that for several filesystems (e.g. nfs, cifs) we might need a /sbin/mount. helper program.
As we are trying to mount NFS. The /sbin/mount.nfs helper program is provided by nfs-common. We can install it with:

sudo apt-get update
sudo apt install nfs-common

On the other hand, if we are trying to mount CIFS, the helper program is provided by cifs-utils. We can install it using below command:

sudo apt install cifs-utils


Then we can mount our target as:
We will have to create a directory where to mount the nfs,

sudo mount :/ /

Thursday, December 14, 2017

VisualVM for monitoring remote jvm

Using VisualVM we can monitor all the running Java Process and status of JDK behind these processes. VisualVM can be found inside the JDK bin directory.



By running VisualVM, by default we can access the locally run processes. To get the Remote Server processes, we have to connect with that server through credential. And in the target server, jstatd must be in running.

jstatd: 

Monitors Java Virtual Machines (JVMs) and enables remote monitoring tools to attach to JVMs. This command is experimental and unsupported. 
The jstatd command is an RMI server application that monitors for the creation and termination of instrumented Java HotSpot VMs and provides an interface to enable remote monitoring tools to attach to JVMs that are running on the local host.


To run jstatd, java security permission is required. For this purpose, at the starting of jstatd, argument will have to be passed in the command line as:

 jstatd -J-Djava.security.policy=/home/paul/jstatd.all.policy



content of jstatd.all.policy  is as:

bash-4.3$ cat /home/oracle/jstatd.all.policy

grant codebase "file:${java.home}/../lib/tools.jar" {
   permission java.security.AllPermission;
};


It permits only the min required security related permission .




Sunday, October 29, 2017

ORA-02297: cannot disable constraint -dependencies exist

ORA-02297: cannot disable constraint -dependencies exist

Whenever you try to disable a constraint of a table it fails with error message ORA-02297: cannot disable constraint -dependencies exist as below.

SQL> alter table transaction disable constraint TRANSACTION_PK;
alter table transaction disable constraint TRANSACTION_PK
*
ERROR at line 1:
ORA-02297: cannot disable constraint (OMS.TRANSACTION_PK) - dependencies exist

Reason behind this problem is as:
Disable constraint command fails as the table is parent table and it has foreign key that are dependent on this constraint.

This problem can be solved in different ways.

Two solutions exist for this problem.
1)Find foreign key constraints on the table and disable those foreign key constraints and then disable this table constraint.

Following query will check dependent table and the dependent constraint name. After that disable child first and then parent constraint.

SQL> SELECT p.table_name "Parent Table", c.table_name "Child Table",
     p.constraint_name "Parent Constraint", c.constraint_name "Child Constraint"
     FROM user_constraints p
     JOIN user_constraints c ON(p.constraint_name=c.r_constraint_name)
     WHERE (p.constraint_type = 'P' OR p.constraint_type = 'U')
     AND c.constraint_type = 'R'
     AND p.table_name = UPPER('&table_name');
Enter value for table_name: transaction
old   7:      AND p.table_name = UPPER('&table_name')
new   7:      AND p.table_name = UPPER('transaction')

Parent Table                   Child Table                    Parent Constraint              Child Constraint
------------------------------ ------------------------------ ------------------------------ ------------------------------
TRANSACTION                    USER_SALARY_RECORD             TRANSACTION_PK                 SYS_C005564
TRANSACTION                    TRANSACTION_DETAIL             TRANSACTION_PK                 TRNSCTN_DTL_TRNSCTN_FK

SQL> alter table USER_SALARY_RECORD disable constraint SYS_C005564;
Table altered.

SQL> alter table TRANSACTION_DETAIL  disable constraint TRNSCTN_DTL_TRNSCTN_FK;
Table altered.

SQL> alter table transaction disable constraint TRANSACTION_PK;
Table altered.

2)Disable the constraint with cascade option.

SQL> alter table transaction disable constraint TRANSACTION_PK cascade;
Table altered.

Thursday, October 12, 2017

Searching text in the file contents inside a directory in linux

Sometimes, We need to find out specific string of text in the files' Contents of a directory of linux system. Its to look for text within the file, no tin the file name. 


In such case we can user the below command:


grep -r -l "specific test" /directory/path/full/*criteria_if_required_in_file_name*log

Tuesday, October 10, 2017

weblogic.net.http.SOAPHttpsURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection

In weblogic environment, a error "weblogic.net.http.SOAPHttpsURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection" may come while trying to connect to a url using javax.net.ssl.HttpsURLConnection.

For my case, modification of the config.xml file inside the cofig directroy inside the server domain directory solved the problem.


<server-start>
<arguments>-DUseSunHttpHandler=true</arguments>
</server-start>

This will tell the weblogic server to use the Sun Http Handlers and not install its own at the time of starting weblogic server.

Thursday, July 6, 2017

NGINX: upstream timed out (110: Connection timed out) while reading response header from upstream

For my case, I got around this issue by clearing the connection keep-alive flag and specifying http version as per the answer here: 

https://stackoverflow.com/a/36589120/479632

server {
    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;

        # these two lines here
        proxy_http_version 1.1;
        proxy_set_header Connection "";

        proxy_pass http://localhost:5000;
    }
}

Thursday, November 17, 2016

Sheel Script for Deleting files older than some days

find is the common tool for this kind of task :

find ./target_dir ! -name 'stayhere.txt' -mtime +5 -type f -delete


EXPLANATIONS

./target_dir your directory (replace with your own)
! -name File to exclude
-mtime +5 older than 5 days
-type f only files
-delete no surprise. Remove it to test your find filter before executing the whole command
And take care that ./target_dir exists to avoid bad surprises !

Thursday, May 26, 2016

Terminator Termina Shortcut in Ubuntu


Its very useful to use shortcut than moving cursor operate terminal. Here is the shortcut for operating Terminator terminal in Ubuntu :


Thursday, May 5, 2016

Excuting local shell script to remote Server

System admin needs to get different information from different servers for various purposes at different times. For the case of collecting informartion from many different servers, its best practise to make a script with the required query and execute that on those servers and collect the output. And that output may be needed to transfer to location PC for further annalysis.

The above task is so much time consuming for the case of different severs and gatthering the inforamtion in the local PC.  To get rid from the fatigue, we can perfrom the task with a little tricks.

Step 1: Wer can write down the scirpt with all the commands to execute on those servers.
Step 2: We can execute the script on the remote servers from local machine and forward the output to the output file.

We are focusing here the process of executing the local script to remote servers.

Suppose, we have a script[dbhostcheck.sh] as below for checking the system information:

#! /bin/bash

echo "Host Name:"|hostname

echo
echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
echo "Disk Checking"
echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
df

echo
echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
echo "CPU Utilization"
echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
sar 1 10

echo
echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
echo "Memory Utilization"
echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"

vmstat 1 10

NO we want to execute this script on a remote server. For this purpose we can excute it with the below command:

ssh user_name@name_of_host "/usr/local/bin/bash -s" -- <./dbhostcheck.sh >output.txt

Through the ssh user_name@name_of_host we are remotely accessing the host
"/usr/local/bin/bash -s": we are making the the bash for collecting standard output.-- <./dbhostcheck.sh:  Providing script information to the bash
 >output.txt redirecting the output to the file names  output.txt






Tuesday, April 26, 2016

Find and kill a process in one line using bash

For operation and other pusposes, we need to kill process in linux system. For this purpose, at first we find the process id then we kill the process with the process id. i.e

[agentrpt@localhost ~]$ ps -ef | grep 'jar'
agentrpt 13131     1  0 16:49 ?        00:00:00 java -jar ABS_ALERT_MIDDLEWARE.jar
agentrpt 13278     1  0 16:54 ?        00:00:00 java -jar SMSMailClient.jar
agentrpt 13402 13367  0 16:58 pts/0    00:00:00 grep jar

For killing process of java -jar SMSMailClient.jar, We need to executge command as:
kill 13278

We can do it in a simple way. For the using the script regulary we can create a script with the below command.

In bash, you should be able to do:

kill $(ps aux | grep '[SMS]MailClient.jar' | awk '{print $2}')
Details on its workings are as follows:

The ps gives you the list of all the processes.
The grep filters that based on your search string, [SMS] is a trick to stop you picking up the actual grep process itself.
The awk just gives you the second field of each line, which is the PID.

Thursday, April 21, 2016

Remove all files/directories except for one file

find . ! -name 'filetoexist.txt' -type f -exec rm -f {} +

will remove all files except filetoexist.txt. To remove directories, change -type f to -type d and add -r option to rm.

To exclude list of files: ! \( -name one_file -o -name two_file \)

In bash, to use rm !(file.txt), we will have to enable extglob:

$ shopt -s extglob
$ rm !(file.txt)

Note that extglob only works in bash and Korn shell family. And using rm !(file.txt) can cause an Argument list too long error.

In zsh, you can use ^ to negate pattern with extendedglob enabled:

$ setopt extendedglob
$ rm ^file.txt

or using the same syntax with ksh and bash with options ksh_glob and no_bare_glob_qual enabled.

Wednesday, April 20, 2016

To get IP Address of Sun Server

For a normal user (i.e., not 'root') ifconfig isn't in his path, but it's the command.
More specifically: /usr/sbin/ifconfig -a
If we want the IP Address easily, we need some scripting as:
/usr/sbin/ifconfig -a | awk 'BEGIN { count=0; } { if ( $1 ~ /inet/ ) { count++; if( count==2 ) { print $2; } } }'

Monday, April 18, 2016

Modifying file using Vim and awk

In some case, we have to change a big file with the same type of text. We can use vim editor for doing this type of task. Suppose, we have a files as below:


Now for a need, we need to generate delete script from this file contents as below:


For doing so, 

1. we have opened the file using vim editor. vim loglistws.txt
2.Then we have used the below commnads to add double quate around the words : 
   :%s/EJB_Str/"EJB_Str/g
   
Then save the file using :w
   :%s/\.log/\.log"/g

3. Now save the file using :wq!
4. Now we have made a new file form the existing file as:
    cat loglistws.txt | awk '{print "rm ",$9,$10,$11,$12}' > myscriptws.sh

Sunday, April 17, 2016

Comparing between two packages

Many times we need to compare between different packages, wars, jars to find out the specific differences. We can use different tools for this purpose i.e pkgdiff, japi-complicance-checker, clirr. Here the process of finding differences has been depicted using the pkgdiff.

1. Download the zipped file from: https://github.com/lvc/pkgdiff/archive/1.7.2.tar.gz
2. Untar the files using the command: tar xvfz somefilename.tar.gz
3. Open the unzip folder.  in this folder make script is available.
4. Install the file using the command:  sudo make install prefix=/usr
5. Now compare the files using:  pkgdiff filename.jar filename_new.jar
6. The above command will provide the result.
7. A report will also be generated in html. We can get the details report from that file.

Wednesday, March 30, 2016

Archive Redo Log

An Oracle database can run in one of two modes. By default, the database is created in NOARCHIVELOG mode. Oracle Database lets you save filled groups of redo log files to one or more offline destinations using its ARCH process, known collectively as the archived redo log, or more simply the archive log. The process of turning redo log files into archived redo log files is called archiving.

When in NOARCHIVELOG mode the database runs normally, but there is no capacity to perform any type of point in time recovery operations or online backups. Thus, you have to shutdown the database to back it up, and when you recover the database you can only recover it to the point of the last backup. While this might be fine for a development environment, the big corporate types tend to frown when a weeks worth of current production accounting data is lost forever. We can check the status of the archiving mode of a database suing hte following query:

SQL> archive log list;
SQL> select log_mode from v$database;
we can also with the below commnad to find the process:
$ ps -ef|grep -i _arc

Wednesday, February 24, 2016

To run a command repeatedly in Linux

For many cases, we need to execute the command repeatedly in the shell. We can do it by cron. But in that cat its not feasible to use cron if the interval time is less than 1 min or more. Suppose, we are inclined to get the output like the top command for a specific command. We can do that in the following ways as:
watch Command
# watch free -m [By Default 2 Sec Interval]
# watch -n 10 script.sh [For the interval of 10 Seconds]
Sleep Command:
a) inside For Loop
# for i in {1..10}; do echo -n "This is a test in loop $i "; date ; sleep
b) Inside while Loop
# while true; do echo -n "This is a test of while loop";date ; sleep 5; done

Wednesday, February 17, 2016

Creating DB Link in Oracle Database

At first we need to add the desired database connection info in tnsnames.ora file. Usually location of tnsnames.ora file in $ORACLE_HOME/network/admin.  We will add connection info as below:

 <connection_name> =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = <db_host_name>)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = <remote_db_service_name>)
    )
  )

Monday, February 8, 2016

SARMON: nmon for Solaris

nmon (short hand for Nigel's Monitor) is a computer performance system monitor tool for the AIX and Linux operating systems developed by IBM employee Nigel Griffiths.
SARMON is for Solaris machine with the functionality of nmon.
The installation is very ease
1. Get the .zip file form Sarmon Download Link
2. Save on /var/tmp
3. Unzip the .zip
# unzip sarmon_v1.01.bin_sparc.zip
4. Make backup of original files
# cp /usr/bin/sar /usr/bin/sar.orig
# cp /usr/bin/timex /usr/bin/timex.orig
# cp /usr/lib/sa/sadc /usr/lib/sa/sadc.orig
5. Move the sarmon to /usr/local
# mv /var/tmp/sarmon_v1.01.bin_sparc /usr/local/sarmon
6. Copy files
# cp /usr/local/sarmon/sar /usr/bin/sar
# cp /usr/local/sarmon/timex /usr/bin/timex
# cp /usr/local/sarmon/sadc /usr/lib/sa/sadc
7. Edit the crontab and put the entry for collect
0 0 * * * /usr/local/sarmon/sa1 300 288 &
This start collect every day at 00:00
The files generated are in /var/adm/sa/ (day-by-day)