Saturday, June 21, 2014

Run scp in Background By Providing Password @ ForeGround


Usually we use scp command to transfer a file from one server to another server. Say for example if we want to transfer 100GB file then best idea is to run at background.

But running scp at background has a problem which is "password". scp always prompt for a password which cannot be given in shell script. ( Check end of the post for other method to run as a shell script )

Here we will see a simple method to scp at background by providing password at the foreground.

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

Source Server : host01
Source Path : /u01/backup/test.dmp Destination server : host02
Destination Path : /u02/test.dmp

#########################################
# 1) scp Command
#########################################


nohup scp /u01/backup/test.dmp host02:/u02/test.dmp > nohup.out 2>&1

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

#########################################
# 2) Run scp Command
#########################################

Once we run the above command it will prompt for Password, Input Password and then Press Ctrl + Z ( Now scp is stopped )

[oracle@host01 srini]$ nohup scp /u01/backup/test.dmp host02:/u02/test.dmp > nohup.out 2>&1
oracle@host02's password:
^Z
[1]+  Stopped                 nohup scp /u01/backup/test.dmp host02:/u02/test.dmp > nohup.out 2>&1
You have new mail in /var/spool/mail/oracle
[oracle@host01 srini]$

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

#########################################
# 3) Start the Process in Background
#########################################

Type "bg" command and scp process will start in background

[oracle@host01 srini]$ bg
[1]+ nohup scp /u01/backup/test.dmp host02:/u02/test.dmp > nohup.out 2>&1 &
[oracle@host01 srini]$

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

#########################################
# 4) Check if scp is running
#########################################

Type "jobs", it will show the scp job is running

[oracle@host01 srini]$ jobs
[1]+  Running                 nohup scp /u01/backup/test.dmp host02:/u02/test.dmp > nohup.out 2>&1 &
[oracle@host01 srini]$ 

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

#########################################
# 5) Run scp at Fore Ground
#########################################

Type "fg", it will show run the scp in foreground instead of background

[oracle@host01 srini]$ fg
nohup scp /u01/backup/test.dmp host02:/u02/test.dmp > nohup.out 2>&1

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

#########################################
# 6) Other Methods to run scp @ Background
#########################################

