Overview:
Using perl+DBI+DBD::ODBC on Windows, I am connecting to a SQL Server 2005
instance and issuing a "restore database [foo] from disk='c:\foo-backup.bak'".
The restore attempt appears to succeed, and nothing calls my installed error
handler.
However, if I run a trace on the SQL Server, I can see the restore is throwing
an error:
Error 3224, Severity 16, State 1: Cannot create worker thread.
RESTORE DATABASE is terminating abnormally.
If I write the same SQL to a file, then execute the file via sqlcmd, the
restore works as expected. Hence I am confident in the SQL command as well as
the backup file.
Other DML-type commands work as advertised, as does the error handler. It
seems to be something specifically about a restore.
Specifics:
The version of perl is ActiveState's v5.10.0 running on a 32 bit Windows 2003
server.
My DSN and connect code looks like:
my $dsn = 'Driver={SQL Native
Client};Server=myServer;Database=master;Trusted_Connection=yes;Encrypt=yes;';
my $dbh = DBI->connect("dbi:ODBC:$dsn",'','', { RaiseError => 1, AutoCommit =>
1 } );
$dbh->{HandleError} = \&error_handler;
My error handler looks like:
sub error_handler {
my @err = @_;
print "Error handler triggered!\n";
return 0;
}
I have tried:
- $dbh->do ( $restore_command )
- $sth = $dbh->prepare( $restore_command ); $sth->execute(); ...
I've tried with and without $dbh->{odbc_exec_direct} = 1 and also not
specifying it.
The MDAC version on the machine is recent: version 2.82.3959.0.
The version of DBI is 1.604.
I have tried running a DBI trace at up to level 15, and there doesn't seem to
be anything of interest.
Has this been brought up before? Has someone encountered it?
If there are other things I should try, I would very much appreciate the
suggestions!
I'm completely at a loss where the problem is. Code? DBD? DBI? SQL Server?
mdac?
Thanks
-rt