Sample Header Ad - 728x90

Database Administrators

Q&A for database professionals who wish to improve their database skills

Latest Questions

0 votes
3 answers
3150 views
Installing DBD:Oracle on RedHat 8.8
I am trying to install DBD:Oracle. I'm in the following environment: Red Hat Enterprise Linux release 8.8 (Ootpa) Perl v5.26.3 Our DBA installed the Oracle 19 client in this location: /u01/app/oracle/product/19.0.0/client_1 I have the following environment variables set up: ORACLE_HOME="/u01/app/ora...
I am trying to install DBD:Oracle. I'm in the following environment: Red Hat Enterprise Linux release 8.8 (Ootpa) Perl v5.26.3 Our DBA installed the Oracle 19 client in this location: /u01/app/oracle/product/19.0.0/client_1 I have the following environment variables set up: ORACLE_HOME="/u01/app/oracle/product/19.0.0/client_1" PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/u01/app/oracle/product/19.0.0/client_1/bin" LD_LIBRARY_PATH=":/u01/app/oracle/product/19.0.0/client_1/lib" When I run cpan install DBD::Oracle as root, I get a bunch of compiler warnings, and the linker fails with this error: /usr/bin/ld: cannot find -lnsl I'm at a loss with how to proceed. Any advice would be appreciated. Here's the output of the cpan command:
Reading '/root/.local/share/.cpan/Metadata'
  Database was generated on Sat, 12 Aug 2023 15:17:02 GMT
Running install for module 'DBD::Oracle'
CPAN: Digest::SHA loaded ok (v6.02)
CPAN: Compress::Zlib loaded ok (v2.081)
Checksum for /root/.local/share/.cpan/sources/authors/id/Z/ZA/ZARQUON/DBD-Oracle-1.83.tar.gz ok
'YAML' not installed, will not store persistent state
CPAN: CPAN::Meta::Requirements loaded ok (v2.140)
CPAN: Parse::CPAN::Meta loaded ok (v2.150010)
CPAN: CPAN::Meta loaded ok (v2.150010)
CPAN: Module::CoreList loaded ok (v5.20181130)
Configuring Z/ZA/ZARQUON/DBD-Oracle-1.83.tar.gz with Makefile.PL
Multiple copies of Driver.xst found in: /usr/local/lib64/perl5/auto/DBI/ /usr/lib64/perl5/vendor_perl/auto/DBI/ at Makefile.PL line 36.
Using DBI 1.643 (for perl 5.026003 on x86_64-linux-thread-multi) installed in /usr/local/lib64/perl5/auto/DBI/
Configuring DBD::Oracle for perl 5.026003 on linux (x86_64-linux-thread-multi)

If you encounter any problem, a collection of troubleshooting
guides are available under lib/DBD/Oracle/Troubleshooting.
'DBD::Oracle::Troubleshooting' is the general troubleshooting
guide, while platform-specific troubleshooting hints
live in their labelled sub-document (e.g., Win32
hints are gathered in 'lib/DBD/Oracle/Troubleshooting/Win32.pod').

Installing on a linux, Ver#4.18
Using Oracle in /u01/app/oracle/product/19.0.0/client_1
DEFINE _SQLPLUS_RELEASE = "1903000000" (CHAR)
Oracle Version 19.3.0.0 (19.3)
Found direct-link candidates: libclntsh.so
Oracle sysliblist: -ldl -lm -lpthread -lnsl -lirc -limf -lirc -lrt -laio -lresolv -lsvml 
Found header files in /u01/app/oracle/product/19.0.0/client_1/rdbms/public.
Your LD_LIBRARY_PATH env var is set to ':/u01/app/oracle/product/19.0.0/client_1/lib'

client_version=19.3


DEFINE= -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"19.3.0.0\" -DORA_OCI_102 -DORA_OCI_112


Checking for functioning wait.ph


System: perl5.026003 linux x86-64-02.build.eng.rdu2.redhat.com 4.18.0-305.25.1.el8_4.x86_64 #1 smp mon oct 18 14:34:11 edt 2021 x86_64 x86_64 x86_64 gnulinux 
Compiler:   gcc   -g -D_REENTRANT -D_GNU_SOURCE -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
Linker:     /usr/bin/ld
Sysliblist: -ldl -lm -lpthread -lnsl -lirc -limf -lirc -lrt -laio -lresolv -lsvml 
Linking with -lclntsh.

Checking if your kit is complete...
Looks good
LD_RUN_PATH=/u01/app/oracle/product/19.0.0/client_1/lib:/lib64
Using DBD::Oracle 1.83.
Using DBD::Oracle 1.83.
Multiple copies of Driver.xst found in: /usr/local/lib64/perl5/auto/DBI/ /usr/lib64/perl5/vendor_perl/auto/DBI/ at Makefile.PL line 1808.
Using DBI 1.643 (for perl 5.026003 on x86_64-linux-thread-multi) installed in /usr/local/lib64/perl5/auto/DBI/
Generating a Unix-style Makefile
Writing Makefile for DBD::Oracle
Writing MYMETA.yml and MYMETA.json

  ZARQUON/DBD-Oracle-1.83.tar.gz
  /usr/bin/perl Makefile.PL -- OK
