High Availbility

OS & Virtualization

Tuesday, June 27, 2017

Getting X11 forwarding through ssh working after running su

Getting X11 forwarding through ssh working after running su



$ xauth list $DISPLAY
You'll get something like

somehost.somedomain:10 mit-magic-cookie-1 4d22408a71a55b41ccd1657d377923ae

Then, after having done su, tell the new user what the cookie is:

$ xauth add somehost.somedomain:10 MIT-MAGIC-COOKIE-1 4d22408a71a55b41ccd1657d377923ae

Thursday, May 11, 2017

Oracle Clusterware Main Log Files

Oracle Clusterware Main Log Files


Oracle Clusterware uses a unified log directory structure to consolidate the Oracle Clusterware
component log files. This consolidated structure simplifies diagnostic information collection and
assists during data retrieval and problem analysis.



The main directories used by Oracle Clusterware to store its log files:
  • CRS logs are in $ORA_CRS_HOME/log//crsd/. The crsd.log file is archived every 10 MB (crsd.l01, crsd.l02, …).
  • CSS logs are in $ORA_CRS_HOME/log//cssd/. The cssd.log file isarchived every 20 MB (cssd.l01, cssd.l02, …).
  • EVM logs are in $ORA_CRS_HOME/log//evmd.
  • Depending on the resource, specific logs are in $ORA_CRS_HOME/log//racg and in $ORACLE_HOME/log//racg. In the last directory, imon_.log is archived every 10 MB for each service. Each RACG executable has a subdirectory assigned exclusively for that executable. The name of the RACG executable subdirectory is the same as the name of the executable.
  • SRVM (srvctl) and OCR (ocrdump, ocrconfig, ocrcheck) logs are in $ORA_CRS_HOME/log//client/ and in $ORACLE_HOME/log//client/.
  • Important Oracle Clusterware alerts can be found in alert.log in the $ORA_CRS_HOME/log/ directory.

Wednesday, January 11, 2017

Oracle dbstart/dbshut does not do anything

Steps
  1. at etc/oratab have the last char as Y and not N
  2. Eg
  3.  orcl:/u01/app/oracle/product/11.2.0/dbhome_1:N

    change it to this :


      orcl:/u01/app/oracle/product/11.2.0/dbhome_1:Y

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





Wednesday, December 16, 2015

export from db where sysaux needs recovery

Whenever sysaux goes to recovery state, you won’t be able to do the exp or expdp. You will get error like ‘not able to read/write sysaux’ datafiles. If you don’t have the archivelog to recover the sysaux, then you can follow below steps to atleast get the exp work. expdp doesn’t work still.


Shutdown immediate;
startup upgrade
@?/rdbms/admin/catnoqm.sql
shutdown immediate
startup


There you go, your export will work. Pls note, you may have to rebuild to have perfect system.

Thursday, October 29, 2015

Importing oracle trusted certificate into oracle wallets

Importing oracle trusted certificate into oracle wallets

 
I am assuming user is created trusted certificate and hand over to you. As a oracle dba
 you have to import the trusted certificate in the oracle database server.
 
How to import user trusted certificate into oracle wallets
  1. Create wallet
    1. Syntax: orapki wallet create -wallet
  2. $orapki wallet create -wallet ‘/home/oracle/admin/WALLETS’
    1. Enter password:
    2.  Enter password again:
  3. copy/ftp the user trusted certificate to database server temp location
    1. /tmp/testwallet_ssl.cer
  4. To add a trusted certificate to an Oracle wallet:
    1. Syntax:  orapki wallet add -wallet -trusted_cert -cert
    2. $orapki wallet add -wallet ‘/home/oracle/admin/WALLETS’ -trusted_cert -cert ‘/tmp/testwallet_ssl.cer’
  5. To view an Oracle wallet:
    1.  Syntax:  orapki wallet display -wallet
    2. $orapki wallet display -wallet ‘/home/oracle/product/WALLETS/oracle’
 

Monday, October 26, 2015

some useful link

https://apexapps.oracle.com/pls/apex/f?p=44785:1:6886471140158490

Wednesday, July 01, 2015

Getting Started with Docker on Oracle Linux

Learn how to customize a Docker container image and use it to instantiate application instances across different Linux servers. This article describes how to create a Dockerfile, how to allocate runtime resources to containers, and how to establish a communication channel between two containers (for example, between web server and database containers).

Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries 

 

Common Docker commands





Commands
 Purpose
 docker info
 information
 docker images
 images
 docker ps -a
List all containers
 docker rm $(docker ps -a -q)
 Remove containers
 docker rmi $(docker images)
 Remove images
docker save mynewimage > /tmp/mynewimage.tar
Export images
docker load < /tmp/mynewimage.tar
Import images


