Important Git commands

  1. To see on which branch git is and the status of the branch changes.
git status

2. To push the changes to staging area from the working directory after the changes to it.

git add "file_name"

3. After add command to push the changes to local repository, use commit command as below to push the changes from staging area to local repository.

git commit -m "commimt message    or git commit

Note: If you will use command “git commit” command only, then the default text editor like Notepad++ will open. Where we can give the commit message.

We can use this way when we need to give long commit message.

4. To push the changes to remote repository(Here Github.com) from local reposiitory.

git push origin master

5. To check which remote repository account we are logged in.

cat ~/.gitconfig

6. To set up Notepad++ as defauklt editor in Git.

git config --global core.editor "Notepadd++.exe --multiInst --nosession"

7. To edit the config file.

git config --global -e

8. To crete a fresh repository in Git.

git init repository_name

9. Rebase: 10. Revert or undo:  It undo the changes made in previous commit.

  • New commit is created without the changes made in the other.
  • Old commit still resides in the history.

11. Reset: Can be used to undo the changes at different levels.

  • Note: –hard, –soft and –mixed (modifiers to decide the reset degree).
git reset v1.5

All important commands for cloning from Github remote repository

The first step to start with Git is to connect to a remote repository. It can be Gitlab, Github or any other. Here we will use Github.

So please follow below three commands to configure Github.

  1. To check if Git is installed or the Git version we are using.
git vesion

2. Next step is to give the User name.

git config --global user.name "Username"

3. Then give the registered email id.

git config --global user.email "user@email.com"

4. Use below command to see if User name and email are correctly given.

git config --global --list

5. Now login to Github.com where your repositories are placed and go to the repository you want to clone. There go to the Clone or Download button as shown in the screenshot below and first select use https and copy the HTTPs Link.

6. Now go to Git bash client and use next command as below.

Note: Change the https link.

git clone "https://github.com/1StopBuyers/Pilot.git"

7. Now give the usename and Password of the Github account for which the details are given above. And you will get the cloning successful message as below.

Please do comment in case of any doubt. Thank you.

Locking and blocking information and solution

1. To see the details about the specified sid
 
set linesize 200 select blocking_session, sid, serial#, wait_class, seconds_in_wait from gv$session where blocking_session is not null order by blocking_session ; blocking_sessionsid serial# wait_classseconds_in_wait ---------------- ---------- ---------- -------------------- -------- 148 135 61521 idle 64

Note: We found that session 148 is blocking session 135 and has been for 64 seconds.

2. Run the script provided by oracle.
 
@?/rdbms/admin/utllockt.sql

3. Simple query to find the blocking session information.

 
select object_id,session_id,process,locked_mode from gv$locked_object where session_id in (&session_id);

  a. This will give easy readable output for locking objects.

  
set lines 100
set pages 500
col "lock particulars" format a100
select
(select username from gv$session where sid=a.sid) || '('||a.sid||')'||
' is blocking to '||
(select username from gv$session where sid=b.sid) || '('||b.sid||')' "lock particulars"
from gv$lock a, gv$lock b where a.block = 1 and b.request> 0 and a.id1 = b.id1 and a.id2 = b.id2
;
lock particulars
----------------------------------------------------------------------------------------------------
qsitbba(9) is blocking to vitvcd(7)
qsitbba(72) is blocking to vitvcd(7)
qsitbba(9) is blocking to qtnsdp(72)
4. Use below to find kill details.

Note: need to provide the sid from above query.

setlinesize 200 col username format a15 colschemaname format a15 col program format a15 select sid,serial#,username,status,schemaname,program,to_char(logon_time,'dd/mm/yyyy hh24:ss:mm') logon_time from v$session where sid in(&sid); 

5. >kill -3/9 can be run on spid provided by below query.

set linesize 100 
column spid format a10
column username format a10
column program format a45
selects.inst_id,
s.sid,
s.serial#,
p.spid,
s.username,
s.program
from gv$session s
join gv$process p on p.addr = s.paddr and p.inst_id = s.inst_id
where s.sid=1950 ;
6. >To see queries running from more than 5 sec.

Note: new feature of 11g.

 
set linesize 200
select s.sid, serial#, s.sql_id, (sysdate-sql_exec_start)*24*60*60 secs, sql_text from v$session s, v$sqltext t
wheres.sql_id = t.sql_id
and sql_exec_start is not null and piece = 0
and (sysdate-sql_exec_start)*24*60*60 > 5 ;

7. To find the details of locking objects.

 
set lines 180
set pages 500
col owner format a15
col object_name format a20
col object_type format a20
col sid a8
col serial# format a50
col status format a 10
col osuser format a10
col machine format a60



select c.owner, c.object_name, c.object_type, b.sid, b.serial#, b.status, b.osuser, b.machine from v$locked_object a , v$session b, dba_objects c where b.sid = a.session_id and a.object_id = c.object_id ;

