High Availbility

OS & Virtualization

Thursday, December 08, 2016

Basic Oracle Exadata administration

Basic Oracle Exadata Machine administration



Using dcli

  1. connect as oracle user
  2. create a file named mycells



     cat <<> mycells
    dbserver01
    dbserver02
    dbserver03
    dbserver04
    END




  1. Generate a ssh key pair
  2.  ssh-keygen -t rsa

  3. You have completed. Now try it.

     dcli -g mycells "cat /proc/meminfo | grep Mem"


How to check Exadata version?





[root@remote_dbacell1 ~]# imageinfo
[root@remote_dbacell1 ~]# imagehistory







How to clean exawatcher logs?

(Doc ID 1617454.1)


One-time cleanup for ExaWatcher logs:



  1.  Stop ExaWatcher

     ./ExaWatcher.sh --stop
  2. Adjust on the command line for a one-time cleanup operation ...  will remove all older ExaWatcher logs over 2GB quotaOutput showing ExaWatcherCleanup.sh execution will be written to the console.  When completed you will see something similar to:"Current size of the result directory /opt/oracle.ExaWatcher/archive/ is 2097152 after clean up. Please see /opt/oracle.ExaWatcher/log/OldFilesDeleted.log to look for the files deleted." - Use 'control C' to exit from cleanup script
     ./ExaWatcher.sh --spacelimit "spacelimit" (in MB)ex) ./ExaWatcher.sh  --spacelimit 2048 

  3. Restart ExaWatcher

      /opt/oracle.cellos/validations/bin/vldrun.pl -script oswatcher


How to change OS user password for Cell Node, Database Node , ILOM, KVM , Infiniband Switch , GigaBit Ethernet Switch and PDU on Exadata Database Machine


(Doc ID 1291766.1)



  1. set /SP/users/root password

     > dcdli -g dbs_cell_group_ilom -| root " ipmitool sunoem cli 'set /SP/users/root password=newpassword' oldpassword"










How to stop database nodes?

  1. /grid/bin/crsctl stop crs –f
  2. Shutdown oswatcher



     cd /opt/oracle/oswatcher/osw/
    /stopOSW.sh




How to power on/off sequence?

Power off sequence



  1. On Database server
    1. crsctl stop cluster
    2. shutdown –h –u now
  2. On Storage server
    1. Shutdown –h –y now
  3. Turn off Rack, network switches


Power on sequence

  1. Rack, network switches
  2. Storage server
  3. Database server


How to Shutdown Exadata storage Server?

Shutdown sequence



  1. cellcli> LIST GRIDDISK WHERE asmdeactivationoutcome != ‘Yes’
  2. cellcli> ALTER GRIDDISK ALL INACTIVE
  3. cellcli> LIST GRIDDISK WHERE STATUS !=’INACTIVE’










Startup sequence








  1.  cellcli> ALTER GRIDDISK ALL ACTIVE
  2. cellcli> LIST GRIDDISK ATTRIBUTES name,attributes











How to replacing a Damaged Physical disk?



  1. cellcli> LIST ALERTHISTORY WHERE ALERTMESSAGE LIKE “Logical drive lost.*” DETAIL
  2. Replace the physical disk
    1. ALTER PHYSICALDISK
  3. Monitor the ASM to confirm the re-addition of the disk


Replacing a damaged Flash Card





  1.  cellcli> LIST PHYSICALDISK DETAIL

  2. power off cell
  3. replace the damanged card
  4. power on the cell


Moving all disk from one cell to another






  1.  cellcli> ALTER GRIDDISK ALL INACTIVE
  2. Backup OS config
  3. Move the disk,flashcard, disk controller and CELLBOOT to new cell
  4. Boot the new cell
  5. Restart cell services



     Cellcli> ALTER CELL RESTART SERVICES ALL



  6. Activate the gird disks

     Cellcli> ALTER GRDDISK ALL ACTIVE












Thursday, September 08, 2016

How to Manage Audit Files and Auditing on 11gr2


The following document explains how to switch on database auditing and the audit management packages for Oracle 11.2.

--
-- Set-up Audit Management
--

BEGIN
  DBMS_AUDIT_MGMT.init_cleanup(
    audit_trail_type         => DBMS_AUDIT_MGMT.AUDIT_TRAIL_ALL,
    default_cleanup_interval => 12 /* hours */);
