Tuesday, February 25, 2014

How to Change the Password Expiry Date of an account in Unix / Linux



When i tried to login as oracle user in one of our servers, i got a response that password has expired and needs to be changed.

Used passwd command to change the password, but when i checked the expiry date it shows as it will expire in another 90 days.

**************************************** Step By Step Procedure ******************************************************

#########################################
# 1) Check Present Values
#########################################

[oracle@host01 ~]$ sudo su -
[root@host01 ~]#

[root@host01 ~]# chage -l oracle
Last password change                                    : Feb 18, 2014
Password expires                                        : May 19, 2014
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 15
Maximum number of days between password change          : 90
Number of days of warning before password expires       : 7
[root@host01 ~]#

=====================================================================================================================

#########################################
# 2) Modify the Expiry Date
#########################################

[root@host01 ~]# chage -M 99999 oracle
[root@host01 ~]#

=====================================================================================================================

#########################################
# 3) View the Changes
#########################################

[root@host01 ~]# chage -l oracle
Last password change                                    : Feb 18, 2014
Password expires                                        : never
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 15
Maximum number of days between password change          : 99999
Number of days of warning before password expires       : 7
[root@host01 ~]#

=====================================================================================================================
 Comments Are Always welcome
=====================================================================================================================

Wednesday, February 5, 2014

Diskgroup is not compatible for database usage. Database compatible attribute of diskgroup should be same or lower than the database compatible initialization parameter value.


##########################
## Error
##########################


##########################
#  Error Occurred
##########################

Error occured when i tried to create a database using DBCA at Step 6 in 11.2.0.3.0 version

**************************************** Step By Step Analysis ******************************************************

#########################################
# 1) Check the compatible Values
#########################################

SQL> select NAME,STATE,COMPATIBILITY,DATABASE_COMPATIBILITY from v$asm_diskgroup;
NAME                           STATE       COMPATIBILITY                                                DATABASE_COMPATIBILITY
------------------------------ ----------- ------------------------------------------------------------ ------------------------------------------------------------
DATA                           MOUNTED     11.2.0.2.0                                                   11.2.0.2.0
RECO                           MOUNTED     11.2.0.2.0                                                   11.2.0.2.0
VOTEDISK                       MOUNTED     11.2.0.2.0                                                   11.2.0.2.0

=====================================================================================================================

#########################################
# 2) Reason for Failure
#########################################

Database compatible attribute of diskgroup should be same or lower than the database compatible initialization parameter value.

From above we can see that Database_compatibility attribute is set to 11.2.0.2.0

When we create a new database using DBCA, by default the database init compatible parameter is set to 11.2.0.0.0, So we are receiving the above error.

This also seems to be Bug 11075044
=====================================================================================================================

##########################
## Solution
##########################

Modify the database creation templates, such that when we invoke DBCA the compatiable parameter must be 11.2.0.2.0

Template Location : $ORACLE_HOME/assistants/dbca/templates

[oracle@host01 templates]$ pwd
/u01/app/oracle/product/11.2.0.3/dbhome_1/assistants/dbca/templates

Here I've tried creating db using General Purpose Option. So i'm taking a backup of General_Purpose.dbc template before making changes.

[oracle@host01 templates]$ cp General_Purpose.dbc General_Purpose.dbc.bkp

Changed the Below parameter as follows,

initParam name="compatible" value="11.2.0.2.0"

Difference between two files,

[oracle@host01 templates]$ diff General_Purpose.dbc General_Purpose.dbc.bkp
32c32
<          initParam name="compatible" value="11.2.0.2.0"
---
>          initParam name="compatible" value="11.2.0.0.0"

[oracle@host01 templates]$

=====================================================================================================================
 Now Invoke DBCA again, this step i didnt face any issues and the DB Creation is Successful.
=====================================================================================================================

=====================================================================================================================
 Comments Are Always welcome
=====================================================================================================================



Tuesday, February 4, 2014

Modify / Change DB_DOMAIN GLOBAL_NAME of the Database



Here We are going to change the DB_UNIQUE_NAME of the RAC database. Changing the Global Name doesn't need a database bounce but db_domain parameter needs database bounce.

**************************************** Step By Step Procedure ******************************************************

#########################################
# 1) Check Present Values
#########################################

SQL> sho parameter uniq
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_unique_name                       string      db01
SQL> sho parameter dom
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_domain                            string
SQL> select * from global_name;
GLOBAL_NAME
--------------------------------------------------------------------------------
db01

=====================================================================================================================
 Here Domain Name is Set to Null, So Global Name just retrieves as db01
=====================================================================================================================

#########################################
# 2) check for the Database service
#########################################

PMON register the instance in the listener whenever a database comes to MOunt stage. Here we can see that LISTENER is listener to a service called "db01"

[oracle@host01 ~]$ lsnrctl  services | grep db01
Service "db01" has 1 instance(s).
  Instance "db011", status READY, has 1 handler(s) for this service...