Running make for Z/ZA/ZARQUON/DBD-Oracle-1.83.tar.gz
cp lib/DBD/Oracle/Troubleshooting/Vms.pod blib/lib/DBD/Oracle/Troubleshooting/Vms.pod
cp lib/DBD/Oracle/Troubleshooting/Win32.pod blib/lib/DBD/Oracle/Troubleshooting/Win32.pod
cp lib/DBD/Oracle/Troubleshooting/Linux.pod blib/lib/DBD/Oracle/Troubleshooting/Linux.pod
cp mk.pm blib/arch/auto/DBD/Oracle/mk.pm
cp lib/DBD/Oracle/Troubleshooting/Win64.pod blib/lib/DBD/Oracle/Troubleshooting/Win64.pod
cp Oracle.h blib/arch/auto/DBD/Oracle/Oracle.h
cp lib/DBD/Oracle/Troubleshooting.pod blib/lib/DBD/Oracle/Troubleshooting.pod
cp lib/DBD/Oracle/Object.pm blib/lib/DBD/Oracle/Object.pm
cp lib/DBD/Oracle/Troubleshooting/Macos.pod blib/lib/DBD/Oracle/Troubleshooting/Macos.pod
cp ocitrace.h blib/arch/auto/DBD/Oracle/ocitrace.h
cp lib/DBD/Oracle/Troubleshooting/Cygwin.pod blib/lib/DBD/Oracle/Troubleshooting/Cygwin.pod
cp lib/DBD/Oracle/Troubleshooting/Sun.pod blib/lib/DBD/Oracle/Troubleshooting/Sun.pod
cp dbdimp.h blib/arch/auto/DBD/Oracle/dbdimp.h
cp lib/DBD/Oracle.pm blib/lib/DBD/Oracle.pm
cp lib/DBD/Oracle/Troubleshooting/Hpux.pod blib/lib/DBD/Oracle/Troubleshooting/Hpux.pod
cp lib/DBD/Oracle/GetInfo.pm blib/lib/DBD/Oracle/GetInfo.pm
cp lib/DBD/Oracle/Troubleshooting/Aix.pod blib/lib/DBD/Oracle/Troubleshooting/Aix.pod
Running Mkbootstrap for Oracle ()
chmod 644 "Oracle.bs"
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Oracle.bs blib/arch/auto/DBD/Oracle/Oracle.bs 644
"/usr/bin/perl" -p -e "s/~DRIVER~/Oracle/g" /usr/local/lib64/perl5/auto/DBI/Driver.xst > Oracle.xsi
"/usr/bin/perl" "/usr/share/perl5/vendor_perl/ExtUtils/xsubpp"  -typemap '/usr/share/perl5/ExtUtils/typemap' -typemap '/root/.local/share/.cpan/build/DBD-Oracle-1.83-6/typemap'  Oracle.xs > Oracle.xsc
mv Oracle.xsc Oracle.c
gcc -c  -I/u01/app/oracle/product/19.0.0/client_1/rdbms/public -I/usr/local/lib64/perl5/auto/DBI -D_REENTRANT -D_GNU_SOURCE -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g   -DVERSION=\"1.83\" -DXS_VERSION=\"1.83\" -fPIC "-I/usr/lib64/perl5/CORE"  -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"19.3.0.0\" -DORA_OCI_102 -DORA_OCI_112 Oracle.c
In file included from dbdimp.h:445,
                 from Oracle.h:52,
                 from Oracle.xs:1:
Oracle.xs: In function ‘XS_DBD__Oracle__db_ora_db_startup’:
Oracle.xs:330:82: warning: macro expands to multiple statements [-Wmultistatement-macros]
  if (admhp) OCIHandleFree_log_stat(imp_dbh, (dvoid*)admhp, (ub4)OCI_HTYPE_ADMIN, status);
                                                                                  ^~~~~~
ocitrace.h:411:2: note: in definition of macro ‘OCIHandleFree_log_stat’
  stat=OCIHandleFree( (hp), (t));    \
  ^~~~
Oracle.xs:330:2: note: some parts of macro expansion are not guarded by this ‘if’ clause
  if (admhp) OCIHandleFree_log_stat(imp_dbh, (dvoid*)admhp, (ub4)OCI_HTYPE_ADMIN, status);
  ^~
gcc -c  -I/u01/app/oracle/product/19.0.0/client_1/rdbms/public -I/usr/local/lib64/perl5/auto/DBI -D_REENTRANT -D_GNU_SOURCE -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g   -DVERSION=\"1.83\" -DXS_VERSION=\"1.83\" -fPIC "-I/usr/lib64/perl5/CORE"  -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"19.3.0.0\" -DORA_OCI_102 -DORA_OCI_112 dbdimp.c
In file included from dbdimp.h:445,
                 from Oracle.h:52,
                 from dbdimp.c:21:
dbdimp.c: In function ‘ora_db_login6’:
dbdimp.c:923:57: warning: macro expands to multiple statements [-Wmultistatement-macros]
        (ub4) OCI_ATTR_CONNECTION_CLASS, imp_dbh->errhp, status);
                                                         ^~~~~~
ocitrace.h:325:2: note: in definition of macro ‘OCIAttrSet_log_stat’
  stat=OCIAttrSet(th,ht,ah,s1,a,eh);    \
  ^~~~
dbdimp.c:920:4: note: some parts of macro expansion are not guarded by this ‘if’ clause
    if (imp_dbh->pool_class) /*pool_class may or may not be used */
    ^~
dbdimp.c: In function ‘ora_bind_ph’:
dbdimp.c:3401:4: warning: increment of a boolean expression [-Wbool-operation]
    ++imp_sth->has_inout_params;
    ^~
In file included from dbdimp.h:445,
                 from Oracle.h:52,
                 from dbdimp.c:21:
