Saturday, 22 February 2020

Local Client Copy

                                           local client copy



Pre- requisites for local client copy:

  • Check the size of client using report rsspacecheck.
  • Test run will be advice to check actual time taken by client copy.
  • Lock the source client/Target client to avoid inconsistency (so that No new entries of recorded while performing the client copy).
  • Suspended all background job with report BTCTRNS1.
  • make rdisp/max_wprun_time =0,  in profile parameters using RZ10 t-code. if the client copy is performing with Dialog work processes not background.


Steps to perform local client copy:

  1. create logic system. eg: CLNT<SID><Client no>,clntdev600
  2. Create client in SCC4 ( just entry in table T000).
  3. Set the value of parameter login/no_automatic_user_sapstar to 0.
  4. Restart SAP Application.
  5. Login to newly created client with userid:  sap* and password  as pass.
  6. Change password for the user SAP* for better security reasons.
  7. Execute local client copy with t-code SCCL. As in step 2 only client created with out any standard tables & standard table will be copy here from source client.if it is implementation project source client will be 000.
  8. Select correct profile for client copy.
  9. Check logs in SCC3.

Note: Lock the source system,to not update any record while performing client copy.To avoid inconsistency.

Client Administration in SAP BASIS

Here are the list of T-code that involve in Client Administration in SAP BASIS

  1. BDLS  - To rename the existing logical system name(CLNT<SID><client no.>).
  2. BD54 or SALE - To create new logical system (CLNT<SID><client no.>).
  3. SCC1 -  To move Transport requests in between clients with in the system.
  4. SCCL - TO perform local client copy.
  5. SCC3 - To  view the logs of on- going client copy and status of previous client copies .
  6. SCC4 - To create new client( just an entry in table T000).
  7. SCC5 - To delete exist client in SAP system. Need to login same client to which need to delete.
  8. SCC7 - To perform post client import. which makes run time adoption of client import data.
  9. SCC8 - To export exist client data.
  10. SCC9 - To perform remote client copy.
  11. STMS_IMPORT  - To import Transport request, Which is obtained by client export.
  12. SCU0 - To perform client compare between two clients

Monday, 17 February 2020

Wildcards in Linux scripting

Types of wildcards


  1. ? - exactly  place wildcard.
  2. * - multiple place wildcard.
use of wildcards in Linux scripting:
  • Act like filter.
  • copy,remove,list files and print output files(>) based on filter applied in wildcards.

Note: Delete files with wildcards might happens. if file names are standard naming conversion.
          eg: dd-mm-yyyy.log  

Saturday, 15 February 2020

Functions and it significance in Linux scrpiting

Functions:


why functions:

  • Don't repeat the same lines of code again and again can be achieved.
  • Reduce of script length.
  • Maintenance of scripts in case of issue is easy with scripts. Because of single entry maintenance in entire script.
Thumb rules in the Function:

  • Must be defined before call.
  • Function syntax basically consists of two parts: 
                         1. defining function.
                         2. calling function.      
                                                                            
-----------------------------------------------------------------------------------------------------------------------
#Syntax for 1.defining function:


#Method-1
function function_name ( ) {

                      #code

}
-----------------------------------------------------------------------------------------------------------------------
#Method-2
function_name ( ) {

            #code
}

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


--------------------------------------------------------------------------------------------------------------------------
#2.calling function.  To call or execute the function which already defined,just mention #function_name  in the line of the script.

real time example:1
#!/bin/bash1

function hello(  ) {
echo "HELLO!!!"

}
hello                 #calling the function


output:

HELLO!!!



Real time example 2: with position parameters

#script     
#/bin/bash
function hello ( ) {
echo "hello $2"
}

hello ram sam zam                 # calling function

output:

hello sam

Friday, 14 February 2020

Log volumes are full in HDB

Log Volume is Full and the Database Doesn’t Accept any new Requests
If the log_mode is set to legacy the logvolume keeps all log segments since the last full backup in the logvolume.

If no backups are performed the logvolume can run out of space.

Solution

1. Stop the database:

HDB stop

