-1

I am trying to pass mount_point details in my oracle script.

I am able to pass integer variable using below code but not able to send mount point details in oracle script:

sed "s/@@pqr@@/$space/g" tablespace_extend.sql |
sqlplus -s "/ as sysdba"
                                                             
BEGIN
space:="@@pqr@@";
dbms_output.put_line(space);
END;
/

When I am using same code to pass mount point details, it is not working. it returns this error message:

sed: -e expression #1, char 13: unknown option to `s', mount_point = /u08/dbname/  
ctrl-alt-delor
  • 27,473
  • 9
  • 58
  • 102
Divya
  • 1
  • 1
  • 6
    Does this answer your question? [Sed - unknown option to \`s'](https://unix.stackexchange.com/questions/91630/sed-unknown-option-to-s). You may also be interested in https://unix.stackexchange.com/q/32907/315749 and https://unix.stackexchange.com/q/129059/315749. – fra-san Oct 28 '20 at 08:34
  • 1
    For clarity, can you also please add the content of your `$space` variable to your question? Is it `mount_point = /u08/dbname/`? – fra-san Oct 28 '20 at 08:36

1 Answers1

1

try the following as I assume your variable contains special character / used as delimiter which is breaking the sed command:

$ space="/u08/dbname/"
$ sed "s:@@pqr@@:$space:g" tablespace_extend.sql
BEGIN
space:="/u08/dbname/";
dbms_output.put_line(space);
END;

I just switched the sed delimiter to : character.

more on this here: https://stackoverflow.com/questions/16790793/how-to-insert-strings-containing-slashes-with-sed

Roman Spiak
  • 289
  • 1
  • 6