Sponsored Content
Full Discussion: A SQL Loader Script
Top Forums Shell Programming and Scripting A SQL Loader Script Post 302115211 by jim mcnamara on Monday 23rd of April 2007 06:17:42 AM
Old 04-23-2007
If I understand, you want to create metacode that generates a .ctl on the fly. There have been discussions at various levels about this idea at
www.orafaq.com

There are several examples - search for dynamic control file

To answer your question - you have to use a scripting facility (perl, ksh, etc.), I assume you are. Then you can use patternmatching or regex to find your database name.

A list of all the Oracle sids must live in the tnsnames.ora in the $ORACLE_HOME/network/admin tree. First, you have to parse that file for db names. You have to validate the names anyway, bad name=load failure. Then use the array of names to search for '@' prefixed on all of your possible dbnames.

Our tnanames files all have the sid on a single line by itself, so this works
Code:
#!/bin/ksh
let cnt=0
set -A sidlist
tr -s '[:upper:]'  '[:lower:]' < $ORACLE_HOME/network/admin/tnsnames.ora |\
grep 'sid =' | awk '{print $3}' \
while read sid
do
    sidlist[cnt]=$sid
    let cnt=$cnt+1
done

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

problems running a sql loader script

Hi Folks, I have created a number of unix scripts that i can run from the scheduler on a server-side application that we use (Chordiant Marketing Director). All scripts are working except one. This last script is a user load script which first truncates a table and then loads it using a flat... (2 Replies)
Discussion started by: jibbadiah
2 Replies

2. Shell Programming and Scripting

Shell script for accessing a file in the network drive and invoking oracle sql loader

Hi, Please let me know if anybody is having a solution handy for the below tasks... It would be helpful if somebody can resolve my query. I am new to unix and oracle environment and looking for some online reference for completing a task. Task: Check if the network drive exists Check... (0 Replies)
Discussion started by: sayydevara
0 Replies

3. UNIX for Dummies Questions & Answers

Problem with SQL loader

Hi, I am trying to load the records in a .txt file into the data base using SQL loader. I gave: $ sqlldr user/pass@DB control=filename.ctl log =mylog.log It throwed the following error: SQL*Loader-297: Invalid syntax or bind variable in SQL string for column STATUS. ORA-01756: quoted... (2 Replies)
Discussion started by: risshanth
2 Replies

4. Shell Programming and Scripting

sql loader script

hi all i am new to shell scripting. i have 35 flat files delimited files that i have to load in to a table. i was asked to create a shell script that loads the data into the table... could you please help me if you have a script. Also .. how to create logs files...does my sql... (3 Replies)
Discussion started by: rajesh_tns
3 Replies

5. Shell Programming and Scripting

Problem in sql loader

Hi Frnds, I wanto load the data thats in data file with comma(,) delimited. it throw this errors SQL*Loader-951: Error calling once/load initialization ORA-00604: error occurred at recursive SQL level 1 ORA-00054: resource busy and acquire with NOWAIT specified Plz look at my file... (3 Replies)
Discussion started by: Gopal_Engg
3 Replies

6. UNIX for Dummies Questions & Answers

SQL*Loader

HI Experts, We have a ksh file named ldr_empdelta.ksh and it is having the SQL*LOADER script as follows. print "LOAD DATA" > $WEDB_GEN/ldrscan.ctl print "INFILE '"$LED_SCAN"/delta/led_del.dat'" >> $WEDB_GEN/ldrparms.ctl print "TRUNCATE" >> $WEDB_GEN/ldrscan.ctl print "PRESERVE BLANKS" >>... (1 Reply)
Discussion started by: ajaykumarkona
1 Replies

7. UNIX for Dummies Questions & Answers

SQL loader script - ORACLE environmental variable

I am new in unix.. I am running a sql loader script where I have to specify the data file path but the file name contains spaces in it so giving error multiple arguments I have tried it with "" and '' but does n't work the command is : $ORACLE_HOME/bin/sqlldr... (1 Reply)
Discussion started by: Sandip Dey
1 Replies

8. Shell Programming and Scripting

use of sql loader in the script

All, Below is the code written when sql loader loads the data: $ORACLE_EXEC_PATH/sqlldr userid=$user_passwd control=$CNTR_FILES/invoice.ctl log=$LOG_FILES/$INVOICE_FILE.log bad=$ER ROR_FILES/$INVOICE_FILE.bad data=$DATA_FILES/$INVOICE_FILE silent=FEEDBACK direct=false errors=50000 rc=$?... (1 Reply)
Discussion started by: Oracle_User
1 Replies

9. Homework & Coursework Questions

Write a shell script for SQL loader to load data into a staging table

Hi, I'm new to Linux. I'm working on a database, and need to load data in a database table (which I already created) using shell script. The table has two columns - Acct_number (not nullable) and date (timestamp). I'm not able to write a shell script for that. Can any one help me? ... (3 Replies)
Discussion started by: saisudeep
3 Replies

