Is shell's next line character '\' the cause of this issue ?


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Is shell's next line character '\' the cause of this issue ?
# 1  
Is shell's next line character '\' the cause of this issue ?

Oracle version: 11.2.0.1 /Red Hat Enterprise Linux Server release 5.4 (Tikanga)

Hi,
impdp is a command line utility in oracle to import data into a DB schema.

Typically impdp command along with its parameters is run in a single line like

Code:
impdp \'/ as sysdba\' DIRECTORY=DATA_PUMP_DIR DUMPFILE=expdp-prod-WMS-12-Sep-2012.dmp parallel=1 LOGFILE=WMS_SIT-imp.log remap_schema=WMS:WMS_SIT remap_tablespace = WMS_DATA:DEV_WMS_01_DATA

For better readability , I thought of putting each parameter on a separate line by using ' \ ' character as the next line indictor (not sure what is this called in Shell scripting terminology Smilie ). Is it New line indicator/separator or Next line separator ?

When I run the below shellscript which has three impdp commands , the second impdp fails with below error (error message is misleading, I think) but the 1st and 3rd impdp commands were succesfull. I have faced this wierd issue several times.

Code:
impdp \'/ as sysdba\' \
DIRECTORY=DATA_PUMP_DIR \
DUMPFILE=expdp-prod-WMS-12-Sep-2012.dmp \
parallel=1 \
LOGFILE=WMS_SIT-imp.log \
remap_schema=WMS:WMS_SIT \
remap_tablespace = WMS_DATA:DEV_WMS_01_DATA \  # -------> is there anything wrong with this particular next line indicator ' \' shown in red
 
impdp \'/ as sysdba\' \                         # -------------------> the second imdp command which failed
DIRECTORY=DATA_PUMP_DIR \ 
DUMPFILE=expdp-prod-WMS-12-Sep-2012.dmp \
parallel=1 \
LOGFILE=WMS_SIP_SIT-imp.log \
remap_schema=WMS:WMS_SIP_SIT \
remap_tablespace = WMS_DATA:DEV_WMS_01_DATA \
 
impdp \'/ as sysdba\' \
DIRECTORY=DATA_PUMP_DIR \
DUMPFILE=expdp-prod-WMS-12-Sep-2012.dmp \
parallel=1 \
LOGFILE=TEST_WMS_01-imp.log \
remap_schema=WMS:TEST_WMS_01 \
remap_tablespace = WMS_DATA:TEST_WMS_01_DATA \



nohup threeImports.sh > threeImportsnohup.log &

error I received for the second import:

Code:
Import: Release 11.2.0.1.0 - Production on Thu Sep 13 05:29:22 2012
 
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
 
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
ORA-39001: invalid argument value
ORA-39000: bad dump file specification
ORA-31640: unable to open dump file "/u07/wmsdata/expdat.dmp" for read
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

I don't understand why I get "unable to open dump file" because the dumpfile is present and moreover the two other impdp commands which uses the same dumpfile (1st and 3rd) were succesfull.


Additional Info
===================
Info on very similair issue I had last week

Last week , I had very similair issue. I put 5 impdp commands in a similair script. I don't know if it is a co-incidence , but then also , it was the second impdp that failed with the same error. This is why I am suspecting that something has between the 1st sucessfull impdp and the second impdp command. Anything wrong with the new line indicator shown in red above ?
# 2  
if impdp can be executed in multiple lines then i really dont think you need \ at the end of each line. You definately dont need \ at the end of impdp command or else it will join next line to current line..
This User Gave Thanks to vidyadhar85 For This Post:
# 3  
Thank you Vidhyadhar. But I have had similar scripts with 5 impdp commands. But only the second one failed. If ' \ ' character at the last parameter is causing the issue , then all the remaining 4 commands would have errored out. Right ?
# 4  
I am surprise to see below error
HTML Code:
ORA-31640: unable to open dump file "/u07/wmsdata/expdat.dmp" for read
check below
Check the permissions on this file & owned user.
Check is file exact location.
If not Might dumpfile could have corrupted.
Are you performing export & import in same versions?
# 5  
what is the word for ' \ ' (which I call 'next line indicator' ) in shell scripting terminology ? I need to do some googling on how this character behaves within a shell script.
# 6  
Quote:
Originally Posted by omega3
what is the word for ' \ ' (which I call 'next line indicator' ) in shell scripting terminology ? I need to do some googling on how this character behaves within a shell script.
Its just instruct the shell that commands will be continued in the next line..

Hope below will explain it more clearly for you Smilie

Code:
 
