Script to create multiple tablespaces

Below is the korne shell script that i have written to create tablespaces for db unitst. Can any1 please verify the execute immediate statement whetherit is correct or not
#!/bin/ksh
########################Set up oracle environment############
ORACLE_SID=unitst
ORACLE_HOME=/ora/product/v102
ORAENV_ASK=NO
PATH=$PATH:/usr/local/bin
export ORACLE_SID PATH ORAENV_ASK
. oraenv
a=`date +"%Y-%m-%d"`
echo "Current Date:$a"
for i in `cat try.txt | awk '{print $1}'`
do
echo "Starting :$i"
     Tsize=`cat try.txt | grep $i | awk '{print $2}'`
     connect1=`sqlplus -s /nolog<< END
     connect / as sysdba
     set pagesize 1000 linesize 1000 feedback off verify off
     execute immediate 'create tablespace' || $i || 'datafile '/unitst/data003/$i.dbf' size' || $Tsize || 'NOLOGGING';
     END`
echo "completed :$i"
doneContents of file try.txt
T_APOGEE_FY_1998_DATA   40M
T_APOGEE_FY_1998_IDX    7M
T_APOGEE_FY_1999_DATA   776M
T_APOGEE_FY_1999_IDX    126M
T_APOGEE_FY_2000_DATA   1060M
T_APOGEE_FY_2000_IDX    171M
T_APOGEE_FY_2001_DATA   1012M
T_APOGEE_FY_2001_IDX    160M
T_APOGEE_FY_2002_DATA   1180M
T_APOGEE_FY_2002_IDX    200MEdited by: 832812 on May 4, 2011 9:58 PM

You need two single quotes around that datafile name,
execute immediate 'create tablespace ' || $i || ' datafile ''/unitst/data003/'||$i||'.dbf'' size ' || $Tsize || ' NOLOGGING';In dynamic sql, two single quotes in the middle of the string is considered as one quote.
You need to take care of the spaces as well.
G.
Edited by: Ganesh Srivatsav on May 5, 2011 1:25 AM
Added spaces

