Stay at Home!! Be Safe!! Take Care!!

For Any queries, please mail us at support@funoracleapps.com

How to Set or Change the Time Zone in Linux Server

No comments

How to Set or Change the Time Zone in Linux Server


1. Check  the Current Time Zone

timedatectl
  
  Local time: Mon 2020-07-06 22:22:40 +08
  Universal time: Mon 2020-07-06 14:22:40 UTC
        RTC time: Mon 2020-07-06 14:22:40
       Time zone: Asia/Singapore (+08, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

The output above shows that the system’s time zone is set to Singapore.

The system time zone is configured by a link i.e. /etc/localtime file to a binary time zone’s identifier in the /usr/share/zoneinfo directory.

$ ls -l /etc/localtime
lrwxrwxrwx 1 root root 36 Jul  6 22:03 /etc/localtime -> ../usr/share/zoneinfo/Asia/Singapore

2. Change  the Time Zone Now

Make sure to identify the exact time zone which needs to be set in Region/City format.

To view all available time zones, use the timedatectl command or list the files in the /usr/share/zoneinfo directory:

# timedatectl list-timezones

America/Montserrat
America/Nassau
America/New_York
America/Nipigon
America/Nome
America/Noronha


Run Command
sudo timedatectl set-timezone America/New_York
or  doing in UTC then

sudo timedatectl set-timezone UTC

To verify the change, invoke the timedatectl command again:


timedatectl
                    Local time: Mon 2020-07-06 14:28:53 UTC
  Universal time: Mon 2020-07-06 14:28:53 UTC
        RTC time: Mon 2020-07-06 14:28:53
       Time zone: UTC (UTC, +0000)
     NTP enabled: no
NTP synchronized: yes
 RTC in local TZ: yes
      DST active: n/a

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

We can also change Time Zone by Creating a Symlink(Especially used in old system)

If you are running an older Linux distribution and the timedatectl utility is not present on your system, you can change the timezone by symlinking /etc/localtime to the time zone in the /usr/share/zoneinfo directory.

Remove the current symlink or file:

sudo rm -rf /etc/localtime or  sudo unlink /etc/localtime 

Identify the timezone you want to configure and create a symlink:

sudo ln -s /usr/share/zoneinfo/UTC /etc/localtime

Verify the /etc/localtime file 

 ls -l /etc/localtime
lrwxrwxrwx. 1 root root 25 Jul  6  2020 /etc/localtime -> ../usr/share/zoneinfo/UTC

No comments :

Post a Comment

Query to find OPP database session details

No comments

Query to find OPP database session details






Query:

select s.ECID ,s.inst_id, s.SID,s.SERIAL#,p.spid,s.status,s.machine, s.ACTION, s.MODULE, s.TERMINAL,s.sql_id,s.last_call_et,s.event, s.client_info,s.PLSQL_SUBPROGRAM_ID,s.PROGRAM,s.client_identifier
, ( SELECT max( substr( sql_text , 1, 40 )) FROM gv$sql sq WHERE sq.sql_id = s.sql_id ) AS sql_text
, ( SELECT object_name FROM dba_procedures WHERE object_id = plsql_entry_object_id AND subprogram_id = 0) AS plsql_entry_object
, ( SELECT procedure_name FROM dba_procedures WHERE object_id = plsql_entry_object_id AND subprogram_id = plsql_entry_subprogram_id) AS plsql_entry_subprogram
, ( SELECT object_name FROM dba_procedures WHERE object_id = plsql_object_id AND subprogram_id = 0) AS plsql_entry_object
, ( SELECT procedure_name FROM dba_procedures WHERE object_id = plsql_object_id AND subprogram_id = PLSQL_SUBPROGRAM_ID) AS plsql_entry_subprogram
, 'alter system kill session ' || '''' || s.SID || ',' || s.serial# ||',@'|| s.inst_id||''''|| ' immediate;' kill_session
from gv$session s ,gv$process p
where
s.module like '%OPP%'
and p.addr=s.paddr
and p.inst_id = s.inst_id

No comments :

Post a Comment

Query to find the OPP Actual and Target Process

No comments

Query to find the OPP Actual and Target Process

Query:


   SELECT b.user_concurrent_queue_name "Concurrent Manager", b.target_node "Node", a.running_processes "Actual Processes", a.max_processes "Target Processes"
    FROM apps.fnd_concurrent_queues a, apps.fnd_concurrent_queues_vl b
   WHERE a.concurrent_queue_id = b.concurrent_queue_id
    AND a.concurrent_queue_name = 'FNDCPOPP' ;

No comments :

Post a Comment

SQL*Loader-128: unable to begin a session ORA-01017: invalid username/password; logon denied

No comments

SQL*Loader-128: unable to begin a session ORA-01017: invalid username/password; logon denied


When running SQL loader concurrent request, we are seeing below error.

Error:

SQL*Loader-128: unable to begin a session
ORA-01017: invalid username/password; logon denied

SQL*Loader: Release 10.1.0.5.0 - Production on Wed Jun 24 14:08:27 2020

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL*Loader-128: unable to begin a session
ORA-01017: invalid username/password; logon denied


Program exited with status 1
Concurrent Manager encountered an error while running SQL*Loader for your concurrent request 57822615.


Cause:

Service Manager logfile (for all managers started by FNDSM). This causes FNDSM log to grow to enormous size 2 GB

$ du -sh FNDSM2342760.mgr
2.1G    FNDSM2342760.mgr


Workaround:

Workaround 1: Restart Concurrent Managers

Workaround 2: Take backup of the file and nullify the file to reduce the size.

$ >FNDSM2342760.mgr


Also you can refer below Oracle Doc for more details and other solution

Concurrent Requests fail with SQL*Loader-101: Invalid Argument for username/password (Due to FNDSM Log File Size Grows 2 GB ) (Doc ID 1542216.1)



No comments :

Post a Comment

Error in DB Tier Auto Config (java.lang.UnsatisfiedLinkError: libnjni11.so: libnjni11.so: wrong ELF class: ELFCLASS64)

No comments

Error in DB Tier Auto Config (java.lang.UnsatisfiedLinkError: libnjni11.so: libnjni11.so: wrong ELF class: ELFCLASS64)


After upgrading EBS database to 11GR2, we can encounter error while running autoconfig on the DB node 

Error:

java.lang.UnsatisfiedLinkError: /d11/oracle/TEST/db/tech_st/11.2.0/lib/libnjni11.so: /d11/oracle/TEST/db/11.2.0/lib/libnjni11.so: wrong ELF class: ELFCLASS64 (Possible cause: architecture word width mismatch)

Solution :

To fix this issue, Edit the database node xml as below and re-run the autoconfig.

 <JDK_TOP oa_var="s_jdktop">/d11/oracle/TEST/db/tech_st/11.2.0/appsutil/jre</JDK_TOP>
 <JRE_TOP oa_var="s_jretop">/d11/oracle/TEST/db/tech_st/11.2.0/appsutil/jre</JRE_TOP>

update to 

 <JDK_TOP oa_var="s_jdktop">/d11/oracle/TEST/db/tech_st/11.2.0/jdk/jre</JDK_TOP>
 <JRE_TOP oa_var="s_jretop">/d11/oracle/TEST/db/tech_st/11.2.0/jdk/jre</JRE_TOP>



Important Note:
----
From 11gR2 DB version onwards AutoConfig on DB node uses the JRE from <Oracle_Home>/jdk/jre where as earlier versions of DB uses JRE from $ORACLE_HOME/appsutil/jre

No comments :

Post a Comment

Downgrading Oracle Database Without Executing catdwgrd.sql or Backup plan to downgrade oracle db

No comments

Downgrading Oracle Database Without Executing catdwgrd.sql or Backup plan to downgrade


When we are upgrading the database, we need to ensure that we have a backup plan to downgrade in case of failure. We can create a guaranteed  restore point.

My Source version: 10.2.0.4
Target version to upgrade 11.2.0.3

Configure Flashback database in the Source version

The Flashback Database feature provides a way to quickly revert entire Oracle database to the state it was in at a past point in time.

To use the Flashback database feature the database must be running in archivelog mode.

Enable flashback feature in the database when it was running in the source release.

Set the environment variables to point to the source Oracle Home (10.2.0.4) and perform a 'startup mount'

SQL> startup mount
ORACLE instance started.

Total System Global Area  918552576 bytes
Fixed Size                  2025072 bytes
Variable Size             239077776 bytes
Database Buffers          675282944 bytes
Redo Buffers                2166784 bytes
Database mounted.

Turn on flashback

SQL> alter database flashback on;

Database altered

Create guaranteed restore point

SQL> CREATE RESTORE POINT before_upgrade GUARANTEE FLASHBACK DATABASE;

Restore point created.

Run the following query to view all guaranteed restore points created.

SQL> SELECT NAME, SCN, TIME, DATABASE_INCARNATION# DI,GUARANTEE_FLASHBACK_DATABASE,
     STORAGE_SIZE FROM V$RESTORE_POINT WHERE GUARANTEE_FLASHBACK_DATABASE='YES';

NAME             SCN     TIME                 DI         GUA     STORAGE_SIZE
----------       --- ------------       -------------    ---    ------------
BEFORE_UPGRADE  34552155 23-JUN-20  10.58.42.000000000 AM  YES    312672256

Query the dba_registry view to see the component status and version before upgrade

SQL> select comp_name, status, version from dba_registry;

COMP_NAME
--------------------------------------------------------------------------------
STATUS      VERSION
----------- ------------------------------
Oracle Database Catalog Views
VALID       10.2.0.4.0

Oracle Database Packages and Types
VALID       10.2.0.4.0


Shutdown the database

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
 

Upgrade the database to the target version(Dont change compatibility parameter to higher version while upgrade)

Set the environment variables to point to the target Oracle Home (11.2.0.4) to which the database will be upgraded to.

compatible-10.2.0.4

Please note that changing COMPATIBLE initialization parameter at this stage will prevent use of the downgrade procedure or the ability to flash back the database to a point prior to this.

Startup the database in upgrade mode using the 11.2.0.4 Oracle Home

SQL> startup upgrade (using 11.2.0.4 Oracle Home)
ORACLE instance started.

Total System Global Area  918552576 bytes
Fixed Size                  2077008 bytes
Variable Size             234884784 bytes
Database Buffers          675282944 bytes
Redo Buffers                6307840 bytes
Database mounted.
Database opened.

Run the upgrade script (catupgrd.sql)

SQL> @?/rdbms/admin/catupgrd.sql


Validate any invalid objects after upgrade if any

SQL> @?/rdbms/admin/utlrp.sql

Query the dba_registry view to see the component status and version after upgrade

SQL> select comp_name, version, status from dba_registry;

COMP_NAME
--------------------------------------------------------------------------------
VERSION STATUS
------------------------------ -----------
Oracle Database Catalog Views
11.2.0.4.0 VALID

Oracle Database Packages and Types
11.2.0.4.0 VALID
 

Downgrading database to previous version using Flashback database

Note that data from any transactions that occur after the point in time to which the database is recovered are lost. Flashback Database is an excellent tool for backing out the database upgrade, Using Flashback Database with sufficient space and creating a guaranteed restore point immediately prior to the upgrade is the fastest method to fallback as compared to a restore operation or a database downgrade.

Using flashback database rather than the conventional downgrade procedure is far quicker. This is only practical when only the database upgrade has been done and no application data changes have occurred.

The steps for flashing back the database after upgrade or after a failed upgrade are

Set the environment variables to the 11.2.0.4 Oracle Home

Shut down the upgraded database

SQL> shutdown immediate

Startup mount the 11.2.0.4 database using the 11.2.0.4 Oracle Home and flashback the database to the guaranteed restore point which was created prior to the upgrade.

SQL> startup mount

SQL> flashback database to restore point before_upgrade;

SQL> shutdown immediate

Set the environment variable to point to the old Oracle Home (10.2.0.4)

SQL> startup mount

SQL> alter database open resetlogs;

query the dba_registry view to see the database component status and version

SQL> select comp_name, version, status from dba_registry;

COMP_NAME
--------------------------------------------------------------------------------
VERSION STATUS
------------------------------ -----------
Oracle Database Catalog Views
10.2.0.4.0 VALID

Oracle Database Packages and Types
10.2.0.4.0 VALID



No comments :

Post a Comment

Query to find any Mview Refresh is going on currently in Oracle DB

No comments

Query to find any Mview Refresh is going on currently in Oracle DB


Query:

select s.obj#,o.obj#,s.containerobj#,lastrefreshdate,pflags,xpflags,o.name,o.owner#, bitand(s.mflags, 8)
from obj$ o, sum$ s
where o.obj# = s.obj# and o.type# = 42 AND bitand(s.mflags, 8) = 8;

No comments :

Post a Comment

How to Stop Auto Refresh of Materialized view in Oracle

No comments

How to Stop Auto Refresh of  Materialized view in Oracle


Disable Automatic Refresh of Materialized View.

STEP 1. 
Connect as mview owner and execute the below query.

select * from user_jobs where broken ='N';

STEP 2. 
In the WHAT column for the mview refresh job we will see:

dbms_refresh.refresh('"[OWNER]"."[MVIEW_NAME]"');
STEP 3. 
Get the JOB_ID form the job column and execute below procedure and mview will stop refreshing automatically:

 
begin
dbms_job.broken(JOB_ID,TRUE);
commit;
end;
/
Example:

begin
dbms_job.broken(30,TRUE);
commit;
end;
/


How to start refreshing Mview again just run the job.

begin
dbms_job.run(JOB_ID);
commit;
end;
/
Example:


 
begin
dbms_job.broken(30,FALSE);
commit;
end;
/

No comments :

Post a Comment

FRM-92095: Oracle JInitiator version too low

No comments

FRM-92095: Oracle JInitiator version too low

If we are trying to open old EBS version which has lower JRE, then we might encounter the error.
Solution 1
Add a OS Parameter: JAVA_TOOL_OPTIONS, and parameter value: "-Djava.vendor="Sun Microsystems Inc." as Environment Variables.


1. Open Advanced system settings
Start Menu › Control Panel › System and Security › System


2. Click Environment Variables:-

Java
3. Add a System variables:-

  • Variable name: JAVA_TOOL_OPTIONS 
  • Variable value: "-Djava.vendor="Sun Microsystems Inc."



parameter


    4.RE-Start your system

    Solution 2

    Add a OS Parameter: JAVA_TOOL_OPTIONS, and parameter value: -Djava.vendor="Sun Microsystems Inc." as Java Runtime Parameter

    1. Open Java Control Panel:-  In the search box enter Java Control Panel
    Click on Java icon to open the Java Control Panel.


    2. After the Java Control Panel opens, go to the Java tab as shown below.


    3. Click "View", then add -Djava.vendor="Sun Microsystems Inc." into the Runtime Parameter box
     
     

    No comments :

    Post a Comment

    Rman Duplicate is Failing With Segmentation Fault

    No comments

    Rman Duplicate is Failing With Segmentation Fault


    Error:

    RMAN duplicate was done successfully but in last step i.e. opening duplicate database with resetlogs failed with "Segmentation Fault" and when trying to open the database manually the database was getting crashed with and the below error in alert.log

    SQL> alter database open;
    alter database open
    *
    ERROR at line 1:
    ORA-01092: ORACLE instance terminated. Disconnection forced


    Cause:

    Undo tablespace name in Target and Duplicate database was different due to which RMAN duplicate was failing with "Segmentation Fault".


    Solution:

    Make sure that the undo_tablespace name in the Duplicate database should be same as Target Database.

    The undo tablespace name can be set using the below parameter in the parameter file

    UNDO_TABLESPACE=<tablespace name>

     and start backup the database in nomount and verify the new undo tablespace name is being used.

    show parameter undo

    Then start the duplicate process again.

    No comments :

    Post a Comment

    How to Migrate Linux Cups Printer from one server to other server

    No comments

    How to Migrate Linux Cups Printer from one server to other server


    CUPS stores its configuration at /etc/cups directory, we have to do is copy /etc/cups to a new server. 

    Steps:

    1. Open terminal and type the commands on old Linux server:
    # tar -cvzf /tmp/cups-$(hostname).tar.gz /etc/cups

    2. Copy /tmp/cups* to new server using SCP or any desired method:
    # scp /tmp/cups* new.linux.server.com:/tmp

    3. Login to new server and take backup of existing cups.
    # mv /etc/cups /etc/cups.backup
    # cd /
    # tar -zxvf /tmp/cups*

    4. Restart the cups service:
    service cups restart

    No comments :

    Post a Comment

    How to migrate OS User Accounts from one Linux Server to Other/New Linux Server

    No comments

    How to migrate OS User Accounts from one Linux Server to Other/New Linux Server 


    We might get into these type of requirements when we are migrating from old server to new server.

    Below are the important files to consider while moving users from one server to another

    • /etc/passwd contains information about the user.
    • /etc/group contains information about the group.
    • /etc/shadow contains encrypted password for the user.
    • /var/spool/mail contains user mails are stored in this file.
    • /home/user contains users home directory, hence it may contain user data.

    Users that are added to the Linux system always start with UID and GID values of as specified by Linux distribution or set by admin. 

    Limits according various Linux distro:
    RHEL/CentOS/Fedora Core : Default is 500 and upper limit is 65534 (/etc/libuser.conf).

    Debian and Ubuntu Linux : Default is 1000 and upper limit is 29999 (/etc/adduser.conf).
     
     
     Steps:
     
    Connect as root User on old server
    1. Backup the user accounts from old server for all users having user id above 500.


    # mkdir -p /stage/common (This can be any directory)
    # export UGIDLIMIT=500
    # awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/passwd > /stage/common/passws.olds

    2. Backup the groups in /etc/group file:

    # awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/group > /stage/common/group.olds

    3. Backup the shadow file:

    # awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534) {print $1}' /etc/passwd | tee - |egrep -f - /etc/shadow > /stage/common/shadow.olds

    4. Backup the users home directory and users mails:

    # tar -zcvpf /stage/common/home.tar.gz /home

    5. Backup the user's mails:

    # tar -zcvpf /stage/common/mail.tar.gz /var/spool/mail

    In case required you can copy the cronjobs for users as well from /var/spool/cron

    6. Copy the Backup files to new server using scp or any preferrable method.

    7. Restore the data into the new server.

    # cat passwd.old >> /etc/passwd
    # cat group.old >> /etc/group
    # cat shadow.old >> /etc/shadow
    # /bin/cp shadow.old /etc/gshadow

    8. Restore the user's data as well as the user's mails to the new server.

    # tar -zxvf /path/to/location/home.tar.gz
    # tar -zxvf /path/to/location/mail.tar.gz

    9. Reboot Server

    No comments :

    Post a Comment

    Query to get list of EBS users with responsibility and last login date (responsibility wise)

    No comments

    Query to get list of EBS users with responsibility and last login date (responsibility wise)


    Script:

    SELECT
        usr.user_name,
        rsp.responsibility_name,
        MAX(ful.start_time) "LAST_CONNECT"
    FROM
        apps.icx_sessions ses,
        apps.fnd_user usr,
        apps.fnd_logins ful,
        apps.fnd_responsibility_tl rsp
    WHERE
         ses.login_id (+) = ful.login_id
        AND
            ses.responsibility_id = rsp.responsibility_id (+)
        AND
            ses.responsibility_application_id = rsp.application_id (+)
        AND
            usr.user_id = ful.user_id
     and rsp.responsibility_name is not null
    GROUP BY
        usr.user_name,
        rsp.responsibility_name
    ORDER BY
        usr.user_name,
        rsp.responsibility_name,
        last_connect

    No comments :

    Post a Comment

    Attach a Oracle Home in Oracle Inventory on Server

    No comments

    Attach a Oracle Home in Oracle Inventory on Server


    Error:

    When running opatch lsinventory getting below error

    Oracle Home       : /u01/oracle/product/11.2.0
    Central Inventory : /home/oracle/oraInventory
       from           : /u01/oracle/product/11.2.0/oraInst.loc
    OPatch version    : 11.2.0.3.6
    OUI version       : 11.2.0.4.0
    Log file location : /u01/oracle/product/11.2.0/cfgtoollogs/opatch/opatch2017-09-12_15-30-47PM_1.log


    Inventory load failed... OPatch cannot load inventory for the given Oracle Home.
    Possible causes are:
       Oracle Home dir. path does not exist in Central Inventory
       Oracle Home is a symbolic link
       Oracle Home inventory is corrupted
    LsInventorySession failed: OracleHomeInventory gets null oracleHomeInfo

    OPatch failed with error code 73

    Cause:
    Checking the inventory.xml file the respective oracle home was not found.

    Solution:

    To fix this, add the new OH to your inventory. From your OH that is missing, do the following:

    cd $ORACLE_HOME/oui/bin
    ./runInstaller -invPtrLoc /d43/oracle/test/11.2.0/oraInst.loc -attachHome ORACLE_HOME=/d43/oracle/test/11.2.0 ORACLE_HOME_NAME="Ora11gHome_TEST"

    Starting Oracle Universal Installer...

    Checking swap space: must be greater than 500 MB.   Actual 8191 MB    Passed
    The inventory pointer is located at /u01/oracle/product/11.2.0/oraInst.loc
    'AttachHome' was successful.


    Now run Opatch again

    No comments :

    Post a Comment

    Deleting/Removing Control M characters in Linux

    No comments

    Deleting/Removing Control M characters in Linux


    Control-M is a character found at the end of a line usually in files in linux/unix. We need to delete these characters before processing this file.

    To put a control m character, please Press Cntrl followed by V and M(Control-V+Control-M) and not as Shift-6-M.



    Viewing the control M characters we can use below commands:

    1) cat -v filename
    2) vi -b filename


    To Remove Control M characters we can use below methods:

    1. dos2unix The simplest of all is using the dos2unix command.

    dos2unix filename

    Note: I have seen occurences where the this command dont remove all Control-M characters so I prefer below menthod
     


    2. tr Command

    $ tr -d '^M' <filename

    To store output after deleting the Control-M we can use below
    tr -d '^M' <filename > newfile

    We can also use below 

    $ tr -d "\015" <filename >newfile



    3. sed command

    $ sed -e 's/^M//g' filename

    To remove and save changes to file use below

    $ sed -i 's/^M//g' filename

    4. vi Editor in the escape mode type below:
     :1,%s/^M//g
     
    5. awk command

    The 1 is used to print the lines.
    $ awk 'sub(/^M/,"");1' filename

    No comments :

    Post a Comment

    How to setup SAMBA in Linux

    No comments

    How to setup SAMBA in Linux


    In this post I am going to share steps to configure Samba in Linux.

    For this I have created 2 virtual machines out of which once will act as client and other will act as server.

    1) Centos1home.lab--Server Machine for Samba
    2) Centos2home.lab--Client Machine which will access Samba Shared file system.


    Setup on Server Machine:


    • Install samba packages
    # Become root user
    # yum install samba samba-client samba-common

    Samba Server

    • Enable samba to be allowed through firewall (Only if you have firewall running)
    # firewall-cmd --permanent --zone=public --add-service=samba

    [root@centos1home ~]# firewall-cmd --permanent --zone=public --add-service=samba
    success

    # firewall-cmd --reload

    [root@centos1home ~]# firewall-cmd --reload
    success
    


    • To stop and disable firewall or iptables(Optional)
    # systemctl stop firewalld
    # systemctl stop iptables
    # systemctl disable firewalld
    # systemctl disable iptables

    • Create Samba share directory and assign permissions
    # mkdir -p /funoracleapps/samba
    # chmod a+rwx /funoracleapps/samba
    # chown -R nobody:nobody /funoracleapps

    [root@centos1home ~]# ls -ld /funoracleapps/samba
    drwxrwxrwx. 2 nobody nobody 6 Jun  1 13:18 /funoracleapps/samba
    

    • We need to change the SELinux security context for the samba shared
    directory as follows: (Only if you have SELinux enabled)
    # chcon -t samba_share_t /funoracleapps/samba

    • If you want to disable SELinux, follow these instructions(Optional)
    # sestatus (To check the SELinux status)

    # vi /etc/selinux/config
    Change
    SELINUX=enforcing
    To
    SELINUX=disabled

    # reboot

    • Modify /etc/samba/smb.conf file to add new shared filesystem (Make sure to
    create a copy of smb.conf file)
    Delete everything from smb.conf file and add the following parameters
    [global]
    workgroup = WORKGROUP
    netbios name = centos
    security = user
    map to guest = bad user
    dns proxy = no
    [Anonymous]
    path = /funoracleapps/samba
    browsable = yes
    writable = yes
    guest ok = yes
    guest only = yes
    read only = no

    • Verify the Samba Configuration setting
    # testparm

    [root@centos1home ~]# testparm
    Load smb config files from /etc/samba/smb.conf
    Loaded services file OK.
    Server role: ROLE_STANDALONE
    
    Press enter to see a dump of your service definitions
    
    # Global parameters
    [global]
    	dns proxy = No
    	map to guest = Bad User
    	netbios name = CENTOS
    	security = USER
    	idmap config * : backend = tdb
    
    
    [Anonymous]
    	guest ok = Yes
    	guest only = Yes
    	path = /funoracleapps/samba
    	read only = No
    

    • Once the packages are installed, enable and start Samba services
    # systemctl enable smb
    # systemctl enable nmb
    # systemctl start smb
    # systemctl start nmb




    Server is configured successfully

    Mount on Windows client

    • Go to start
    • Go to search bar
    • Type \\192.168.56.101 (This is my server IP, you can check in CentOS IP by running the command ifconfig)

    Mount on Linux client

    Become root
    # yum -y install cifs-utils samba-client

    Samba Client


    Create a mount point directory

    # mkdir -p /him/funsambashare/

    Mount the samba share
    # mount -t cifs //192.168.56.101/Anonymous /him/funsambashare/
    # Enter root  password

    Samba Filesystem

    No comments :

    Post a Comment

    How to Install Rar/Unrar in Linux

    No comments

    How to Install Rar/Unrar in Linux


    RAR is tool for creating/extracting compressed archive (.rar) files. 


    Steps to Install on RHEL/Centos

    # cd /usr/src (Or any other folder)
    # wget https://www.rarlab.com/rar/rarlinux-x64-5.6.0.tar.gz
    # tar -zxvf rarlinux-x64-5.6.0.tar.gz
    # cd rar
    # sudo cp -v rar unrar /usr/local/bin/


    Steps to install on Debian and Ubuntu based distributions

    $ sudo apt-get install unrar
    or
    $ sudo apt install unrar

    No comments :

    Post a Comment

    How to find the current patchset levels for products in Oracle Apps

    No comments

    How to find the current patchset levels for products in Oracle Apps


    To obtain the current patchset levels for each specific E-Business Suite functional product test the following steps:

    1. Log into OAM.
    (Responsibility System Administrator,"Oracle Applications Manager", menu "OAM Support Cart") 
    and Navigate:

    2. Support Cart --> Applications Signature --> Collect --> Check "Product Information" box
    --> Click on "View" (eyeglasses)
    This will display the following patchset information:
    Application Name
    Current Patch Level
    Product Version
    Status (Installed, Shared Product, Inactive)

    3. The patchset level information can be retrieved directly from sqlplus with the following diagnostic script:
    $AD_TOP/sql/adutconf.sql

    No comments :

    Post a Comment

    Important Queries Related to Undo in Oracle

    No comments

    Important Queries Related to Undo in Oracle


    To find retention guarantee for undo tablespace

    select tablespace_name,status,contents,retention from dba_tablespaces where tablespace_name like '%UNDO%';

    To find Undo Space Availability

    select a.tablespace_name, SIZEMB, USAGEMB, (SIZEMB - USAGEMB) FREEMB
    from (select sum(bytes) / 1024 / 1024 SIZEMB, b.tablespace_name
    from dba_data_files a, dba_tablespaces b
    where a.tablespace_name = b.tablespace_name
    and b.contents = 'UNDO'
    group by b.tablespace_name) a,
    (select c.tablespace_name, sum(bytes) / 1024 / 1024 USAGEMB
    from DBA_UNDO_EXTENTS c
    where status <> 'EXPIRED'
    group by c.tablespace_name) b
    where a.tablespace_name = b.tablespace_name;

    To show ACTIVE/EXPIRED/UNEXPIRED Extents of Undo Tablespace

    select status,
      round(sum_bytes / (1024*1024), 0) as MB,
      round((sum_bytes / undo_size) * 100, 0) as PERC
    from
    (
      select status, sum(bytes) sum_bytes
      from dba_undo_extents
      group by status
    ),
    (
      select sum(a.bytes) undo_size
      from dba_tablespaces c
        join v$tablespace b on b.name = c.tablespace_name
        join v$datafile a on a.ts# = b.ts#
      where c.contents = 'UNDO'
        and c.status = 'ONLINE'
    );

    To find Undo Retention Value

    show parameter undo_retention;


    Undo retention in hours

    col "Retention" for a30
    col name for a30
    col value for a50
    select name "Retention",value/60/60 "Hours" from v$parameter where name like '%undo_retention%';


    Session Details Consuming Undo


    SELECT s.inst_id,
            r.name                   rbs,
            nvl(s.username, 'None')  oracle_user,
            s.osuser                 client_user,
            p.username               unix_user,
            to_char(s.sid)||','||to_char(s.serial#) as sid_serial,
            p.spid                   unix_pid,
            TO_CHAR(s.logon_time, 'mm/dd/yy hh24:mi:ss') as login_time,
            t.used_ublk * 8192  as undo_BYTES,
                    st.sql_text as sql_text
       FROM gv$process     p,
            v$rollname     r,
            gv$session     s,
            gv$transaction t,
            gv$sqlarea     st
      WHERE p.inst_id=s.inst_id
        AND p.inst_id=t.inst_id
        AND s.inst_id=st.inst_id
        AND s.taddr = t.addr
        AND s.paddr = p.addr(+)
        AND r.usn   = t.xidusn(+)
        AND s.sql_address = st.address
      AND t.used_ublk * 8192 > 1073741824
      ORDER
           BY undo_BYTES desc
    /


    To check space related statistics of  UndoTablespace from v$undostat

    select
    sum(ssolderrcnt) "Total ORA-1555s",
    round(max(maxquerylen)/60/60) "Max Query HRS",
    sum(unxpstealcnt) "UNExpired STEALS",
    sum(expstealcnt) "Expired STEALS"
    from v$undostat
    order by begin_time;

    Find Undo Segments related to users


    select  s.sid,s.serial#,username,s.machine,
    t.used_ublk ,t.used_urec,(rs.rssize)/1024/1024 MB,rn.name
    from    v$transaction t,v$session s,v$rollstat rs, v$rollname rn
    where   t.addr=s.taddr and rs.usn=rn.usn and rs.usn=t.xidusn and rs.xacts>0;

    No comments :

    Post a Comment

    Locking and Disabling User Accounts in Linux

    No comments

    Locking and Disabling User Accounts in Linux


    1. Locking the user account
    To lock a user account use the command usermod -L or passwd -l. Both the commands adds an exclamation mark (“!”) in the second field of the file /etc/shadow.It has to be executed by either bob/privilaged user.
    It will deny any access which would be done directly using su or with ssh.

    # usermod -L bob
    or

     
    # passwd -l bob

    Verify if the user account is locked.
    Check for the flag *LK* in the below command output which indicates that the account is locked.

    # passwd --status bob
    bob *LK* 2020-05-01 0 45 7 -1 (Password set, SHA512 crypt.)

    Try to Login

    [himanshu@lcfs ~]$ su - bob
    Password: 
    su: Authentication failure

    But with SSH key still connecting

    [himanshu@lcfs ~]$ ssh bob@lcfs.lab
    Welcome to Himanshu's Server Remote Login!
    Last failed login: Fri May 15 17:52:08 IST 2020 on pts/1
    There was 1 failed login attempt since the last successful login.
    Last login: Fri May 15 17:51:07 2020 from lcfs.lab


    2. Expiring the user account

    The problem with above menthod is that if ssh password less key setup is done, then the user can still login via ssh using the keys.


    # chage -E0 bob
    Expiring an account via use of the 8th field in /etc/shadow (using “chage -E”) will block all access methods that use PAM to authenticate a user.


    Verify if the account has been expired.


    # chage -l bob
    Last password change                                    : Apr 17, 2020
    Password expires                                        : never
    Password inactive                                       : never
    Account expires                                         : Jan 01, 1970
    Minimum number of days between password change          : 0
    Maximum number of days between password change          : 999999
    Number of days of warning before password expires       : 7


    Try Login

    [himanshu@lcfs ~]$ ssh bob@lcfs.lab
    Welcome to Himanshu's Server Remote Login!
    Your account has expired; please contact your system administrator
    Authentication failed.

    So normally I prefer to lock and expire the user account both for better security.

    3. Changing the shell to no login
    We can also change the default shell of the user to /sbin/nologin so that the user do not get any login shell when he tries to login into the system.

    # usermod -s /sbin/nologin bob
    You can check for the 7th and last field in /etc/passwd for the change of shell to /sbin/nologin.

    Verify for no login shell


    # grep ^bob /etc/passwd
    bob:x:1001:1001:bob:/bob:/sbin/nologin

    No comments :

    Post a Comment

    Globbing/Wildcards in Linux

    No comments

    Globbing/Wildcards in Linux


    Globbing in linux is referred to the use of wildcards. Wildcards, in the Linux file system, allow you to refer to files in a flexible way. 

    Types of  Wildcards  in Linux

    1) * - Star is for everything. Unlimited number of characters. 
    example:
    ls *
    It will give all file names in the current directory, no matter how long they are. 

    ls a*

    All files starting with a

    2) ? - Question mark is for one single character. 
    example:
    ls ?

    It will give all filesname with single character

    3) [] - Square brackets, you can specify a range. 

    example:
    ls [a-c]

    It will search with filenames as a, b, or c. It's a range. 

    We can combine them with other wildcards as well.

    example:
    ls [a-c]*

    It will show all files names starting with a or b or c.

    example:

    ls ?[z-s]*

    It will show you all files where the second character is a z or an s. 

    example:

    ls *?

    star already covers all characters and if we put anything behind a star, that makes no sense, especially if you make that star question mark. 


    example:

    ls *?[a-c]
    It will mean all files that have a letter(a/b/c) on the last position. In this case, the file name must be at least two characters long.

    No comments :

    Post a Comment

    Installing and Removing Packages in Linux using Yum

    1 comment

    Installing and Removing Packages in Linux using Yum

    To install/remove a package in linux using yum we have to use root or privilaged user.Package will install all the dependencies as well.


    Install package
    yum install <package name>

    yum install zip


    Only Download RPM

    yum install --downloadonly --downloaddir=/tmp

    Install from local rpm

    yum localinstall  <rpm name>


    Re-install a package

    yum reinstall <package name>


    Re-install while skipping a dependencies which is not available in repository

    yum reinstall  --skip-broken <package name>

    Upgrade a package

    yum upgrade <package name>

    Remove a package
    It will only remove package and dont remove any dependency

    yum remove <package name>

    Remove package and its dependencies

    yum autoremove <package name>

    1 comment :

    Post a Comment

    Understanding Yum in Linux

    No comments

    Understanding Yum in Linux


    Yum overview
    RPM knows what its dependencies are, and has the ability to download software from FTP and web servers. 
    Yum was created by Yellowdog Linux, and has since been adopted by many Red Hat-based distributions including Fedora and CentOS. 
    Yum resolves dependencies automatically. This means it downloads and installs all software packages necessary. 
    This includes packages that the user didn't specify, if the chosen package requires them. Y
    Yum has also the concept of software package groups. A group is a list of software that is usually installed together. 

    For instance, we could have a web server group that included the web server, and other tools commonly installed with it. Yum repositories contain RPM software packages. 
    The Yum client maintains a local list of software repositories. Users can add repositories by just adding a new Yum configuration file for them. 
    The Yum client also maintains a local list of all available software. The package install process using Yum is pretty straightforward. 
    First, the Yum client contacts the repositories that it's aware of, and gets their list of software packages. 
    These lists are then cached locally, and it updates them during install operations. 
    The user then selects a software package that they want to install. Users can select packages to install by using either CLI or GUI tools. 
    Yum then calculates dependencies. This would be the requested software package, and any packages that it requires. 
    Yum then downloads all software packages and installs them using the RPM libraries, just like the RPM command does. 
    Once the install has finished, Yum updates the RPM package database. 
    Installing software using Yum couldn't be easier. 
    Yum also has the concept of software groups. Yum groups contain multiple software packages. 
    These software packages are usually installed together. All software in a group can be installed at once. 
    All software in a group can be removed at once. Groups can contain optional software. 
    Option software is related software, but not installed by default. Groups make configuring a system quicker. 
    Installing a group of software with one command is much easier than installing each package individually.


    Yum commands:

    1) show package list in repository
    yum list <name>

    yum list samba

    2) Show all version of packages in repository

    yum --showduplicates list samba*

    3) Get information on package

    yum list 
    yum info <name>


    ex. yum info samba

    4) Get info on installed packages

    yum list installed

    Output Color Codes:

    All package in Bold and Underline means -Curent Kernel Version
    All package in Bold means -Have updates available
    All package in Red means- Package is not in our repository
    All package in yellow means -package in installed with higher version that in repository

    5) To only download rpm 

    yum install -downloadonly -downloaddir=/tmp

    6)Get all packages with updates available

    yum list updates

    7)Get list of packages available in repository

    yum list available

    Output Color Codes:

    Blue: An updated to an installed package
    Cyan: Downgrade to a installed package
    Green and Underlined: Current Version of installed package


    8) Check all package

    yum list all

    9) Check obsolete package list
    yum list obsoletes

    10)Check more information on package

    yum info <package name>

    yum info zip
    yum info updates (check information on updates)
    yum info obsoletes (check information on obsoletes)

    11) Check dependency of a package

    yum deplist <package name>
    yum deplist zip

    12) Checking various package groups

    yum group list

    13) Checking hidden groups

    yum group list hidden

    14) Checking group information

    yum group info "group name"

    yum group info "Development Tools"

    15) Searching a package using yum

    yum search <package name>

    yum search zip

    we can also search all which will search description as well

    yum search all zip

    16) Find which package can provide specific utility

    yum provides <package name>

    yum provides zip

    No comments :

    Post a Comment

    Restore the Original Permissions of Package Files using RPM

    No comments

    Restore the Original Permissions of Files using RPM


    If in any case the package configuration files permissions or get changed in Linux, we can use rpm to restore the permissions.

    I have changed the permission manully.

    [root@lcfs packages]# rpm -qc wget
    /etc/wgetrc
    [root@lcfs packages]# ls -ltr /etc/wgetrc
    -rw-r--r--. 1 root root 4479 May 16  2019 /etc/wgetrc
    [root@lcfs packages]# chmod 777 /etc/wgetrc
    [root@lcfs packages]# chown himanshu:himanshu /etc/wgetrc
    [root@lcfs packages]# ls -ltr /etc/wgetrc
    -rwxrwxrwx. 1 himanshu himanshu 4479 May 16  2019 /etc/wgetrc

    Now lets restore original permissions using setperms:

    [root@lcfs packages]# rpm -setperms wget
    [root@lcfs packages]# ls -ltr /etc/wgetrc
    -rw-r--r--. 1 himanshu himanshu 4479 May 16  2019 /etc/wgetrc

    Also we can restore the original ownership as well using setugids:

    [root@lcfs packages]# rpm -setugids wget
    [root@lcfs packages]# ls -ltr /etc/wgetrc
    -rw-r--r--. 1 root root 4479 May 16  2019 /etc/wgetrc

    No comments :

    Post a Comment

    Install|Remove|Upgrade|Re-Install|Verify|Validate Packages using RPM in Linux

    No comments

    Install|Remove|Upgrade|Re-Install|Verify|Validate Packages using RPM in Linux


    Installing a Package:

    rpm -ivh

    rpm -ivh httpd-2.4.6-93.el7.centos.x86_64.rpm

    Please note if any dependent package is notinstalled it will fail and you have first install the dependent package.

    Uninstalling a Package:

    rpm -ev

    rpm -ev httpd

    Please note this will not remove any dependent package that was installed as part of the "httpd" installation.

    Upgrading a Package:

    rpm -Uvh

    To find out which package need to be upgraded we will use below command and all the packages mentioned in bold would be eligible for upgrade.

    yum list installed

    I ran the command and found below 2 packages.
    tzdata.noarch                      
    tzdata-java.noarch 

    Note: I have already downloaded the rpm.

    Now we will upgrade packages, it will cleanup old version and install new rpm.

    [root@lcfs packages]# rpm -Uvh tzdata-2020a-1.el7.noarch.rpm
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:tzdata-2020a-1.el7               ################################# [ 50%]
    Cleaning up / removing...
       2:tzdata-2019c-1.el7               ################################# [100%]


    In case there is a dependency problem while upgrade which means it create a deadlock like situation where each package is dependent on other then we can use below option while upgrade which will ignore dependency problem.

    rpm -Uvh --nodeps

    Freshening a Package:

    rpm -F

    It works same way as upgrade but the diffrence is that it will only upgrade the packages which are already installed, whereas upgrade will install the package if it is not installed.


    Re-Installing a Package:

    rpm -ivh --force

    [root@lcfs packages]# rpm -ivh --force tzdata-2020a-1.el7.noarch.rpm
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:tzdata-2020a-1.el7               ################################# [100%]


    Verify Package Attributes:

    Attibutes of a files are
    S - Size
    M - File permission
    5 - Checksum
    D - Device Number
    L - Link Path
    U - User ownership
    G - Group ownership
    T - Last modified Time
    C - Capabilities
    c - file type


    This will help to identify if the files were changed once they were installed.
    This information includes file size, file permissions, check sum, device major and minor numbers, link path, user ownership, group ownership, last modify time, and capabilities. Using rpm verify, we can check if files have changed since they were installed. Rpm verify will also show us the file type. This type could be, a configuration file, a documentation file, a ghost file, which is one where the contents were not included in the package itself, a license file, or lastly, a README file.



    rpm -V name

     This shows the size has changed, the digest or check sum has changed, and the last modify timestamp has changed. 
    [root@lcfs zoneinfo]# rpm -V yum
    S.5....T.  c /etc/yum.conf


    We can use "v" to get information in detail

    [root@lcfs zoneinfo]# rpm -Vv zip
    .........    /usr/bin/zip
    .........    /usr/bin/zipcloak
    .........    /usr/bin/zipnote
    .........    /usr/bin/zipsplit
    .........    /usr/share/doc/zip-3.0
    .........  d /usr/share/doc/zip-3.0/CHANGES
    .........  d /usr/share/doc/zip-3.0/LICENSE
    .........  d /usr/share/doc/zip-3.0/README
    .........  d /usr/share/doc/zip-3.0/README.CR
    .........  d /usr/share/doc/zip-3.0/TODO
    .........  d /usr/share/doc/zip-3.0/WHATSNEW
    .........  d /usr/share/doc/zip-3.0/WHERE
    .........  d /usr/share/doc/zip-3.0/algorith.txt
    .........  d /usr/share/man/man1/zip.1.gz
    .........  d /usr/share/man/man1/zipcloak.1.gz
    .........  d /usr/share/man/man1/zipnote.1.gz
    .........  d /usr/share/man/man1/zipsplit.1.gz


    To verify all files we can use below command. This is a time taking activity

    rpm -Va

    Validate Package Integrity

    It will help validate if the package is not alter or modified or any type of corruption.

    Check MD5 checksum

    [root@lcfs packages]# rpm -K --nosignature tzdata-java-2020a-1.el7.noarch.rpm
    tzdata-java-2020a-1.el7.noarch.rpm: sha1 md5 OK

    GPG check

    [root@lcfs packages]# rpm -K  tzdata-java-2020a-1.el7.noarch.rpm
    tzdata-java-2020a-1.el7.noarch.rpm: rsa sha1 (md5) pgp md5 OK

    Check the key information

    [root@lcfs packages]# rpm -q gpg-pubkey
    gpg-pubkey-f4a80eb5-53a7ff4b

    [root@lcfs packages]# rpm -qi gpg-pubkey-f4a80eb5-53a7ff4b
    Name        : gpg-pubkey
    Version     : f4a80eb5
    Release     : 53a7ff4b
    Architecture: (none)
    Install Date: Thursday 09 April 2020 08:03:16 AM IST
    Group       : Public Keys
    Size        : 0
    License     : pubkey
    Signature   : (none)
    Source RPM  : (none)
    Build Date  : Monday 23 June 2014 03:49:55 PM IST
    Build Host  : localhost
    Relocations : (not relocatable)
    Packager    : CentOS-7 Key (CentOS 7 Official Signing Key)
    Summary     : gpg(CentOS-7 Key (CentOS 7 Official Signing Key) )
    Description :

    No comments :

    Post a Comment