dbdimp.c: In function ‘ora_free_phs_contents’:
ocitrace.h:380:2: warning: macro expands to multiple statements [-Wmultistatement-macros]
  if (DBD_OCI_TRACEON(impxxh)) PerlIO_printf(DBD_OCI_TRACEFP(impxxh), \
  ^~
dbdimp.c:4395:9: note: in expansion of macro ‘OCIDescriptorFree_log’
         OCIDescriptorFree_log(imp_sth, phs->desc_h, phs->desc_t);
         ^~~~~~~~~~~~~~~~~~~~~
dbdimp.c:4394:2: note: some parts of macro expansion are not guarded by this ‘if’ clause
  if (phs->desc_h)
  ^~
dbdimp.c: In function ‘dump_env_to_trace’:
dbdimp.c:4764:29: warning: comparison between pointer and zero character constant [-Wpointer-compare]
  } while ((char*)environ[i] != '\0');
                             ^~
dbdimp.c:4764:11: note: did you mean to dereference the pointer?
  } while ((char*)environ[i] != '\0');
           ^
gcc -c  -I/u01/app/oracle/product/19.0.0/client_1/rdbms/public -I/usr/local/lib64/perl5/auto/DBI -D_REENTRANT -D_GNU_SOURCE -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g   -DVERSION=\"1.83\" -DXS_VERSION=\"1.83\" -fPIC "-I/usr/lib64/perl5/CORE"  -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"19.3.0.0\" -DORA_OCI_102 -DORA_OCI_112 oci8.c
oci8.c:18: warning: "sv_set_undef" redefined
 #define sv_set_undef(sv) if (SvROK(sv)) sv_unref(sv); else SvOK_off(sv)
 
In file included from /usr/lib64/perl5/CORE/perl.h:5644,
                 from /usr/local/lib64/perl5/auto/DBI/DBIXS.h:23,
                 from Oracle.h:50,
                 from oci8.c:12:
/usr/lib64/perl5/CORE/embed.h:673: note: this is the location of the previous definition
 #define sv_set_undef(a)  Perl_sv_set_undef(aTHX_ a)
 
In file included from dbdimp.h:445,
                 from Oracle.h:52,
                 from oci8.c:12:
