How to alter tablespace add in pdb from cdb root

Hi Experts,
Is there a way to run the "alter tablespace xx add tempfile ..." command in root cdb while the tablespace xx belongs to a pdb. Is it possible to do it without login or change session to pdb? Thanks.

Krishna-Oracle wrote:
You have to login into particular PDB using alter session set container command and then make changes.
You are confusing logging to PDB with setting PDB as current container. These are two completely different actions. Create common user:
SQL> connect /@sol12 as sysdba
Connected.
SQL> create user c##ommon identified by common container = all;
User created.
SQL> grant create session to c##ommon container = all;
Grant succeeded.
SQL> grant set container to c##ommon container = all;
Grant succeeded.
Create after login trigger for the common user in a PDB:
SQL> connect /@pdb1sol12 as sysdba
Connected.
SQL> create or replace
  2    trigger c##ommon_logon_trigger
  3      after logon
  4      on c##ommon.schema
  5      begin
  6          raise_application_error(-20500,'You are not allowed logging to this PDB.');
  7  end;
  8  /
Trigger created.
SQL>
Now I will login as c##ommon to CDB and with set container to PDB:
SQL> connect c##ommon@sol12
Enter password: ******
Connected.
SQL> alter session set container = pdb1sol12;
Session altered.
SQL>
As you can see, AFTER LOGON trigger wasn't executed. And now I will try logging to PDB:
SQL> connect c##ommon@pdb1sol12
Enter password: ******
ERROR:
ORA-00604: error occurred at recursive SQL level 1
ORA-20500: You are not allowed logging to this PDB.
ORA-06512: at line 2
Warning: You are no longer connected to ORACLE.
SQL>
Now you see SET CONTAINER != LOGIN.
SY.

