Pages

Sunday, December 8, 2013

How to Clone Oracle Inventory if existing Oracle Inventory corrupted

 Cloning Oracle Inventory

perl <ORACLE_HOME>/clone/bin/clone.pl ORACLE_BASE=/sid/oracle/product ORACLE_HOME=/sid/oracle/product/112 ORACLE_HOME_NAME=<home name>

If you get error like 'Oracle home already exist' first detach the home with the below syntax and try clone.pl script.

cd $ORACLE_HOME/oui/bin
./runInstaller -silent -detachHome -invPtrLoc /sid/oracle/product/112/oraInst.loc ORACLE_HOME="/sid/oracle/product/112" ORACLE_HOME_NAME="home name"

You can get the existing home name in inventory.xml (under /sid/oracle/oraInventory/ContentsXML)

Example

-bash-3.2$ ./runInstaller -silent -detachHome -invPtrLoc /sid/oracle/product/112/oraInst.loc ORACLE_HOME="/sid/oracle/product/112" ORACLE_HOME_NAME="home name"

Starting Oracle Universal Installer...


Checking swap space: must be greater than 500 MB.   Actual 283059 MB    Passed

The inventory pointer is located at /sid/oracle/product/112/oraInst.loc

The inventory is located at /sid/oracle/oraInventory
'DetachHome' was successful.
-bash-3.2$



-bash-3.2$ perl /sid/oracle/product/112/clone/bin/clone.pl ORACLE_BASE=/sid/oracle/product ORACLE_HOME=/sid/oracle/product/112 ORACLE_HOME_NAME=<home name>

./runInstaller -clone -waitForCompletion  "ORACLE_BASE=/sid/oracle/product"
"ORACLE_HOME=/sid/oracle/product/112" "ORACLE_HOME_NAME=home name"
-silent -noConfig -nowait
Starting Oracle Universal Installer...


Checking swap space: must be greater than 500 MB.   Actual 283058 MB    Passed

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2013-12-07_01-40-37AM. Please
wait ...Oracle Universal Installer, Version 11.2.0.3.0 Production

Copyright (C) 1999, 2011, Oracle. All rights reserved.


You can find the log of this install session at:

 /sid/oracle/oraInventory/logs/cloneActions2013-12-07_01-40-37AM.log

....................................................................................................
 100% Done.



Installation in progress (Saturday, December 7, 2013 1:40:57 AM CST)

...............................................................................                   
                             79% Done.
Install successful


Linking in progress (Saturday, December 7, 2013 1:41:27 AM CST)

Link successful


Setup in progress (Saturday, December 7, 2013 1:44:02 AM CST)
Setup successful


End of install phases.(Saturday, December 7, 2013 1:44:32 AM CST)

WARNING:A new inventory has been created in this session. However, it has not yet been registered
as the central inventory of this system.

To register the new inventory please run the script '/sid/oracle/oraInventory/orainstRoot.sh'
with root privileges.

If you do not register the inventory, you may not be able to update or patch the products you
installed.
The following configuration scripts need to be executed as the "root" user.

/sid/oracle/oraInventory/orainstRoot.sh
/sid/oracle/product/112/root.sh

To execute the configuration scripts:
    1. Open a terminal window

    2. Log in as "root"
    3. Run the scripts


The cloning of OraDb11203_ was successful.

Please check '/sid/oracle/oraInventory/logs/cloneActions2013-12-07_01-40-37AM.log' for more details.

ORA-01031: insufficient privileges error when connecting as SYSDBA

SYSDBA OS Authentication

The OS authentication is the process of verifying the identity of the user connecting to the database with the information managed by the OS. An OS user is able to use this authentication method if the following conditions are met:

1. The  user is a member of a special group.
2. the OS authentication is allowed by the server settings(sqlnet.authentication_services is set correctly)

The OS user should belong to the OSDBA group in order to login as sysdba. On Unix the default name of these group is dba. On Windows the name of the group is ORA_DBA.  

On Unix Parameter sqlnet.authentication_services must be set to (ALL) or to (BEQ, <other values>) for this to work. On Windows this parameter must be set to (NTS).

3. Check the value of the SQLNET.AUTHENTICATION_SERVICES parameter in file $ORACLE_HOME/network/admin/SQLNET.ORA

On Unix

This parameter should not be set if no strong authentication method is used. If such a method is being used then set the parameter to one of the following values:

SQLNET.AUTHENTICATION_SERVICES = (ALL)
or
SQLNET.AUTHENTICATION_SERVICES = (BEQ,<the strong auth method>)
Where  <the strong auth method> can be any combination of the following values: TCPS, KERBEROS5, RADIUS

NOTE: If the definition of SQLNET.AUTHENTICATION_SERVICES is preceded by a leading blank space, an ORA-1031 error may occur

On Windows

This parameter should be set to NTS:
SQLNET.AUTHENTICATION_SERVICES = (NTS)

If needed you can add other strong authentication methods besides NTS:
SQLNET.AUTHENTICATION_SERVICES = (NTS,TCPS)


SYSDBA Password File Authentication


The credentials provided when connecting remotely as sysdba are compared to the contents of the passwordfile.
Password file authentication is enabled by setting the database parameter remote_login_password file to "shared" or "exclusive".

SQL> alter system set remote_login_passwordfile=exclusive scope=spfile;

1. Check whether the OS user is part of the OSDBA group.

A. See what are the groups of the user:

[oracle@seclin4 ~]$ id
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba) context=user_u:system_r:unconfined_t

B. See what is the OSDBA group defined in file $ORACLE_HOME/rdbms/lib/config.[cs]

$ id
$ cd $ORACLE_HOME/rdbms/lib
$ cat config.c or config.s (depending on platform)
 If they do not match output from id command then the solution is:

