Search This Blog

Sunday, May 11, 2014

Steps for configuring OCM



[orauser@erp1 ~]$ grep -i jdk $CONTEXT_FILE
         <JDK_TOP oa_var="s_jdktop">/data/d02/orauser/usertest/db/tech_st/11.2.0/jdk/jre</JDK_TOP>
         <JRE_TOP oa_var="s_jretop">/data/d02/orauser/usertest/db/tech_st/11.2.0/jdk/jre</JRE_TOP>
         <ADJVAPRG oa_var="s_adjvaprg" osd="UNIX">/data/d02/orauser/usertest/db/tech_st/11.2.0/jdk/jre/bin/java</ADJVAPRG>
         <JAVA_HOME oa_var="s_db_java">/data/d02/orauser/usertest/db/tech_st/11.2.0/jdk/jre</JAVA_HOME>
[orauser@erp1 ~]$ export JAVA_HOME=/data/d02/orauser/usertest/db/tech_st/11.2.0/jdk/jre
[orauser@erp1 ~]$ cd $ORACLE_HOME/ccr/bin




[orauser@erp1 bin]$ ./setupCCR -s 123456 xyz.abc@doman.com

** Installing base package **
Deploying core - Version 10.3.4.0.0

** Registering installation with Oracle Configuration Manager server(s) **
Deploying engines - Version 10.2.7.1.0
Deploying metricdata - Version 10.2.4.0.3
Deploying scripts - Version 10.3.4.0.0

** Getting package updates from ContentServer **
Deploying core - Version 12.0.0.0.1
Deploying engines - Version 12.0.0.0.0
Deploying metricdata - Version 12.0.0.0.0
Deploying ocmcert - Version 12.0.0.0.1
Deploying scripts - Version 12.0.0.0.1

** Starting the Oracle Configuration Manager Scheduler **
Oracle Configuration Manager - Release: 12.0.0.0.1 - Production
Copyright (c) 2005, 2013, Oracle and/or its affiliates.  All rights reserved.
------------------------------------------------------------------
Starting Oracle Configuration Manager...
Waiting for status from Oracle Configuration Manager....
Start Date               10-May-2014 23:51:27
Last Collection Time     -
Next Collection Time     11-May-2014 23:49:00
Collection Frequency     Daily at 23:49
Collection Status        scheduled collection running
Log Directory            /data/d02/orauser/usertest/db/tech_st/11.2.0/ccr/hosts/erp1.com/log
Registered At            10-May-2014 23:49:25
Automatic Update         On
Collector Mode           Connected

Oracle Configuration Manager successfully started.