Similar Messages

  • Question about ALTER TABLESPACE add/drop datafile

    Good afternoon,
    As an exercise, I created a tablespace STORETABS and added a datafile to it using the command:
    SQL> alter tablespace storetabs add datafile 'e:/storetabs3.dbf' size 50M;This step succeeded. A new file was created in the root of e: as expected.
    Following that command, I issued:
    SQL> alter tablespace storetabs drop datafile 'e:/storetabs3.dbf';
    Tablespace altered.The command succeeded. However, the file *'e:/storetabs3.dbf'* was not removed. After re-reading the documentation found at http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_3002.htm, I get the impression that removing the O/S file itself is something that always needs to be done manually.
    The question: Am I correct that there is no option to cause the "alter tablespace <tablespace> drop datafile <datafilename>" to delete the O/S file ? In other words, must the O/S file always be manually deleted as a separate step ?
    Thank you for your help,
    John.

    I believe in windows directory paths used backslash and not forward slash.
    You can argue why oracle does not give error, either while creating or while dropping ;)
    SQL> select * from v$version ;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL> select tablespace_name, file_name from dba_data_files ;
    TABLESPACE_NAME
    FILE_NAME
    USERS
    /u01/app/oracle/oradata/orcl/users01.dbf
    UNDOTBS1
    /u01/app/oracle/oradata/orcl/undotbs01.dbf
    SYSAUX
    /u01/app/oracle/oradata/orcl/sysaux01.dbf
    SYSTEM
    /u01/app/oracle/oradata/orcl/system01.dbf
    EXAMPLE
    /u01/app/oracle/oradata/orcl/example01.dbf
    SCOTT_TBS
    /home/oracle/scott_f1.dat
    6 rows selected.
    SQL> !ls -l scott_f1.dat   
    -rw-r----- 1 oracle oinstall 276832256 Sep 11 21:15 scott_f1.dat
    SQL> alter tablespace scott_tbs add datafile '/home/oracle/scott_f2.dat' size 10M ;
    Tablespace altered.
    SQL> !ls -l scott_*.dat
    -rw-r----- 1 oracle oinstall 276832256 Sep 11 21:15 scott_f1.dat
    -rw-r----- 1 oracle oinstall  10493952 Sep 11 21:18 scott_f2.dat
    SQL> alter tablespace scott_tbs drop datafile '/home/oracle/scott_f2.dat' ;
    Tablespace altered.
    SQL> !ls -l scott*.dat
    -rw-r----- 1 oracle oinstall 276832256 Sep 11 21:15 scott_f1.dat

  • Alter tablespace add datafile taking too much time

    Hi All,
    DB Version :10.2.0.1
    OS Version: Windows Server 2003 32 Bit
    When i am trying to add datafile into tablespace it takes lot of time approx 8 hours.but earlier it take approx 40 to 60 mins
    When i check Alert log file i got the message:
    ORA-604 signalled during: alter tablespace crbt add datafile
    I check there is sufficent space in Disk as i need to add Datafile of 30G.
    Syntax i am using is
    ALTER TABLESPACE TEST
    ADD DATAFILE 'C:\TEST02.DBF' SIZE 30G
    Can anyone tell me exactly the reason for the same
    Thanks in advance

    Hi Aman,
    The space is added sometime but most of the time i am getting this error
    SQL> ALTER TABLESPACE IN_OCT2011
    2 ADD DATAFILE 'E:\CAT\IN_OCT04.DBF' SIZE 30G REUSE;
    ALTER TABLESPACE IN_OCT2011
    ERROR at line 1:
    ORA-19502: write error on file "E:\CAT\IN_OCT04.DBF", blockno 11008
    (blocksize=8192)
    ORA-27072: File I/O error
    OSD-04008: WriteFile() failure, unable to write to file
    O/S-Error: (OS 33) The process cannot access the file because another process
    has locked a portion of the file.
    Kindly help over the same
    Edited by: Vikas Kohli on Nov 5, 2011 8:38 PM

  • How do I easily add a contact from the same company?

    How do I easily add a new contact from the same company or family without having to enter all the same information on an existing contact card I already have?

    Any card in your address book can be duplicated. Select the card within the Name column, and use the Edit > Copy menu item followed by the Edit > Paste menu item. Then you can update the card copy and only change the name/email/phone fields as needed.

  • How to loop and add multiple records from db in .pdf using cfdocument

    I have a query that pulls a users information (Id, FirstName,
    LastName, Title,etc). I then use cfdocument to output a person's
    biography into a pdf. This is great, because we no longer have to
    manually create bios, as they are now all dynamically generated.
    The problem I have now is that we want to be able to select
    multiple users and create a .pdf with each of their bios included
    in the one pdf.
    How do I loop thru records from a sql database in a
    cfdocument that includes a header and footer in cfdocument items,
    and ensure that one persons bio doesn't continue on the page with
    anothers.
    Here's the code I have so far for the cfdocument:

    Put the query around just the body of your cfdocument not
    around the whole cfdocument tag. Also, move any query information
    out of the header and put that in the body of the document. Lastly,
    put a cfdocumentitem pagebreak after each bio...you will need to
    check the recordcount of the query against the row you are on so
    that you don't add an empty page break at the end.

  • How to change "tablespace allocation" Metric chng from 7 days to 1 day?

    Hi
    I got to change metric collection time from 7 days (i.e once in every week) to every day. I have not find any tab to modify, please let me know how can I modify.
    Here are the details.
    Metric Name: Tablespace Allocation None
    Sub tabs : Tablespace Allocated Space (MB) Not Set
    Tablespace Used Space (MB) Not Set
    Thanks,
    RK

    Ah, you can't actually change it, at least not through the front end. From the Oracle® Enterprise Manager Oracle Database and Database-Related Metric Reference Manual
    10g Release 2 (10.2)
    Part Number B25986-01:
    This metric calculates the space allocated for each tablespace. It is not intended to generate alerts. Rather it should be used in conjunction with the Allocated Space Used (MB) metric to produce an historical view of the amount of space being used and unused by each tablespace.
    For all target versions, the collection frequency for this metric is every 7 hours.
    The metric is only designed for historical information, looks a typo on the 7 hours, mine is also set to 7 days.

  • How to alter or add foreign key constr to table having child rows or data

    Hi,
    I have a table by name DEPT in which the column DEPTNO is a primary key column and have data in it for all the columns . Now I have a EMP table where in the column DEPTNO is not having any constraint including foreign key constraint too. Now i have data in the EMP table for all the columns . now i would like to add the foreign key constraint to DEPTNO column in the EMP table referencing the DEPTNO column in the DEPT table. Both the table do not have any null values .
    I need to add the foreign key without deleting the data in the EMP table.
    Please advice.
    Regards,
    Vinesh

    Hi,
    I need to add the foreign key without deleting the data in the EMP table.Foreign key constraint can have only those values which are present in the primary key of the parent table or null.
    When your tables are populated with values and then you are adding the constraint then,
    the parent table data is only present in child table or null values.
    Example
    SQL> create table emp_bkp as select * from emp;
    Table created.
    SQL> create table dept_bkp as select * from dept;
    Table created.
    SQL> alter table dept_bkp
      2  add constraint pk_deptno primary key(deptno);
    Table altered.
    SQL> select distinct deptno from emp_bkp;
        DEPTNO
            30
            20
            40
            10
    SQL> select deptno from dept_bkp;
        DEPTNO
            10
            20
            30
            40
            55
    SQL>  alter table emp_bkp
      2   add constraint fk_deptno_bkp foreign key(deptno)
      3    references dept_bkp(deptno);
    Table altered.
    SQL> alter table emp_bkp
      2  drop constraint fk_deptno_bkp;
    Table altered.
    SQL> insert into emp_bkp(empno,ename,deptno) values(142,'Fenny',90);
    1 row created.
    SQL> alter table emp_bkp
      2  add constraint fk_deptno_bkp foreign key(deptno)
      3   references dept_bkp(deptno);
    add constraint fk_deptno_bkp foreign key(deptno)
    ERROR at line 2:
    ORA-02298: cannot validate (SCOTT.FK_DEPTNO_BKP) - parent keys not found
    SQL> update emp_bkp
      2  set deptno=null
      3  where empno=142;
    1 row updated.
    SQL> alter table emp_bkp
      2  add constraint fk_deptno_bkp foreign key(deptno)
      3   references dept_bkp(deptno);
    Table altered.
    SQL> insert into dept_bkp (deptno,dname)values(90,'IT');
    1 row created.
    SQL> update emp_bkp
      2  set deptno=90
      3  where empno=142;
    1 row updated.Twinkle

  • How to call Collection.add(E o) from JNI?

    Hi.
    JNI + Generics ???
    I just managed it to call methods like MyClass.f(String a) but i cannot figure out how to call methods with generics in its signatures.
    The signature string i used for the former method is: "(Ljava.lang.String;)V" and it works well but what is the corresponding signature string for Collection.add(E o)??
    Thanks in advance.

    Hi,
    I think it's a compiler problem here is a Generic class :
    public class test<T> {
            public void add(T o) {
                    System.err.println(o);
            public static  void main(String[] args) {
                    new test<Integer>().add(5);
    }I compiled it with javac (1.5.0_05)
    Then decompile it with jad
    // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
    // Jad home page: http://www.geocities.com/kpdus/jad.html
    // Decompiler options: packimports(3)
    // Source File Name:   test.java
    import java.io.PrintStream;
    public class test
        public test()
        public void add(Object obj)
            System.err.println(obj);
        public static void main(String args[])
            (new test()).add(Integer.valueOf(5));
    }As you can see T is now Object
    --Marc (http://jnative.sf.net)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to hide the Add-on panel from a script

    Good day
    I've installed an Add-on on my PowerShell ISE.
    I activate the add-on by 
    Import-Module c:\ps1\Modules\VariableExplorer\VariableExplorer.psm1
    im my Profile
    A minor annoyance is that the adds-on panel gets shown. 
    i have to press Alt+Shift+V in order to hide the adds-on panel.
    I'd like the panel remain hidden even when i activate the add-on.Maybe i activate the add-on incorrectly, then pls share a correct way of activating an add-on.
    Or there is a command that i can put in the profile.ps1 in order to hide the adds-on panel.
    Regards
    Kamil

    Perhaps this may help
    https://msdn.microsoft.com/en-us/library/dd878350(v=vs.85).aspx
    M.

  • How to stop persistant 'Add on' tabs from opening as well as my homepage when I first loogin into Firefox?

    Every time I log on to Firefox 5 Add on tabs also open alongside my home page trying to get me to install/activate them.
    I have tried clicking to install them and then restarting Firefox as per the tab instruction. I have been into Add On manager to try to enable, or disable the specific add on. I have cleared the cache, temp files and history etc, but no matter what I do, they come back each time I log on.
    What can I do to get rid of the pesky things one way or the other?

    It is possible that there is a problem with the file(s) that store the extensions registry.
    Delete the files extensions.* (e.g. extensions.sqlite, extensions.ini, extensions.cache) and compatibility.ini in the Firefox profile folder to reset the extensions registry.
    *https://support.mozilla.org/kb/Profiles
    New files will be created when required.
    See "Corrupt extension files":
    *http://kb.mozillazine.org/Unable_to_install_themes_or_extensions
    *https://support.mozilla.org/kb/Unable+to+install+add-ons
    If you see disabled, not compatible, extensions in "Tools > Add-ons > Extensions" then click the Tools button at the left side of the Search Bar (or click the "Find Updates" button in older Firefox versions) to check if there is a compatibility update available.
    If this hasn't helped then also try to delete the addons.sqlite file.

  • How to input data into an arraylist from a text file?

    I am trying to take data from a text file and put that data into an arraylist. First here is the text file:
    [item1, 10, 125.0, item2, 10, 12.0, item3, 20, 158.0]
    3
    4530.0
    [item5, 65, 555.5, item4, 29, 689.0]
    2
    56088.5
    [item7, 84, 34.5, item6, 103, 0.5, item8, 85, 1.36]
    3
    3065.1The text between the [ ] is the output from my arraylists. I have three arraylists. The first [ ] belongs to arraylist A, the second to arraylist B, and the third to arraylist C. The format of the arraylists is this:
    <item name>,<# in stock>,<value of one item>
    The first number below the arraylists in the text file represents the number of items in the list. The second number below the arraylists represents the total value of the items in the arraylists.
    Here is the class file I have (yes, it does everything):
    import java.io.*;
    import java.util.Scanner;
    import java.util.ArrayList;
    public class Inventory extends Object
         public int toAdd = 0;
         private boolean done = false;               //Are we done yet?
         public String strItemName;                    //The name of the item type.
         public int intNumInStock;                    //The number in stock of that type.      
         public double dblValueOfOneItem;          //The value of one item.
        public String strNumberInStock;               
        public double dblTotalValueA;               //The total value of warehouse A.
        public double dblTotalValueB;               //The total value of warehouse B.
        public double dblTotalValueC;               //The total value of warehouse C.
        public int intWarehouseAItemCount;          //Counter for items in warehouse A.
        public int intWarehouseBItemCount;          //Counter for items in warehouse B.
        public int intWarehouseCItemCount;          //Counter for items in warehouse C.
         ArrayList warehouseAList = new ArrayList();     //Create the Warehouse A ArrayList.                                   
         ArrayList warehouseBList = new ArrayList(); //Create the Warehouse B arrayList.
         ArrayList warehouseCList = new ArrayList(); //Create the Warehouse C arrayList.
         /** Construct a new Inventory object. */
         public Inventory()
              super();
         /**Add items to the Warehouse A ArrayList.*/
         private void createWareHouseA()
              System.out.println("!" + toAdd + " item types will be added to warehouse A.");
              //Cast
              String strNumInStock = Integer.toString(intNumInStock);
              String strValueOfOneItem = Double.toString(dblValueOfOneItem);
              this.strNumberInStock = strNumInStock;
              System.out.println("!Initial size of warehouseAList :  " +
                                                                warehouseAList.size());
              //Add items to the array List
              warehouseAList.add(this.strItemName);
              warehouseAList.add(this.strNumberInStock);
              warehouseAList.add(this.dblValueOfOneItem);
              System.out.println("!size of arrayList after additions " + warehouseAList.size());
         /**Add items to the Warehouse B ArrayList.*/
         private void createWareHouseB()
              System.out.println("!" + toAdd + " item types will be added to warehouse B.");
              //Cast
              String strNumInStock = Integer.toString(intNumInStock);
              String strValueOfOneItem = Double.toString(dblValueOfOneItem);
              this.strNumberInStock = strNumInStock;
              System.out.println("!Initial size of warehouseBList :  " +
                                                                warehouseBList.size());
              //Add items to the array List
              warehouseBList.add(this.strItemName);
              warehouseBList.add(this.strNumberInStock);
              warehouseBList.add(this.dblValueOfOneItem);
              System.out.println("!size of arrayList after additions " + warehouseBList.size());
         /**Add items to the Warehouse C ArrayList.*/
         private void createWareHouseC()
              System.out.println("!" + toAdd + " item types will be added to warehouse C.");
              //Cast
              String strNumInStock = Integer.toString(intNumInStock);
              String strValueOfOneItem = Double.toString(dblValueOfOneItem);
              this.strNumberInStock = strNumInStock;
              System.out.println("!Initial size of warehouseCList :  " +
                                                                warehouseCList.size());
              //Add items to the array List
              warehouseCList.add(this.strItemName);
              warehouseCList.add(this.strNumberInStock);
              warehouseCList.add(this.dblValueOfOneItem);
              System.out.println("!size of arrayList after additions " + warehouseCList.size());
         /**Interpret the commands entered by the user.*/
         public void cmdInterpreter()
              this.displayHelp();
              Scanner cin = new Scanner(System.in);
              while (!this.done)
                   System.out.print(">");
                   //"line" equals the next line of input.
                   String line = cin.nextLine();
                   this.executeCmd(line);
         /**Execute one line entered by the user.
          * @param cmdLN; The command entered by the user to execute. */
          private void executeCmd(String cmdLN)
               Scanner line = new Scanner(cmdLN);
               if (line.hasNext())
                    String cmd = line.next();
                    //What to do when users enter the various commands below.
                    if (cmd.equals("help"))
                         this.displayHelp();
                    else if (cmd.equals("Q!"))
                         this.done = true;
                    else if (cmd.equals("F") && line.hasNext())
                         this.inputFromFile(line.next());
                    else if (cmd.equals("K") && line.hasNext())
                         int numItemsToAdd = Integer.valueOf( line.next() ).intValue();
                         this.toAdd = numItemsToAdd;
                         this.inputFromKeyboard(numItemsToAdd);
          /**What to do if input comes from a file.
           *     @param inputFile; The name of the input file to process.*/
          private void inputFromFile(String inputFile)
               Scanner cin = new Scanner(System.in);
               System.out.println("!Using input file " + inputFile + ".");
               System.out.print("!Enter the name of the output file: ");
               String outputFile = cin.next();
               System.out.println("!Using output file " + outputFile + ".");
              try
                   BufferedReader in = new BufferedReader(new FileReader(inputFile));
                   //Scanner in = new Scanner(new File(inputFile));
                   //Initialize the String variables.
                   String line1 = null;
                   String line2 = null;
                   String line3 = null;
                   String line4 = null;
                   String line5 = null;
                   String line6 = null;
                   String line7 = null;
                   String line8 = null;
                   String line9 = null;
                   System.out.println(in.equals(",") + " see?");
                   //System.out.println((char)(char)in.read() + " experiment");
                   /**This loop assigns values to the string variables based on the
                    * values on each line in the input file. */
                   while(in.readLine() != null)
                        line1 = in.readLine();
                        line2 = in.readLine();
                        line3 = in.readLine();
                        line4 = in.readLine();
                        line5 = in.readLine();
                        line6 = in.readLine();
                        line7 = in.readLine();
                        line8 = in.readLine();
                        line9 = in.readLine();
                   //Print the contents of each line in the input file.
                   System.out.println("!value of line 1: " + line1);
                   System.out.println("!value of line 2: " + line2);
                   System.out.println("!value of line 3: " + line3);
                   System.out.println("!value of line 4: " + line4);
                   System.out.println("!value of line 5: " + line5);
                   System.out.println("!value of line 6: " + line6);
                   System.out.println("!value of line 7: " + line7);
                   System.out.println("!value of line 8: " + line8);
                   System.out.println("!value of line 9: " + line9);
                /**Add items to the warehouses.*/
                   warehouseAList.add(line1);
                   warehouseBList.add(line4);
                   warehouseCList.add(line7);
                /**Add the item count and total value for warehouse A.*/
                   int intLine2 = Integer.valueOf(line2).intValue();
                   this.intWarehouseAItemCount = intLine2;
                   double dblLine3 = Double.valueOf(line3).doubleValue();
                   this.dblTotalValueA = dblLine3;
                /**Add the item count and total value for warehouse B.*/
                   int intLine5 = Integer.valueOf(line5).intValue();
                   this.intWarehouseBItemCount = intLine5;
                   double dblLine6 = Double.valueOf(line6).doubleValue();
                   this.dblTotalValueB = dblLine6;
                /**Add the item count and total value for warehouse C.*/
                  int intLine8 = Integer.valueOf(line8).intValue();
                  this.intWarehouseCItemCount = intLine8;
                  double dblLine9 = Double.valueOf(line9).doubleValue();
                  this.dblTotalValueC = dblLine9;
                /**Ask the user how many items to add or delete from inventory.*/
                  System.out.print("Enter the number to add to inventory for " +
                                                               warehouseAList.get(0) + ":");
                  String toAddOrDel = cin.next();
                /**Print the contents of all the warehouses. */
                   System.out.println(" ");
                   //Print the contents of warehouse A.
                   System.out.println("!--------------------------------");
                   System.out.println("!----------Warehouse A:----------");
                   System.out.println("!--------------------------------");
                   //Print the item list for warehouse A.
                   System.out.println(warehouseAList);
                   //Print the total amount of items in warehouse A.
                   System.out.println("Total items: " + this.intWarehouseAItemCount);
                   //Print the total value of the items in warehouse A.
                   System.out.println("Total value: " + this.dblTotalValueA);
                   System.out.println("!--------------------------------");
                   System.out.println("!----------Warehouse B:----------");
                   System.out.println("!--------------------------------");
                   //Print the item list for warehouse B.
                   System.out.println("!warehouseB: " + warehouseBList);
                   //Print the total amount of items in warehouse B.
                   System.out.println("Total items: " + this.intWarehouseBItemCount);
                   //Print the total value of the items in warehouse B.
                   System.out.println("Total value: " + this.dblTotalValueB);
                   System.out.println("!--------------------------------");
                   System.out.println("!----------Warehouse C:----------");
                   System.out.println("!--------------------------------");
                   //Print the item list for warehouse C.
                   System.out.println("!warehouseC: " + warehouseCList);
                   //Print the total amount of items in warehouse C.
                   System.out.println("Total items: " + this.intWarehouseCItemCount);
                   //Print the total value of the items in warehouse C.
                   System.out.println("Total value: " + this.dblTotalValueC);
                   in.close();
              catch (FileNotFoundException e)
                   System.out.println("!Error: Unable to open file for reading.");
              catch (EOFException e)
                   System.out.println("!Error: EOF encountered, file may be corrupted.");
              catch (IOException e)
                   System.out.println("!Error: Cannot read from file.");
          /**What to do if input comes from the keyboard.
           *     @param numItems; The total number of items that will be added to the
           *                      Warehouse(s). */
          public void inputFromKeyboard(int numItems)
               System.out.println("!You will be adding " + numItems + " items to " +
                                             "inventory from the keyboard. ");
               this.toAdd = numItems;
               Scanner cin = new Scanner(System.in);
               //Prompt user for name of output file.
               System.out.print("!Enter the name of the output file: ");
               String outputFile = cin.next();
               /**This loop asks the user for information about the item(s) and inputs
                 *them into the appropriate array.*/
               int count = 0;
               while (numItems > count)
                    //Item name.
                    System.out.print("!Item name: ");
                    String addItemName = cin.next();
                    //Number in stock.
                    System.out.print("!Number in stock: ");
                    String addNumInStock = cin.next();
                    //Initial warehouse.
                    System.out.print("!Initial warehouse(A,B,C): ");
                    String addInitWarehouse = cin.next();
                    //Value of one item.
                    System.out.print("!Value of one item: ");
                    String addValueOfOneItem = cin.next();
                    //Add or delete from inventory
                    System.out.print("!Enter amount to add or delete from inventory: ");
                    String strAddOrDelete = cin.next();
                    System.out.println("!Amount to add or delete: " + strAddOrDelete);
                    //Cast
                    int intAddNumInStock = Integer.valueOf(addNumInStock).intValue();
                    double doubleAddValueOfOneItem = Double.valueOf(addValueOfOneItem).doubleValue();
                    int intAddOrDelete = Integer.valueOf(strAddOrDelete).intValue();
                    /**Add intAddNumInStock with intAddOrDelete to determine the amount
                     * to add or delete from inventory (If a user wishes to remove items
                     * from inventory simply add negative values). */
                    intAddNumInStock = intAddNumInStock + intAddOrDelete;
                    System.out.println("!Inventory after modifications: " + strAddOrDelete);
                    this.strItemName = addItemName;
                    this.intNumInStock = intAddNumInStock;
                    this.dblValueOfOneItem = doubleAddValueOfOneItem;
                    //Put items into warehouse A if appropriate.
                    if (intAddNumInStock < 25)
                        //Increment the warehouse A item count.
                        this.intWarehouseAItemCount = this.intWarehouseAItemCount + 1;
                        //Calculate the total value of warehouse A.
                        this.dblTotalValueA = this.dblTotalValueA + intAddNumInStock * doubleAddValueOfOneItem;
                        //Create the warehouse A array list.
                        this.createWareHouseA();
                    //Put items into warehouse B if appropriate.
                    if (intAddNumInStock >= 25)
                        if (intAddNumInStock < 75)
                             //Increment the warehouse B item count.
                             this.intWarehouseBItemCount = this.intWarehouseBItemCount + 1;
                             //Calculate the total value of warehouse B.
                             this.dblTotalValueB = this.dblTotalValueB + intAddNumInStock * doubleAddValueOfOneItem;
                             //Create the warehouse B array list.
                             this.createWareHouseB();
                    //Put items into warehouse C if appropriate.
                    if (intAddNumInStock >= 75)
                        //Increment the warehouse C item count.
                        this.intWarehouseCItemCount = this.intWarehouseCItemCount + 1;
                        //Calculate the total value of warehouse C.
                        this.dblTotalValueC = this.dblTotalValueC + intAddNumInStock * doubleAddValueOfOneItem;
                        //Create the warehouse C array list.
                        this.createWareHouseC();
                     //display helpful information.      
                    System.out.println("!--------------------------------");
                    System.out.println("!" + addItemName + " is the item name.");
                    System.out.println("!" + addNumInStock + " is the number in stock.");
                    System.out.println("!" + addInitWarehouse + " is the initial warehouse.");
                    System.out.println("!" + addValueOfOneItem + " is the value of one item.");
                    System.out.println("!--------------------------------------------------");
                   //Increment the counters.
                    count++;
               /**Create and write to the output file. */
               try
                     //Use the output file specified by the user.
                    PrintWriter out = new PrintWriter(outputFile);
                 /**Write warehouse A details.*/
                      //Blank the first line.
                      out.println(" ");
                    //Write the array list for warehouse A.
                    out.println(warehouseAList);
                    //Write the amount of items in warehouse A.
                    out.println(intWarehouseAItemCount);
                    //Write the total value for warehouse A.
                    out.println(dblTotalValueA);
                 /**Write warehosue B details.*/
                   //Write the array list for warehouse B.
                    out.println(warehouseBList);
                    //Write the amount of items in warehouse B.
                    out.println(intWarehouseBItemCount);
                    //Write the total value for warehouse B.
                    out.println(dblTotalValueB);
                 /**Write warehouse C details.*/
                      //Write the array list for warehouse C.
                    out.println(warehouseCList);
                    //Write the amount of items in warehouse C.
                    out.println(intWarehouseCItemCount);
                    //Write the total value for warehouse C.
                    out.println(dblTotalValueC);
                    //Close the output file.
                    out.close();     
                catch (FileNotFoundException e)
                   System.out.println("Error: Unable to open file for reading.");
               catch (IOException e)
                   System.out.println("Error: Cannot read from file.");
               /**View the contents and the value of each warehouse.*/
               System.out.println("!---------------Inventory Summary------------------");
               System.out.println("!--------------------------------------------------");
               System.out.println("!--------------------LEGEND:-----------------------");
               System.out.println("!<item type>, <amount in stock>,<value of one item>");
               System.out.println("!--------------------------------------------------");
               System.out.println("!------------------Warehouse A:--------------------");
               System.out.println("!--------------------------------------------------");
               //Display Items in warehouse A.
               System.out.println(warehouseAList);
               //Total items in warehouse A.
               System.out.println("Total items: " + intWarehouseAItemCount);
               //Display total value of warehouse A.
               System.out.println("Total value: " + "$" + dblTotalValueA);
               System.out.println("!--------------------------------------------------");
               System.out.println("!------------------Warehouse B:--------------------");
               System.out.println("!--------------------------------------------------");
               //Display Items in warehouse B.
               System.out.println(warehouseBList);
               //Total items in warehouse B.
               System.out.println("Total items: " + intWarehouseBItemCount);
               //Display total value of warehouse B.
               System.out.println("Total value: " + "$" + dblTotalValueB);
               System.out.println("!--------------------------------------------------");
               System.out.println("!------------------Warehouse C:--------------------");
               System.out.println("!--------------------------------------------------");
               //Display Items in warehouse C.
               System.out.println(warehouseCList);
               //Total items in warehouse C.
               System.out.println("Total items: " + intWarehouseCItemCount);
               //Display total value of warehouse C.
               System.out.println("Total value: " + "$" + dblTotalValueC);
         /**Display a help message.*/
         private void displayHelp()
              System.out.println("!--------------------------------");
              System.out.println("! General Help:");
              System.out.println("!--------------------------------");
              System.out.println("! ");
              System.out.println("!'help' display this help message.");
              System.out.println("!'Q!' quit this program.");
              System.out.println("!--------------------------------");
              System.out.println("! Input File Specific Commands:");
              System.out.println("!--------------------------------");
              System.out.println("! ");
              System.out.println("!'F' <name> type F followed by the name of the " +
                                       "file to be used for input.");
              System.out.println("!---------------------------------------");
              System.out.println("! Input From Keyboard Specific Commands:");
              System.out.println("!---------------------------------------");
              System.out.println("! ");
              System.out.println("!'K' <number> type K followed by the number of " +
                                        "items that will be added. ");
              System.out.println("! ");
    }Program file:
    public class InventoryProg
         public static void main(String[] args)
              //Create a new Inventory object.
              Inventory test = new Inventory();
              //Execute the command interpreter.
              test.cmdInterpreter();
    }Right now I am stuck on this and I cannot progress any further until I figure out how to input the data in the text file back into a arraylist.
    Thanks in advance.

    Thanks but I figured it out. Heres a sample of the code i used to solve my problem:
    try
                           //Warehouse A BufferedReader.
                   BufferedReader inA = new BufferedReader(new FileReader(inputFileWarehouseA));
                   //Warehouse B BufferedReader.
                   BufferedReader inB = new BufferedReader(new FileReader(inputFileWarehouseB));
                   //Warehouse C BufferedReader.
                   BufferedReader inC = new BufferedReader(new FileReader(inputFileWarehouseC));
                   //Warehouse details BufferedReader.
                   BufferedReader inDetails = new BufferedReader(new FileReader(inputFileDetails));
                   //Will hold values in warehouse arraylists.
                   String lineA = null;
                   String lineB = null;
                   String lineC = null;
                   //Will hold the details of each warehouse.
                   String line1 = null;
                   String line2 = null;
                   String line3 = null;
                   String line4 = null;
                   String line5 = null;
                   String line6 = null;
                   //Get the item count and total value for each warehouse.
                   while(inDetails.readLine() != null)
                        line1 = inDetails.readLine();
                        line2 = inDetails.readLine();
                        line3 = inDetails.readLine();
                        line4 = inDetails.readLine();
                        line5 = inDetails.readLine();
                        line6 = inDetails.readLine();
               /**Assign the item count and total value to warehouse A.*/
                  //Cast.
                   int intLine1 = Integer.valueOf(line1).intValue();
                   double dblLine2 = Double.valueOf(line2).doubleValue();
                   //Assign the values.
                   this.intWarehouseAItemCount = intLine1;
                   this.dblTotalValueA = dblLine2;
                /**Assign the item count and total value to warehouse B.*/
                     //Cast.
                   int intLine3 = Integer.valueOf(line3).intValue();
                   double dblLine4 = Double.valueOf(line4).doubleValue();
                     //Assign the values.
                   this.intWarehouseBItemCount = intLine3;
                   this.dblTotalValueB = dblLine4;
                /**Assign the item count and total value to warehouse C.*/
                     //Cast.
                     int intLine5 = Integer.valueOf(line5).intValue();
                   double dblLine6 = Double.valueOf(line6).doubleValue();
                   //Assign the values.
                   this.intWarehouseCItemCount = intLine5;
                   this.dblTotalValueC = dblLine6;
                /**Put the items back into the warehouses arraylists. */
                   //Add items to warehouse A.
                   while((lineA = inA.readLine()) != null)
                        warehouseAList.add(lineA);
                   //Add items to warehouse B.
                   while((lineB = inB.readLine()) != null)
                        warehouseBList.add(lineB);
                   //Add items to warehouse C.
                   while((lineC = inC.readLine()) != null)
                        warehouseCList.add(lineC);
                   }(this isn't the whole try statement its pretty long)

  • 12c Create Control File for Entire CDB (CDB-root + PDBs)

    Hi,
    In 12c, I understand that there is a single redo log and a single control file for an entire CDB. My question is what datafiles should I use to create control file for the entire CDB. According to Managing Control Files, I suppose I should use all the datafiles (the result of query from CDB-Root: select name from v$datafile), but in practice, the control file creation process can only be successful when I use CDB-Root databfiles. Thanks in advance for any advice.

    The actual error message is duplicate tablespace (system, sysaux), but the root-CDB and PDBs should have separate system and sysaux. The following is the script I used.
    CREATE CONTROLFILE REUSE DATABASE "CDB" RESETLOGS  ARCHIVELOG
        MAXLOGFILES 16
        MAXLOGMEMBERS 3
        MAXDATAFILES 1024
        MAXINSTANCES 8
        MAXLOGHISTORY 292
    LOGFILE
      GROUP 1 '/cdbdata/cdb/redo01.log'  SIZE 50M BLOCKSIZE 512,
      GROUP 2 '/cdbdata/cdb/redo02.log'  SIZE 50M BLOCKSIZE 512,
      GROUP 3 '/cdbdata/cdb/redo03.log'  SIZE 50M BLOCKSIZE 512
    DATAFILE
      '/cdbdata/cdb/system01.dbf',
      '/cdbdata/cdb/sysaux01.dbf',
      '/cdbdata/cdb/undotbs01.dbf',
      '/cdbdata/cdb/pdbseed/system01.dbf',
      '/cdbdata/cdb/users01.dbf',
      '/cdbdata/cdb/pdbseed/sysaux01.dbf',
      '/cdbdata/cdb/pdb1/system01.dbf',
      '/cdbdata/cdb/pdb1/sysaux01.dbf',
      '/cdbdata/cdb/pdb1/pdb1_users01.dbf'
    CHARACTER SET WE8MSWIN1252

  • Dynamic alter tablespace statement to add datafiles

    Hi Gurus,
    I need a PL/SQL stored procedure which will accept a datafile name as parameter and dynamically create and execute "alter tablespace" command to add this passed datafile dynamically.
    Thanks
    Amitava.

    See this demo : 11.2.0.1 Windows
    Before running this demo, I logged into SYS account and said :
    grant create tablespace to scott;
    grant select on dba_tablespaces to scott;
    grant select on dba_data_files to scott;
    grant alter tablespace to scott;
    even scott user is having DBA role. Then I login as scott user and :
    set serveroutput on;
    create or replace procedure create_tbs(tbs_name in varchar2, filename in varchar2) as
    rt dba_tablespaces%rowtype;
    str_tbs varchar2(500);
    v_tbs varchar2(100);
    begin
    str_tbs := 'create tablespace ' || tbs_name || ' datafile '''||filename|| ''' size 1m' ;
    dbms_output.put_line(str_tbs);
    select * into rt from dba_tablespaces where tablespace_name=upper(tbs_name);
    dbms_output.put_line('tablespace exists');
    exception
    when no_data_found then
    execute immediate str_tbs;
    dbms_output.put_line('tablespace was created');
    end;
    select tablespace_name from dba_tablespaces;
    TABLESPACE_NAME
    SYSTEM
    SYSAUX
    UNDOTBS1
    TEMP
    USERS
    EXAMPLE
    PERFSTAT
    7 rows selected.
    SQL> exec create_tbs('TESTTBS','c:\data\test.dbf');
    create tablespace TESTTBS datafile 'c:\data\test.dbf' size 1m
    tablespace was created
    PL/SQL procedure successfully completed.
    SQL> exec create_tbs('SYSAUX','c:\data\test.dbf');
    create tablespace SYSAUX datafile 'c:\data\test.dbf' size 1m
    tablespace exists
    PL/SQL procedure successfully completed.
    SQL> drop tablespace testtbs including contents and datafiles;
    Tablespace dropped.
    SQL>Now I am going to create add datafile procedure, which is your question :
    column file_name for a50;
    column tablespace_name for a20;
    select file_name,tablespace_name from dba_data_files;
    FILE_NAME                                          TABLESPACE_NAME
    E:\APP\SERVERROOM\ORADATA\ORCL\USERS01.DBF         USERS
    E:\APP\SERVERROOM\ORADATA\ORCL\UNDOTBS01.DBF       UNDOTBS1
    E:\APP\SERVERROOM\ORADATA\ORCL\SYSAUX01.DBF        SYSAUX
    E:\APP\SERVERROOM\ORADATA\ORCL\SYSTEM01.DBF        SYSTEM
    E:\APP\SERVERROOM\ORADATA\ORCL\EXAMPLE01.DBF       EXAMPLE
    E:\APP\SERVERROOM\ORADATA\ORCL\PERFSTAT            PERFSTAT
    6 rows selected.
    create or replace procedure alter_tbs(tbs_name in varchar2, filename in varchar2) as
    rt dba_data_files%rowtype;
    str_tbs varchar2(500);
    v_tbs varchar2(100);
    begin
    str_tbs := 'alter tablespace ' || tbs_name || ' add datafile '''||filename|| ''' size 10m' ;
    dbms_output.put_line(str_tbs);
    select * into rt from dba_data_files where tablespace_name=upper(tbs_name) and file_name=upper(filename);
    dbms_output.put_line('Datafile already exists.');
    exception
    when no_data_found then
    execute immediate str_tbs;
    dbms_output.put_line('Datafile added.');
    end;
    SQL> exec alter_tbs('users','E:\APP\SERVERROOM\ORADATA\ORCL\USERS01A.DBF');
    alter tablespace users add datafile 'E:\APP\SERVERROOM\ORADATA\ORCL\USERS01A.DBF' size 10m
    Datafile added.
    PL/SQL procedure successfully completed.
    SQL> column file_name for a50;
    SQL> column tablespace_name for a20;
    SQL> select file_name,tablespace_name from dba_data_files;
    FILE_NAME                                          TABLESPACE_NAME
    E:\APP\SERVERROOM\ORADATA\ORCL\USERS01.DBF         USERS
    E:\APP\SERVERROOM\ORADATA\ORCL\UNDOTBS01.DBF       UNDOTBS1
    E:\APP\SERVERROOM\ORADATA\ORCL\SYSAUX01.DBF        SYSAUX
    E:\APP\SERVERROOM\ORADATA\ORCL\SYSTEM01.DBF        SYSTEM
    E:\APP\SERVERROOM\ORADATA\ORCL\EXAMPLE01.DBF       EXAMPLE
    E:\APP\SERVERROOM\ORADATA\ORCL\PERFSTAT            PERFSTAT
    E:\APP\SERVERROOM\ORADATA\ORCL\USERS01A.DBF        USERS
    7 rows selected.
    SQL> alter tablespace users drop datafile 'E:\APP\SERVERROOM\ORADATA\ORCL\USERS01A.DBF';
    Tablespace altered.
    SQL> select file_name,tablespace_name from dba_data_files;
    FILE_NAME                                          TABLESPACE_NAME
    E:\APP\SERVERROOM\ORADATA\ORCL\USERS01.DBF         USERS
    E:\APP\SERVERROOM\ORADATA\ORCL\UNDOTBS01.DBF       UNDOTBS1
    E:\APP\SERVERROOM\ORADATA\ORCL\SYSAUX01.DBF        SYSAUX
    E:\APP\SERVERROOM\ORADATA\ORCL\SYSTEM01.DBF        SYSTEM
    E:\APP\SERVERROOM\ORADATA\ORCL\EXAMPLE01.DBF       EXAMPLE
    E:\APP\SERVERROOM\ORADATA\ORCL\PERFSTAT            PERFSTAT
    6 rows selected.
    SQL>Similar thread : Create a procedure to dynamically add a tablespace
    Regards
    Girish Sharma

  • I am using numbers in the new iWork. Just bought it 10 days back. I am not able to figure out how to add serial umbers from 1 to 100( for example) also i need to freeze the top header like in windows so that we can browse down without the heading going of

    i am using numbers in the new iWork. Just bought it 10 days back. I am not able to figure out how to add serial umbers from 1 to 100( for example) also i need to freeze the top header like in windows so that we can browse down without the heading going off. Can some one help?

    Hi Jay,
    Be aware that "Freeze Header Rows" and "Freeze Header Columns" apply only to rows and columns that are Header rows or Header columns. You can have up to five Header rows, Five Header Columns (and five Footer rows) on a Numbers Table.
    "Header rows" is a special designation. Besides being able to be frozen, Header and Footer rows are not included in formulas referencing whole columns, making it possible to place formulas such as =SUM(B) at the top (or bottom) of column B without causing a self-reference error, These designated rows are also not included in sorts of the rows in a table.
    Regards,
    Barry

  • How do I uninstall an add on file from the Seamonkey browser?

    HOW DO I UNINSTALL AN ADD ON FILE FROM MY SEAMONKEY BROWSER?
    Mozilla needs to make their products more user friendly. There is a multitude of people out there
    who are "NOT" very computer literate. Older people like myself, for example, who are old
    school, have a difficult time being dragged kicking and screaming into the electronic generation.
    My grandchildren are better at this kind of stuff than I am; yet we really don't have much choice
    but to try and make the transition, because I have found that there are a lot of types of business
    that you cannot get done unless you are willing to do it with a computer, going online.
    My problem is not with Firefox (I don't use it because it is too slow) , because I use the Seamonkey browser. The problem I now have is that when I try to download some software, I get a message that says I must first uninstall a certain “add on” file, (npfdm.dll.), a "Free Download Manager" file. When I get the list of add ons through the “help” drop down menu, there is “NO” link or any way I can see that will allow me to uninstall this file from the add on list. Therefore, Seamonkey becomes useless to me. Someone please help me with this. Thank you.
    Tim Applegarth
    Phone: xxx-xxx-xxxx
    Email: [email protected]
    edit removed email/phone number as only spambots will be making use of them though it may be too late as this is a public forum.

    SeaMonkey support is over here - http://forums.mozillazine.org/viewforum.php?f=40

Maybe you are looking for

  • Macbook to HDTV black bars

    Hello, I am running my macbook in clamshell mode connected to my new 40 inch Samsung LN40A500TF TV, I am using the mini dvi to VGA connector and have the resolution set to 1920*1080, everything works pretty well except the screen is sandwiched and ce

  • Why doesn't my Skype video work?

    I have a mini iPad. Everything works great on it but when I try to Skype with video I get no connection. Why? So I have to go on my MacBook in order to use Skype properly. iPad

  • Can I sync both my ipod Touch and iphone to the same itunes account.

    I have an ipod touch and ipod classic that both sync to the same itunes account, and I'm thinking of getting an iphone. Will I be able to use the same apps on the iphone and ipod touch?

  • Cant find my apple ID

    hey heres an nother problem iv found what i dont know how to fix when i go to apple to reset my password i dont know why but my email it says its not there so i put in forgot ID then it says name second name then your email and when i put it all in i

  • AS3 Math issue

    If i have this code: var test: Boolean; test = false; if (2 == 2 == 1)     test = true; trace (test); Result: true. var test: Boolean; test = false; if (2 == 2 == 2)     test = true; trace (test); Result: false var test: Boolean; test = false; if (2