Service "db01XDB" has 1 instance(s).
  Instance "db011", status READY, has 1 handler(s) for this service...
[oracle@host01 ~]$

=====================================================================================================================

#########################################
# 3) Modify Database Parameters
#########################################

Now we Will alter the DB_Domain Parameter in spfile as this is a STATIC parameter.

Alter system set db_domain="stepintooracledba.com" scope=spfile sid='*';

SQL> Alter system set db_domain="stepintooracledba.com" scope=spfile sid='*';
System altered.

Lets see Listener Status after Parameter change. Still it remains same.

oracle@host01 ~]$ lsnrctl services | grep db01
Service "db01" has 1 instance(s).
  Instance "db011", status READY, has 1 handler(s) for this service...
Service "db01XDB" has 1 instance(s).
  Instance "db011", status READY, has 1 handler(s) for this service...

=====================================================================================================================

#########################################
# 4) Shutdown / Startup Database
#########################################

[oracle@host01 ~]$ srvctl stop database -d db01

[oracle@host01 ~]$ srvctl start database -d db01

[oracle@host01 ~]$ lsnrctl services | grep db01
Service "db01.stepintooracledba.com" has 1 instance(s).
  Instance "db011", status READY, has 1 handler(s) for this service...
Service "db01XDB.stepintooracledba.com" has 1 instance(s).
  Instance "db011", status READY, has 1 handler(s) for this service...
[oracle@host01 ~]$ 

SQL> select * from global_name;

GLOBAL_NAME
--------------------------------------------------------------------------------
db01.stepintooracledba.com

=====================================================================================================================
 Now We can See that PMON has registered the instance service name as "db01.stepintooracledba.com"
=====================================================================================================================

=====================================================================================================================
 Comments Are Always welcome
=====================================================================================================================

rman: can't open target


##########################
## Error
##########################

 [/usr/oracle/siod/SCRIPTS] oracle@host01 $ rman target /
rman: can't open target

##########################
#  Error Occurred
##########################

Error occured while tried to connect rman in one of our server

##########################
## Command Executed
##########################

rman target /

**************************************** Step By Step Analysis ******************************************************

#########################################
# 1) Check Home
#########################################

I have cross checked whether correct Oracle Database Home and Environmental variable like PATH is correctly set. Everything is fine but still it produces error.

=====================================================================================================================

#########################################
# 2) Reason for Failure
#########################################

Upon Digging Further, found that whenever i type rman its not taking the binary from $ORACLE_HOME/bin

#########################################
# 3) Troubleshooting
#########################################

I need to find out which rman binary is getting kick started when i give rman target /

So i have given which rman command.

$ which rman
/usr/X11R6/bin/rman

From the above output we can see that whenever i type rman it tries to execute the binary from /usr/X11R6/bin/rman and not $ORACLE_HOME/bin/rman

And also checking the PATH environmental variable,

 /usr/oracle/product/11.2.0.2/bin] oracle@host01 $ echo $PATH
/usr/local/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/jvm/jre/bin:/siod/thishost/unix/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:.:/usr/oracle/product/11.2.0.2/bin
[/usr/oracle/product/11.2.0.2/bin] oracle@host01 $

=====================================================================================================================

##########################
## Solution
##########################

Three Solutions available for this Issue.

1) Run the rman prompt like below,

$ORACLE_HOME/bin/rman target /

2) Place $ORACLE_HOME/bin in the beginning of the PATH variable, such that when rman binary is searched it will look into $ORACLE_HOME/bin/rman

3) Remove /usr/X11R6/bin entry from $PATH

=====================================================================================================================
Thanks to my Wife for bringing up this error and helped me in troubleshooting & Resolving.
=====================================================================================================================
 Comments Are Always welcome
=====================================================================================================================



Sunday, February 2, 2014

-bash:ELF: command not found


##########################
## Error
##########################

[oracle@host02 ~]$ . dtest
-bash:ELF: command not found

##########################
#  Error Occurred
##########################

Error occured when trying to set the Oracle Database enviornmental Profile.

##########################
## Command Executed
##########################

. dtest

**************************************** Step By Step Analysis ******************************************************

#########################################
# 1) Check if /bin/ksh  is included
#########################################

Earlier, below line was not included in the Script file. So added the file and then executed still got the same error.

#!/bin/ksh

=====================================================================================================================

#########################################
# 2) Reason for Failure
#########################################

Looks like the file name should be with a dot (.) hidden file.

##########################
## Solution
##########################

I've just renamed the environmental setup file from dtest to .dtest and it worked good.

[oracle@host02 ~]$ . .dtest
############################################
# List of Instances Running on this Server #
############################################
+ASM2
db1
db2
************************************************
* Type the Database Name Which you need to Use *
************************************************


=====================================================================================================================
 Comments Are Always welcome
=====================================================================================================================