Wednesday, June 11, 2014

ORA-12518: TNS:listener could not hand off client connection



Scenario:
When trying to connection with SID/service name getting error message
Enter user-name: PS C:\Users\Administrator> sqlplus scott/tiger@orcl

SQL*Plus: Release 10.2.0.3.0 - Production on Mon Jun 9 16:37:16 2014

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

ERROR:
ORA-12518: TNS:listener could not hand off client connection
But without service name / SID can able to connect successfully.
         PS C:\Users\Administrator> sqlplus scott/tiger

         SQL*Plus: Release 10.2.0.3.0 - Production on Mon Jun 9 18:16:11 2014

         Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


         Connected to:
         Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
         With the Partitioning, OLAP and Data Mining options

         SQL>

Tried with many options editing listener.ora and tnsnames.ora file but can’t get success.

PS C:\Users\Administrator> lsnrctl start
LSNRCTL for 32-bit Windows: Version 10.2.0.3.0 - Production on 09-JUN-2014 16:36:52
Copyright (c) 1991, 2006, Oracle.  All rights reserved.
Starting tnslsnr: please wait...

TNSLSNR for 32-bit Windows: Version 10.2.0.3.0 - Production
System parameter file is C:\oracle\product\10.2.0\db_1\network\admin\listener.ora
Log messages written to C:\oracle\product\10.2.0\db_1\network\log\listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=tstpip)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for 32-bit Windows: Version 10.2.0.3.0 - Production
Start Date                09-JUN-2014 16:36:58
Uptime                    0 days 0 hr. 0 min. 6 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   C:\oracle\product\10.2.0\db_1\network\admin\listener.ora
Listener Log File         C:\oracle\product\10.2.0\db_1\network\log\listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=tstpip)(PORT=1521)))
Services Summary...
Service "ORCL" has 1 instance(s).
  Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "onlinepnet" has 1 instance(s).
  Instance "onlinepnet", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

PS C:\Users\Administrator> tnsping orcl

TNS Ping Utility for 32-bit Windows: Version 10.2.0.3.0 - Production on 09-JUN-2014 16:37:08

Copyright (c) 1997, 2006, Oracle.  All rights reserved.

Used parameter files:
C:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = TSTPIP)(PORT = 1521))) (CONNECT_
DATA = (SERVICE_NAME = orcl)))
OK (0 msec)
PS C:\Users\Administrator> sqlplus scott/tiger@ORCL

SQL*Plus: Release 10.2.0.3.0 - Production on Mon Jun 9 16:37:11 2014

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

ERROR:
ORA-12518: TNS:listener could not hand off client connection


Enter user-name: PS C:\Users\Administrator> sqlplus scott/tiger@orcl

SQL*Plus: Release 10.2.0.3.0 - Production on Mon Jun 9 16:37:16 2014

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

ERROR:
ORA-12518: TNS:listener could not hand off client connection

               
               
Finally edited listener.ora file with login mode on parameter.
logging_listener_name=on

When checked C:\oracle\product\10.2.0\db_1\network\log\ listener.log file found below
TIMESTAMP * CONNECT DATA [* PROTOCOL INFO] * EVENT [* SID] * RETURN CODE
09-JUN-2014 17:36:33 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=)(USER=Administrator))(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSION=169870080)) * status * 0
09-JUN-2014 17:36:35 * (CONNECT_DATA=(SERVER=DEDICATED)(SID=ORCL)(CID=(PROGRAM=C:\oracle\product\10.2.0\db_1\bin\sqlplus.exe)(HOST=TSTPIP)(USER=Administrator))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.16.2.20)(PORT=53125)) * establish * ORCL * 12518
TNS-12518: TNS:listener could not hand off client connection
 TNS-12560: TNS:protocol adapter error
  TNS-00534: Failed to grant connection ownership to child
   32-bit Windows Error: 10022: Unknown error
09-JUN-2014 17:37:24 * service_register * orcl * 0
09-JUN-2014 17:45:19 * service_update * orcl * 0
09-JUN-2014 17:45:27 * service_died * orcl * 12537

Out of all above three error have different reason.
Finally  TNS-00534: Failed to grant connection ownership to child error helped me to resolve issue.

Issue is my listener service started with local admin user while orcl service started as local admin
               


Must start both service should be started with common method.
Changed both service started with .\Administrator resolved my issue.
               