docker pull oracle/nosql




Monday, February 16, 2015

Linux Containers

Linux Containers


Linux Containers (LXC) allow running multiple isolated Linux instances (containers) on the same host.

  • Lightweight and resource-friendly
  • Run multiple versions of an operating system on a single server
  • Rapid and Easy deployment

Installing Oracle Linux containers


https://blogs.oracle.com/OTNGarage/entry/linux_container_lxc_part_2

Installing Oracle on Linux containers

https://bdrouvot.wordpress.com/2014/04/25/reduce-resource-consumption-and-clone-in-seconds-your-oracle-virtual-environment-on-your-laptop-using-linux-containers-and-btrfs/

Wednesday, February 04, 2015

Oracle Migration (Windows 10g to Linux 11g ) Using storage move

Oracle Migration (Windows 10g to Linux 11g ) Using storage move.


Describes steps for migration Opera Databases 10.2.0.4 on Windows to 11.2.0.3  on Linux Red Hat Enterprise Linux using Storage Disk copy

Steps in Windows side


1) Check disks and ASM Diskgroups in Windows environment.

select disk_number,name, parth for v$asm_disk;

Check for invalid objects

select owner, count(*) from dba_objects where status='INVALID'
2) Run the 11g pre upgrade script
@%oracle_home%\rdbms\admin\utlu112s.sql

3) Shutdown database
shutdown immediate

4) Dismount ASM diskgroup
alter diskgroup dismount all;


DC STORAGE ASM DISK MOVE FROM WINDOWS TO LINUX

Steps in Linux side


1) as grid user
oracleasm scandisks
oracleasm listdisks

sqlplus / as sysasm
alter diskgroup DATADG mount;

2) as oracle user
startup mount pfile='/home/oracle/initopera_pre.ora'
alter database open upgrade
@?/rdbms/admin/catupgrd
@?/rdbms/admin/utlu112s.sql
@?/rdbms/admin/utlrp.sql

Monday, September 08, 2014

Deinstalling Oracle 11gr2 software on Windows 2003/2008

Issue


Unable to uninstall Oracle 11g software on Windows 2003/2008
D:\oracle\1120\client_1\deinstall>deinstall.bat
Checking for required files and bootstrapping ...
Please wait ...
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
'C:\DOCUME~1\vng\Local' is not recognized as an internal or external command,
operable program or batch file.

 

Solution


Check your Temp and TMP environment variables. They might indicate a path which contains spaces so, just reset them temporarily to c:\temp and then try the deinstall.bat script

Monday, August 25, 2014

Monitor the progress of Oracle session

Monitor the progress of Oracle session


Some of my fun tools I have created during my free time. :)

Progress Monitor a monitoring tool for monitor long running processes like RMAN backup, export, statistics gathering.
  • bakstatus.exe is the main executable file
  • bakstatus.exe.config – configuration file. Key1 is the sys password, Key2 is the connection string
  • Oracle.DataAccess.dll – the required oracle ddl file
  • Inprt : program : Enter the name of the program (eg RMAN for RMAN backup, EXP for export, GATHER for statistics)
  • 2 progress bar indicating the amount of percentage to be complete.
 
 
Download Files
bakstatus.exe
bakstatus.exe.config

    Dataguard Monitor (tool)


    Dataguard Monitor


    Some of my fun tools I have created during my free time. :)

    Dataguard Monitor a monitoring tool for monitor the log shipping to dataguard server. It will auto upgrade every minute. The status show the current status of the recovery process and the archive log number/instance node currently applied. The log not apply show the number of archive log waiting to be apply.

    • DGcheck.exe is the main executable file
    • Dgcheck.exe.config – configuration file. Key1 is the sys password, Key2 is the connection string
    • Oracle.DataAccess.dll – the required oracle ddl file



    Setup
    1. Download oracle odp.net ODAC1120320Xcopy_32bit from Oracle website
    2. Extract the zip file to c:\temp
    3. Install using the command
      1.  install.bat odp.net20 c:\oracle\odp odp
      2. (to uninstall uninstall all c:\oracle\odp)
    4. Unzip to the dataguard_status.zip
    5. Execute the DGcheck.exe
    Download Files



    Thursday, April 17, 2014

    Unable to execute asmcmd due to wrong Perl home

    Problem

    You may encounter this error while executing asmcmd if you have multiple Oracle_home.

    Perl lib version (v5.6.1) doesn't match executable version (v5..8.3) dt d:\oracle.......

    This is due to the perl library is using the wrong ORACLE_HOME

    Solution

    set PERL5LIB=D:\oracle\1020\asm\perl\5.8.3\lib\MSWin32-X64-multi-thread