gDBClone “gDBClone_Snap.pm line 1292”

If you are using gDBClone to do snapshots from your databases on acfs, you’ll have noticed that in the last version (3.0.2-19) published 2017-06-30, when you do a snap from your databases, previously cloned, it shows you an error just in this moment:

INFO: 2017-07-07 18:09:08: ...Creating controlfile for database 'test11gd'
Unsuccessful open on filename containing newline at /opt/gDBClone/lib/gDBClone_Snap.pm line 1292.
ERROR: 2017-07-07 18:09:08: SNAP DB creation phase 2 cannot be continued due to errors

 

Well, it isn’t everything lost, if you dive in the gDBClone’s log executed, you can see:

2017-07-07 18:09:08: INFO: ...Creating controlfile for database 'test11gd'
2017-07-07 18:09:08: Generating the control file script for 'test11gd' from the controlfile backup 'SYS@test11gt> alter session set tracefile_identifier='ctrlbackup';
2017-07-07 18:09:08: Unable to open the file SYS@test11gt> alter session set tracefile_identifier='ctrlbackup';
2017-07-07 18:09:08: ERROR: SNAP DB creation phase 2 cannot be continued due to error

 

if you dive a little more in the scripts and you open the lib/gDBClone_Queries.pm, you can see:

sub bkupCtrlFile { my ($db_name, $passwd) = @_;
trace("Taking backup of controlfile for the database '$db_name'");
my %conn_attr = getDbConAttr($db_name, $passwd) ;
my $sid = getSID($db_name); $conn_attr{'sid'} = $sid;
my $ctrlbkuptag = "ctrlbackup";
my @sql_stmts = ( 
"alter session set tracefile_identifier='$ctrlbkuptag'",
"alter database backup controlfile to trace",
"oradebug setmypid",
"oradebug tracefile_name", 
"exit" );
my $sqlname = "bkupctrlfile"."_".$db_name."_".$PID.".sql";
my @output = execSqlStmts(\%conn_attr, \@sql_stmts, $sqlname);
my $rc = shift @output; if ($rc == SQL_EXECUTION_FAILED) { die("Unable to take the backup of control file");
}
my @out = grep (/$ctrlbkuptag/i, @output);
trace(@output);
logInfo(\@sql_stmts, \@output);
return $out[0];
}

 

You can solve it changing this line:

my @out = grep (/$ctrlbkuptag/i, @output);

by this one:

my @out = grep (/$db_name/i, @output);

Because we want to receive the name of tracefile, with this script we receive twice, but only the first entry is used… you can see the tracefile names generated:

[oracle@xxxxx trace]$ pwd
/u01/app/oracle/diag/rdbms/test11gt/test11gt/trace
[...]
-rw-rw---- 1 oracle dba   255 jul  7 22:28 test11gt_ora_82462_ctrlbackup.trm
-rw-rw---- 1 oracle dba 33372 jul  7 22:28 test11gt_ora_82462_ctrlbackup.trc

 

If you execute the script again, you can see that it follows without stop in the before point:

INFO: 2017-07-08 00:36:48: ...Creating controlfile for database 'test11gd'
INFO: 2017-07-08 00:36:51: ...Opening the database 'test11gd' with resetlogs
INFO: 2017-07-08 00:37:03: ...Setting the temporary tablespace for database 'test11gd'

 

I hope this information is useful and save some of your time.

Adding value with Arumel!