Home » RDBMS Server » Server Utilities » Sql Loader
Sql Loader [message #73779] Mon, 12 July 2004 09:22 Go to next message
SharanC
Messages: 2
Registered: July 2004
Junior Member
Hi,

I am having problem with the below mentioned code which is executed on the unix OS calling the Sql Loader of Oracle.

The problem is its putting out the login(User/pwd) on to the console while doing the ps -ef | grep sql*.

Its straight away showing the User Name and the Password, its okay if its User Name but The passowrd shouldnt be shown.

strstream command;

command << sqlLoaderPath << " " << login << " " << ctlFile
          << " log=" << uniqueLog << " direct=" << directStr
          << " SILENT=FEEDBACK" << " ERRORS=1000000 "
          << ends;

where login=User/pwd;

Can we write the password into a password file and pass that file as a redirection?

I did write the password into a file, how can i redirect the password file to the sql loader?

How can I do it if that is possible?

Could anybody modify the code above and send it to me.

Thanks

 
Re: Sql Loader [message #73781 is a reply to message #73779] Mon, 12 July 2004 10:02 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
there are many custom definitons already available for this.
I am using the following C code and i named it hide.c
COmpile it somewhere and have it defined inyour $PATH

--
-- Regular...without using the hide
--
bash-2.03$ sqlplus -s mag/mag@lawt
!ps -ef | grep sqlplus
  oracle  4814  4789  0 14:01:20 pts/6    0:00 /bin/bash -c ps -ef | grep sqlplus
  oracle  4789  4746  0 14:01:07 pts/6    0:00 sqlplus -s mag/mag@lawt
  oracle  4816  4814  0 14:01:20 pts/6    0:00 grep sqlplus

exit
bash-2.03$

--
-- now use the compile hide
-- You can seee that username/password is NOT displayed.
-- hide.c confuses the ps -ef and woouldnt let it display!!!

bash-2.03$ hide sqlplus -s mag/mag@lawt
!ps -ef | grep sqlplus
  oracle  4827  4825  0 14:02:29 pts/6    0:00 grep sqlplus
  oracle  4824  4746  0 14:02:20 pts/6    0:00 sqlplus
  oracle  4825  4824  0 14:02:29 pts/6    0:00 /bin/bash -c ps -ef | grep sqlplus

exit

--
-- THIS IS hide.c
--
/*--------------------------------------------------------------------------+

| Can be used as a program prefix: hide program arguments 

| or as a symbolic link. If this program is not invoked as hide, it 

| will hide its arguments and invoke the program name.hide 

| The best way to use this is to rename your critical programs to 

| program.hide, and create a symbolic link program to hide. 

| mv sqlplus sqlplus.hide; ln -s hide sqlplus 

| Thus when sqlplus is invoked, its arguments will be hidden 

| NOTES 

| This program works by padding 3000 '/' chars in argv[[0]]. This fools

| all known ps's. This will reduce the argument capacity of your 

| program by 3000 chars. A good enhancement would be to reduce the 

| padding if needed so that no arguments are lost - would require a 

| method of determining the max argument size on the system. Some 

| system's provide the E2BIG error on exec. 

| There is some performace penalty for using this program, but it is 

| minimal because this program is so small - the biggest cost is the 

| extra exec required to get this program started.

 

+-------------------------------------------------------------------------*/

/*

* $Header *

*/

#include <stdio.h>

#ifdef SYS5

#include <string.h>

#else

#include <strings.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>

#define strrchr rindex

#define memset MEMSET /* some BSD systems have a memset() */

char *memset();

#endif

#define JUNK_SIZE 3000

#define JUNK_CHAR ' '

char arg0buf[[4096]];

char progbuf[[4096]];

char errbuf[[4096]];

int main(argc, argv)

int argc;

char *argv[[]];

{

char *name, *base;

int firstarg;

if (!(name = strrchr(argv[[0]], '/')))

name = argv[[0]];

else

name ++; /* get past '/' */

firstarg = (!strcmp(name, "hide")) ? 1 : 0;

if (firstarg && (argc == 1))

{

fprintf(stderr, "Usage: hide program argumentsn");

fprintf(stderr, " ie: hide sqlplus username/passwordn");

fprintf(stderr, "if hide is not named hide, 

it will execute name.hide (useful as a symbolic link)n");

exit(1);

}

/* Build program name. If symbolic link mode, use argv[[0]] || .hide */

strcpy(progbuf, argv[[firstarg]]);

if (!(base = strrchr(argv[[firstarg]], '/')))

base = argv[[firstarg]];

else

base ++; /* get past '/' */

if (!firstarg) strcat(progbuf, ".hide");

/* Build arg0 buffer. First, fill it with junk */

memset((void *)arg0buf, JUNK_CHAR, JUNK_SIZE);

arg0buf[[JUNK_SIZE-1]] = '/'; /* set last char to '/' */

/* Prepend real program name - so ps can see what prog is running */

strncpy(arg0buf, base, strlen(base));

/* Append real program name - so prog can see what prog is running */

strcpy(arg0buf + JUNK_SIZE, argv[[firstarg]]);

/* Assign new arg0 buffer to the argv array */

argv[[firstarg]] = arg0buf;

/* Start the new program with the shifted arguments */

execvp(progbuf, argv + firstarg);

sprintf(errbuf, "Could not execvp '%s'", progbuf);

perror(errbuf);

exit(1);

}

#ifndef SYS5

char *

memset(s, c, n)

register char *s;

register c, n;

{

register char *p = s;

while (n-- > 0)

*s++ = c;

return (p);

}

#endif /* ifndef SYS5 */

icon12.gif  Re: Sql Loader [message #132283 is a reply to message #73779] Thu, 11 August 2005 13:47 Go to previous message
wzs33j
Messages: 2
Registered: August 2005
Location: India
Junior Member
This could also be done on the script side. I suggest to use

USER=username
PASS=passwd
{ echo ${USER}/${PASS}@TNS; cat <sqlfile>; } | sqlplus

excuse if you know this already.
Previous Topic: SQL Loader-350 Syntax error
Next Topic: user define parameters to SQL Loader.
Goto Forum:
  


Current Time: Wed Dec 25 19:22:40 CST 2024