Similar Messages

  • Script to create multiple folios

    Hi,
    I have been searching for a script that creates multiple folios based on the same metadata, but haven't found anything.
    The idea is to use it when creating renditions of the same publication, the only difference will be the size of the folio. It will save me some time to have a script where I can input metadata for the publication once.
    I am only looking for a script to create the folios, after this I will import the articles.
    Have anyone seen a script like this or knows if it is possible to do this?
    Thanks,
    Kristoffer

    Thank you for your reply!
    I tried to find the structure for the folio sidecar. Do you know where to find this? I am interested to see what kind of metadata that could be imported.
    I also assume that this must be scripted since there is nowhere in the standard dialogue to import a sidecar?
    Thanks,
    /K

  • I have a request from a customer to run a script to create multiple Usernames and Passwords on ACS5.3 appliance.

    I have a request from a cutomer to run a script to create multiple username and password on ACS5.3 Appliance. Does anyone has any suggestion on how to go about this?

    Have you tried using the import option on the ACS? You can put all your accounts in a csv file and upload it into the ASA.
    http://www.cisco.com/en/US/docs/net_mgmt/cisco_secure_access_control_system/5.3/user/guide/users_id_stores.html#wp1132152
    If that doesnt work you can use the REST Web Services in ACS also:
    http://www.cisco.com/en/US/docs/net_mgmt/cisco_secure_access_control_system/5.3/sdk/rest.html
    Thanks,
    Tarik Admani
    *Please rate helpful posts*

  • Create a script to create multiple objects without using execute immediate.

    I have a function that requires several objects (4 types, 8 functions) to run. Right now they're in separate sql files. I'd like to combine them into one file that I would run but I'd rather not use the 'execute immediate' since it seems like you have to escape quotes and the like.
    How would you do that?
    Thanks in advance,
    J

    Yeah I thought about that but I'd like them all to be in one file.
    I believe I figured it out though. (about 20m after I posted no less)
    Adding a '/' on it's own line after each block of code appears to do the trick. I just have to write a bit of code to drop a dependent type if it exists.
    J

  • One db and user for multiple tablespaces or schemas per server?

    Hello again.
    I installed Oracle 11g on server_1 and created one database db_1.
    Using Enterprise Manager, I did the following:
    Created a tablespace myname_1.
    Created a user myname_1.
    Logged in as myname_1 and created a table into the default tablespace myname_1.
    When creating this table, the schema field defaulted to myname_1.
    Created another tablespace myname_2.
    My confusion about the relationship between tablespaces, users, and schemas starts here:
    When I try to create a new table for tablespace myname_2, I get an error:
    "user myname_2 does not exist"
    I am seeking some clarification on these levels of organization in Oracle.
    My goal is to setup my server with one database each and one user each per database.
    Then, I think I want to create multiple tablespaces and organize objects per tablespace.
    Or should it be per schema?
    Eventually each tablespace will be moved to a separate server.
    Any comments and suggestions are greatly appreciated.
    Thank you for helping.

    Hello,
    This error means user MYNAME_2 doesn't exists and you have to create one.
    Example 1:
    CREATE USER MYNAME_2
      IDENTIFIED BY "my_password"
      DEFAULT TABLESPACE MYNAME_1
      TEMPORARY TABLESPACE TEMP
      PROFILE DEFAULT
      ACCOUNT UNLOCK;
      -- 4 Roles for KLONDIKE
       GRANT RESOURCE TO MYNAME_2; ---> This privs give unlimited quota on all the tablespaces
      GRANT CONNECT TO MYNAME_2;
      ALTER USER MYNAME_2 DEFAULT ROLE NONE;
    Then create your table (you were missing "AS" )
    create table myname_2.mytable_1 as
    select * from source_table@dblink_2;Example 2: If you want to create table mytable_1 in tablespace myname_2 then you have to create tablespace myname_2 first. To create table in different tablespace than user default tablespace
    create table mytable_1 tablespace myname_2 as select * from source_table@dblink;Regards
    OrionNet

  • Bash script question, how do I create multiple directories on one line

    I am making a package for amavisd-new (yes I am aware that there is one in community but I can't say I like the way it is done).
    I have an install script from which I want to create multiple directories if they do not exist.
    So I want to create a directory /var/spool/amavis with subdirectories of var tmp virusmails spammassassin .
    I can't seem to be able to find a way to do this on one line.

    pelle.k wrote:
    peets wrote:Hehe because it's less typing!
    Good one!
    Also, it's by far the more dynamic method.
    If you want to get pedantic, it's also far less efficient in terms of execution time: each iteration of the loop forks a new process, whereas using a single mkdir command forks only once.  The "best" way is the curly-braces method demonstrated above by chimeric.

  • Script for InDesign CS6 - create multiple, prenamed layers

    I created a script for Illustrator CS6, in ExtendScript Toolkit, that will create multiple, prenamed layers...see below...
    //Apply to myDoc the active document
    var layerName = LayerOrderType;
    var myDoc = app.activeDocument;
    //define first character and how many layers do you need
    var layerName
    var numberOfLayers=0;
    //Create the layers
    for(var i=0; i<=numberOfLayers; i++)
    { var layerName = ":: GRADIENT";  var myLayer = myDoc.layers.add(); myLayer.name = layerName;  }
    { var layerName = ":: STRIPES";  var myLayer = myDoc.layers.add(); myLayer.name = layerName;  }
    { var layerName = ":: LEGAL";  var myLayer = myDoc.layers.add(); myLayer.name = layerName;  }
    { var layerName = ":: BLK BAR";  var myLayer = myDoc.layers.add(); myLayer.name = layerName;  }
    { var layerName = ":: FLAME";  var myLayer = myDoc.layers.add(); myLayer.name = layerName;  }
    { var layerName = ":: LOGO/TYPE";  var myLayer = myDoc.layers.add(); myLayer.name = layerName;  }
    { var layerName = ":: TRIM,ETC";  var myLayer = myDoc.layers.add(); myLayer.name = layerName;  }
    { var layerName = ":: LOEC INFO";  var myLayer = myDoc.layers.add(); myLayer.name = layerName;  }
    // Moves the bottom layer to become the topmost layer
    if (documents.length > 0) {
    countOfLayers = activeDocument.layers.length;
    if (countOfLayers > 1) {
    bottomLayer = activeDocument.layers[countOfLayers-1];
    bottomLayer.zOrder(ZOrderMethod.BRINGTOFRONT);
    else {
    alert("The active document only has only 1 layer")
    I tried to use this exact code to replicate the same scenario in InDesign but it doesn't work.
    Can anybody help me out!?
    Thanks in advance

    Marijan Tompa's scripts are very nice and useful, however, for this simple task you can try create your own wiht this code:
    app.activeDocument.layers.add ({name: "GRADIENT", layerColor: UIColors.red});
    app.activeDocument.layers.add ({name: "STRIPES", layerColor: UIColors.lightBlue});
    app.activeDocument.layers.add ({name: "LEGAL", layerColor: UIColors.gray});
    //merge existing document layer to bottom layer (in this case original layer will be merged to 'GRADIENT')
    var myDocument = app.documents.item(0);
    var myLayerA = myDocument.layers.item(2);
              var myLayerB = myDocument.layers.item(3);
              myLayerA.merge(myLayerB);
    alert("Layers created!");
    assume, your document has one layer.
    Script creates three new layers, they appear in Scripts palette in this order:
    LEGAL
    STRIPES
    GRADIENT
    and merges 'old' layer to bottom layer of newly created set (GRADIENT).
    sure, you can add as much layers as you need, just don't forget modify LayerA and LayerB numbers accordingly.
    Or disable second part of the script at all, if you don't want anything to be merged.

  • How to create multiple users in solaris using script

    hi
    how i can create multiple users (2000 users) using shell script with a common password .
    useradd is creating one user at a time.
    thanks

    I m new to solaris and scripting also.
    how i can write a script for this .

  • Creating multiple user tables using script

    hi
    my requirement is i want to create multiple tables by running script . is it possible .how do i do that can any one suggest me and send sample code to solve this task.
    (i have to create 100 userTables it is very difficult to create using code or from B1 that is my requirement )and i think some good solution is there for my problem and inserting the tables into B1 by running script.

    Hi Om,
    Take a look at the SDK help files, or even better, the examples provided with the SDK, they give you a good example how to create a usertable.
    Tried that, you could programm a loop wich creates your usertables, or a function that progresses a input file containing all your usertables.
    <b>Pseudo code loop (C#)</b>
    for(int i = 1; i <=100; i++)
      /* Call you your function that creates a usertable with the given name */
      CreateUserTable("TBL_" + i.ToString());
    Hope it helps,
    Rowdy

  • Batch create multiple files in a script

    I have 130,000 gif files I want to convert to pdf.  I can only batch convert about 1,500 at a time, acrobat will bomb out if I do more.  Is there a script I can use to process all my files ?
    Thanks,
    Alex

    I have uploaded the files and shared them.  These are the links
    Grade 11 Maths Standardisation Project Paper 2 2013.doc
    https://files.acrobat.com/preview/9694310d-ca7f-4919-883d-c53b36215d89
    Grade 11 Maths Standardisation Project Paper 2 Analysis Grid 2013.doc
    https://files.acrobat.com/preview/97da9e5f-d412-4d25-9bbc-d1a525d90826
    Grade 11 Maths Standardisation Project Paper 2 Diagram Sheet 2013.doc
    https://files.acrobat.com/preview/f50dd62e-af04-4060-85c5-fa81ce6803d8
    Grade 11 Maths Standardisation Project Paper 2 Formula Sheet 2013.doc
    https://files.acrobat.com/preview/7fc6007b-aaa6-4d65-9a8c-bf99818474a5
    Grade 11 Maths Standardisation Project Paper 2 Marking Guidelines 2013.doc
    https://files.acrobat.com/preview/b3a715bb-3683-48df-b0ec-3d17442275be
    Grade 11 Maths Standardisation Project Paper I Analysis Grid 2013.docx
    https://files.acrobat.com/preview/ab62e6b6-0261-434e-8a2f-382f74335685
    The first file is the problem file.  If you create this file separately, Acrobat will convert it perfectly.  But "Batch create multiple files" and the graphics are deconstructed on page 8

  • A script to accept dafault tablespace and tempspace at runtime create users

    I need to write a script to accept default tablespace and temporary tablespace , then create the users in that tablespace. Please see the example but some how it is not working....
    prompt Specify user's default tablespace
    prompt Using &&default_tablespace for the default tablespace
    prompt Specify user's temporary tablespace
    prompt Using &&temporary_tablespace for the temporary tablespace
    create user test identified by test default tablespace &&default_tablespace temporary tablespace &&temporary_tablespace ;
    grant connect , resource to test;
    Please help me in identifying the errors
    Thanks in advance...
    Message was edited by:
    mvarier

    some how it is not workingHow ? Doesn't the user get created ? Do you get errors ? which errors ?
    (It worked to me)

  • PLEASE HELP!! I've used iWeb to create multiple sites, all published to third party servers.  The very last site I made changes to is showing up in any domain file I open - despite their different names and locations on my iMac.  I just switched to Lion.

    Please HELP!!  I just switched to Lion.  I have created multiple websites using iWeb  3.0.4 and despite my having saved their 'domain' files in various locations and using different filenames, upon opening the domain files I keep getting the very last site I published.  All the sites were published to third party servers.  The domain files (still have a preview that look correct and have different file sizes) but keep going back to the last site published. HELP ME PLEASE!! Are the old files still available?!!

    In Lion the Library folder is now invisible. To make it permanently visible enter the following in the Terminal application window: chflags nohidden ~/Library and hit the Enter button - 10.7: Un-hide the User Library folder.
    To open your domain file in Lion or to switch between multiple domain files Cyclosaurus has provided us with the following script that you can make into an Applescript application with Script Editor. Open Script Editor, copy and paste the script below into Script Editor's window and save as an application.
    do shell script "/usr/bin/defaults write com.apple.iWeb iWebDefaultsDocumentPath -boolean no"delay 1
    tell application "iWeb" to activate
    You can download an already compiled version with this link: iWeb Switch Domain.
    Just launch the application, find and select the domain file you want to open and it will open with iWeb. It modifies the iWeb preference file each time it's launched so one can switch between domain files.
    WARNING: iWeb Switch Domain will overwrite an existing Domain.sites2 file if you select to create a new domain in the same folder.  So rename your domain files once they've been created to something other than the default name.
    OT

  • Bridge CS6 Script to Find Multiple Images in Multiple folders.

    Is it possible to have a script to find multiple images within multiple folders that is on a external hard drive?
    For instances I have a external hard drive assuming it's for a library of pictures.
    Inside this hard drive has folders named as below
    1-1000
    1001-2000
    2001-3000
    3001-4000
    If I had a perfect csv file for example that calls out for specific pictures for example 2, 10,1500 and 2000 (remember think big, it may be a larger list than this it could be hundreds or thousands of pictures); is there a script that would allow me to find these images and save a copy of them on to my desktop so that way I don't have to hunt for them in the old fashion way? I can read scripts but writing them is a different story.

    If you want to go with Batch I would recommend creating an Action of more or less these steps:
    • set the resolution to the same as the background image’s
    • change the image from Background Layer to regular Layer if necessary
    • convert it to a Smart Object
    • add a Drop Shadow Layer Style to the image (do not use Global Angle)
    • place the background image (File > Place …)
    • move it behind the image layer
    • Image > Reveal All
    • make Selection from that layer’s transparency (cmd-click its icon in the Layers Panel) and use Image > Crop
    • select and transform the image layer to fit the intended position
    This would naturally work out best if the images had the same size and proportions.
    For the reflection on the floor duplicate the image, flip it vertically, move it in position and reduce its opacity to maybe 10%.
    Realistically you may have to hide it partially behind the pillows, a Vector Mask would be an option.

  • Is there any other way to achieve per user call forward restriction other than to create multiple voice policies?

    Hello,
    We mentioned the environment details below:
    Environment
    In our PBX environment, currently a user can forward calls to any local (within a region) internal extension. But for external PSTN call forwarding, a user needs to send a request and be approved by their manager. And the forwarding restriction
    is applied such that user is only allowed to forward to that particular PSTN number - to prevent toll fraud.
    Moving forward to Lync, using voice policy's call forwarding and simultaneous ring PSTN usages, I can set it to allow forward and simultaneous ring to custom PSTN usage and a custom route that will only send calls to these pre-approved
    external numbers.
    Outcome
    But in such a scenario,
     sSince all the custom external allowed numbers will have to be put into a single Route match table, User A will be able to successfully
    set up call forward to User B's number. (if they come to know about it somehow, that is)
    rü 
    Route matching list will be very long due to the number of users per hubsite that has call forwarding enabled.
    Questions
    Is there any other way to achieve per user call forward restriction other than to create multiple voice policies ? MSPL may be ?  
    2. Is there a limit in the number of entries you can have on the Route pattern matching regex expression ?
    Please advise. MANY THANKS.

    1) I think multiple policies may be your best bet, though it's not a fun one to manage, I agree.  MSPL could do it, but it would be more complex to maintain in the end.  Even gateways have limitations on routes.
    2) I'm not aware of a limit, though I'm not saying there's isn't one.  But if you hit it, you could move to a second usage/route combo.
    I'd suggest building out some PowerShell usage/route creation/organization script for this so it's not something that would need to be maintained within the GUI.
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question please click "Mark As Answer".
    SWC Unified Communications
    This forum post is based upon my personal experience and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Export to PDF - Can a single report (rpt file) create multiple PDF files using the export command?

    Post Author: markeyjd2
    CA Forum: Exporting
    Greetings forum members,
    My question is, in its entirety: Can a single report (rpt file) create multiple PDF files using the export command, ideally one PDF file per DB record?
    In my case; I have a Crystal Report that reads data from a DB table containing ~ 500 records.  When I export the report to a PDF file, I get one PDF file, with ~ 500 pages.
    What I would like to do is export the report to ~ 500 individual PDF files; One file per DB record.  The file names would be based on the table's primary key.
    Is this possible?

    Post Author: Micha
    CA Forum: Exporting
    Hi,
    you need some lines of code, but its easy. Dependend on how to start the generation of your 500 PDFs, you can write an ASP page and start it via Web Browser, or a Windows Script and start it via scheduled job...
    Here's an abstract of the ASP code I use:
    First, you create a recordset (here: "rsc") which gives you the list of ID fields you want to export, then you create CrystalRuntime.Application object, then you loop through the recordset, open your report (here: "oRpt") and set login info. Then set the selectionformula, so that the report displays only the data of the current ID, e.g.:
      oRpt.RecordSelectionFormula = "(" & oRpt.RecordSelectionFormula & ") AND {myTab.myVal}=" & rsc("myVal")
    Then you export the report, move to the next record in recordset, and repeat the loop until recordset.EOF. Then you close recordset and connection.
    Micha

Maybe you are looking for

  • How do I create a text style in CC libraries? Every time I drag and drop text into library form Photoshop or illustrator it turns it into a graphic.

    How do I create a text style in CC libraries? Every time I drag and drop text into library form Photoshop or illustrator it turns it into a graphic. If I select the text layer and click the text style button in the library it just creates a new text

  • Hw do  u run java programs in xcode 4?

    hw do  u run java programs in xcode 4? pls tell the detailed steps fr running a java program

  • HT204406 iTunes match isn't working

    Ive been using match for several years with no problems. However, it doesn't seem to be working now...songs are not adding to the cloud, and my iphone isn't adding any new songs because of it. I let match run overnight, but t was always getting caugh

  • Versions of RFX in srm 7

    HI Gurus, We are in SRM 7, when I am trying to publish a bid the version of the bid changes to 2 insted of 1, If again the bid is republish the version changes to 3 but in tracking it show version 1 as a historical doc. Is it standard behavior??or sh

  • Alv sort option

    Hi Folks . can anyone tell me how can i disable the column sort option ? i mean that when i point with the cursur on the column header appears a little downside arrow that can sort the column asc or dsc .