Study Transfer: Https://blogs.oracle.com/Database4CN/entry/%E5%A6%82%E4%BD%95%E5%88%A9%E7%94%A8rman_debug%E5%92%8C10046_ Trace%e6%9d%a5%e8%af%8a%e6%96%adrman%e9%97%ae%e9%a2%98
Describe how to debug the Rman problem. We use the following scenario to illustrate how Debug RMAN issues .
On 11.2.0.4, the following error occurred while performing an archive backup on the physical standby:
[[email protected] ~]$ Rman target/
Recovery manager:release 11.2.0.4.0-production on Tue Mar 25 13:58:59 2014
Copyright (c) 1982, Oracle and/or its affiliates. All rights reserved.
Connected to target database:r11204 (dbid=2001766638, not open)
rman> backup Archivelog all;
Starting backup at 25-mar-14
Using target database control file instead of recovery catalog
rman-06820:warning:failed to archive current log at primary database<============== error cannot connect to the main library
Connect identifier for Db_unique_name R11204 not configured
Allocated Channel:ora_disk_1
Channel ora_disk_1:sid=1 Device Type=disk
Channel ora_disk_1:starting archived log backup set
Channel ora_disk_1:specifying archived log (s) in backup set
Input archived log thread=1 sequence=58 recid=1 stamp=842172838 <============== back archive backup or successful
Input archived log thread=1 sequence=59 recid=2 stamp=842172838
Input archived log thread=1 sequence=60 recid=3 stamp=842172928
Input archived log thread=1 sequence=61 recid=4 stamp=842173275
Input archived log thread=1 sequence=62 recid=5 stamp=842175748
Input archived log thread=1 sequence=63 recid=6 stamp=842182033
Input archived log thread=1 sequence=64 recid=7 stamp=842185463
Input archived log thread=1 sequence=65 recid=9 stamp=842432288
Input archived log thread=1 sequence=66 recid=8 stamp=842432286
Input archived log thread=1 sequence=67 recid=10 stamp=842432291
Input archived log thread=1 sequence=68 recid=11 stamp=842432322
Channel ora_disk_1:starting piece 1 at 25-mar-14
Channel ora_disk_1:finished piece 1 at 25-mar-14
Piece handle=/u01/app/oracle/fast_recovery_area/sdy/backupset/2014_03_25/o1_mf_annnn_tag20140325t135903_ 9M2HLJ0P_.BKP tag=tag20140325t135903 Comment=none
Channel Ora_disk_1:backup set complete, elapsed time:00:00:03
Finished backup at 25-mar-14
Note: 11.2.0.4 has a new feature, that is, when backing up the archive on the standby, it will connect to the main library and have the main library log switch once, so the error above is that the repository cannot connect to the main library for log switch,aboveThe main error is "Connect identifier for Db_unique_name R11204 not Configured", which looks like the connection string required to connect to the main library is not configured correctly. At this point our question is where is this connection string set?
First Use Rman Debug:
[Email protected] ~]$ Rman target/debug trace=/tmp/rman_debug
rman> backup Archivelog all;
Rman-03090:starting Backup at 25-mar-14
Rman-06009:using Target Database control file instead of recovery catalog
rman-06820:warning:failed to archive-log at primary database
Rman-06613:connect identifier for Db_unique_name R11204 not configured
...
For the generated/tmp/rman_debug, we found that the connection string was empty "Lprimary_db_cs = null"
dbgsql:target> Begin:lprimary_db_cs: = Sys.dbms_backup_restore.get_connect_identifier (dbuname=> :p Rimary_dbunam
e); End
Dbgsql:sqlcode = 0
Dbgsql:b: Lprimary_db_cs = NULL "========== This is the connection string for the main library
Dbgsql:b:p rimary_dbuname = R11204
DBGRCVMAN:getConfig:configurations exists for this site
rman-06820:warning:failed to archive-log at primary database
Dbgmisc:entered KRMKURSR [14:08:50.007]
That is, Rman calls an internal package sys.dbms_backup_restore.get_connect_identifier to get the strings that are needed to connect the repository to the Master repository. At this point we need to know where the string is set and why it is empty.
Next, 10046 Trace is performed for Rman:
[Email protected] ~]$ Rman target/debug trace=/tmp/rman_debug
Recovery manager:release 11.2.0.4.0-production on Mon Mar 17 09:00:00 2014
Copyright (c) 1982, Oracle and/or its affiliates. All rights reserved.
rman-06568:connected to Target database:r11204 (dbid=2001766638, not open)
Rman> SQL "alter session set Tracefile_identifier= ' rman_10046";
Rman-06009:using Target Database control file instead of recovery catalog
Rman-06162:sql statement:alter Session Set tracefile_identifier= "rman_10046"
Rman> SQL "alter session SET events" 10046 Trace name context forever,level 12 "";
Rman-06162:sql statement:alter Session Set Events ' 10046 Trace name context forever,level 12 '
rman> backup Archivelog all;
Rman-03090:starting Backup at 25-mar-14
rman-06820:warning:failed to archive-log at primary database
Rman-06613:connect identifier for Db_unique_name R11204 not configured
...
View the generated trace file, which is under Udump:
$CD/u01/app/diag/rdbms/sdy/sdy/trace
$ls-ltr
-RW-R-----1 Oracle oinstall 1037463 Mar 14:11 sdy_ora_3792_rman_10046.trc
Parsing in CURSOR #140366085001120 len=119 dep=0 uid=0 oct=47 lid=0 tim=1395736859520777 hv=3388798669 ad= ' 7ec65738 ' sqlid = ' 7pwt2c34
Ztxqd '
Begin:lprimary_db_cs: = Sys.dbms_backup_restore.get_connect_identifier (dbuname=>:p rimary_dbuname); End
END of STMT
PARSE #140366085001120: c=0,e=285,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=1,plh=0,tim=1395736859520776
Binds #140366085001120:
Bind#0
Oacdty=01 mxl=2000 (1536) mxlc=00 mal=00 scl=00 pre=00
oacflg=01 fl2=1000000 frm=01 csi=873 siz=2128 off=0
kxsbbbfp=7fa986a27f08 bln=2000 avl=00 flg=05
Bind#1
Oacdty=01 mxl=128 (mxlc=00) mal=00 scl=00 pre=00
oacflg=01 fl2=1000000 frm=01 csi=873 siz=0 off=2000
Kxsbbbfp=7fa986a286d8 bln=128 avl=06 flg=01
Value= "R11204"
ACTION NAME0000018 STARTED189) 2014-03-25 14:10:59.521
WAIT #140366085001120: nam= ' control file sequential read ' ela= file#=0 block#=1 blocks=1 obj#=-1 tim=1395736859521532
WAIT #140366085001120: nam= ' control file sequential read ' ela= 4 file#=0 block#=16 Blocks=1 obj#=-1 tim=1395736859521566
WAIT #140366085001120: nam= ' control file sequential read ' ela= 4 file#=0 block#=18 Blocks=1 obj#=-1 tim=1395736859521580
WAIT #140366085001120: nam= ' control file sequential read ' ela= 4 file#=0 block#=281 Blocks=1 obj#=-1 tim=1395736859521594
WAIT #140366085001120: nam= ' control file sequential read ' ela= 4 file#=0 block#=1 Blocks=1 obj#=-1 tim=1395736859521614
WAIT #140366085001120: nam= ' control file sequential read ' ela= 3 file#=0 block#=16 Blocks=1 obj#=-1 tim=1395736859521627
WAIT #140366085001120: nam= ' control file sequential read ' Ela= 2 file#=0 block#=18 Blocks=1 obj#=-1 tim=1395736859521638
WAIT #140366085001120: nam= ' control file sequential read ' ela= 3 file#=0 block#=281 Blocks=1 obj#=-1 tim=1395736859521650
Krsd_get_primary_connect_string:found PCs ' by Fal_server lookup <==================== found a connection string with Fal_server
So this 10046 trace, which tells us very clearly that it is getting a connection string from the parameter fal_server.
At this point, connect to the repository, view the parameter fal_server, its value is indeed empty:
Sql> Show parameter Fal
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
Fal_client string
Fal_server string
Here we get the information we want through Rman Debug and 10046 trace.
To summarize:
If you are experiencing performance problems or need to drill down to an error after executing the Rman command, consider using Rman debug:
$ rman target <connection> catalog <connection> Debug Trace=/tmp/rmandebug.trc Log=/tmp/rmanlog.txt
Run {
... Run your backup commands here
}
If you need further tracking, you can use 10046 trace again:
$ rman Target <connection> catalog <connection> Debug trace=/tmp/rmandebug.trc Log=/tmp/rmanlog.txt
rman> SQL "alter session set Tracefile_identifier= ' rman_10046";
rman> SQL "alter session SET events" 10046 Trace name Context forever,level ";
Rman> Run-your-commands;
Rman> exit;
It is important to note that these methods may generate a large number of files, and you need to consider the pressure on disk space and the impact on the performance of Rman.
How can Rman Debug and 10046 trace be used to diagnose rman problems?