2) The 'dba' group in the file config.s is set to 'xxx' but your primary group is 'yyy', so to solve the problem, please do the following:
    a)  shutdown all databases running from this home

    b)  $ cd $ORACLE_HOME/rdbms/lib

    c)  $ vi config.c

Example for Linux:

[oracle@seclin4 ~]$ cat $ORACLE_HOME/rdbms/lib/config.c

/* SS_DBA_GRP defines the UNIX group ID for sqldba adminstrative access. */
/* Refer to the Installation and User's Guide for further information. */

/* IMPORTANT: this file needs to be in sync with
rdbms/src/server/osds/config.c, specifically regarding the
number of elements in the ss_dba_grp array.
*/

#define SS_DBA_GRP "dba"
#define SS_OPER_GRP "dba"
#define SS_ASM_GRP ""

char *ss_dba_grp[] = {SS_DBA_GRP, SS_OPER_GRP, SS_ASM_GRP};

Example for AIX:

[celcaix3]/grdbms/64bit/app/oracle/product/1120/rdbms/lib> cat config.s
# SS_DBA_GRP defines the UNIX group ID for sqldba adminstrative access.
# Refer to the Installation and User's Guide for further information.

.rename H.10.NO_SYMBOL{TC},""
.rename H.11.NO_SYMBOL{TC},""
.rename H.12.NO_SYMBOL{TC},""
.rename H.13.NO_SYMBOL{RO},""
.rename H.14.NO_SYMBOL{RO},""
.rename H.15.NO_SYMBOL{RO},""
.rename H.16.ss_dba_grp{TC},"ss_dba_grp"

.lglobl H.13.NO_SYMBOL{RO}
.lglobl H.14.NO_SYMBOL{RO}
.lglobl H.15.NO_SYMBOL{RO}
.globl ss_dba_grp{RW}

# .text section

# .data section

.toc
T.16.ss_dba_grp:
.tc H.16.ss_dba_grp{TC},ss_dba_grp{RW}
T.10.NO_SYMBOL:
.tc H.10.NO_SYMBOL{TC},H.13.NO_SYMBOL{RO}
T.11.NO_SYMBOL:
.tc H.11.NO_SYMBOL{TC},H.14.NO_SYMBOL{RO}
T.12.NO_SYMBOL:
.tc H.12.NO_SYMBOL{TC},H.15.NO_SYMBOL{RO}
.csect ss_dba_grp{RW}, 3
.llong H.13.NO_SYMBOL{RO}
.llong H.14.NO_SYMBOL{RO}
.llong H.15.NO_SYMBOL{RO}
# End csect ss_dba_grp{RW}
.csect H.13.NO_SYMBOL{RO}, 3
.string "dba"
# End csect H.13.NO_SYMBOL{RO}
.csect H.14.NO_SYMBOL{RO}, 3
.string "dba"
# End csect H.14.NO_SYMBOL{RO}
.csect H.15.NO_SYMBOL{RO}, 3
.string ""
# End csect H.15.NO_SYMBOL{RO}
.llong 0x00000000

# .bss section


Example for Solaris:

        .section        ".text",#alloc,#execinstr
/* 0x0000          7 */         .file   "x.c"
        .section        ".data",#alloc,#write
/* 0x0000          9 */         .global ss_dba_grp
/* 0x0000         10 */         .align  8
                       .global ss_dba_grp
                       ss_dba_grp:
/* 0x0000         17 */         .align  8
/* 0x0000         18 */         .xword  (.L12+0)
/* 0x0004         24 */         .align  8
/* 0x0004         25 */         .xword  (.L13+0)
/* 0x0008         26 */         .type   ss_dba_grp,#object
/* 0x0008         27 */         .size   ss_dba_grp,16
        .section        ".rodata1",#alloc
/* 0x0008         13 */         .align  8
                       .L12:
/* 0x0008         15 */         .ascii  "dba\0"
/* 0x0014         20 */         .align  8
                       .L13:
/* 0x0014         22 */         .ascii  "dba\0"


C) now remove the existing config.o:

                  mv config.o config.old

D)  Check if  updated config.c/config.s can be relinked successfully by running below command        

            $ make -f ins_rdbms.mk config.o
            $ ls -al config.o

E) relink oracle to rebuild config.o and store it inside the oracle executable:

           $ make -f ins_rdbms.mk ioracle

F) Try login '/ as sysdba' again.


On Windows

When using OS authentication on Windows the OS user must be a member of one of the following two groups:

ORA_DBA
ORA_<%ORACLE_SID%>_DBA
The membership to the second group allows the OS user to use OS authentication while connecting to the instance with the name %ORACLE_SID%> only.

Check whether the OS user is a member of any of these two local groups:

Get the name of the OS user:


D:\oracle\product\10.2.0\db_1\NETWORK\ADMIN>echo %username%
dbadmin

Obtain the list of the members of the local group:


D:\oracle\product\10.2.0\db_1\NETWORK\ADMIN>NET LOCALGROUP ORA_DBA
Alias name ORA_DBA
Comment Members can connect to the Oracle database as a DBA without a password
Members
-------------------------------------------------------------------------------
dbadmin
NT AUTHORITY\SYSTEM
The command completed successfully.

D:\oracle\product\10.2.0\db_1\NETWORK\ADMIN>set oracle_sid=d1v10204

D:\oracle\product\10.2.0\db_1\NETWORK\ADMIN>NET LOCALGROUP ORA_%ORACLE_SID%_DBA
Alias name ORA_d1v10204_DBA
Comment Members can connect to instance d1v10204 as a DBA without a password
Members
-------------------------------------------------------------------------------
dbadmin
The command completed successfully.

For more information please review the Nots Ids: 400459.1 , 730067.1