Enter user-name: PS C:\Users\Administrator> sqlplus sys as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on Mon Jun 9 17:46:07 2014

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

Enter password:
Connected to an idle instance.

SQL> startup;
ORACLE instance started.

Total System Global Area  612368384 bytes
Fixed Size                  1292036 bytes
Variable Size             335546620 bytes
Database Buffers          268435456 bytes
Redo Buffers                7094272 bytes
Database mounted.
Database opened.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
PS C:\Users\Administrator> sqlplus scott/tiger@orcl

SQL*Plus: Release 10.2.0.3.0 - Production on Mon Jun 9 17:46:31 2014

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
PS C:\Users\Administrator>

Thursday, May 08, 2014

brrestore backup restoration options




To restore only Online redo log and control files.

If you see offline database backup log file, will show entry similar to below

--------------------------------------------------------------------------------------------------------------------------------------------------
BRBACKUP Action Log for Database PIP

From:          01.05.2014 00:13:07
LogFile:       benteodf.aft
Return Code:   0000 Success
Database Host: XXXXX

--------------------------------------------------------------------------------------------------------------------------------------------------
|Tape  |Position|Backup Time        |Compressn|DF ID|Back. ID|Redo No.|Tablespace |TS Stat.|DF Stat.|File Name                                   |
--------------------------------------------------------------------------------------------------------------------------------------------------
|010514|      4 |01.05.2014 00:15:11|         |   4 |        | 41,852 |PSAPSR3    |ONLINE  |ONLINE  |/oracle/PIP/sapdata1/sr3_1/sr3.data1        |
|010514|      5 |01.05.2014 00:16:27|         |   5 |        | 41,852 |PSAPSR3    |ONLINE  |ONLINE  |/oracle/PIP/sapdata2/sr3_2/sr3.data2        |
--
--
--
--
|010514|    158 |01.05.2014 04:13:00|         |   1 |        | 41,852 |           |        |        |/oracle/PIP/origlogA/log_g11m1.dbf          |
|010514|    159 |01.05.2014 04:13:12|         |   2 |        | 41,852 |           |        |        |/oracle/PIP/origlogB/log_g12m1.dbf          |
|010514|    160 |01.05.2014 04:13:23|         |   3 |        | 41,852 |           |        |        |/oracle/PIP/origlogA/log_g13m1.dbf          |
|010514|    161 |01.05.2014 04:13:33|         |   4 |        | 41,852 |           |        |        |/oracle/PIP/origlogB/log_g14m1.dbf          |
|010514|    162 |01.05.2014 04:13:42|         |   0 |        | 41,852 |           |        |        |/oracle/PIP/origlogA/cntrl/cntrlPIP.dbf     |
--------------------------------------------------------------------------------------------------------------------------------------------------


Based on above can able to idenfity online log file starting from position (DF ID) 1 to 4 while control file position (DF ID) 0

Execute brrestore command i.e. brrestore -b <backuplogfile name> -m <starting position DF ID>-<ending posistion DF ID>,<0 for control file DF ID>

ipldia10:orapip 20> brrestore -b benteodf.aft -m 01-04,0
BR0401I BRRESTORE 7.20 (29)
BR0405I Start of file restore: rentklfs.rsb 2014-05-02 04.58.00
BR0484I BRRESTORE log file: /oracle/PIP/sapbackup/rentklfs.rsb

BR0280I BRRESTORE time stamp: 2014-05-02 04.58.00
BR0407I Restore of database: PIP
BR0408I BRRESTORE action ID: rentklfs
BR0409I BRRESTORE function ID: rsb
BR0449I Restore mode: partial
BR0411I Database files for restore:
/oracle/PIP/origlogA/log_g11m1.dbf
/oracle/PIP/mirrlogA/log_g11m2.dbf
/oracle/PIP/origlogB/log_g12m1.dbf
/oracle/PIP/mirrlogB/log_g12m2.dbf
/oracle/PIP/origlogA/log_g13m1.dbf
/oracle/PIP/mirrlogA/log_g13m2.dbf
/oracle/PIP/origlogB/log_g14m1.dbf
/oracle/PIP/mirrlogB/log_g14m2.dbf
/oracle/PIP/origlogA/cntrl/cntrlPIP.dbf
/oracle/PIP/origlogB/cntrl/cntrlPIP.dbf
/oracle/PIP/sapdata1/cntrl/cntrlPIP.dbf
BR0419I Files will be restored from backup: benteodf.aft 2014-05-01 00.13.07
BR0416I 5 files found to restore, total size 824.988 MB
BR0424I Files will not be decompressed
BR0421I Restore device type: tape
BR0102I Following backup device will be used: /dev/rmt/3mn
BR0103I Following backup volume will be used: 010514 (2014-05-01 00.13.07)

