Tuesday, October 16, 2018

burn mp3 to audio cd on linux with command line


1. convert mp3 to wav format using online service

https://online-audio-converter.com/

2. find device

[root@hanli gymnastic_song]# wodim -devices
wodim: Overview of accessible drives (1 found) :
-------------------------------------------------------------------------
 0  dev='/dev/sg2'      rwrw-- : 'HL-DT-ST' 'DVDRAM GH24NSB0'
-------------------------------------------------------------------------

3. burn

cdrecord -v -nofix -eject dev='/dev/sg2' -audio -pad 5_Clubs_ELE.wav

reference:
https://linuxconfig.org/burn-your-music-files-from-any-format-to-audio-cd-using-command-line

Monday, October 15, 2018

CSSD start failed on one node of two-nodes RAC database cluster after reboot


Symptom:


One node has CSSD start failed after reboot
The other node is OK.

Log file show disk HB is godd and network HB failed


Checking :


olsnodes -n -i -s -t # check nodes

node1 1 active unpinned
node2 2 inactive unpinned ## unpinned is not an issue.

According Metalink doc Top 5 Grid Infrastructure Startup Issues (Doc ID 1368382.1)
#3

check
ping -s 8900 hostname/IP # check jumbo frame setting
ping -s 1500 hostname/IP # check if default value MTU 1500 is good

root cause:

MTU set as 9000 on unix OS level, but network is not enabled jumbo frame on both private and public network interfaces.

Fix:

network team need enable jumbo frame as MTU 9000 and make sure "ping -s 9000 IP" work.
restart cluster/reboot server.


reference:

Troubleshooting Clusterware startup problems with detailed debugging info

https://www.hhutzler.de/blog/troubleshooting-clusterware-startup-problems/


Wednesday, February 7, 2018

SSL setup for oracle RAC database.

SSL setup for oracle RAC database.
Step by Step Guide: How to Configure SSL/TLS on ORACLE RAC (with SCAN) (Doc ID 1448841.1)


1. configure TCPS protocal endpoints
 crsctl stat res -p | grep -i endpoints
 srvctl modify listener -p "TCP:1521/TCPS:35050";
 srvctl config listener 
 srvctl modify scan_listener -p "TCP:1521/TCPS:35050"
 srvctl config scan_listener
 
 

2. create SSL certificataes and wallets for cluster and for client.

2.1  create self-signed CA (NO need if exsited CA is used. )
mkdir -p /u01/app/oracle/CA
cd /u01/app/oracle/CA 
export CA_HOME=/u01/app/oracle/CA
orapki wallet create -wallet $CA_HOME
orapki wallet remove -trusted_cert_all -wallet $CA_HOME
orapki wallet add -wallet $CA_HOME -self_signed -dn "CN=DEV-CA,O=MYORG,C=MYOFFICE" -keysize 2048 -validity 3650 -sign_alg sha256 -pwd <password>
orapki wallet export -wallet $CA_HOME -dn "CN=DEV-CA,O=MYORG,C=MYOFFICE" -cert devCA.cer -pwd <password>
orapki wallet display -wallet $CA_HOME -summary

2.2 create cluster wallet and cert
mkdir -p /u01/app/oracle/wallet/myrac
export W_HOME=/u01/app/oracle/wallet/myrac
orapki wallet create -wallet $W_HOME
orapki wallet remove -trusted_cert_all -wallet $W_HOME -pwd <password>
orapki wallet add -wallet $W_HOME -dn "CN=myrac" -keysize 2048 -pwd <password>
orapki wallet export -wallet $W_HOME -dn "CN=myrac" -request $W_HOME/myrac.req -pwd <password>
orapki cert create -wallet $CA_HOME -request $W_HOME/myrac.req -cert $W_HOME/myrac.cer -validity 3650 -sign_alg sha256 -pwd <password>
orapki wallet add -wallet $W_HOME -trusted_cert -cert $CA_HOME/devCA.cer -pwd <password> 
orapki wallet add -wallet $W_HOME -user_cert -cert $W_HOME/myrac.cer -pwd <password>
orapki wallet display -wallet $W_HOME -summary -pwd <password>
orapki wallet create -wallet $W_HOME -auto_login
## the wallet with cert need be copy to all nodes.

