To
Create User group and to add user group :
sudo
usermod -g psdqnhspftp psadm2 -- here lowercase g primary group
sudo
usermod -G psdqnhspftp psadm2 -- here upercase G secondary group
sudo usermod -a -G
psdqnhspftp,psft,appinst psadm2 -- to
add multiple secondary group
adduser oracle2
adduser shibd
adduser i_umiafa
sudo usermod -a -G
oinstall,oracle,psft oracle2
/usr/sbin/groupadd shibd
sudo usermod -a -g oinstall -G
psft,appinst,oinstall psadm2
sudo usermod -a -g oinstall -G
psft,oinstall,j_umia,appinst psadm3
# /usr/sbin/groupadd appinst
# /usr/sbin/groupadd psft
#/usr/sbin/groupadd oinstall
Oracle User Creation
#
/usr/sbin/useradd -g oinstall -G dba oracle
adduser i_umia01
/usr/sbin/groupadd i_umiasf
/usr/sbin/useradd -g i_umia01 -G
i_umia01
/usr/sbin/useradd -g i_umiafa -G
i_umiafa
adduser i_umiafa
adduser i_umiasf
/usr/sbin/useradd -g shibd -G
oinstall shibd
useradd -g oinstall -G
dba,asmdba,oper emopr
useradd -g oinstall -G dba emopr
adduser psadm2
adduser psadm1
adduser psadm3
adduser esadm1
adduser oracle2
sudo usermod -a -G
sudo
usermod -G oinstall,psft
psadm3
sudo
usermod -G oinstall,psft
psadm2
sudo
usermod -G oinstall,psft
psadm3
sudo
usermod -g oinstall -G oinstall,psft
psadm2
sudo
usermod -g oinstall -G oinstall,psft
psadm1
sudo
usermod -g appinst -G appinst,psft
psadm3
sudo
usermod -g shibd -G oinstall shibd
sudo
usermod -g oinstall -G oracle,dba,i_umia,shibd oracle
sudo
usermod -G oinstall,dba,backupdba,dgdba,j_atlh oracle
sudo
usermod -G oinstall,dba,psft,appinst oracle
sudo usermod -a -G oinstall psadm3
sudo
usermod -g oinstall psadm2
sudo usermod -a -G appinst
prasbhas
sudo usermod -a -G oinstall psadm3
sudo
usermod -g oinstall ociagent
sudo usermod -a -G oinstall,dba
ociagent
Remove user group:
gpasswd -d prasbhas appinst
Some important OS Command
Copy xauthority from home directory.
xauth add $DISPLAY . hexkey
*********************************
DB commands to alter user
ALTER USER sidney IDENTIFIED BY
second_2nd_pwd DEFAULT TABLESPACE example;
ALTER USER sh PROFILE
new_profile;
ALTER USER sh DEFAULT ROLE ALL
EXCEPT dw_manager;
ALTER USER app_user1 IDENTIFIED
GLOBALLY AS 'CN=tom,O=oracle,C=US';
**********************************************
DB commands to create/grant roles
to users
select * from dba_users where
username like '%RATHEESH%';
create user RATHEESH identified
by xxxx profile userprofile default tablespace psdefault temporary tablespace
pstemp;
grant create session to RATHEESH;
grant SELUSER to RATHEESH;
select * from dba_role_privs
where GRANTEE='RBHASKARAN';
select NAME,PASSWORD from
user$ -- To encrypt database password
***************************
DB commands to
create/delete/verify database links
select * from dba_db_links;
DROP PUBLIC DATABASE LINK
FINLINK.IMF.ORG;
CREATE PUBLIC DATABASE LINK
FINLINK.IMF.ORG CONNECT TO username IDENTIFIED BY password USING 'FINUPGT';
select * from
dual@FINLINK.IMF.ORG;
select * from
psdbowner@FINLINK.IMF.ORG;
*****************************
Unix commands
find . -type f -size +100000000c
-exec ls -l {} \; - command to list files larger than 100MB. The dot(.) after
find represents current working directory. It can be changed to any path.
find . -type f -size +100000000c
-exec gzip {} \; - command to compress/zip files larger than 100MB. The dot(.)
after find represents current working directory. It can be changed to any path.
find . -type f -size +100000000c
-exec rm {} \; - command to delete files larger than 100MB. The dot(.) after
find represents current working directory. It can be changed to any path.
find . -type f -mtime +30 -exec
ls -l {} \; - command to list files older than 10 days. The dot(.) after find
represents current working directory. It can be changed to any path.
find . -type f -mtime +10 -exec gzip
{} \; - command to compress/zip files older than 10 days. The dot(.) after find
represents current working directory. It can be changed to any path.
find . -type f -mtime +30 -exec
rm {} \; - command to delete files older than 10 days. The dot(.) after find
represents current working directory. It can be changed to any path.
find . -type d -ctime +30 -exec
rm -rf {} \;
find . -type f -exec grep
'String' {} + - command to list all the files that contains a String/String
pattern
tar -cvf folder_name.tar
folder_name - command to create a tar archive
tar -xvf folder_name.tar -
command to de-archive a tar file
gzip file_name - command to zip a
file. In unix/linux a folder cannot be zipped directly. A tar file needs to be
created for the folder and then the tar file can be zipped.
gunzip file_name.gz - command to
unzip a file
free -m - command to find current
memory usage
free | grep Mem | awk '{print
$3/$2 * 100.0}' - command to find what percentage of memory is in use
free | grep Mem | awk '{print
$4/$2 * 100.0}' - command to find what percentage of memory is free
ps -ef - command to list all the
processes that are running on the server
ps -ef | grep domain_name -
command to list all applicaiton server, process scheduler and web server
process running with the domain_name
ps -ef | grep domain_name | grep
java - command to list only web server process running with the domain_name
ps -ef | grep domain_name | grep
PIA - command to list only PIA process running with the domain_name
Port Ping Test :
nc -v trcdev.imf.org 23093
lsof -i | grep 23093
lsof -i -P |grep http
netstat -na |grep 55555
Change file permissions :
chmod -R g+rwxs /apps/hrpatch/srce
chmod -R g+rwxs
/apps/hrpatch/hris_srce
chgrp -R hrdev /apps/hrpatch/srce
chgrp -R hrdev
/apps/hrpatch/hris_srce
chmod 6751
/u01/app/oracle/product/19.0.0.0/dbhome_1/bin/oracle
To find the large files :
du -a /apps/pstools | sort -n -r | head -n 20
du -a /apps/ | sort -n -r | head -n 20
du -a /home
| sort -n -r | head -n 20
du -a /apps/pstools/hrtrain/appserv/hrtrain/LOGS |
sort -n -r | head -n 20
du -a /u01/ | sort -n -r | head -n 20
du -a /tmp | sort -n -r | head -n 20
Find and delete the older files
/logs :
find
/apps/pstools/finpatch/appserv/prcs/finpatch/LOGS -type f -name '*.LOG' -mtime
+30 -exec ls -ltr {} \;
find /apps/pstools/finpatch/appserv/prcs/finpatch/LOGS
-type f -name '*.LOG' -mtime +30 -exec rm {} \;
find
/apps/pstools/hcmtst02/appserv/hcmtst02/LOGS -type f -name '*.LOG' -mtime +30
-exec rm {} \;
find
/apps/pstools/hrdev/appserv/prcs/hrdev/LOGS -type f -name '*.LOG' -mtime +30
-exec rm {} \;
find
/apps/hrprod/psreports/hrprod -type f -name '*patdupst_*'
find /interface/OOD_WORK -type f -name '*.mflic*'
find /apps -type f -name '*finesupgt.imf.org_*'
finesupgt.imf.org
To Find the CPU utilization :
ps -eo pcpu,pid,user,args | sort
-k 1 -r | head -10
du -a
/apps/pstools/finprod/appserv/prcs/finprod/LOGS | sort -n -r | head -n
20
du -a /tqnh1j/logs/pt854/appserv | sort -n -r |
head -n 20
du -a /home | sort -n -r | head -n 20
du -a /boot | sort -n -r | head -n 20
To Find the memory utilization :
ps -o pid,user,%mem,command ax |
sort -b -k3 -r
Find
To Setup Password Less Connection
:
findev@appvwn96d:[/home/findev]
> /usr/bin/ssh\-copy\-id -i .ssh/id_rsa.pub hrdev@hrdev.imf.org
To delete old logs files :
find
/apps/hrprod/psreports/hrprod -type f -name 'patdupst*' -mtime +30 -exec ls
-ltr {} \;
find
/apps/hrprod/psreports/hrprod -type f -name 'patdupst_*.PDF' -exec ls -ltr {} \ ;
find
/apps/pstools/finprod/appserv/prcs/finprod/LOGS
-type f -name '*.LOG*' -mtime +120 -exec ls -ltr {} \;
find /apps/pstools/hcmtst02/appserv/hcmtst02/LOGS
-type f -name '*.LOG' -mtime +30 -exec rm {} \;
find /home/oracle/oodgss/log
-type f -name '*.LOG' -mtime +30 -exec rm {} \;
Soft Link Sample :
ln [-sf] [source] [destination]
By default, the ln command creates a hard
link.
Use the -s option to create a soft
(symbolic) link.
The -f option will force the command to
overwrite a file that already exists.
Source is the file or directory being
linked to.
Destination is the location to save the
link – if this is left blank, the symlink is stored in the current working
directory.
For example, create a symbolic
link with:
ln -s test_file.txt link_file.txt
This creates a symbolic link
(link_file.txt) that points to the test_file.txt.
To verify whether the symlink has
been created, use the ls command:
ls -l link_file.txt
TAR FILES :
tar -czvf jre.tar.gz jre
"tar -czvf (archive
name).tar.gz (pathtofile)”
change_permission.sh:
psadm2@hmshfodr-lnxmt-2 pt$ cat
change_permission.sh
echo "start permission
change `date`"
chown -R psadm3:appinst
ps_cust_home
echo "end permission change
`date`"
Drop SYSADM Schema :
SET NEWPAGE 0
SET SPACE 0
SET LINESIZE 80
SET PAGESIZE 0
SET ECHO OFF
SET FEEDBACK OFF
SET HEADING OFF
SET MARKUP HTML OFF
spool drop_sysadm_objects.sql
select 'drop '||object_type||'
'|| object_name||
DECODE(OBJECT_TYPE,'TABLE',' CASCADE CONSTRAINTS;',';') from dba_objects
where owner='SYSADM';
spool off;
exit;
cat generate_drop_public_synonym_script.sql
SET NEWPAGE 0
SET SPACE 0
SET LINESIZE 80
SET PAGESIZE 0
SET ECHO OFF
SET FEEDBACK OFF
SET HEADING OFF
SET MARKUP HTML OFF
SPOOL PUBLIC_SYN_DROP.sql
select 'drop PUBLIC
SYNONYM '||SYNONYM_NAME||';' from DBA_SYNONYMS WHERE TABLE_OWNER='SYSADM' and
owner='PUBLIC';
SPOOL OFF
exit
cat
generate_drop_sysadm_objects_script.sql
SET NEWPAGE 0
SET SPACE 0
SET LINESIZE 80
SET PAGESIZE 0
SET ECHO OFF
SET FEEDBACK OFF
SET HEADING OFF
SET MARKUP HTML OFF
spool
drop_sysadm_objects.sql
select 'drop
'||object_type||' '|| object_name||
DECODE(OBJECT_TYPE,'TABLE',' CASCADE CONSTRAINTS;',';') from dba_objects
where owner='SYSADM';
spool off;
exit;
set linesize 132 pagesize
2000
COLUMN TABLESPACE_NAME
FORMAT A20
COLUMN PCT_FREE FORMAT
999.99
COLUMN FREE FORMAT
999999.99
COLUMN USED FORMAT
999999.99
COLUMN MAX_ALLOC_MB
FORMAT 99999999999
COLUMN ACTUAL_ALLOC_MB
FORMAT 99999999999
COLUMN ACTUAL_USED_MB
FORMAT 99999999999
COLUMN ALLOC_FREE_MB
FORMAT 99999999999
COLUMN MAX_FREE_MB FORMAT
99999999999
COLUMN alloc_pct_free
FORMAT a15
COLUMN total_pct_free
FORMAT a15
colum max_blocks noprint
colum count_blocks
noprint
colum sum_free_blocks
noprint
SELECT TABLESPACE_NAME,
MAX_BLOCKS, COUNT_BLOCKS, SUM_FREE_BLOCKS,
BYTES1/(1024*1024)
ACTUAL_ALLOC_MB, (BYTES1/(1024*1024)-BYTES2/(1024*1024)) ACTUAL_USED_MB,
BYTES2/(1024*1024)
ALLOC_FREE_MB,
to_char(round((100*SUM_FREE_BLOCKS/SUM_ALLOC_BLOCKS),0))
|| '%' ALLOC_PCT_FREE,
MAXBYTES MAX_ALLOC_MB,
maxbytes - (BYTES1/(1024*1024)-BYTES2/(1024*1024)) MAX_FREE_MB,
to_char(round(((maxbytes
- (BYTES1/(1024*1024)))/maxbytes)*100,0))||'%' total_pct_free
FROM ( SELECT
TABLESPACE_NAME, SUM(BLOCKS) SUM_ALLOC_BLOCKS, sum(BYTES) BYTES1,
SUM(decode(MAXBYTES,0,bytes,null,bytes,maxbytes)/(1024*1024)) maxbytes
FROM DBA_DATA_FILES
GROUP BY TABLESPACE_NAME)
a,
( SELECT TABLESPACE_NAME
FS_TS_NAME, SUM(BYTES) BYTES2,
MAX(BLOCKS) MAX_BLOCKS,
COUNT(BLOCKS)
COUNT_BLOCKS,
SUM(BLOCKS)
SUM_FREE_BLOCKS
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME)
b
WHERE TABLESPACE_NAME =
FS_TS_NAME
/
For the environments created
using the downloaded software from edelivery use following query.
Select ptiaspspvers from
SYSADM.ps_ptiaspsrcinfo;
For the environments where the
PUM patches applied using CA use the following query.
select distinct
to_char(DESCRLONG) from sysadm.ps_maintenance_log where descrlong like '%PI%’;
To check Ports:
curl https://xxxxxxxx:443
curl -v telnet:\\abcd.com:443
curl -v telnet:\\xxxsss 443
nslookup www.kkkk.com
dig www.oabdd.com
ssh -v abcde.com -p 443
ssh -v abcde.com -p 443
Test-NetConnection abcde.com -Port 443
No comments:
Post a Comment