BR0280I BRRESTORE time stamp: 2014-05-02 04.58.00
BR0256I Enter 'c[ont]' to continue, 's[top]' to cancel BRRESTORE:
c
BR0280I BRRESTORE time stamp: 2014-05-02 04.58.11
BR0257I Your reply: 'c'
BR0259I Program execution will be continued...

BR0208I Volume with name 010514 (2014-05-01 00.13.07) required in device /dev/rmt/3mn
BR0210I Please mount BRBACKUP volume, if you have not already done so

BR0280I BRRESTORE time stamp: 2014-05-02 04.58.11
BR0256I Enter 'c[ont]' to continue, 's[top]' to cancel BRRESTORE:
c
BR0280I BRRESTORE time stamp: 2014-05-02 04.58.14
BR0257I Your reply: 'c'
BR0259I Program execution will be continued...

BR0280I BRRESTORE time stamp: 2014-05-02 04.58.14
BR0226I Rewinding tape volume in device /dev/rmt/3m ...

BR0351I Restoring /oracle/PIP/sapreorg/.tape.hdr0
BR0355I from /dev/rmt/3mn ...

BR0241I Checking label on volume in device /dev/rmt/3mn

BR0209I Volume in device /dev/rmt/3mn has name 010514 (2014-05-01 00.13.07)

BR0280I BRRESTORE time stamp: 2014-05-02 04.59.46
BR0199I Volume label checked successfully

BR0351I Restoring /oracle/PIP/origlogA/log_g11m1.dbf
BR0355I from /dev/rmt/3mn ...

#FILE..... /oracle/PIP/origlogA/log_g11m1.dbf
#RESTORED. log_g11m1.dbf  010514/158

BR0280I BRRESTORE time stamp: 2014-05-02 05.01.23
BR0418I 1 of 5 files restored - 200.001 of 824.988 MB done
BR0204I Percentage done: 24.24%, estimated end time: 5:11
BR0001I ************______________________________________

BR0351I Restoring /oracle/PIP/origlogB/log_g12m1.dbf
BR0355I from /dev/rmt/3mn ...

#FILE..... /oracle/PIP/origlogB/log_g12m1.dbf
#RESTORED. log_g12m1.dbf  010514/159

BR0280I BRRESTORE time stamp: 2014-05-02 05.01.25
BR0418I 2 of 5 files restored - 400.002 of 824.988 MB done
BR0204I Percentage done: 48.49%, estimated end time: 5:04
BR0001I ************************__________________________

BR0351I Restoring /oracle/PIP/origlogA/log_g13m1.dbf
BR0355I from /dev/rmt/3mn ...

#FILE..... /oracle/PIP/origlogA/log_g13m1.dbf
#RESTORED. log_g13m1.dbf  010514/160

BR0280I BRRESTORE time stamp: 2014-05-02 05.01.26
BR0418I 3 of 5 files restored - 600.003 of 824.988 MB done
BR0204I Percentage done: 72.73%, estimated end time: 5:02
BR0001I ************************************______________

BR0351I Restoring /oracle/PIP/origlogB/log_g14m1.dbf
BR0355I from /dev/rmt/3mn ...

#FILE..... /oracle/PIP/origlogB/log_g14m1.dbf
#RESTORED. log_g14m1.dbf  010514/161

BR0280I BRRESTORE time stamp: 2014-05-02 05.01.27
BR0418I 4 of 5 files restored - 800.004 of 824.988 MB done
BR0204I Percentage done: 96.97%, estimated end time: 5:01
BR0001I ************************************************__

BR0351I Restoring /oracle/PIP/origlogA/cntrl/cntrlPIP.dbf
BR0355I from /dev/rmt/3mn ...

#FILE..... /oracle/PIP/origlogA/cntrl/cntrlPIP.dbf
#RESTORED. cntrlPIP.dbf  010514/162