10. Shell Programming and Scripting

How to call SQL Loader in shell script?

HI Experts, I am pretty new to scripting and i need to create a perl or shell script which should fetch a file from local directory and insert the data into a table using sql loader. This will be later added to chron job to run daily and fetch all files and load them into the table. Also i... (1 Reply)
Discussion started by: sam1234
1 Replies
sccs-delta(1)                                                      User Commands                                                     sccs-delta(1)

NAME
sccs-delta, delta - make a delta to an SCCS file SYNOPSIS
/usr/ccs/bin/delta [-dnps] [-g sid-list | -gsid-list] [-m mr-list | -mmr-list] [-r sid | -rsid] [ -y [comment]] s.filename... /usr/xpg4/bin/delta [-dnps] [-g sid-list | -gsid-list] [-m mr-list | -mmr-list] [-r sid | -rsid] [ -y [comment]] s.filename... DESCRIPTION
The delta utility checks in a record of the line-by-line differences made to a checked-out version of a file under SCCS control. These changes are taken from the writable working copy that was retrieved using the SCCS get command (see sccs-get(1)). This working copy does not have the `s.' prefix, and is also referred to as a g-file. If a directory name is used in place of the s.filename argument, the delta command applies to all s.files in that directory. Unreadable s.files produce an error; processing continues with the next file (if any). The use of `-' as the s.filename argument indicates that the names of files are to be read from the standard input, one s.file per line (requires -y, and in some cases, -m). delta may issue prompts on the standard output depending upon the options specified and the flags that are set in the s.file (see sccs- admin(1), and the -m and -y options below, for details). /usr/xpg4/bin/delta The SID of the delta is not echoed to stdout. OPTIONS
The following options are supported: -d Use command diff(1) instead of bdiff(1). Returns exit status 2 if s.filename argument is not specified. -n Retain the edited g-file, which is normally removed at the completion of processing. -p Display line-by-line differences (in diff(1) format) on the standard output. -s Silent. Do not display warning or confirmation messages. Do not suppress error messages (which are writ- ten to standard error). -g sid-list | -gsid-list Specify a list of deltas to omit when the file is accessed at the SCCS version ID (SID) created by this delta. sid-list is a comma-separated list of SIDs. To specify a range of deltas, use a `-' separator instead of a comma, between two SIDs in the list. -m mr-list | -mmr-list If the SCCS file has the v flag set (see sccs-admin(1)), you must supply one or more Modification Request (MR) numbers for the new delta. When specifying more than one MR number on the command line, mr-list takes the form of a quoted, space-separated list. If -m is not used and the standard input is a terminal, delta prompts with MRs? for the list (before issuing the comments? prompt). If the v flag in the s.file has a value, it is taken to be the name of a program to validate the MR numbers. If that validation program returns a non-zero exit status, delta terminates without checking in the changes. -r sid | -rsid When two or more versions are checked out, specify the version to check in. This SID value can be either the SID specified on the get command line, or the SID of the new version to be checked in as reported by get. A diagnostic results if the specified SID is ambiguous, or if one is required but not supplied. -y[comment] Supply a comment for the delta table (version log). A null comment is accepted, and produces an empty com- mentary in the log. If -y is not specified and the standard input is a terminal, delta prompts with `com- ments?'. An unescaped NEWLINE terminates the comment. ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of delta: LANG, LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES, and NLSPATH. EXIT STATUS
The following exit values are returned: 0 Successful completion. 1 An error occurred and the -d option had not been specified. 2 An error occurred, the -d option had been specified, and the s.filename argument was not specified. FILES
d.file temporary file of differences p.file lock file for a checked-out version q.file temporary file s.file SCCS history file x.file temporary copy of the s.file z.file temporary file ATTRIBUTES
See attributes(5) for descriptions of the following attributes: /usr/ccs/bin/delta +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWsprot | +-----------------------------+-----------------------------+ /usr/xpg4/bin/delta +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWxcu4t | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
bdiff(1), diff(1), sccs-admin(1), sccs-cdc(1), sccs-get(1), sccs-help(1), sccs-prs(1), sccs-prt(1), sccs-rmdel(1), sccs-sccsdiff(1), sccs- unget(1), sccs(1), what(1), sccsfile(4), attributes(5), environ(5), standards(5) DIAGNOSTICS
Use the SCCS help command for explanations (see sccs-help(1)). WARNINGS
Lines beginning with an ASCII SOH character (binary 001) cannot be placed in the SCCS file unless the SOH is escaped. This character has special meaning to SCCS (see sccsfile(4)) and produces an error. SunOS 5.10 1 Nov 1999 sccs-delta(1)
All times are GMT -4. The time now is 04:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy