Thursday, March 24, 2005
PROC this time
I started to do a Pro C today. Got a example file, sample.pc.
Now need to do:
proc INAME=sample.pc
This will generate a sample.c file.
Now I do:
gcc -I someinclude -L somelib te.c
I got this error:
Undefined first referenced
symbol in file
sqlcex sample1.o
sqlglm sample1.o
From http://krypton.stern.nyu.edu:7700/oradocs/solaris.815/a67456/ch4.htm, I got:
This error occurs when the linker cannot find a definition for a referenced symbol. Generally, the remedy for this type of problem is to ensure that the library or object file containing the definition exists on the link line and that the linker is searching the correct directories for the file.
Oracle provides a utility called symfind to assist in locating a library or object file where a symbol is defined. Here is example output of symfind locating the symbol sqlcex:
$ symfind sqlcex
SymFind - Find Symbol in <**>.a, .o, .so
------------------------------------------------------
Command: /u01/app/oracle/product/8.1.5/bin/symfind sqlcex
Local Directory: /u01/app/oracle/product/8.1.5
Output File: (none)
Note: I do not traverse symbolic links
Use '-v' option to show any symbolic links
Locating Archive and Object files ...
[11645] | 467572| 44|FUNC |GLOB |0 |8 |sqlcex
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ./lib/libclntsh.so
[35] | 0| 44|FUNC |GLOB |0 |5 |sqlcex
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ./lib/libsql.a
Now I issue:
gcc -I someinclude -L somelib -lclntsh te.c
It then works
Now need to do:
proc INAME=sample.pc
This will generate a sample.c file.
Now I do:
gcc -I someinclude -L somelib te.c
I got this error:
Undefined first referenced
symbol in file
sqlcex sample1.o
sqlglm sample1.o
From http://krypton.stern.nyu.edu:7700/oradocs/solaris.815/a67456/ch4.htm, I got:
This error occurs when the linker cannot find a definition for a referenced symbol. Generally, the remedy for this type of problem is to ensure that the library or object file containing the definition exists on the link line and that the linker is searching the correct directories for the file.
Oracle provides a utility called symfind to assist in locating a library or object file where a symbol is defined. Here is example output of symfind locating the symbol sqlcex:
$ symfind sqlcex
SymFind - Find Symbol
------------------------------------------------------
Command: /u01/app/oracle/product/8.1.5/bin/symfind sqlcex
Local Directory: /u01/app/oracle/product/8.1.5
Output File: (none)
Note: I do not traverse symbolic links
Use '-v' option to show any symbolic links
Locating Archive and Object files ...
[11645] | 467572| 44|FUNC |GLOB |0 |8 |sqlcex
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ./lib/libclntsh.so
[35] | 0| 44|FUNC |GLOB |0 |5 |sqlcex
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ./lib/libsql.a
Now I issue:
gcc -I someinclude -L somelib -lclntsh te.c
It then works
Library linking
I am trying to get a perl script to work on a machine to connect to an Oracle database. It has modules installed. When I ran it, I got:
install_driver(Oracle) failed: Can't load '/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: ld.so.1: /usr/local/bin/perl: fatal: libwtc8.so: open failed: No such file or directory at /usr/local/lib/perl5/5.00503/sun4-solaris/DynaLoader.pm line 169.
An lld command reveals that it could not be found. So I went into /usr/local and /u01/app/oracle directory to search for it, and surely enough I found it. Then adding the new path to the LD_LIBRARY_PATH and re-run it, then another error comes:
install_driver(Oracle) failed: Can't load '/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: ld.so.1: /usr/local/bin/perl: fatal: ./libclntsh.so.8.0: wrong ELF class: ELFCLASS64 at /usr/local/lib/perl5/5.00503/sun4-solaris/DynaLoader.pm line 169.
I did a search in Google for that error, here is what I found in one article:
It appears that you are using the 64-bit Solaris Oracle drivers, however native driver support in S-PLUS uses the 32-bit drivers. The Oracle 64-bit Solaris driver installation does include the 32-bit drivers, however they are not used by default. The following should solve your problem:
The 32-bit driver libraries can be found in {ORACLE_HOME}/lib32 where ORACLE_HOME is the path to your Oracle installation. To ensure that S-PLUS can find this library you can set the flag at the top of the script used to start S-PLUS, usually installed as /usr/local/bin/Splus. Include the following:
LD_LIBRARY_PATH=${ORACLE_HOME}/lib32:${LD_LIBRARY_PATH} export LD_LIBRARY_PATH
This should resolve the problem, however if not, as an alternative try backing up the ORACLE_HOME/lib directory and then renaming ORACLE_HOME/lib32 as ORACLE_HOME/lib, as this should ensure the libraries are correctly available.
I surely found the lib32 library, and linked the file and everything is working now.
install_driver(Oracle) failed: Can't load '/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: ld.so.1: /usr/local/bin/perl: fatal: libwtc8.so: open failed: No such file or directory at /usr/local/lib/perl5/5.00503/sun4-solaris/DynaLoader.pm line 169.
An lld command reveals that it could not be found. So I went into /usr/local and /u01/app/oracle directory to search for it, and surely enough I found it. Then adding the new path to the LD_LIBRARY_PATH and re-run it, then another error comes:
install_driver(Oracle) failed: Can't load '/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: ld.so.1: /usr/local/bin/perl: fatal: ./libclntsh.so.8.0: wrong ELF class: ELFCLASS64 at /usr/local/lib/perl5/5.00503/sun4-solaris/DynaLoader.pm line 169.
I did a search in Google for that error, here is what I found in one article:
It appears that you are using the 64-bit Solaris Oracle drivers, however native driver support in S-PLUS uses the 32-bit drivers. The Oracle 64-bit Solaris driver installation does include the 32-bit drivers, however they are not used by default. The following should solve your problem:
The 32-bit driver libraries can be found in {ORACLE_HOME}/lib32 where ORACLE_HOME is the path to your Oracle installation. To ensure that S-PLUS can find this library you can set the flag at the top of the script used to start S-PLUS, usually installed as /usr/local/bin/Splus. Include the following:
LD_LIBRARY_PATH=${ORACLE_HOME}/lib32:${LD_LIBRARY_PATH} export LD_LIBRARY_PATH
This should resolve the problem, however if not, as an alternative try backing up the ORACLE_HOME/lib directory and then renaming ORACLE_HOME/lib32 as ORACLE_HOME/lib, as this should ensure the libraries are correctly available.
I surely found the lib32 library, and linked the file and everything is working now.
Wednesday, March 23, 2005
TCP/IP Network Transport is not installed
I installed KAV and it said it could conflict with existing Norton. I did not pay much attention. The first time it rebooted, right after it went into Windows, it said something like "SVCHOST.ext/c...dll" is a trojen, asking me if I want to remove it. I said so. And then it kept saying it could not be deleted. Back and forth so many times, it rebooted again (seemed like some other program was closing it). And once it got into Windows, I got "TCP/IP Network Transport is not installed", then no internet connectivity at all, (it can still receive the wireless signal). I did a search on google and found this: http://news.swzone.it/swznews-9826.php. From there, I downloaded the software, back'ed up my registry, and ran that program. Reboot, come back into Windows, and everything is working fine now. Whewwwww.
Thursday, March 17, 2005
Oracle - Alter - Stored Procedure - Compile
I need to change some column definition, need to issue
alter table xxxx modify col_name number(18, 6)
I was told that after I issue this, "all the stored programs would invalidate...so, you need to compile them all."
1. I don't know what those stored programs are, store procedures? functions? packages?
2. Are only only those who are related to that table required to be compiled? Or all of them are to be compiled?
3. How to compile them?
4. How to find what procedures, functions, packages are referencing a table?
Let's go.
From MCGraw Hill Osborne Oracle9i The Complete Reference, page 560.To recompile a procedure, use the alter procedure command, as shown in the following listing. The compile clause is the only valid option for this command.
alter procedure NEW_BOOK compile;
To recompile a procedure, you must either own the procedure or have the ALTER ANY PROCEDURE system privilege.
To recompile a function, use the alter function command, with the compile clause:
alter function OVERDUE_CHARGES compile;
To recompile a function, you must either own the function or have the ALTER ANY PROCEDURE system privilege.
When recompiling packages, you may either recompile both the package specification and the body or just recompile the package body. By default, both the package specification and the package body are recompiled. You cannot use the alter function or alter procedure command to recompile functions and procedures stored within a package.
If the source code for the procedures or functions within the package body has changed but the package specification has not, you may want to recompile only the package body. In most cases, it is appropriate to recompile both the specification and the package body. The following is the syntax for the alter package command:
alter package [ user.] package_name compile [debug] [package | body | specification];
To recompile a package, use the preceding alter package command with the compile clause, as follows:
alter package BOOK_MANAGEMENT compile;
To recompile a package, you must either own the package or have the ALTER ANY PROCEDURE system privilege. Since neither PACKAGE nor BODY was specified in the preceding example, the default of PACKAGE was used, resulting in the recompilation of both the package specification and the package body.
So now I know how to compile them. That's answer to question 3.
Answer to question 1, 2. "However, procedural objects may become invalid if the database objects they reference change.".
Now I got this:
Login to SQL Plus,
set serverout 500000
exec pcrecomplieinvalid
This will recompile all invalids.
Neat.
alter table xxxx modify col_name number(18, 6)
I was told that after I issue this, "all the stored programs would invalidate...so, you need to compile them all."
1. I don't know what those stored programs are, store procedures? functions? packages?
2. Are only only those who are related to that table required to be compiled? Or all of them are to be compiled?
3. How to compile them?
4. How to find what procedures, functions, packages are referencing a table?
Let's go.
From MCGraw Hill Osborne Oracle9i The Complete Reference, page 560.
Compiling Procedures, Functions, and Packages
Oracle compiles procedural objects when they are created. However, procedural objects may become invalid if the database objects they reference change. The next time the procedural objects are executed, they will be recompiled by the database. You can avoid this runtime compiling-and the performance degradation it may cause-by explicitly recompiling the procedures, functions, and packages.
alter procedure NEW_BOOK compile;
To recompile a procedure, you must either own the procedure or have the ALTER ANY PROCEDURE system privilege.
alter function OVERDUE_CHARGES compile;
To recompile a function, you must either own the function or have the ALTER ANY PROCEDURE system privilege.
If the source code for the procedures or functions within the package body has changed but the package specification has not, you may want to recompile only the package body. In most cases, it is appropriate to recompile both the specification and the package body. The following is the syntax for the alter package command:
alter package [ user.] package_name compile [debug] [package | body | specification];
To recompile a package, use the preceding alter package command with the compile clause, as follows:
alter package BOOK_MANAGEMENT compile;
To recompile a package, you must either own the package or have the ALTER ANY PROCEDURE system privilege. Since neither PACKAGE nor BODY was specified in the preceding example, the default of PACKAGE was used, resulting in the recompilation of both the package specification and the package body.
So now I know how to compile them. That's answer to question 3.
Answer to question 1, 2. "However, procedural objects may become invalid if the database objects they reference change.".
Now I got this:
Login to SQL Plus,
set serverout 500000
exec pcrecomplieinvalid
This will recompile all invalids.
Neat.