2.3 create client wallet and cert
## unique ssl cert is required for client with the same CA for successful SSL connection.
mkdir -p /home/oracle/ben/wallet
export W_HOME=/home/oracle/ben/wallet
orapki wallet create -wallet $W_HOME -pwd <password>
orapki wallet remove -trusted_cert_all -wallet $W_HOME -pwd <password>
orapki wallet add -wallet $W_HOME -trusted_cert -cert $W_HOME/devCA.cer -pwd <password> 
orapki wallet create -wallet $W_HOME -auto_login
orapki wallet add -wallet $W_HOME -dn "CN=devUser" -keysize 2048 -pwd <password>
orapki wallet export -wallet $W_HOME -dn "CN=devUser" -request $W_HOME/devUser.req -pwd <password>
orapki wallet add -wallet $W_HOME -user_cert -cert $W_HOME/devUser.cer -pwd <password>

3. configure listener.ora and sqlnet.ora for cluster
# both PMON and the listener processes of each node must be able to access the wallets.
# This is in oracle home.
3.1 in sqlnet.ora
SQLNET.AUTHENTICATION_SERVICES= (BEQ, TCPS)

SSL_VERSION = 0

SSL_CLIENT_AUTHENTICATION = FALSE

WALLET_LOCATION =
  (SOURCE =
    (METHOD = FILE)
    (METHOD_DATA =
      (DIRECTORY = /u01/app/oracle/wallet/myrac)
    )
  )



3.2 in listener.ora   ## this is in Grid home.
SSL_CLIENT_AUTHENTICATION = FALSE

WALLET_LOCATION =
  (SOURCE =
    (METHOD = FILE)
    (METHOD_DATA =
      (DIRECTORY = /u01/app/oracle/wallet/myrac)
    )
  )


4.Restart instances and listeners. 

srvctl stop listener
srvctl start listener

srvctl stop scan_listener
srvctl start scan_listener

srvctl stop database -d testdb
srvctl start database -d testdb

/** OR shut instance one by one
srvctl stop instance -db testdb -instance testdb1 -stopoption immediate -force
srvctl start instance -db testdb -instance testdb1 
srvctl stop instance -db testdb -instance testdb2 -stopoption immediate -force
srvctl start instance -db testdb -instance testdb2
 */

  
5. configure sqlnet.ora for client
WALLET_LOCATION =
  (SOURCE =
    (METHOD = FILE)
    (METHOD_DATA =
      (DIRECTORY = /u01/app/oracle/wallet/devUser)
    )
  )


6. test connection
6.1 create tns entry

testdbSSL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCPS)(HOST = myrac-scan)(PORT = 35050))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = testdb)
    )
  )

6.2 ping ssl entry
tnsping testdbSSL

TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 07-FEB-2018 16:17:03

Copyright (c) 1997, 2014, Oracle.  All rights reserved.

Used parameter files:
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCPS)(HOST = myrac-scan)(PORT = 35050)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = testdb)))
OK (130 msec)

6.3 connect  with sqlplus
[oracle@sp-ud-oitord01 ben]$ sqlplus system@testdbssl

SQL*Plus: Release 12.1.0.2.0 Production on Wed Feb 7 16:17:51 2018

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

Enter password:

Last Successful login time: Wed Feb 07 2018 16:00:09 -05:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SQL>




6. verify connection protocol
SELECT SYS_CONTEXT('USERENV', 'network_protocol') FROM DUAL;

SQL> SELECT SYS_CONTEXT('USERENV', 'network_protocol') FROM DUAL;

SYS_CONTEXT('USERENV','NETWORK_PROTOCOL')
--------------------------------------------------------------------------------
tcps

SQL>



###################
# troubelshooting
####################

###ORA-28865: SSL connection closed  or ORA-28864: SSL CONNECTION CLOSED GRACEFULLY 

for rac both grid_home and oracle_home need have below setup on sqlnet.ora
WALLET_LOCATION =
  (SOURCE =
    (METHOD = FILE)
    (METHOD_DATA =
      (DIRECTORY = /u01/app/oracle/wallet/myrac)
    )
  )


####   ORA-28860: Fatal SSL error
this is because client side sqlnet.ora has 
SL_CLIENT_AUTHENTICATION=FALSE
comment it out.

Wednesday, January 18, 2017

Xming X server : No protocol defined issue

symtem:

in log: client was rejected from IP xxx.xxx.xxx.xxx

This is caused by client not accept setting.

solution:

1. edit Xming host file to add ip
2. start Xming with -ac option
edit shortcut and add -ac for target field.


http://theunixtips.com/xming-client-4-rejected-from-ip/

Wednesday, October 1, 2014

DATAGUARD: Oracle Physical standby database Log shipping issue

Symptom:
  Physical standby was sync with primary a day ago, but stopped receiving logs. All logs are still available on primary site.