8. To find the sql being run by blocking sid

 
select s.sid, s.serial#, t.sql_fulltext,t.sql_id,s.sql_hash_value,t.hash_value from v$session s, v$sql t where s.sql_address = t.address and s.sql_hash_value = t.hash_value and s.sid=1950 ;

9. To find out the query information against the process which you take from unix.

 
select sql_text, optimizer_mode, module, action from v$sqlarea where hash_value in ( select sql_hash_value from v$session wherepaddr=( select addr from v$process where spid=&process_id ) );

10. To see the queries running from more than 5 sec

 
set linesize 200 select s.sid, serial#, s.sql_id, (sysdate-sql_exec_start)*24*60*60 secs, sql_text from v$session s, v$sqltext t where s.sql_id = t.sql_id and sql_exec_start is not null and piece = 0 and (sysdate-sql_exec_start)*24*60*60 > 5 ; sid serial# sql_idsecssql_text ---------- ---------- ------------- ---------- ---------------------------------------------------------------- 492 46694 a0f74y2n959cbt 12 select /*+ first_rows(1) use_nl (p t) */ path_name,path_doci

Weblogic: Scripts to start/stop Weblogic

1. Node Manager:
Start

 
$WLS_HOME/server/bin/startNodeManager.sh

Stop
Note: There is no specific command to stop node manager, you have to kill the process manually to stop the node manager.

 
kill -9 `ps -ef | grep -i nodemanager.javahome | grep -v grep | awk {'print $2'} | head -1`

2. Weblogic:
Start

 $DOMAIN_HOME/bin/startWebLogic.sh 

Stop

 
$DOMAIN_HOME/bin/stopWebLogic.sh

3. Managed Server:
Start

 
$DOMAIN_HOME/bin/startManagedWebLogic.sh

Stop

 
$DOMAIN_HOME/bin/stopManagedWebLogic.sh

Workflow Mailer Script to start notification mailer

 
sqlplus apps/apps_pwd
 
declare
p_retcode number;
p_errbuf varchar2(100);
m_mailerid fnd_svc_components.component_id%TYPE;
begin
-- Find mailer Id
-----------------
select component_id
into m_mailerid
from fnd_svc_components
where component_name = 'Workflow Notification Mailer';
--------------
-- Start Mailer
--------------
fnd_svc_component.start_component(m_mailerid, p_retcode, p_errbuf);
commit;
end;
/

Workflow Mailer Script to stop notification mailer

 
sqlplus apps/apps_wpd
 
declare
p_retcode number;
p_errbuf varchar2(100);
m_mailerid fnd_svc_components.component_id%TYPE;
begin
-- Find mailer Id
-----------------
select component_id
into m_mailerid
from fnd_svc_components
where component_name = 'Workflow Notification Mailer';
--------------
-- Stop Mailer
--------------
fnd_svc_component.stop_component(m_mailerid, p_retcode, p_errbuf);
commit;
end;
/

HA: Scripts to check if archive logs are being shipped and applied to standby

1. Steps to check archive logs are being shipped and applied to standby.

AT PRIMARY:

A.  Check the status.

Note: Status should return valid for standby destination

 
set lines 500
column destination format a35 wrap
column process format a7
column archiver format a8
column ID format 99
select dest_id "ID",destination,status,target,archiver,schedule,process,mountid from v$archive_dest ;

Sample Output:

B. Check if any error is reported for archive dest.

 Note: Should not return any error messages

 
column error format a55 tru
select dest_id,status,error from v$archive_dest;

Sample Output:

C. Check the errors from dataguard status.
Note: Should not return any row.

 
column message format a80
select message, timestamp from v$dataguard_status where severity in ('Error','Fatal') order by timestamp;

AT STANBDY:

A. Check MRP status and which block is being applied at standby database.

 
set linesize 230
select process,status,client_process,sequence#,block#,active_agents,known_agents from v$managed_standby ;

Sample Output:

B. Check the error for dataguard status
Note: Should not return any rows.

 
column message format a80
select message, timestamp from v$dataguard_status where severity in ('Error','Fatal') order by timestamp;

RAC: List info of all long operations in whole RAC

 
SET LINESIZE 230
COLUMN sid FORMAT 9999
COLUMN serial# FORMAT 9999999
COLUMN machine FORMAT A25
COLUMN progress_pct FORMAT 99999999.00
COLUMN elapsed FORMAT A20
COLUMN remaining FORMAT A20
SELECT s.inst_id,
s.sid,
s.serial#,
s.username,
s.module,
ROUND(sl.elapsed_seconds/60) || ':' || MOD(sl.elapsed_seconds,60) elapsed,
ROUND(sl.time_remaining/60) || ':' || MOD(sl.time_remaining,60) remaining,
ROUND(sl.sofar/sl.totalwork*100, 2) progress_pct
FROM gv$session s,
gv$session_longops sl
WHERE s.sid = sl.sid
AND s.inst_id = sl.inst_id
AND s.serial# = sl.serial#;