END;
/

--
-- Check Default Clean Up Interval has been Set and Cleanup is Initialized
--

COLUMN parameter_name FORMAT A30
COLUMN parameter_value FORMAT A20
COLUMN audit_trail FORMAT A20

SELECT * FROM dba_audit_mgmt_config_params WHERE PARAMETER_NAME = 'DEFAULT CLEAN UP INTERVAL'
/

SET SERVEROUTPUT ON
BEGIN
  IF DBMS_AUDIT_MGMT.is_cleanup_initialized(DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD) THEN
    DBMS_OUTPUT.put_line('YES');
  ELSE
    DBMS_OUTPUT.put_line('NO');
  END IF;
END;
/

pause Check the default clean up interval been set and the cleanup has been initialized.

--
-- Set Last Archive Timestamp Values for OS and XML Files.
--

BEGIN
DBMS_AUDIT_MGMT.set_last_archive_timestamp(
audit_trail_type  => DBMS_AUDIT_MGMT.AUDIT_TRAIL_OS,
last_archive_time => SYSTIMESTAMP-31);
END;
/

BEGIN
DBMS_AUDIT_MGMT.set_last_archive_timestamp(
audit_trail_type  => DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD,
last_archive_time => SYSTIMESTAMP-31);
END;
/

BEGIN
DBMS_AUDIT_MGMT.set_last_archive_timestamp(
audit_trail_type  => DBMS_AUDIT_MGMT.AUDIT_TRAIL_XML,
last_archive_time => SYSTIMESTAMP-31);
END;
/

--
-- Check Last Archive Timestamp Values are Set
--

SELECT * FROM dba_audit_mgmt_last_arch_ts
/

pause Check the last archive timestamp values have been set.

--
-- Set-up Automated Purge Job
--

BEGIN
DBMS_AUDIT_MGMT.create_purge_job(
audit_trail_type           => DBMS_AUDIT_MGMT.AUDIT_TRAIL_ALL,
audit_trail_purge_interval => 24 /* hours */,
audit_trail_purge_name     => 'PURGE_ALL_AUDIT_TRAILS',
use_last_arch_timestamp    => TRUE);
END;
/

--
-- Set-up a Job to Move the Last Archive Timestamp Forward Each Day
--

-- Unhash if rerunning code.
--
-- BEGIN
--   SYS.DBMS_SCHEDULER.DROP_JOB
--     (job_name  => 'SYS.MOVE_LAST_TIMESTAMP_FORWARD');
-- END;
-- /

BEGIN
  SYS.DBMS_SCHEDULER.CREATE_JOB
    (
       job_name        => 'SYS.MOVE_LAST_TIMESTAMP_FORWARD'
      ,start_date      => TO_TIMESTAMP_TZ('2012/04/13 08:00:00.000000 +01:00','yyyy/mm/dd hh24:mi:ss.ff tzr')
      ,repeat_interval => 'FREQ=DAILY;INTERVAL=1'
      ,end_date        => NULL
      ,job_class       => 'DEFAULT_JOB_CLASS'
      ,job_type        => 'PLSQL_BLOCK'
      ,job_action      => 'BEGIN
  DBMS_AUDIT_MGMT.set_last_archive_timestamp(
    audit_trail_type  => DBMS_AUDIT_MGMT.AUDIT_TRAIL_OS,
    last_archive_time => SYSTIMESTAMP-31);
END;
BEGIN
  DBMS_AUDIT_MGMT.set_last_archive_timestamp(
   audit_trail_type  => DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD,
   last_archive_time => SYSTIMESTAMP-31);
END;
BEGIN
  DBMS_AUDIT_MGMT.set_last_archive_timestamp(
    audit_trail_type  => DBMS_AUDIT_MGMT.AUDIT_TRAIL_XML,
    last_archive_time => SYSTIMESTAMP-31);
END;'
      ,comments        => NULL
    );
  SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
    ( name      => 'SYS.MOVE_LAST_TIMESTAMP_FORWARD'
     ,attribute => 'RESTARTABLE'
     ,value     => FALSE);
  SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
    ( name      => 'SYS.MOVE_LAST_TIMESTAMP_FORWARD'
     ,attribute => 'LOGGING_LEVEL'
     ,value     => SYS.DBMS_SCHEDULER.LOGGING_OFF);
  SYS.DBMS_SCHEDULER.SET_ATTRIBUTE_NULL
    ( name      => 'SYS.MOVE_LAST_TIMESTAMP_FORWARD'
     ,attribute => 'MAX_FAILURES');
  SYS.DBMS_SCHEDULER.SET_ATTRIBUTE_NULL
    ( name      => 'SYS.MOVE_LAST_TIMESTAMP_FORWARD'
     ,attribute => 'MAX_RUNS');
  BEGIN
    SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
      ( name      => 'SYS.MOVE_LAST_TIMESTAMP_FORWARD'
       ,attribute => 'STOP_ON_WINDOW_CLOSE'
       ,value     => FALSE);
  EXCEPTION
    -- could fail if program is of type EXECUTABLE...
    WHEN OTHERS THEN
      NULL;
  END;
  SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
    ( name      => 'SYS.MOVE_LAST_TIMESTAMP_FORWARD'
     ,attribute => 'JOB_PRIORITY'
     ,value     => 3);
  SYS.DBMS_SCHEDULER.SET_ATTRIBUTE_NULL
    ( name      => 'SYS.MOVE_LAST_TIMESTAMP_FORWARD'
     ,attribute => 'SCHEDULE_LIMIT');
  SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
    ( name      => 'SYS.MOVE_LAST_TIMESTAMP_FORWARD'
     ,attribute => 'AUTO_DROP'
     ,value     => TRUE);

  SYS.DBMS_SCHEDULER.ENABLE
    (name                  => 'SYS.MOVE_LAST_TIMESTAMP_FORWARD');