2. Change into the folder mnt00001 of the logvolume (Default: /usr/sap//global/hdb/log):

cd /usr/sap//global/hdb/log/mnt00001

3. You have to move one of the logvolumes temporarily to another volume where enough space is available.

You should free at least 2 GB of space to ensure that the database has enough space to start.

To find out the space consumption of each volume execute:

du -sh

4. Move a volume which consumes at least 2 GB of space (e.g. hdb00003)

to a volume with enough free space,

e.g. to the data volume (Default: /usr/sap//global/hdb/data):

mv hdb00003 /usr/sap//global/hdb/data

5. Create a symbolic link to the new folder in the old location:

ln -s /usr/sap//global/hdb/data/hdb00003 /usr/sap//global/hdb/log/mnt00001/hdb00003

6. Start the database (HDB start) and perform a backup

7. Use the following SQL-Statement to clean up the logvolume:

ALTER SYSTEM RECLAIM LOG;

8. Stop the database again and remove the symbolic link:

rm -f /usr/sap//global/hdb/log/mnt00001/hdb00003

9. Move the log volume back to its original location:

mv /usr/sap//global/hdb/data/hdb00003 /usr/sap//global/hdb/log/mnt00001

10. Start the database (HDB start)

ref: 1679938 – Log Volume is full (log mode = legacy)

Tuesday, 11 February 2020

host connectivity check using Linux scripts using exit code


cat connect_check.sh
#!/bin/bash
HOST="google.com"
ping -c 4 $HOST
if [ "$?" -eq "1" ]                        #exit code test condition
then
echo " $HOST is reachable "
else
echo " $HOST unreachable "
fi




Output

./connect_check.sh
PING google.com (172.217.17.78) 56(84) bytes of data.
From 10.188.34.2 icmp_seq=1 Destination Host Unreachable
From 10.188.34.2 icmp_seq=2 Destination Host Unreachable
From 10.188.34.2 icmp_seq=3 Destination Host Unreachable
From 10.188.34.2 icmp_seq=4 Destination Host Unreachable

--- google.com ping statistics ---
4 packets transmitted, 0 received, +4 errors, 100% packet loss, time 2998ms

 google.com is reachable



Position parameters in linux scripts



#!/bin/bash
echo "check your employee details: "
echo " running '$0'"
echo " SAP employee id: '$1'"
echo " TCS employee id: '$2'"
echo " Contact number: '$3'"
echo " TCS cubic number: '$4'"
echo " Building : '$5'"
echo " location : '$6'"
echo " job role : '$7'"
echo " ODC: '$8'"
echo " Name: '$9'"
echo " date: '${10}'"   #from 10 th position parameter on wards 's{10}' is mandatory. 

Output

Hostname:/install # ./pp.sh CXX9350  1XX1350   8XXXXXX2 8 victor Bangalore BASIS 7 Naveen 11_02_2020
check your employee details:
 running './pp.sh'
 SAP employee id: 'CXX9350'
 TCS employee id: '1XX1350'
 Contact number: '8XXXXXX2 '
 TCS cubic number: '8'
 Building : 'victor'
 location : 'Bangalore'
 job role : 'BASIS'
 ODC: '7'
 Name: 'Naveen'
 date: '11_02_2020'


Monday, 10 February 2020

Read command in linux

Good Reference:
https://www.youtube.com/watch?v=QW-stV8aW_U

To pass SID details in to scripts:

#!/bin/bash
echo "enter the SID :"
read SID
echo "the SID you enter is $SID"


OUTPUT:
Hostname:/install/ ./test1.sh
enter the SID :
RAM
the SID you enter is RAM

Method 2 of passing dynamic parameter in to scripts

 cat test2.sh
#!/bin/bash
read -p "enter your SID: " SID
echo " conform your SID as $SID"

Friday, 7 February 2020

if else condition in linux scrpits


Example script:                                                                                                           




output:                                                                                                                        
echo ''you don't seem to like the bash shell.''

if condition in linux scripts


Example for if condition:                                                                                                                              



Wednesday, 5 February 2020

Test conditions syntax

in some case, their should be some condition to check and satisfy. to execute linux cmds in the script.
At that time this Tests concept play an important role.







Example syntax:                                                          
                                                      if [ -d /usr/sap/<sid> ]                                               
then                    
command1
command2
command3
fi                    
               
Note: here fi is used to close the if condition.




Tuesday, 4 February 2020

How to create and use variables.

Variables: storage locations that have a name
                 it is the combination of Name -Value pair.
  Syntax: VARIABLE_NAME="Value"
  • variables are case sensitive
  • By convention variables are uppercase


importance of interpreter in the scripts

An interpreter executes the commands in the scripts


  1. Before executing any script, make sure that it is having 755 file permission rights
  2. Make sure about the shebang use in script. in case of miss match of shebang the scripts won't execute completely.if you are not aware of shebang concept make use of .sh as extension for you script.

How exactly need to write shell scripts.

A script is a series of commands to execute particular task.
usually we will make use of scripts, while performing the routine tasks or regular tasks to make them automate.

For loop syntax in Linux scripts