Friday, July 20, 2018

How to disable OCM scheduled job if you are not using this product


Error:
ORA-12012: error on auto execute of job "ORACLE_OCM"."MGMT_CONFIG_JOB_2_1"

SQL> exec dbms_scheduler.disable(‘ORACLE_OCM.MGMT_CONFIG_JOB’);

PL/SQL procedure successfully completed.

SQL> exec dbms_scheduler.disable(‘ORACLE_OCM.MGMT_STATS_CONFIG_JOB’)

PL/SQL procedure successfully completed.

Oracle CPU patches applied list using opatch


$ORACLE_HOME/OPatch/opatch lsinventory -bugs_fixed | grep MOLECULE

20506699   20449729  Tue Jul 07 12:26:29 GMT 2015   DB-11.2.0.4-MOLECULE-020-CPUAPR2015
20506706   20449729  Tue Jul 07 12:26:29 GMT 2015   DB-11.2.0.4-MOLECULE-021-CPUAPR2015



Identify EBS profile option settings that may be related to performance-degrading debug/trace activity

-- check_ebs_trace_profs.sql
--  Author: John Piwowar
-- Purpose: Identify E-Business Suite system profile option settings that may
--          be related to performance-degrading debug/trace activity
--   Notes: Prompts for a cutoff date for when profile options were set
--          May need additional tweaking for multi-language installations 
set pagesize 9999
set linesize 120
set verify off
 col "Profile Option" for a25
 col "Option Level" for a13
 col "set for" for a20
 col "Value" for a20
 col "Set On" for a11
 col "Blame" for a20
 PROMPT Enter date value in form DD-MON-YYYY for check_since
    select tl.user_profile_option_name "Profile Option"
         , decode( val.level_id
                 , 10001, 'Site'
                 , 10002, 'Application'
                 , 10003, 'Responsibility'
                 , 10004, 'User'
                 , 10005, 'Server'
                 , 10006, 'Organization'
                 , 10007, 'Server+Resp'
                 , 'No idea, boss') "Option Level"
         , decode( val.level_id
                 , 10001
                 , 'EVERYWHERE!'
                 , 10002
                 , (select application_name
                      from fnd_application_tl
                     where application_id = val.level_value)
                 , 10003
                 , (select responsibility_name
                      from fnd_responsibility_tl
                     where responsibility_id = val.level_value
                       and application_id = val.level_value_application_id)
                 , 10004
                 , (select user_name
                      from fnd_user
                     where user_id = val.level_value)
                 , 10005
                 , (select host || '.' || domain
                      from fnd_nodes
                     where node_id = val.level_value)
                 , 10006
                 , (select name
                      from hr_all_organization_units
                     where organization_id = val.level_value)
                 , 10007
                 , 'Look it up' --per specification El-Ay-Zed-why
                 , '''Tis a mystery') "Set for"
         , val.profile_option_value "Value"
         , val.last_update_date "Set on"
         , usr.user_name "Set By"
      from fnd_profile_options opt,
           fnd_profile_option_values val,
           fnd_profile_options_tl tl,
           fnd_user usr
     where opt.profile_option_id = val.profile_option_id
       and opt.profile_option_name = tl.profile_option_name
       and regexp_like( tl.user_profile_option_name
                      , '(trace|log|debug|audit|diag|sql)'
                      , 'i'
                      )
       and not(regexp_like( tl.user_profile_option_name
                          , '(catalog|file|login|utilities)'
                          , 'i'
                          )
              )
       and usr.user_id = val.last_updated_by
       and usr.user_name  not in ( 'AUTOINSTALL'
                                 , 'INITIAL SETUP'
                                 , 'ANONYMOUS')
       and val.last_update_date > '&check_since'
     order by val.last_update_date desc
 ;

oracle RAC diagnostics command

use the below commands to gather information on RAC for troubleshooting

From the grid user account do the following:

1)check the whole CRS installation as it is now:
cluvfy stage -post crsinst -n all -verbose

2) check the whole RAC db install as it is now
cluvfy stage -pre dbinst -n all -verbose

3) compare nodes
cluvfy comp peer -n all -verbose

4) check crs nodes integrity
cluvfy comp crs -n all -verbose

5) check if nodes have been removed previously registered in crs
cluvfy stage -post nodedel

6) validate installation deviations to best practices and mandatory reqs for crs/db
cluvfy comp healthcheck -deviations

Oracle CPU Patches applied list

SQL Query

SQL> col action_time format a30
SQL> select substr(action_time,1,30) action_time,substr(id,1,8) id,substr(action,1,10) action,
substr(version,1,8) version,substr(bundle_series,1,6) bundle,substr(comments,1,20) comments from registry$history;

or

you can also use

SQL> set serverout on
SQL> exec dbms_qopatch.get_sqlpatch_status;

Wednesday, July 18, 2018

How to change hostname in Linux

[root ~]# hostname
old-name

[root ~]# hostname new-name
[root@ ~]# hostname
new-name

[root ~]# vi /etc/sysconfig/network
[root ~]# vi /etc/hosts

[root ~]# pwd
/root
[root ~]# service network restart
Shutting down interface eth650_1.989:                      [  OK  ]
Shutting down interface eth1290_2.989:                     [  OK  ]

Using flashback on oracle RAC database

Here are steps to enable flashback in sit:

To Enable flashback

check make sure archive log is enabled.

alter system set db_recovery_file_dest_size=50G scope=both sid='*';
alter system set DB_RECOVERY_FILE_DEST='+RECOC1' scope=both sid='*';
alter system set db_flashback_retention_target=10080 scope=both sid='*';

srvctl stop database -d
srvctl start instance -d -i -o nomount;

alter system set cluster_database=false scope=spfile;

srvctl stop database -d
srvctl start instance -d -i -o mount;

alter database flashback on;
alter system set cluster_database=true scope=spfile;

srvctl stop database -d
srvctl start database -d


To create restore point

To create a restore point(db snapshot)
sqlplus "/as sysdba"
create restore point ;

To restore the flashback

srvctl stop database -d
srvctl start instance -d -i -o mount

flashback database to restore point 1_07APR15;
alter database open resetlogs;


SET PAUSE ON
SET PAUSE 'Press Return to Continue'
SET PAGESIZE 60
SET LINESIZE 300
SET VERIFY OFF

COLUMN scn FOR 999,999,999,999,999
COLUMN Incar FOR 99
COLUMN name FOR A25
COLUMN storage_size FOR 999,999,999,999
COLUMN guarantee_flashback_database FOR A3

SELECT
      database_incarnation# as Incar,
      scn,
      name,
      time,
      storage_size,
      guarantee_flashback_database
FROM
      v$restore_point
/