|
|
sybperl-l Archive
Up Prev Next
From: michael dot peppler at bnpparibas dot com
Subject: RE: sybperl, cron and environment variables
Date: Apr 13 2006 11:25AM
The issue lies with the open client library versions, and the way Client
Library apps initialize the "context" in which they are to run.
dbschema.pl still works because it used DBlibrary, which isn't as dependant
on this issue (mainly becase DBlibrary hasn't been updated to handle all
the recent changes in functionality).
> guptaash@tktecwsd20:/export/home/guptaash/my_scripts/exp/bin> a.pl
> Sybase::CTlib initialize: ct_init(12500) failed at
> /export/home/guptaash/perl/lib/5.8.6/DynaLoader.pm line 253.
> Compilation failed in require at a.pl line 3.
> BEGIN failed--compilation aborted at a.pl line 3.
The most likely problem here is that the Sybase::CTlib module was built
with an older version of OpenClient. When no env. variables are set it may
try to use Sybase library files that are different from the ones in your
normal installation. If you are on Solaris you can test this with the ldd
command. Find the CTlib.so file in the perl site-lib tree and run ldd on
that file - it will tell you which libraries will get loaded given the
current environment.
For example, on linux I get:
[pepm01a@gvas1tkc6001 sql]$ ldd /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi/auto/Sybase/CTlib/CTlib.so
linux-gate.so.1 => (0x00372000)
/etc/libcwait.so (0x00390000)
libsybct_r.so => /pvar/sybase/15.0/OCS-15_0/lib/libsybct_r.so (0x00de0000)
libsybcs_r.so => /pvar/sybase/15.0/OCS-15_0/lib/libsybcs_r.so (0x00516000)
libsybtcl_r.so => /pvar/sybase/15.0/OCS-15_0/lib/libsybtcl_r.so (0x006ba000)
libsybcomn_r.so => /pvar/sybase/15.0/OCS-15_0/lib/libsybcomn_r.so (0x00f84000)
libsybintl_r.so => /pvar/sybase/15.0/OCS-15_0/lib/libsybintl_r.so (0x00426000)
libsybblk_r.so => /pvar/sybase/15.0/OCS-15_0/lib/libsybblk_r.so (0x005ca000)
libm.so.6 => /lib/libm.so.6 (0x0078c000)
libc.so.6 => /lib/libc.so.6 (0x00ab6000)
libdl.so.2 => /lib/libdl.so.2 (0x003cc000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00570000)
libnsl.so.1 => /lib/libnsl.so.1 (0x005e8000)
libsybunic.so => /pvar/sybase/15.0/OCS-15_0/lib/libsybunic.so (0x00198000)
/lib/ld-linux.so.2 (0x007f3000)
[pepm01a@gvas1tkc6001 sql]$
This will tell you if the libraries that the dynamic loader wants to use
are the ones you expected (i.e the ones under $SYBASE/$SYBASE_OCS/lib.
Michael
PS. If you want to clear things without any hassle you could just rebuild
sybperl...
Internet
ashish.gupta@mizuho-sc.com@peppler.org - 13/04/2006 07:18
Please respond to ashish.gupta@mizuho-sc.com
Sent by: owner-sybperl-l@peppler.org
To: lucv
cc: sybperl-l
Subject: RE: sybperl, cron and environment variables
Hi Luc,
Thanks for your reply.
And sorry for not replying earlier, there were many problems in the
office related to an application which was earlier handed over to me in
about 30 minutes worth of discussions!
Coming back to my sybperl problem:
The following are some points:
(a) the scripts were running fine from the cron
(b) since the day i installed an RS, they stopped working
(c) from "man cron", i found that cron does not set any env variables
for the programs it executes
(d) even now, the scripts fail if no env variables are set, but run fine
if env variables are set.
(e) dbschema.pl works fine even if no env variables are set.
what is confusing is:
(a) why did my scripts work fine earlier - even from the cron, where no
env variables were set
(b) why does dbschema.pl work fine, but a simple script which i make
(pasted below) does not
simple script which fails (even though with the same env, dbschema.pl
works fine)
------------------------------------------------------------------------
--------------------------------------------------
#!/export/home/guptaash/perl/bin/perl -w
use Sybase::CTlib;
$server = "SYB_DBA61_TKD";
$user = "sa";
$pass = "xxxxxx";
$me = "test_script";
$charset = "iso_1";
$host = "tktecwsd20";
$dbh = Sybase::CTlib->ct_connect($user, $pass, $server, $me,
{ CON_PROPS => {
CS_SYB_CHARSET => "$charset",
CS_HOSTNAME => "$host"
}
} );
@array_of_rows = $dbh->ct_sql("select @@version");
$result = $array_of_rows[0][0];
print "$result\n";
outputs
------------------------------------------
guptaash@tktecwsd20:/export/home/guptaash/my_scripts/exp/bin> a.pl
Sybase::CTlib initialize: ct_init(12500) failed at
/export/home/guptaash/perl/lib/5.8.6/DynaLoader.pm line 253.
Compilation failed in require at a.pl line 3.
BEGIN failed--compilation aborted at a.pl line 3.
guptaash@tktecwsd20:/export/home/guptaash/my_scripts/exp/bin> cd
guptaash@tktecwsd20:/export/home/guptaash> cd dbschema
guptaash@tktecwsd20:/export/home/guptaash/dbschema> dbschema.pl -Usa -S
SYB_DBA61_TKD -D sybsystemprocs -T p -t sp_who
Password:
Extraction started at: Thu Apr 13 14:13:30 2006
ASE Version 12.5.2
Running dbschema.pl(2.4.2) on database 'sybsystemprocs' on Thu Apr 13
14:13:30 2006
Create procedures...done.
Extraction finished at: Thu Apr 13 14:13:45 2006
Looks like I'm all done!
guptaash@tktecwsd20:/export/home/guptaash/dbschema>
Thanks for your kind help.
Best regards,
Ashish
-----Original Message-----
From: Luc Van der Veurst [mailto:lucv@az.vub.ac.be]
Sent: Thursday, April 06, 2006 4:17 PM
To: ashish.gupta@mizuho-sc.com
Cc: sybperl-l@peppler.org
Subject: Re: sybperl, cron and environment variables
Hi,
How do you set your sybase environment variables in your profile ?
Do you source a script comparable to Sybase.csh ?
It seems that the installation of the repserver has overwritten
a script, or made changes in your profile (or whatever script
you source into your cronjobs) so that your cronjobs are using
a different sybase environment.
Check the modification dates of your .profile(s) and scripts that
are sourced in them.
That's my guess,
Luc.
> From: "Ashish Gupta"
> To:
> Subject: sybperl, cron and environment variables
> Date: Thu, 6 Apr 2006 15:06:05 +0900
> X-Barracuda-Spam-Score: -1.88
>
> Hi,
>
> Please can you help me with a problem probably regarding environment
> variables.
>
> I had written some scripts in perl and sybperl and put them in the
cron.
> examples:
>
> ----------------------------------------------------------------
> 01 20 * * * /home/sybase/dbalib/bin/run_dbcc -s SYB_DBA61_TKD
> 01 21 * * * /home/sybase/dbalib/bin/update_stats -s SYB_DBA61_TKD
> 01 22 * * * /home/sybase/dbalib/bin/dump_db -s SYB_DBA61_TKD
> -syb_zip
> #
> 01 6 * * * /home/sybase/dbalib/bin/check_space -s SYB_DBA61_TKD
> ----------------------------------------------------------------
>
> They were working fine.
>
> Then, I think I installed Replication Server.
> And these scripts stopped working!
>
> I get an error of the following type:
>
> ----------------------------------------------------------------
> Your "cron" job on tktecwsd20
> /home/sybase/dbalib/bin/run_dbcc -s SYB_DBA61_TKD
>
> produced the following output:
>
> Sybase::CTlib initialize: ct_init(12500) failed at
> /home/sybase/perl/lib/5.8.6/sun4-solaris-thread-multi/DynaLoader.pm
line
> 253.
> Compilation failed in require at
> /home/sybase/dbalib/bin/../lib/DBAlib.pm line 86.
> BEGIN failed--compilation aborted at
> /home/sybase/dbalib/bin/../lib/DBAlib.pm line 86.
> Compilation failed in require at /home/sybase/dbalib/bin/run_dbcc line
> 11.
> BEGIN failed--compilation aborted at /home/sybase/dbalib/bin/run_dbcc
> line 11.
> ----------------------------------------------------------------
>
> When I run the script interactively, by default I get this error.
> But if I set the environment variables related to sybase correctly -
via
> SYBASE.csh - then the scripts work fine.
>
> What I do not understand is: why were the cron jobs working fine
earlier
> on? and why do they fail now.
>
>
> Thanks for your kind help.
>
> Best regards,
> Ashish
>
>
> Note: This e-mail contains privileged and confidential information and
is for
the sole use of the intended recipient(s). If you are not an intended
recipient, you are hereby kindly requested to refrain from printing,
copying, or
distributing the information contained herein. Furthermore, any other
use of
the information contained herein is strictly prohibited. If you have
received
this transmission in error, please kindly notify the sender immediately
and
destroy all copies of the original message.
Note: This e-mail contains privileged and confidential information and is
for the sole use of the intended recipient(s). If you are not an intended
recipient, you are hereby kindly requested to refrain from printing,
copying, or distributing the information contained herein. Furthermore,
any other use of the information contained herein is strictly prohibited.
If you have received this transmission in error, please kindly notify the
sender immediately and destroy all copies of the original message.
This message and any attachments (the "message") is
intended solely for the addressees and is confidential.
If you receive this message in error, please delete it and
immediately notify the sender. Any use not in accord with
its purpose, any dissemination or disclosure, either whole
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message.
BNP PARIBAS (and its subsidiaries) shall (will) not
therefore be liable for the message if modified.
---------------------------------------------
Ce message et toutes les pieces jointes (ci-apres le
"message") sont etablis a l'intention exclusive de ses
destinataires et sont confidentiels. Si vous recevez ce
message par erreur, merci de le detruire et d'en avertir
immediatement l'expediteur. Toute utilisation de ce
message non conforme a sa destination, toute diffusion
ou toute publication, totale ou partielle, est interdite, sauf
autorisation expresse. L'internet ne permettant pas
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce
message, dans l'hypothese ou il aurait ete modifie.
|