Error message:
   'ORA-01031: insufficient privileges'

Cause:
  sys password was changed on primary side.

Solution:
  copy password file from primary to standby site

Check sql:
select sequnece#, applied from v$archived_log;
select process, status, sequence# from v$managed_standby;
select dest_id, status, error from v$archive_dest;
alter database recover managed standby database using current logfile disconnect;
(alter database recover managed standby database disconnect from session;)
alter database recover managed standby database cancel;
show parameter fal_client
show parameter fal_server
show parameter log
alter system witch logfile;
alter system set log_archive_dest_state_3=enable;
alter database register logfile 'path/filename';
rman> catalog start with '/var/arch';

Check step:
1. check network
tnsping fal_client and fal_server and service_name of log_archive_dest_state_3
2. check instance are up
3. check password
login as sys to both primary and standby database.
4. check error for log_dest

Processes:
primary database

There are a number of Oracle background processes that play a key role, first the primary database
•LGWR - log writer process flushes from the SGA to the ORL files
•LNS - LogWriter Network Service reads redo being flushed from the redo buffers by the LGWR    and performs a network send of the redo to the standby
•ARCH - archives the ORL files to archive logs, that also used to fulfill gap resolution requests, one ARCH processes is dedicated to local redo log activity only and never communicates with a

standby database

The standby database will also have key processes
•RFS - Remote File Server process performs a network receive of redo transmitted from the primary and writes the network redo to the standby redo log (SRL) files.
•ARCH - performs the same as the primary but on the standby
•MRP - Managed Recover Process coordinates media recovery management, recall that a physical standby is in perpetual recovery mode
•LSP - Logical Standby Process coordinates SQL apply, this process only runs in a logical standby
•PR0x - recovery server process reads redo from the SRL or archive log files and apply this redo to the standby database.

reference:
http://www.dba-oracle.com/t_physical_standby_missing_log_scenario.htm
http://www.datadisk.co.uk/html_docs/oracle_dg/cheatsheet.htm
http://arup.blogspot.com/2009/12/resolving-gaps-in-data-guard-apply.html
http://jarneil.wordpress.com/2008/05/16/registering-archive-logfiles-on-a-standby/
http://www.syksky.com/oracle/oracle-11g-data-guard-log-shipping-fails-with-error-ora-16191.html

Monday, July 7, 2014

Change Monitor resolution from terminal

Problem:
default resolution is not support by my moniter. There is black screen on the monitor but remote ssh login is available.

Solution:

1. check /var/log/xorg.0.log to find out monitor name and allowed resolution. or run command to findout

[root@test log]# xrandr -d :0
Screen 0: minimum 320 x 200, current 1280 x 1024, maximum 8192 x 8192
HDMI-0 disconnected (normal left inverted right x axis y axis)
DVI-0 disconnected (normal left inverted right x axis y axis)
VGA-0 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 384mm x 306mm
   1280x1024      56.3*+   60.0
   1280x960       60.0
   1152x864       75.0
   1024x768       75.1     70.1     60.0
   832x624        74.6
   800x600        72.2     75.0     60.3     56.2
   640x480        72.8     75.0     66.7     60.0
   720x400        70.1



2. change resolution with command from termial

  xrandr -d :0 --output VGA-0 --mode 1152x864

reference:
http://askubuntu.com/questions/405645/how-to-enable-monitor-from-terminal

Thursday, June 26, 2014

Generate multiple files using each line of a file in Linux

ISSUE:

Sometimes a file or a command need be used against to a list of servers or databases. So a general file or command need be generated with specific information as a general pattern such as database name.

SOLUTION:

A simple While statement can do this task.  So general while statement is provided for easy access

Statement:

while read line
do
host_name=`echo $line | cut -d ' ' -f 1` #get first field of input line
host_ip=`echo $line | cut -d ' ' -f 2`       # get second field of input line
short_hname=${host_name%%\.*}      # remove domain port of hostname
alias_hname=${short_hname:9:5}        # extract 5 character starting at 9 as alias name
if [ ${short_hname:0:3} == "tet" ] ; then # extract 3 character to setup environment name
env_name=test
else
env_name=${short_hname:4:3}
fi
echo "sshpass -e ssh -o StrictHostKeyChecking=no test@$host_ip" > ${env_name}_${alias_hname}_${short_hname}.sh  # generate a sh file for ssh login for each server
chmod 700 ${env_name}_${alias_hname}_${short_hname}.sh # make gererated file executable
done < serverlist.txt