BR0280I BRRESTORE time stamp: 2014-05-02 05.01.27
BR0418I 5 of 5 files restored - 824.988 of 824.988 MB done
BR0204I Percentage done: 100.00%, estimated end time: 5:01
BR0001I **************************************************

BR0351I Restoring /oracle/PIP/mirrlogA/log_g11m2.dbf
BR0355I from /oracle/PIP/origlogA/log_g11m1.dbf ...

BR0351I Restoring /oracle/PIP/mirrlogB/log_g12m2.dbf
BR0355I from /oracle/PIP/origlogB/log_g12m1.dbf ...

BR0351I Restoring /oracle/PIP/mirrlogA/log_g13m2.dbf
BR0355I from /oracle/PIP/origlogA/log_g13m1.dbf ...

BR0351I Restoring /oracle/PIP/mirrlogB/log_g14m2.dbf
BR0355I from /oracle/PIP/origlogB/log_g14m1.dbf ...

BR0351I Restoring /oracle/PIP/origlogB/cntrl/cntrlPIP.dbf
BR0355I from /oracle/PIP/origlogA/cntrl/cntrlPIP.dbf ...

BR0351I Restoring /oracle/PIP/sapdata1/cntrl/cntrlPIP.dbf
BR0355I from /oracle/PIP/origlogA/cntrl/cntrlPIP.dbf ...

BR0280I BRRESTORE time stamp: 2014-05-02 05.01.39
BR0226I Rewinding tape volume in device /dev/rmt/3m ...

BR0406I End of file restore: rentklfs.rsb 2014-05-02 05.03.20
BR0280I BRRESTORE time stamp: 2014-05-02 05.03.20
BR0402I BRRESTORE completed successfully
ipldia10:orapip 21>

To restore selecting data file, online redo log and control files.

Execute brrestore command i.e. brrestore -b <backuplogfile name> -m <staring position DF ID of datafile>,<ending position DF ID of data file> <starting position DF ID>-<ending posistion DF ID>,<0 for control file DF ID>

Restoring data file from DF ID 1 to 15 with online redo log 4 files and control file.
ipldia10:orapip 20> brrestore -b benteodf.aft -m 1,15 01-04,0

To restore only data file.

Execute brrestore command i.e. brrestore -b <backuplogfile name> -m all

Restoring data file from DF ID 1 to 15 with online redo log 4 files and control file.
ipldia10:orapip 20> brrestore -b benteodf.aft -m all

Restore full backup including data, online log and control file

Execute brrestore command i.e. brrestore -b <backuplogfile name> -m full
ipldia10:orapip 20> brrestore -b benteodf.aft -m full


Examples of BRRESTORE Runs

1.       brrestore -b last -m all
Restore all tablespaces without the control file and online redo log files from the last successful backup

2.       brrestore -b bcnmhluz.aft -m full
Restores all the files from backup bcnmhluz.aft, including the control file and the online redo log files
Restores the mirror copies of the control file and the online redo log files

3.       brrestore -m /usr/sap/C11/SYS/profile
Restores the SAP profiles

4.       brrestore -m /oracle/C11/sapdata1=/oracle/C11/sapdata5
Restores all the database data files that were originally stored in the subdirectories of /oracle/C11/sapdata1 in directory /oracle/C11/sapdata5
brrestore -b last -m 1-10,01-04,0

Restores all the database data files with Oracle file IDs from 1 through 10, the four online redo log files, and the control file starting from the last successful backup
Restores the mirror copies of the control file and the online redo log files

5.       brrestore -m 0
Restores the control file. Restore the mirror copies of the control file

6.       brrestore -b last -m /oracle/C11/sapdata2/ddicd_5/ddicd.data5
Restores a database data file starting from the last successful backup

7.       brrestore -a 200-220
Restores the archived redo log files with the log sequence numbers from 200 through 220 into the archiving directory

8.       brrestore -a 40-70=/oracle/C11/sapbackup 71-90=/oracle/C11/sapreorg
Restores the archived redo log files with the log sequence numbers from 40 through 70 in directory sapbackup and those with the log sequence numbers from 71
through 90 in directory /oracle/C11/sapreorg

9.       brrestore -a 40-69,70-100=/oracle/C11/sapbackup
Restores the archived redo log files with the log sequence numbers from 40 through 69 in the archiving directory, and those with the log sequence numbers from 70 through 100 in directory sapbackup

10.   brrestore -n det_log
Restores a detail log to the local working directory