a) Using Expect Script
b) SSHPass
c) Establish ssh connectivity by generating keygen ( http://stepintooracledba.blogspot.com/2013/12/configure-ssh-manually-for-rac-4-node.html )

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

Friday, June 6, 2014

DGMRL shows ORA-16664: unable to receive the result from a database


We have configured a new dataguard database. So we want to verify whether the dataguard configuration is set up good.

So we have used 12c Cloud control to verify the Data Guard Configuration and it has ended with the above error.

How to Verify Dataguard Configuration using 12c Cloud Control?

http://stepintooracledba.blogspot.com/2014/06/verify-data-guard-configuration-using.html

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

ORA-16664: unable to receive the result from a database

### Full Error

DGMGRL> show configuration;
Configuration - oralin_dg
  Protection Mode: MaxPerformance
  Databases:
    oralin   - Primary database
    oralin_stdby - Physical standby database
      Error: ORA-16664: unable to receive the result from a database
Fast-Start Failover: DISABLED
Configuration Status:
ERROR
DGMGRL>

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

Error occured while running a "show configuration" command in DGMGRL in 11.2.0.3.0 version

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

In DGMGRL,

show configuration;

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

#########################################
# 1) Verify Data Guard Configuration in 12c Cloud Control
#########################################

Initializing
Connected to instance host01:oralin
Starting alert log monitor...
Updating Data Guard link on database homepage...
WARNING: Broker name (oralin) and target name (oralin_host01) do not match.
WARNING: The broker name will be renamed to match the target name.
WARNING: Broker name (oralin_stdby) and target name (oralin_stdby_host02) do not match.
WARNING: The broker name will be renamed to match the target name.
Skipping verification of fast-start failover static services check.
Data Protection Settings:
  Protection mode : Maximum Performance
  Redo Transport Mode settings:
    oralin: ASYNC
    oralin_stdby: ASYNC
  Checking standby redo log files.....not checked due to broker name mismatch. Run verify again.
Checking Data Guard status
  oralin : Normal
  oralin_stdby : ORA-16664: unable to receive the result from a database
Checking inconsistent properties
Checking agent status
WARNING: No credentials available for target. host01
Attempting agent ping ... Down
WARNING: No credentials available for target. host02
Attempting agent ping ... Down
Processing completed.

=====================================================================================================================
Verification of Data Guard in 12c oem gives Below Error for standby Database
ORA-16664: unable to receive the result from a database
=====================================================================================================================

#########################################
# 2) Reproduce the Error
#########################################

Show configuration in DGMGRL in standby site gives the error.

[oracle@host02 trace]$ dgmgrl /
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show configuration;
Configuration - oralin_dg
  Protection Mode: MaxPerformance
  Databases:
    oralin   - Primary database
    oralin_stdby - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
ORA-16501: the Data Guard broker operation failed
ORA-16625: cannot reach database "oralin"
DGM-17017: unable to determine configuration status
DGMGRL>

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

#########################################
# 3) Check DRC logs
#########################################

#### Primary Database Log

/u01/app/oracle/diag/rdbms/oralin/oralin/trace/drcoralin.log

[oracle@host01 trace]$ vi drcoralin.log
05/31/2014 18:18:37
Site oralin_stdby returned ORA-16664.
Data Guard Broker Status Summary:
  Type                        Name                             Severity  Status
  Configuration               oralin_dg                        Warning  ORA-16607
  Primary Database            oralin                             Success  ORA-00000
  Physical Standby Database   oralin_stdby                             Error  ORA-16664

#### Standby Database Log

/u01/app/oracle/diag/rdbms/oralin_stdby/oralin_stdby/trace/drcoralin_stdby.log

[oracle@host02 trace]$ vi drcoralin_stdby.log
05/31/2014 18:34:38
Property 'DbFileNameConvert' has inconsistent values:METADATA='+DATA, +DATA', SPFILE='+DATA/oralin,+DATA/oralin_stdby', DATABASE='+DATA, +DATA'
Property 'LogFileNameConvert' has inconsistent values:METADATA='+RECO, +RECO, +DATA, +DATA', SPFILE='+DATA/oralin,+DATA/oralin_stdby,+RECO/oralin,+RECO/oralin_stdby', DATABASE='+RECO, +RECO, +DATA, +DATA'
Failed to send message to site oralin. Error code is ORA-16501.
[oracle@host02 trace]$

=====================================================================================================================
From Standby Database drcoralin_stdby.log we can see that there are inconsistent Values set
=====================================================================================================================

#########################################
# 4) Check Inconsistent Properties
#########################################

show database 'oralin_stdby' InconsistentProperties;

[oracle@host02 trace]$ dgmgrl /
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show database 'oralin_stdby' InconsistentProperties;
INCONSISTENT PROPERTIES
   INSTANCE_NAME        PROPERTY_NAME         MEMORY_VALUE         SPFILE_VALUE         BROKER_VALUE
         oralin_stdby    DbFileNameConvert         +DATA, +DATA +DATA/oralin,+DATA/oralin_stdby         +DATA, +DATA
         oralin_stdby   LogFileNameConvert +RECO, +RECO, +DATA, +DATA +DATA/oralin,+DATA/oralin_stdby,+RECO/oralin,+RECO/oralin_stdby +RECO, +RECO, +DATA, +DATA
DGMGRL>

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

#########################################
# 5) Reason for Failure
#########################################

From the above output, we can find out the reason for failure is because of the Inconsistent Properties of db_file_name_convert and log_file_name_convert set at the database level in standby.

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

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

Alter both the parameter in standby Database.

ALTER SYSTEM SET log_file_name_convert='+DATA/oralin_stdby, +DATA/oralin, +RECO/oralin_stdby, +RECO/oralin' SCOPE=SPFILE;

ALTER SYSTEM SET db_file_name_convert='+DATA/oralin_stdby','+DATA/oralin' SCOPE=SPFILE;

=====================================================================================================================
Check Inconsistent Properties
=====================================================================================================================

[oracle@host02 ~]$ dgmgrl /
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show database 'oralin_stdby' inconsistentproperties;
INCONSISTENT PROPERTIES
   INSTANCE_NAME        PROPERTY_NAME         MEMORY_VALUE         SPFILE_VALUE         BROKER_VALUE
DGMGRL>

=====================================================================================================================
Verification using 12c Is also Looks good.
=====================================================================================================================

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



Thursday, June 5, 2014

Verify Data Guard Configuration using 12c Cloud Control


An Easiest way to check if your Data Guard is configured Correctly. This can be done using 12c Cloud Control.

12c Cloud Control uses DGMGRL to perform these validations at the background.

You have only 4 steps left to check your configuration.

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

Step 1 :


Go to the Primary database Page and Click Availability à Verify Data Guard Configuration

Step 2 :

Provide the Named Credential to login and click continue


Step 3 :

Once we click Continue, Verification Process starts to Progress…


Step 4 :

Once Verification completes, we will get results like below. Please review the logs and everything should be ok. Click OK to Exit.


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