END;
/

--
-- Check the DBMS Scheduler Jobs are Configured.
--

SELECT owner,job_name FROM DBA_SCHEDULER_JOBS WHERE job_name IN ('PURGE_ALL_AUDIT_TRAILS','MOVE_LAST_TIMESTAMP_FORWARD')
/

pause Check the jobs are scheduled.

Wednesday, April 06, 2016

Linux & command - Firewalld

Firewall

The firewall on Redhat 7 Linux system is enabled by default.
  1. Stop and Start RHEL7 firewall

    root@rhel7 ~] service firewalld stop
    root@rhel7 ~]# service firewalld start |
  2. Disable and Enable RHEL7 firewall

    [root@rhel7 ~]# systemctl disable firewalld
    [root@rhel7 ~]# systemctl enable firewalld
  3. How to open http port 80 on Redhat 7 Linux using firewall-cmd

    [root@rhel7 ~]## firewall-cmd --zone=public --add-port=80/tcp

    Once you add the above firewall rule reload firewall service:

    [root@rhel7 ~]# firewall-cmd --reload 4.
  4. List all the port

    [root@SGNWH01HP1DB1 firewalld]# firewall-cmd --zone=public --list-all public


Start, Stop and Restart services on systemd RHEL



  1. list all currenly running services

    [root@rhel7 ~]# systemctl list-units --type=service | grep running
  2. list all active services available

    [root@rhel7 ~]# systemctl list-units --type=service

Journal Analysis

  1. To get the content of the Systemd journal,
    # journalctl
  2. To get all the events related to the crond process in the journal
    # journalctl --unit=chronyd
  3. To get all the events that appeared today in the journal, type:
    # journalctl --since=today
  4. To display the disk space used by Journald# journalctl --disk-usage
  5. To get the 10 last events
    # journalctl -f

Boot Process

  1. To get the boot process duration
    # systemd-analyze


Service Management

Systemd deals with all the aspects of the service management. The systemctl command replaces the chkconfig and the service commands
  1.  To activate the NTP service at boot
    # systemctl enable ntpd
  2. To deactivate it, start it, stop it, restart it, reload it, type:
    # systemctl disable ntpd
    # systemctl start ntpd
    # systemctl stop ntpd
    # systemctl restart ntpd
    # systemctl reload ntpd
  3. To get the status of the Apache service
    # systemctl status httpd
  4. To get the list of services that failed at boot, type:
    
    
    # systemctl --failed
  5. To get all the configuration details about a service (here httpd), type:
    
    
    # systemctl show httpd

Other commands

  • nmtui
  • nmcli
  • ip


How to add a user to the sudoers list

How to add a user to the sudoers list?



 
cat << END >> /etc/sudoers
oracle ALL=(ALL) NOPASSWD:ALL
Defaults:oracle !requiretty
END