Oracle Configuration Manager has been configured in connected mode. If the
target ORACLE_HOME is running a database, please refer to the
"Post-installation Database Configuration" section of the OCM Installation
and Administration Guide
(http://www.oracle.com/technology/documentation/ocm.html) to complete the
installation.

View configuration data reports and access valuable configuration best
practices by going to My Oracle Support.
[orauser@erp1 bin]$

 Steps to drop OCM:

[orauser@erp1 bin]$ ./emCCR stop
Oracle Configuration Manager - Release: 12.0.0.0.1 - Production
Copyright (c) 2005, 2013, Oracle and/or its affiliates.  All rights reserved.
------------------------------------------------------------------
Oracle Configuration Manager Stopped...
[orauser@erp1 bin]$


[orauser@erp1 scripts]$ sqlplus '/as sysdba'

SQL*Plus: Release 11.2.0.3.0 Production on Sun May 11 00:00:29 2014

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> @dropocm.sql
SQL> SET serveroutput on
SQL> set verify off
SQL>
SQL> -- handle 11+ databases (ACLs)
SQL> @@dropocm11plus
SQL> Rem
SQL> Rem dropocm11plus.sql
SQL> Rem
SQL> Rem Copyright (c) 2011, 2013, Oracle and/or its affiliates.
SQL> Rem All rights reserved.
SQL> Rem
SQL> Rem    NAME
SQL> Rem         dropocm11plus.sql - <one-line expansion of the name>
SQL> Rem
SQL> Rem    DESCRIPTION
SQL> Rem         <short description of component this file declares/defines>
SQL> Rem
SQL> Rem    NOTES
SQL> Rem         <other useful comments, qualifications, etc.>
SQL> Rem
SQL> Rem    MODIFIED   (MM/DD/YY)
SQL> Rem    imunusam    09/16/13 - To fix bug 17461614
SQL> Rem    jsutton     09/03/13 - make more tolerant of no xmldb
SQL> Rem    jsutton     09/16/11 - put 11+ operations in separate file
SQL> Rem    jsutton     09/16/11 - Created
SQL> Rem
SQL>
SQL>
SQL> SET serveroutput on
SQL> set verify off
SQL>
SQL> DECLARE
  2    l_instvers       VARCHAR2(100);
  3    l_comp_cnt       NUMBER;
  4    l_regexp_match   NUMBER;
  5    TYPE p_acl_ids_type  IS TABLE OF VARCHAR2(4000);
  6    TYPE p_acl_priv_type IS TABLE OF NUMBER;
  7    l_acl_ids        p_acl_ids_type;
  8    l_acl_privs      p_acl_priv_type;
  9    l_acl_cnt        NUMBER;
 10
 11  BEGIN
 12    -- Drop the Network ACL if the ACL was created.
 13    select LPAD(version,10,'0') into l_instvers from v$instance;
 14    IF l_instvers >= '11.0.0.0.0' THEN
 15      -- check for XML DB installed
 16      EXECUTE IMMEDIATE
 17      'select count(*) from dba_registry where COMP_NAME = ''Oracle XML Database'' and STATUS = ''VALID''' into l_comp_cnt;
 18      -- XML DB installed, proceed
 19      IF l_comp_cnt > 0 THEN
 20        -- drop the entire ACL if it is the one we created
 21        EXECUTE IMMEDIATE
 22        'select count(*) from dba_network_acls where regexp_like(acl,''.oracle-sysman-ocm-Resolve-Access.xml$'')' into l_regexp_match;
 23        IF (l_regexp_match > 0) THEN
 24          EXECUTE IMMEDIATE
 25          'BEGIN ' ||
 26          '  DBMS_NETWORK_ACL_ADMIN.DROP_ACL(''oracle-sysman-ocm-Resolve-Access.xml''); ' ||
 27          '  COMMIT;' ||
 28          'END;';
 29        END IF;
 30        -- check for resolve privilege for OCM user
 31        -- get all ACLIDs and determine whether ORACLE_OCM has resolve privilege through each
 32        BEGIN
 33          EXECUTE IMMEDIATE
 34          'SELECT acl, DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE_ACLID(aclid, ''ORACLE_OCM'', ''resolve'') acl_priv ' ||
 35          '  FROM dba_network_acls' BULK COLLECT INTO l_acl_ids, l_acl_privs;
 36          EXCEPTION
 37            WHEN OTHERS THEN NULL;
 38        END;
 39        -- walk the collection
 40        FOR i IN 1..l_acl_ids.count LOOP
 41          BEGIN
 42            IF (l_acl_privs(i) IS NOT NULL AND l_acl_privs(i) > 0) THEN
 43              -- remove resolve privilege
 44              EXECUTE IMMEDIATE
 45              'BEGIN ' ||
 46              '  DBMS_NETWORK_ACL_ADMIN.DELETE_PRIVILEGE(acl => ' || l_acl_ids(i) || ',principal => ''ORACLE_OCM'');' ||
 47              '  COMMIT;' ||
 48              'END;' ;
 49            END IF;
 50            EXCEPTION
 51              WHEN OTHERS THEN NULL;
 52          END;
 53        END LOOP;
 54      END IF;
 55    END IF;
 56  END;
 57  /

PL/SQL procedure successfully completed.

SQL>
SQL> DECLARE
  2    l_user_dropped   BOOLEAN;
  3
  4   /*
  5    * Procedure to drop user.
  6    * If p_throw_exp is TRUE, throw exception if user cannot be dropped.
  7    */
  8    PROCEDURE drop_user
  9       (p_user IN VARCHAR2, p_dir_name IN VARCHAR2, p_dir_name2 IN VARCHAR2,
 10        p_throw_user_drop_exp BOOLEAN := FALSE,o_user_dropped OUT BOOLEAN)
 11    IS
 12      l_ll_user_exists       NUMBER;
 13      l_ll_pkg_exists       NUMBER;
 14      l_vers            v$instance.version%TYPE;
 15      l_compat_vers     v$parameter.value%TYPE;
 16      l_dirobj_cnt   NUMBER;
 17    BEGIN
 18      BEGIN
 19        select count(*) into l_ll_user_exists from dba_users where username = p_user;
 20        o_user_dropped := FALSE;
 21        IF l_ll_user_exists = 1 THEN
 22          SELECT count(*) into l_ll_pkg_exists FROM sys.user$ u, sys.obj$ o WHERE u.name = p_user AND o.name ='MGMT_DB_LL_METRICS' AND o.owner# = u.user# AND o.type# = 9 AND o.status LIKE '%' ;
 23          IF l_ll_pkg_exists = 1 THEN
 24            execute immediate 'drop user '|| p_user ||' cascade';
 25            o_user_dropped := TRUE;
 26          ELSIF p_throw_user_drop_exp  THEN
 27            RAISE_APPLICATION_ERROR(-20030,'Could not drop the OCM user ''' || p_user || '''. It does not contain OCM schema. Please drop this user to proceed.');
 28          END IF;
 29        END IF;
 30      EXCEPTION
 31        WHEN OTHERS THEN
 32          IF  p_throw_user_drop_exp  THEN
 33            raise_application_error(-20006,SQLERRM);
 34          ELSE
 35             NULL;
 36          END IF;
 37      END;
 38      select substr(version,1,5) into l_vers from v$instance;
 39      begin
 40        select substr(value,1,5) into l_compat_vers from v$parameter where lower(name) = 'compatible';
 41        exception
 42          WHEN NO_DATA_FOUND THEN
 43            l_compat_vers := l_vers;
 44      end;
 45      IF l_vers != '9.0.1' AND l_vers != '8.1.7' AND l_compat_vers != '8.1.7' THEN
 46        select count(*) into l_dirobj_cnt from  dba_directories where DIRECTORY_NAME = p_dir_name ;
 47        IF l_dirobj_cnt = 1 THEN
 48          execute immediate 'DROP DIRECTORY ' || p_dir_name;
 49        END IF;
 50        IF p_dir_name2 IS NOT NULL THEN
 51          select count(*) into l_dirobj_cnt from  dba_directories where DIRECTORY_NAME = p_dir_name2 ;
 52          IF l_dirobj_cnt = 1 THEN
 53            execute immediate 'DROP DIRECTORY ' || p_dir_name2;
 54          END IF;
 55        END IF;
 56      END IF;
 57    END drop_user;
 58
 59  BEGIN
 60     -- Drop previous OCM user
 61     -- discard the return value
 62     drop_user('CCR','CCR_CONFIG_DIR',NULL,FALSE,l_user_dropped);
 63
 64     -- Drop current OCM user
 65     drop_user('ORACLE_OCM','ORACLE_OCM_CONFIG_DIR','ORACLE_OCM_CONFIG_DIR2',TRUE,l_user_dropped);
 66     if( l_user_dropped ) THEN
 67       DBMS_OUTPUT.PUT_LINE('Dropped previous OCM schema successfully.');
 68     ELSE
 69       DBMS_OUTPUT.PUT_LINE('No previous OCM schema to drop.');
 70     END IF;
 71  END;
 72  /
Dropped previous OCM schema successfully.

PL/SQL procedure successfully completed.

SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Ref:
OCM ( Oracle Configuration Manager ) and My Oracle Support : FAQ and Troubleshooting (Doc ID 369619.1)
Upgrading Oracle Configuration Manager (OCM) within E-Business Suite Release 12.0 (Doc ID 727157.1)

No comments:

Post a Comment

Transportable tablespace refresh

  1.check tablespace for the user which need to refresh -------------------------------------------------------------------  SQL> select ...