Need help in a shell script to edit a tablespace creation script.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need help in a shell script to edit a tablespace creation script.
# 1  
Old 12-29-2008
Java Need help in a shell script to edit a tablespace creation script.

Hi,

CREATE TABLESPACE aps_blob_large01
DATAFILE '/c2r6u13/u03/oradata/qnoldv01/aps_blob_large0101.dbf' SIZE X 270532608
REUSE
DEFAULT STORAGE (INITIAL 134217728 NEXT 134217728
MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0)
ONLINE
/

CREATE TABLESPACE aps_data_medium01
DATAFILE '/c2r6u13/u03/oradata/qnoldv01/aps_data_medium0101.dbf' SIZE X 52428800
REUSE
DEFAULT STORAGE (INITIAL 4194304 NEXT 4194304
MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0)
ONLINE
/

CREATE TABLESPACE aps_data_small01
DATAFILE '/c2r6u13/u03/oradata/qnoldv01/aps_data_small0101.dbf' SIZE X 104857600
REUSE
DEFAULT STORAGE (INITIAL 131072 NEXT 131072
MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0)
ONLINE
/

I have about 150 tablespace creation scripts of which I have listed 3.
I need help in writing a shell script to replace the number after SIZE X with 100M in the above mentioned script.

The output should be as follows after running the script into a new file.

CREATE TABLESPACE aps_blob_large01
DATAFILE '/c2r6u13/u03/oradata/qnoldv01/aps_blob_large0101.dbf' SIZE 100M
REUSE
DEFAULT STORAGE (INITIAL 134217728 NEXT 134217728
MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0)
ONLINE
/

CREATE TABLESPACE aps_data_medium01
DATAFILE '/c2r6u13/u03/oradata/qnoldv01/aps_data_medium0101.dbf' SIZE 100M
REUSE
DEFAULT STORAGE (INITIAL 4194304 NEXT 4194304
MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0)
ONLINE
/

CREATE TABLESPACE aps_data_small01
DATAFILE '/c2r6u13/u03/oradata/qnoldv01/aps_data_small0101.dbf' SIZE 100M
REUSE
DEFAULT STORAGE (INITIAL 131072 NEXT 131072
MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0)
ONLINE
/

Thanks a lot in advance.

Ram.
# 2  
Old 12-30-2008
Open the file in "vi"

:1,$s/SIZE X .*$/SIZE 100M/
# 3  
Old 12-30-2008
Quote:
Originally Posted by FlyingSquirrel
Open the file in "vi"

:1,$s/SIZE X .*$/SIZE 100M/

Hi FlyingSquirrel,

Thanks a lot for all the help.

Attached are the 2 files mentioned below:

create_tablespaces.sql has the original file.
ram_test_tbs.sql has the output from the code provided by you.

If I look at the output file not all the tablespace creation scripts have been changed. Could you please help me figure out what I have done wrong in my original file create_tablespaces.sql ?

Thanks,

Ram.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Edit the file in shell script

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I am trying to automate hadoop installation procedure using shell script. It involves go to perticular directory... (3 Replies)
Discussion started by: Abdul Navaz
3 Replies

2. UNIX for Dummies Questions & Answers

Shell script folder creation

hi can any one help me in shell scripting where in my requirement is to write a shell script where in if i run that script i should copy all the .doc files from one system to another systems within a network like from parent folders to child folder example parent folder A within parent folder... (5 Replies)
Discussion started by: afra
5 Replies

3. Shell Programming and Scripting

Script to check Oracle tablespace

I'm new to unix script, and I need to check the tablespaces daily, here is the script(quite simple), but it does not work. Did I missed something ? Please guide me, Many thanks ! #!/bin/sh echo "ORA TABLEASPACE:" sqlplus system/oracle as sysdba; set pagesize 9999; set linesize 132; ... (5 Replies)
Discussion started by: dehetoxic
5 Replies

4. Shell Programming and Scripting

shell script to edit a file

i have a file called number which contains data as 1 2 3 4 5 6 7 8 9 0 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 needed a shell script to print the output as 1 7 7 1 4 and (2 Replies)
Discussion started by: jacky29
2 Replies

5. Shell Programming and Scripting

Shell script to edit a file

Hello, I have a big file in wich I would like to rename inside this exactly the string '_ME' and not rename in case we have 'ABC_MELANGE'. Is there a way to do it by using a shell script? Any tip will be apreciated. The file is like described bellow, after using command more filename : ... (3 Replies)
Discussion started by: Titas
3 Replies

6. Shell Programming and Scripting

tablespace monitoring script

I have prepared the below script to monitor the tablespace and alert the users whenever it reaches a threshold limit. #!/bin/sh . /home/.profile sqlplus -s $LOGON << .eof > $scripts/check_tablespace.temp set pages 0 select tablespace_name, free_percent from ( SELECT... (4 Replies)
Discussion started by: svajhala
4 Replies

7. Shell Programming and Scripting

alias to a shell script - tablespace size

I have developed the following shell script. The idea was to create an alias to execute it and return the tablespaces and their sizes from an oracle database. When I execute is via the alias, I have issues. So, here is the script first: > cat ts_size.sh #!/bin/ksh xwhere=" " xwild=" "... (8 Replies)
Discussion started by: desibabu
8 Replies

8. Shell Programming and Scripting

Can we edit crontab using a shell script

Hi, Can some one tell me if we can configure the jobs in crontab using a shell script. I know it can be done easily by using "crontab -e", but i just want to know whether we can add a job into the crontab using a shell script. If it can be done, plz suggest the procedure to do it. If it... (6 Replies)
Discussion started by: rudrarajumk
6 Replies

9. Shell Programming and Scripting

error in script path for tablespace usage

Hi , I am trying to run this script in crontab but I get errors. When I run it explicitly like ./monitor_tblsp from another location then it runs fine . I am messing somewhere with paths but I don't know where and how . Please help . Here is the error part ./monitor_tblsp: touch: not... (2 Replies)
Discussion started by: capri_drm
2 Replies

10. Shell Programming and Scripting

Shell Script to find the tablespace size in oracle.

Hi, I need to execute a script to find the tablespace size in oracle.But i get an error.:confused: Script Executed:- #!/bin/ksh ORACLE_SID= oracelinstance ORACLE_HOME= oracle path PATH=$ORACLE_HOME/bin export ORACLE_SID ORACLE_HOME PATH sqlplus... (4 Replies)
Discussion started by: vighna
4 Replies
Login or Register to Ask a Question