oci8.c: In function ‘init_lob_refetch’:
ocitrace.h:380:2: warning: macro expands to multiple statements [-Wmultistatement-macros]
  if (DBD_OCI_TRACEON(impxxh)) PerlIO_printf(DBD_OCI_TRACEFP(impxxh), \
  ^~
oci8.c:4571:3: note: in expansion of macro ‘OCIDescriptorFree_log’
   OCIDescriptorFree_log(imp_sth, colhd, OCI_DTYPE_PARAM);
   ^~~~~~~~~~~~~~~~~~~~~
oci8.c:4570:2: note: some parts of macro expansion are not guarded by this ‘if’ clause
  if (colhd)
  ^~
In file included from dbdimp.h:445,
                 from Oracle.h:52,
                 from oci8.c:12:
oci8.c: In function ‘ora_free_lob_refetch’:
ocitrace.h:380:2: warning: macro expands to multiple statements [-Wmultistatement-macros]
  if (DBD_OCI_TRACEON(impxxh)) PerlIO_printf(DBD_OCI_TRACEFP(impxxh), \
  ^~
oci8.c:4911:3: note: in expansion of macro ‘OCIDescriptorFree_log’
   OCIDescriptorFree_log(imp_sth, lr->rowid, OCI_DTYPE_ROWID);
   ^~~~~~~~~~~~~~~~~~~~~
oci8.c:4910:2: note: some parts of macro expansion are not guarded by this ‘if’ clause
  if (lr->rowid)
  ^~
oci8.c: In function ‘get_attr_val’:
oci8.c:2337:25: warning: ‘%02d’ directive writing between 2 and 4 bytes into a region of size 2 [-Wformat-overflow=]
     sprintf(s_tz_hour," %02d",tz_hour);
                         ^~~~
oci8.c:2337:23: note: directive argument in the range [-128, 127]
     sprintf(s_tz_hour," %02d",tz_hour);
                       ^~~~~~~
In file included from /usr/include/stdio.h:873,
                 from /usr/lib64/perl5/CORE/perlio.h:41,
                 from /usr/lib64/perl5/CORE/iperlsys.h:51,
                 from /usr/lib64/perl5/CORE/perl.h:3880,
                 from /usr/local/lib64/perl5/auto/DBI/DBIXS.h:23,
                 from Oracle.h:50,
                 from oci8.c:12:
/usr/include/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 4 and 6 bytes into a destination of size 3
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __glibc_objsize (__s), __fmt,
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~
oci8.c:2335:25: warning: ‘%03d’ directive writing between 3 and 4 bytes into a region of size 2 [-Wformat-overflow=]
     sprintf(s_tz_hour," %03d",tz_hour);
                         ^~~~
oci8.c:2335:23: note: directive argument in the range [-128, 127]
     sprintf(s_tz_hour," %03d",tz_hour);
                       ^~~~~~~
In file included from /usr/include/stdio.h:873,
                 from /usr/lib64/perl5/CORE/perlio.h:41,
                 from /usr/lib64/perl5/CORE/iperlsys.h:51,
                 from /usr/lib64/perl5/CORE/perl.h:3880,
                 from /usr/local/lib64/perl5/auto/DBI/DBIXS.h:23,
                 from Oracle.h:50,
                 from oci8.c:12:
/usr/include/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 5 and 6 bytes into a destination of size 3
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __glibc_objsize (__s), __fmt,
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~
oci8.c:2340:23: warning: ‘%02d’ directive writing between 2 and 4 bytes into a region of size 2 [-Wformat-overflow=]
    sprintf(s_tz_min,":%02d", tz_minute);
                       ^~~~
oci8.c:2340:21: note: directive argument in the range [-128, 127]
    sprintf(s_tz_min,":%02d", tz_minute);
                     ^~~~~~~
In file included from /usr/include/stdio.h:873,
                 from /usr/lib64/perl5/CORE/perlio.h:41,
                 from /usr/lib64/perl5/CORE/iperlsys.h:51,
                 from /usr/lib64/perl5/CORE/perl.h:3880,
                 from /usr/local/lib64/perl5/auto/DBI/DBIXS.h:23,
                 from Oracle.h:50,
                 from oci8.c:12:
/usr/include/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 4 and 6 bytes into a destination of size 3
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __glibc_objsize (__s), __fmt,
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~
rm -f blib/arch/auto/DBD/Oracle/Oracle.so
gcc  -lpthread -shared -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -L/usr/local/lib -fstack-protector-strong  Oracle.o dbdimp.o oci8.o  -o blib/arch/auto/DBD/Oracle/Oracle.so  \
   -L/u01/app/oracle/product/19.0.0/client_1/lib -lclntsh -ldl -lm -lpthread -lnsl -lirc -limf -lirc -lrt -laio -lresolv -lsvml -lperl   \
  
/usr/bin/ld: cannot find -lnsl
collect2: error: ld returned 1 exit status
make: *** [Makefile:524: blib/arch/auto/DBD/Oracle/Oracle.so] Error 1
  ZARQUON/DBD-Oracle-1.83.tar.gz
  /bin/make -- NOT OK
Stev (1 rep)
Aug 12, 2023, 10:49 PM • Last activity: Apr 11, 2025, 06:03 AM
0 votes
0 answers
24 views
What do I need to install to connect to a remote Oracle database?
I need to install an Oracle client on an Ubuntu server (20.04.6) so that Perl scripts can connect to a remote Oracle database. The database version is "Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production". Perl is version 5.30. It's been ages since I've needed to install an...
I need to install an Oracle client on an Ubuntu server (20.04.6) so that Perl scripts can connect to a remote Oracle database. The database version is "Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production". Perl is version 5.30. It's been ages since I've needed to install an Oracle client and I've never done it on a Linux machine. I also need to build the DBD::Oracle module for Perl's use. And IIRC, that process depends on some C headers from Oracle? Can anyone point me to the file(s) that I need to grab (instant client? full?) in order to do the above?
DaveKub (101 rep)
Sep 11, 2024, 12:10 AM
5 votes
2 answers
893 views
Kill infinite loop plperl
How can I kill session with infinite looped plperl function? Both `pg_terminate_backend` and `pg_cancel_backend` had no effect. `kill -1 pid` did nothing as well and `kill -9 pid` crashed server.
How can I kill session with infinite looped plperl function? Both pg_terminate_backend and pg_cancel_backend had no effect. kill -1 pid did nothing as well and kill -9 pid crashed server.
Łukasz Kamiński (173 rep)
Jul 27, 2018, 11:22 AM • Last activity: Feb 4, 2024, 03:30 PM
0 votes
0 answers
104 views
PGSQL pgcompacttable on windows
I have a big PGSQL database and need to reclaim some disk space.PGSQL is version 13.2, running on Windows. I have found several posts which state you can use pgcompacttable on a windows PGSQL and i tried following it. > https://stackoverflow.com/questions/56389509/how-to-use-pg-squeeze-on-windows I...
I have a big PGSQL database and need to reclaim some disk space.PGSQL is version 13.2, running on Windows. I have found several posts which state you can use pgcompacttable on a windows PGSQL and i tried following it. > https://stackoverflow.com/questions/56389509/how-to-use-pg-squeeze-on-windows I have 0 experience with Perl. I keep getting compilation errors on the 'DBI package'. Anyone got this to work on a windows PGSQL? Can someone point me in the right direction? Thanks!
Morph (11 rep)
Sep 5, 2022, 09:18 AM
4 votes
1 answers
2104 views
Where temp table data goes after creation?
As far as I can understand `temp_buffers` setting serve for storing temp tables data. But as I have created a temp table immediately files gets created for it inside `PGDATA` along with the main database. So I would appreciate help on several questions. 1. What happens with a. temp table data if `te...
As far as I can understand temp_buffers setting serve for storing temp tables data. But as I have created a temp table immediately files gets created for it inside PGDATA along with the main database. So I would appreciate help on several questions. 1. What happens with a. temp table data if temp_buffers is enough to store temp table data? b. temp table data if temp_buffers is not enough to store temp table data? 2. Is there any case when not enough temp_buffers setting ends up spilling to pgsql_tmp?
George K (2306 rep)
Dec 21, 2021, 04:10 PM • Last activity: Dec 21, 2021, 08:02 PM
1 votes
1 answers
1693 views
How to generate current Oracle timestamp in perl?
I use DBI. And I want to make some like INSERT INTO ... VALUES (the_generated_timestamp, ...); What is the command? How could it be created, the perl `ocaltime` scalar value has a very complex, for human eyes optimized format (f.e. `Mon Apr 28 15:58:51 2014`). My goal were some like as the unix `get...
I use DBI. And I want to make some like INSERT INTO ... VALUES (the_generated_timestamp, ...); What is the command? How could it be created, the perl ocaltime scalar value has a very complex, for human eyes optimized format (f.e. Mon Apr 28 15:58:51 2014). My goal were some like as the unix gettimeofday() does (giving back the seconds since 1970.1.1), converted by some format string, which I can let eat by the Oracle. But any simpler solution were also okay, if it exists. It need to be generated in perl. INSERT ... (current_timestamp, ...) isn't okay.
peterh (2137 rep)
Apr 28, 2014, 02:10 PM • Last activity: Jun 4, 2021, 07:50 PM
0 votes
1 answers
848 views
Oracle: Connects with sqlplus but not from perl
I need to connect to an Oracle database from a perl script, it works in my tests and when using sqlplus, but not in production. This is a summary of the situation: Oracle 11g XE (11.2.0.2.0) : (Test environment) sqlplus : OK perl : OK Oracle 11g (11.2.0.4.0) : (Production environment) sqlplus : OK p...
I need to connect to an Oracle database from a perl script, it works in my tests and when using sqlplus, but not in production. This is a summary of the situation: Oracle 11g XE (11.2.0.2.0) : (Test environment) sqlplus : OK perl : OK Oracle 11g (11.2.0.4.0) : (Production environment) sqlplus : OK perl : ERROR The error reported is: Connect failed because target host or object does not exist I have triple checked the connection settings and are not mistaken. ### Specifics: - Test Server: Windows Server 2012 - Production Server: Windows Server (Unknown version) - Client: Ubuntu 18.04 x64 - Perl: 5.26.1 - SQL*Plus: 12.2.0.1.0 ### SQL*Plus command:
sqlplus64 user/password@192.168.0.1/db_sid
### Perl script:
#!/usr/bin/perl
use DBI;
$driver = "Oracle";
$sid    = "db_sid";
$host   = "192.168.0.1";
$dsn    = "DBI:$driver:sid=$sid;host=$host";
$dbh    = DBI->connect($dsn, "user", "password");
**Note**: I won't be able to test or execute anything in the production environment until next month. What could be the issue?
lepe (103 rep)
Dec 23, 2019, 06:20 AM • Last activity: Jan 21, 2020, 07:35 AM
-1 votes
1 answers
1041 views
Import Oracle dump from Amazon RDS
I have successfully transferred my dump files to my RDS database instance based on http://d0.awsstatic.com/whitepapers/strategies-for-migrating-oracle-database-to-aws.pdf Now, I want to reverse this process: transfer files from RDS to linux server, from dump_file_dir to my local linux machine. I am...
I have successfully transferred my dump files to my RDS database instance based on http://d0.awsstatic.com/whitepapers/strategies-for-migrating-oracle-database-to-aws.pdf Now, I want to reverse this process: transfer files from RDS to linux server, from dump_file_dir to my local linux machine. I am aware there are only a few lines I need to change, but I couldn't get it to work. Any tips is appreciated. Original Perl script: use DBI; use warnings; use strict; # RDS instance info my $RDS_PORT=1521; my $RDS_HOST=""; my $RDS_LOGIN="/*******"; my $RDS_SID=""; #The $ARGV is a parameter you pass into the script my $dirname = "DATA_PUMP_DIR"; my $fname = $ARGV; my $data = "dummy"; my $chunk = 8192; my $sql_open = "BEGIN perl_global.fh := utl_file.fopen(:dirname, :fname, 'wb', :chunk); END;"; my $sql_write = "BEGIN utl_file.put_raw(perl_global.fh, :data, true); END;"; my $sql_close = "BEGIN utl_file.fclose(perl_global.fh); END;"; my $sql_global = "create or replace package perl_global as fhutl_file.file_type; end;"; my $conn = DBI->connect('dbi:Oracle:host='.$RDS_HOST.';sid='.$RDS_SID.';port='.$RDS_PORT,$RDS_LOGIN, '') || die ( $DBI::errstr . "\n"); my $updated=$conn->do($sql_global); my $stmt = $conn->prepare ($sql_open); $stmt->bind_param_inout(":dirname", \$dirname, 12); $stmt->bind_param_inout(":fname", \$fname, 12); $stmt->bind_param_inout(":chunk", \$chunk, 4); $stmt->execute() || die ( $DBI::errstr . "\n"); open (INF, $fname) || die "\nCan't open $fname for reading: $!\n"; binmode(INF); $stmt = $conn->prepare ($sql_write); my %attrib = ('ora_type','24'); my $val=1; while ($val> 0) { $val = read (INF, $data, $chunk); $stmt->bind_param(":data", $data , \%attrib); $stmt->execute() || die ( $DBI::errstr . "\n") ; }; die "Problem copying: $!\n" if $!; close INF || die "Can't close $fname: $!\n"; $stmt = $conn->prepare ($sql_close); $stmt->execute() || die ( $DBI::errstr . "\n") ;
user165576
Nov 25, 2016, 06:02 PM • Last activity: Nov 24, 2019, 03:52 PM
1 votes
2 answers
228 views
Reading data from oracle 8 in 2019
I'm an intern stuck dealing with a database system that is as old as I am. **The Issue:** I have a perl script pulling data from a server running Oracle 8 (8.1.7) and placing the data into a .csv. The server that runs the script is being decommissioned and I am now need to port that script into a ne...
I'm an intern stuck dealing with a database system that is as old as I am. **The Issue:** I have a perl script pulling data from a server running Oracle 8 (8.1.7) and placing the data into a .csv. The server that runs the script is being decommissioned and I am now need to port that script into a new server running a client for oracle 11 (11.2.0.4.0). The problem is that when I run that script in the new server I get an error: > failed: ORA-03134: Connections to this server version are no longer > supported. (DBD ERROR: OCISessionBegin) *All servers are linux servers* **The questions:** - Documentation reagarding Oracle 8 is scarce but I'm assuming the error is happening because Oracle client 11 dosen't support oracle 8. Assuming I can find a copy of client 8 is it possible to load 2 clients on one machine? - I could easily re-write the script in Java. The issue is figuring out how to find a driver that is compatible with Oracle 8, what is the latest version of OJDBC that supports oracle 8? I'm open to other suggestions as to how to read data from Oracle 8. Using a server running Oracle 10 as an in-between is not an option
Nicolasome (123 rep)
May 9, 2019, 07:26 PM • Last activity: Sep 23, 2019, 07:45 PM
3 votes
2 answers
1558 views
Convert Ruby regex to Postgres regex, for selecting invalid email addresses
I've done some internet trawling, and some reading of the Postgres regex docs, but I'm at the stage where I think asking a question here is the best thing to do. I have the following Ruby regex: ```ruby /\A[^@\s]+@([^@\s]+\.)+[^@\W]+\z/ ``` Which I am trying to convert into a Postgres regex. So far...
I've done some internet trawling, and some reading of the Postgres regex docs, but I'm at the stage where I think asking a question here is the best thing to do. I have the following Ruby regex:
/\A[^@\s]+@([^@\s]+\.)+[^@\W]+\z/
Which I am trying to convert into a Postgres regex. So far I have come up with:
'\\A[^@\\s]\+@([^@\\s]+\\.)\+[^@\\W]\+\\z'
As I found this in one article online: > Thus, + is a metacharacter in PostgreSQL, whereas \+ is a plain “plus” character. and this in another: > The backslash is used to escape characters in PostgreSQL strings. So a regular expression like \w that contains a backslash becomes \\w when written as a literal string in a PostgreSQL statement. To match a single literal backslash, you’ll need the regex \\ which becomes \\\\ in PostgreSQL. The total query I'm running is this:
SELECT email
FROM users
WHERE email !~ '\\A[^@\\s]\+@([^@\\s]+\\.)\+[^@\\W]\+\\z'
And I'm expecting it to return zero results, bit it looks like it is selecting **all** email addresses. I'm expecting no results because I've used the operator !~ (I've also tried !~*), which I think returns non-matches, and because I'm pretty sure that all the email addresses in my database do match the Ruby regex I pasted at the top of this question. (This in turn is because we use Devise in a Rails app to validate all user emails, with the default email validation settings) So I've come to the conclusion that I've not converted my regex format/syntax correctly for Postgres, but also that I don't know what else I'm missing. Please can you help me understand whether this is possible, and if so, what else I need to change. --- Once I have successfully translated that regex, I have a second Ruby regex which I also want to translate into Postgres, which is this one:
/\A[a-zA-Z0-9.!\#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\z/
This is because I want to find all the user emails that don't have a valid email address according to the spec here: https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address Thanks so much in advance 🙏
samjewell (131 rep)
May 3, 2019, 11:47 AM • Last activity: May 3, 2019, 09:13 PM
0 votes
1 answers
2009 views
Msg 102, Level 15, State 1, Server DESKTOP-U368A1B, Line 1 Incorrect syntax near '1'
I get the above error message when i run the following perl script from the cmd, that is supposed to do some transaction in my database. #!/usr/bin/perl. use warnings; use strict; my ( $pid1, $pid2, $pid3, $i ); #Declaration of local variables $| = 1; if ( ($pid1 = fork()) && ($pid2 = fork()) && ($p...
I get the above error message when i run the following perl script from the cmd, that is supposed to do some transaction in my database. #!/usr/bin/perl. use warnings; use strict; my ( $pid1, $pid2, $pid3, $i ); #Declaration of local variables $| = 1; if ( ($pid1 = fork()) && ($pid2 = fork()) && ($pid3 = fork()) ) { #Starts child processes print( "I have to wait for my kids.\n" ); #The main process execute this code my $straggler = wait(); #The main process waits for all the children to finish print( "Finally $straggler finished, now I can go.\n" ); } elsif ( $pid1 && $pid2 && defined($pid3)) { #Is executed by the third child sleep( 1 ); #Wait 1 second print( "Start moving money between account 1 - 2" ); sleep(2); for ($i=0; $i Msg 102, Level 15, State 1, Server DESKTOP-U368A1B, Line 1 Incorrect syntax near '1'. I would really appreciate if somebody could help me out. I have tried to google a solution but havn't had any luck.
user127832
Mar 27, 2019, 04:36 PM • Last activity: Mar 27, 2019, 04:53 PM
-2 votes
2 answers
108 views
Plperlu func with column as param
I have postgres 9.5, and want to use plperlu as lang to get result from curl put My func is: create or replace function langDetect(str text) returns text as $$ use warnings; use strict; my $str = $_[0]; my $output = `curl -X PUT --data $str http://localhost:9998/language/string`; return($output); $$...
I have postgres 9.5, and want to use plperlu as lang to get result from curl put My func is: create or replace function langDetect(str text) returns text as $$ use warnings; use strict; my $str = $_; my $output = curl -X PUT --data $str http://localhost:9998/language/string; return($output); $$ language plperlu; When i use: select langDetect('some text'); Everything is ok But: Select langDetect(column) from table limit 1; Returns empty string. Column type is text. Any help will be good!
Ivan Alex (9 rep)
Jun 2, 2018, 01:01 PM • Last activity: Jun 3, 2018, 06:50 PM
3 votes
2 answers
963 views
How can I load 'utf8' into plperl by default?
I am attempting to solve a problem explained in another question [here](https://stackoverflow.com/q/20355007/13860). On Debian 7.4 with Postgres 9.1.12, I am able to use the Perl `qr` operator just fine. On Solaris 5.11 with Postgres 9.2.4, however, I am not able to. As detailed in the question abov...
I am attempting to solve a problem explained in another question [here](https://stackoverflow.com/q/20355007/13860) . On Debian 7.4 with Postgres 9.1.12, I am able to use the Perl qr operator just fine. On Solaris 5.11 with Postgres 9.2.4, however, I am not able to. As detailed in the question above, the following stored procedure fails on the Solaris installation: REATE FUNCTION foo(VARCHAR) RETURNS VARCHAR AS $$ my ( $re ) = @_; $re = ''.qr/\b($re)\b/i; return $re; $$ LANGUAGE plperl; With the following error: ERROR: Unable to load utf8.pm into plperl at line 3. BEGIN failed--compilation aborted. CONTEXT: PL/Perl function "foo" It is apparent that in the Debian installation of Postgres, 'utf8' is already loaded by default. I ran the following stored procedure on both systems: CREATE FUNCTION perl_modules() RETURNS VOID AS $$ warn join(', ',sort keys %INC); $$ LANGUAGE plperl; On the Debian system: > WARNING: Carp.pm, Carp/Heavy.pm, Exporter.pm, feature.pm, overload.pm, strict.pm, unicore/Heavy.pl, unicore/To/Fold.pl, utf8.pm, utf8_heavy.pl, vars.pm, warnings.pm, warnings/register.pm at line 2. On the Solaris system: > WARNING: Carp.pm, Carp/Heavy.pm, Exporter.pm, feature.pm, overload.pm, overloading.pm, strict.pm, vars.pm, warnings.pm, warnings/register.pm at line 2. I tried to load the utf8 module on the Solaris system by adding this to the postgres config file: plperl.on_init = 'use utf8; use re;' And that successfully loads the utf8 and re modules, as shown here: > WARNING: Carp.pm, Carp/Heavy.pm, Exporter.pm, XSLoader.pm, feature.pm, overload.pm, overloading.pm, re.pm, strict.pm, utf8.pm, vars.pm, warnings.pm, warnings/register.pm at line 2. However the foo() stored procedure still fails: dc=# select foo('foo'); ERROR: Attempt to reload utf8_heavy.pl aborted. Compilation failed in require at /opt/perl-5.18.0/lib/utf8.pm line 17. CONTEXT: PL/Perl function "foo" What is the secret to successfully loading utf8, and its dependencies, in this Solaris environment?
Flimzy (609 rep)
May 16, 2014, 06:48 PM • Last activity: Jan 19, 2018, 02:03 AM
1 votes
1 answers
1347 views
Sybase Database Migration from 11.5 to 15
I have to migrate the Sybase Database from 11.5 version to 15. I would like to know few things mentioned below - i) What are the neccessary steps I need to follow in this migration. ii) What are the changes required for table, Stored Proc, etc., for this change to work as per the current execution?...
I have to migrate the Sybase Database from 11.5 version to 15. I would like to know few things mentioned below - i) What are the neccessary steps I need to follow in this migration. ii) What are the changes required for table, Stored Proc, etc., for this change to work as per the current execution? iii) Any bottle necks if exist for this transiton Note :- We have a Unix server that executes these procs with the help of Perl Script? Thanks Utkarsh
Utkarsh
Feb 26, 2013, 12:12 PM • Last activity: Dec 22, 2017, 06:11 PM
1 votes
2 answers
2243 views
Perl - MySQL/MariaDB - slow with no identifiable bottleneck
I am running a Perl script (using DBI) which reads from raw files from a hard disk, and updates MySQL database (which is on a separate SSD). My performance is rather slow (1000 files processed in 30-60 seconds), but I can not find the bottleneck. CPU. Network, Disk and Memory are all rather unused....
I am running a Perl script (using DBI) which reads from raw files from a hard disk, and updates MySQL database (which is on a separate SSD). My performance is rather slow (1000 files processed in 30-60 seconds), but I can not find the bottleneck. CPU. Network, Disk and Memory are all rather unused. I am running Windows 7 64bit on an i7 machine (8 cores). MariaDB is version 10.0.10. My database is around 78G in size with 5M entries, all tables properly indexed. Perfmon confirms this showing total CPU 6%, Network 0%, HD Disk 140 I/O/s, Memory 10%. None of the CPU cores are used more than 3-4%. I have experimented with changing all these mysql variables with no success: innodb_use_global_flush_log_at_trx_commit innodb_buffer_pool_instances global.max_connections innodb_thread_sleep_delay global.innodb_io_capacity global.innodb_sync_spin_loops innodb_flush_log_at_trx_commit wait_timeout Mysqltuner did not report anything of interest, except for: Data in InnoDB tables: 78G (Tables: 12) Total fragmented tables: 10 Query cache is disabled Thread cache is disabled InnoDB data size/buffer pool: 78.1G/2.0G Perl profiling showed that majority of time is taken up by DBI::st::execute (invoking sql). I have also tried disabling firewall and virus scanner too - no difference.
Shalabajzer (31 rep)
Jul 18, 2014, 08:08 PM • Last activity: Nov 7, 2017, 04:17 PM
0 votes
0 answers
273 views
How to install pgperl for postgresql 9.6 windows
Trying various versions of ActiveState and Strawberry Perl, I'm still not having any luck overcoming: pg96/lib/postgresql/plperl.dll: The specified module could not be found Suggestions that may have worked for prior versions of postgres don't work for 9.6
Trying various versions of ActiveState and Strawberry Perl, I'm still not having any luck overcoming: pg96/lib/postgresql/plperl.dll: The specified module could not be found Suggestions that may have worked for prior versions of postgres don't work for 9.6
Reinsbrain (309 rep)
Oct 9, 2017, 02:31 PM • Last activity: Oct 19, 2017, 08:37 PM
1 votes
1 answers
10426 views
Create Language plperl - Error: could not load library plperl.dll
When I `create language plperl` , I get error: *ERROR: could not load library "C:/Program Files/PostgreSQL/9.1/lib/plperl.dll": The specified module could not be found*. But in my computer, "plperl.dll" file is exist in "C:/Program Files/PostgreSQL/9.1/lib/..." folder ( I can not post illustrative i...
When I create language plperl , I get error: *ERROR: could not load library "C:/Program Files/PostgreSQL/9.1/lib/plperl.dll": The specified module could not be found*. But in my computer, "plperl.dll" file is exist in "C:/Program Files/PostgreSQL/9.1/lib/..." folder ( I can not post illustrative image, this forum require >= 10 reputations) And if I select * pg_pltemplate, I get: -[ RECORD 4 ]-+------------------------- tmplname | plperl tmpltrusted | t tmpldbacreate | t tmplhandler | plperl_call_handler tmplinline | plperl_inline_handler tmplvalidator | plperl_validator tmpllibrary | $libdir/plperl
Luan Huynh (2010 rep)
Aug 9, 2013, 02:35 AM • Last activity: Oct 19, 2017, 05:51 PM
5 votes
1 answers
9676 views
How to create an alphanumeric sequence like AAAA0000 and so on
I want to create an alphanumeric sequence like this: AAAA0000 AAAA0001 AAAA0002 AAAA0003 . . . AAAA9999 AAAB0000 AAAB0001 . . . ZZZZ9999 I have created this store procedure to do that but its too slow: CREATE OR REPLACE FUNCTION public.fn_batch_seq() RETURNS text LANGUAGE plpgsql AS $body$ DECLARE v...
I want to create an alphanumeric sequence like this: AAAA0000 AAAA0001 AAAA0002 AAAA0003 . . . AAAA9999 AAAB0000 AAAB0001 . . . ZZZZ9999 I have created this store procedure to do that but its too slow: CREATE OR REPLACE FUNCTION public.fn_batch_seq() RETURNS text LANGUAGE plpgsql AS $body$ DECLARE v_sequence TEXT := ''; v_next_sequence TEXT := ''; v_existing_id BIGINT := 0; BEGIN /* * VARCHAR BATCH SEQUENCE FOR SIMCARDS */ SELECT "sequence" FROM batch_sequence WHERE id = 1 INTO v_sequence; IF v_sequence = '' THEN RAISE NOTICE 'Error - No existe ningun registro en batch_sequence almacenado'; RETURN -500; END IF; SELECT perl_increment(v_sequence) INTO v_next_sequence; IF v_next_sequence = '' THEN RAISE NOTICE 'Error - La siguiente secuencia generada devolvio null o vacio'; RETURN -500; END IF; UPDATE batch_sequence SET "sequence" = v_next_sequence WHERE id = 1; RETURN v_next_sequence; EXCEPTION WHEN OTHERS THEN /* * Other errors */ RAISE NOTICE 'Error General - Posibles causas: No existe la tabla batch_sequence o no existe ningun registro en la misma'; RETURN -500; END; $body$ VOLATILE COST 100; This procedure uses a table to store the sequence: CREATE TABLE batch_sequence ( id serial NOT NULL, sequence text DEFAULT 'AAAA0000'::text NOT NULL ); -- Column id is associated with sequence public.batch_sequence_id_seq ALTER TABLE batch_sequence ADD CONSTRAINT batch_sequence_pk PRIMARY KEY (id); And for increment the sequence I use a perl procedure: CREATE OR REPLACE FUNCTION public.perl_increment(text) RETURNS text LANGUAGE plperl AS $body$ my ($x) = @_; if (not defined $x) { return undef; } ++$x; $body$ VOLATILE COST 100; It works very slow with large amount of data, because it must be executed before inserting every single row. Is there another way to do that with or without Perl?
juanpscotto (163 rep)
Sep 6, 2017, 01:21 PM • Last activity: Sep 8, 2017, 09:24 AM
3 votes
2 answers
3525 views
Installing a language with Amazon RDS?
I am using an instance of Postgres on RDS and I am trying to run: `=> create language plperlu;` but I get: `ERROR: must be superuser to create procedural language "plperlu"` If I run: => grant rds_superuser to treex; NOTICE: role "treex" is already a member of role "rds_superuser" GRANT ROLE Is it a...
I am using an instance of Postgres on RDS and I am trying to run: => create language plperlu; but I get: ERROR: must be superuser to create procedural language "plperlu" If I run: => grant rds_superuser to treex; NOTICE: role "treex" is already a member of role "rds_superuser" GRANT ROLE Is it actually possible to use perl extensions for Postgres on RDS or the only solution is creating a Docker instance with Postgres and Perl modules preinstalled?
Randomize (1203 rep)
Jul 16, 2017, 10:50 AM • Last activity: Jul 16, 2017, 10:45 PM
1 votes
2 answers
2275 views
Storing blobs outside the database
I had a PostgreSQL database with loads of scanned documents, as a `document bytea` column in the table `scans`, with hundreds of thousands of documents that was large and inconvenient to backup. Also, there was a high rate of duplication, not major but 5-10%. I wanted to store those documents outsid...
I had a PostgreSQL database with loads of scanned documents, as a document bytea column in the table scans, with hundreds of thousands of documents that was large and inconvenient to backup. Also, there was a high rate of duplication, not major but 5-10%. I wanted to store those documents outside of the database so they could be backed-up via incremental tar, and reduce the size of the pg_dump database backup. I came up with a solution I want to share below, using plperlu. Any comments or further optimisation ideas will be appreciated!
Ezequiel Tolnay (5028 rep)
Apr 7, 2016, 02:44 AM • Last activity: May 25, 2017, 04:05 AM
Showing page 1 of 20 total questions