/home/lscpvbf > cat v
echo "vi\
dya\
dhar"
da\
te
/home/lscpvbf > v
vidyadhar
Thu 13 Sep 16:21:45 2012

This User Gave Thanks to vidyadhar85 For This Post:
# 7  
I don't have so much to say about using "\" more than it's an escape for the following newline character, like esacping e.g. "$" with "\$". So perhaps it's important that there is no character (space etc.) after the "\".

This line:
Code:
remap_tablespace = WMS_DATA:DEV_WMS_01_DATA \  # -------> is there anything wrong with this particular next line indicator ' \' shown in red

Perhaps the spaces surrounding "=" is causing problems, and if you should use "\", don't have it at this last line.
Don't know if this is helpful...
This User Gave Thanks to 244an For This Post:
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #288
Difficulty: Easy
In Linux, Logical Volume Manager (LVM) is a device mapper target that provides sound card I/O management for the Linux kernel.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to understand special character for line reading in bash shell?

I am still learning shell scripting. Recently I see a function for read configuration. But some of special character make me confused. I checked online to find answer. It was not successful. I post the code here to consult with expert or guru to get better understanding on these special characters... (3 Replies)
Discussion started by: duke0001
3 Replies

2. Shell Programming and Scripting

Sql multi line comment /* shell interpretation issue

Greetings Experts, I do have some basic knowledge of Unix. The task I am trying to do through shell script is to generate the view script for all of the tables which is in YYYYMMDD format (I assume I am on Ksh). I have certain tables that ends in YYYYMMDD format (eg: tbl_20150630) For each... (1 Reply)
Discussion started by: chill3chee
1 Replies

3. Shell Programming and Scripting

Read character by character in line in which space is also included

Hi friend, I have one file , and i want to read that file character by character. I need this script in ksh. while using read option with -n1 am getting error. while read -n1 c read has bad option And if i am using below script, then if in a line has space like this ( Pallvi mahajan)... (10 Replies)
Discussion started by: pallvi_mahajan
10 Replies

4. Shell Programming and Scripting

awk new line issue, saying string can't contain new line character

Hi , I am doing some enhancements in an existing shell script. There it used the awk command in a function as below : float_expr() { IFS=" " command eval 'awk " BEGIN { result = $* print result exit(result == 0) }"' } It calls the function float_expr to evaluate two values ,... (1 Reply)
Discussion started by: mady135
1 Replies

5. Solaris

Line too long error Replace string with new line line character

I get a file which has all its content in a single row. The file contains xml data containing 3000 records, but all in a single row, making it difficult for Unix to Process the file. I decided to insert a new line character at all occurrences of a particular string in this file (say replacing... (4 Replies)
Discussion started by: ducati
4 Replies

6. HP-UX

How to remove new line character and append new line character in a file?

Hi Experts, I have data coming in 4 columns and there are new line characters \n in between the data. I need to remove the new line characters in the middle of the row and keep the \n character at the end of the line. File is comma (,) seperated. Eg: ID,Client ,SNo,Rank 37,Airtel \n... (8 Replies)
Discussion started by: sasikari
8 Replies

7. Shell Programming and Scripting

delete new line character ( - ) , korn shell

Hi guys , i need help so bad on this issue.. Basically i have to delete the line continuation symbol of first column variable and add the truncated part of that word in next line to first line. here i written sample 3 lines but originally i have bunch of lines in that file. client1_day- ... (3 Replies)
Discussion started by: chrismorgan
3 Replies

8. Shell Programming and Scripting

Issue with New Line character

Hi, I am reading data from file and storing it in a multiline variable. Every line is seperated with "\n" character. globalstrval="${globalstrval}""${line}""\n" If the value of globalstrval is like: 1234 ABCD EFGH WXYZ .... If I do, YLvar=`echo $globalstrval | grep "ABC"` then... (1 Reply)
Discussion started by: gupt_ash
1 Replies

9. Shell Programming and Scripting

Help with shell script: moving end of line character

Hello. I have a file (old.txt) that I need to copy into another file (new.txt). Each line on old.txt ends with CR/LF but the position of CR/LF varies from one record to another. I need to copy each line of record to new.txt and move CR/LF in pos 165. Can I use awk to achieve this? How?... (8 Replies)
Discussion started by: udelalv
8 Replies

10. Shell Programming and Scripting

Using shell to get the last character in a line

Good day ladies and gents, I'm trying to write shell code that can give ignore everything else in a line bar the last character but not having much luck. Any ideas? I have been looking at cut and sed but not making any progress. (3 Replies)
Discussion started by: Mr_Plow
3 Replies