Output from a Database

I have a program which takes user input, searches keywords, if the keywords are found a specific SQL query is sent to the database and the results are output.
I'm having problems with the output because there are obviously a few tables in the database each with different numbers of fields in there.
The current program I have outputs the first 4 fields from the table. If there are less that 4 fields then an error occurs and I can't retrieve more than 4 for those tables with more than 4 fields. (I hope this makes sense)
I know why this is happening, because I have a rs.getString 4 times, I was wondering if there was a way to have a sort of loop which keeps looking and outputtng to the screen until there are no more fields in the table to display.
My current code is below.
import java.io.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.*;
import javax.swing.JOptionPane;
public class SQL  {
     public static void main(String[] args)throws IOException{
     String text =  JOptionPane.showInputDialog("Please enter your sentence here");
    String text2= null;
    String text3 = "";
    StringTokenizer st;
    String[] keyword = {"employees", "managers"};  
    String[] keyword2 = {"employees", "admins"};
    String[] keyword3 = {"employees", "analysts"};
    String[] keyword4 = {"employees", "programmers"};
    String firstString;
    String secondString;
    String thirdString;
    String fourthString;
    String Url = "jdbc:mysql://localhost:3306/NLP?user=root&password=m1t35h";
    String dbClass = "com.mysql.jdbc.Driver";
    String query = null;
    int key = 0;
     st = new StringTokenizer (text, " ");
     int count;
          while (st.hasMoreElements()){
                text2 = (st.nextToken());
                System.out.println (text2);
                text3 = text3 + " " + text2;
          String[] words = text3.split (" ");
     for (int i=0; i < words.length; i++){
       System.out.println (words);
     count = words.length;
     while (i < count){
          String Word = words[i];
          if (Word.equals ("managers")){
               key ++;
               else if (Word.equals ("employees")){
               key ++;
          i++;
     if (key == 2){
          System.out.println("SELECT * FROM employees WHERE Position = 'Manager'");
          query ="SELECT * FROM employees WHERE Position = 'Manager'";
          key = 0;
          i = 0;
     else {
               key= 0;
               i = 0;
     while (i < count){
               String Word = words[i];
               if (Word.equals ("programmers")){
                    key ++;
                    else if (Word.equals ("employees")){
                    key ++;
               i++;
          if (key == 2){
               System.out.println("SELECT * FROM employees WHERE Position = 'programmer'");
               query ="SELECT * FROM employees WHERE Position = 'programmer'";
               key = 0;
               i = 0;
          else {
                    key= 0;
                    i = 0;
     while (i < count){
               String Word = words[i];
          if (Word.equals ("admins")){
                    key ++;
          else if (Word.equals ("employees")){
                    key ++;
               i++;
     if (key == 2){
     System.out.println("SELECT * FROM employees WHERE Position = 'admin'");
     query = "SELECT * FROM employees WHERE Position = 'admin'";
          key = 0;
          i=0;
     else {
               key= 0;
               i=0;
     while (i < count){
          String Word = words[i];
     if (Word.equals ("analysts")){
               key ++;
     else if (Word.equals ("employees")){
               key ++;
          i++;
     if (key == 2){
     System.out.println("SELECT * FROM employees WHERE Position = 'analyst'");
     query = "SELECT * FROM employees WHERE Position = 'analyst'";
          key = 0;
     else {
     if (key > 0){
     System.out.println();
     try {
          Class.forName("com.mysql.jdbc.Driver");
          Connection con = DriverManager.getConnection (Url);
          Statement stmt = con.createStatement();
          ResultSet rs = stmt.executeQuery(query);
          while (rs.next()) {
          class ConsoleOutput {
               public void main(String[] args) {
               firstString = rs.getString(1);
               secondString = rs.getString(2);
               thirdString = rs.getString(3);
               fourthString = rs.getString(4);
               System.out.println(firstString + " " + secondString + " " + thirdString + " " + fourthString);
               } //end while
          con.close();
          } //end try
          catch(ClassNotFoundException e) {
          e.printStackTrace();
          catch(SQLException e) {
          e.printStackTrace();
     else {
          System.err.println("Not Found");
Thank you in advance                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Mitty_NTU wrote:
Encephalopathic, Can you stop wasting peoples time if you do not have anything constructive to say.Please read this and then tell me how it is not relevant to your posting habits.: [http://faq.javaranch.com/java/BeForthrightWhenCrossPostingToOtherSites]

Similar Messages

  • Inserting or embed and image into cfmail output from a database-stored path to an actual image.

    I am trying to insert or embed and image into cfmail from a database-stored path to an actual image. The actual JPEG image is stored in a folder called "images_personnel". The path to the image under the column titled photopath is stored in my database table as "/file/images_personnel/28.jpg". Displaying the image on the screen renders without a problem, embedding the same image as part of a cfloop query does not insert/embed the image into an email. All of the other output of the same cfloop displays and emails just fine. However none of the photos of each personelle show up. What an I doing wrong?
    My code is below:
    <cfquery name="Staffreport" datasource="master">
    Select staffreport.*, name.personnelid, name.email, name.last, name.noiid, stafflt, CONCAT(name.fname,' ',name.middle,' (',name.last,')') AS teammember, CONCAT(name.fname,' ',name.middle) AS teammember2, concat(name.photopath,'',name.photo)as hisphoto, stafflt.*, trim(concat(ltfname,' ',ltmiddle)) as LT from Staffreport, name, stafflt
    where 0=0
    and stalt = '#Session.user_id#'
    and ltid = '#session.user_id#'
    and staweekbegin = <cfqueryparam value="#form.staweekbegin#" cfsqltype="cf_sql_date" />
    AND staweekend = <cfqueryparam value="#form.staweekend#" cfsqltype="cf_sql_date" />
    AND stapersonnelid = personnelID
    <!---AND ltid = stalt--->
    AND CITY = 'richmond'
    AND STATUS <> 'd'
    AND STATUS <> 'T'
    AND type = 'personnel'
    Group by personnelid
    Order by teammember
    </cfquery>
    <cfmail>...
    <cfloop query="staffreport"><br />
    <table width="90%" border="0" cellspacing="2" cellpadding="4" align="left">
      <tr>
        <td colspan="2" align="center" valign="top" nowrap="nowrap" bgcolor="cccccc"><strong><font color="black"><cfif #staffreport.last# eq ".">#Ucase(Staffreport.teammember2)# <cfelse>#Ucase(Staffreport.teammember)#</cfif> - ID: <cfoutput>#Staffreport.noiid#</cfoutput></font></strong></td>
      </tr>
    <tr>
        <td align="left" valign="top" nowrap="nowrap" bgcolor="#000000">Name:</td>
        <td>#Staffreport.teammember#</td>
      </tr>
    <tr>
        <td bgcolor="E6E1FD">Photo:</td>
        <td bgcolor="EBEBEB">
    <img src="#staffreport.hisphoto#" alt="Photo" width="98" height="98">
    </td>
      </tr>
    <tr>
        <td bgcolor="E6E1FD">Email:</td>
        <td bgcolor="EBEBEB">#staffreport.email#</td>
      </tr>
    </table>
    </cfloop>
    </cfmail>

    You'll need to provide a full URL link to the image ("http://mywebserver/file/images_personnel/28.jpg"), not just a relative path.  Remember, the email client that is used to view the email content knows nothing of the internals of your web server - it can only follow a complete URL to get images and other resources.
    -Carl V.

  • Creating Secure Form that Outputs from a Database?

    I need to create a form that pulls data from a database (of any format) based on what the user enters.  Specifically, I want a customer to be able to enter their name in a field and output data based on their name.  I was about to use a standard PHP mail form methodology, but I realize this would be insecure (I would like to keep my customer list hidden).  Can someone offer a suggestion on what I should look for in creating a secure form/database output structure for my site?  Even if it's just the name of the method so I can search for a tutorial.  Thank you!

    Does it matter that anyone could enter the right name in the form to return the customer data? If so you need to use a password.
    1. Create a form through which the customer can register their details with a user name and password.
    2. On the server side hash the password with something like SHA256 (plenty of open source implementations about or you can create your own).
    3. Store the customer details together with a userid and hashed password in the server database
    4. Create a form through which the customer can request their details, and asks them for their userid and password.
    6. On the server side, rehash the password from the form and request a row from the customer database where the userid and hashed password match an entry
    7. Return the customer data if row retrieved from database else return a message saying on data matching those details etc.
    Regards
    Phil

  • Is it Possible to upload the output from Oracle reports To Access database

    Hi All,
    Wish you All a Very Happy New Year.
    I have a query.Is it possible to
    upload the output from the Oracle reports
    to the Access database???
    Any suggestions would be appreciated.
    TIA
    sg

    Hi sg,
    Research the DDE option.
    Dynamic Data Exchange (DDE) is a mechanism by which applications can communicate and exchange data in Windows.
    I have imported data into the excel spreadsheet using DDE built in functions. I am sure it can work with MS Acess as well. If not, then you need to create a 2 step process .. reports -> excel -> access.

  • Dealing with null values from a database (easy?)

    I'm sure this should be a simple question :
    I'm creating a dynamic dropdown of my companies products that once a product is selected draws values (links) from a database and displays them (links to User guides, FAQs etc).
    My problem is dealing with blank entries in the database - i.e. if a product doesn't have a User guide I've left the database blank.
    I'd like to show 'none' or 'not available' if the entry is blank rather than the 'null' I currently get.
    I'm sure it should be a straightforward if .... else .... but I'm struggling and would appreciate any help,
    Many thanks,
    Mo

    Thanks for the message, the cut down piece of code I'm using for the output is:
    <%
    while (rs.next())
    //header row
    out.println("<tr bgcolor='#666666'>");
    out.println("<td><font style='font-family:arial;color:#ffffff;font-size:10px;'>Product Name</font></td>");
    out.println("<td><font style='font-family:arial;color:#ffffff;font-size:10px;'>FAQs</font></td>");
    out.println("<td><font style='font-family:arial;color:#ffffff;font-size:10px;'>Technical Information</font></td>");
    out.println("</tr>");
    //results
    out.println("<tr border='1' bordercolor='#CCCCCC' bgcolor='#FFFFFF'>");
    out.println("<td><font style='font-family:arial;font-size:12px;font-weight:bold;'><a style='text-decoration:none' href=" + rs.getString("ProductURL") + " target='_blank'><font color='#669999'>" + rs.getString("ProductName") + "</a></td>");
    out.println("<td><font style='font-family:arial;color:#000000;font-size:10px;'>" + rs.getString("FAQs") + "</td>");
    out.println("<td><font style='font-family:arial;color:#000000;font-size:10px;'>" + rs.getString("TechInfo") + "</td>");
    out.println("</tr>");
    stmt.close();
    conn.close();
    %>
    It's the FAQs and TechInfo strings I need to use the statement on - if there's no entry show 'none',
    Thanks again,
    Mo

  • Transfer data from one database to another without identities but keep the relation b/w PK and Foreign key

    Hi,
    I need to transfer data from one database to another database (both are identical databases). 
    1. Not transferring identity columns (primary keys). the destination table might have the same key.
    2. keep the PK's and FK's relation b/w parent and child table
    3. I have 4 levels 
    Example: tableA (col1 int identity(1,1) , col2, col3)
    tableB (col1 int identity(1,1) ,
    col2 , col3) -- col2 has the foreign key relation with tableA.col1
    tableC (col1 int identity(1,1) ,
    col2, col3) -- col2  has the foreign key relation with tableB.col1
    tableD (col1 int identity(1,1) , col2, col3) -- col2  has the foreign key relation with tableC.col1
    please advise me.
    Thanks in advance

    Try the below:
    /********************************SAMPLE TARGET***************************************************************/
    Use MSDNSamples
    create table TableA(LevelValueId int identity(1,1) primary key, name varchar(100))
    Insert into TableA(name) Select 'R1'
    Insert into TableA(name) Select 'R2'
    create Table TableB(ChildId int identity(100,1),name varchar(100), LevelValueID int references TableA(LevelValueId))
    Insert into TableB(name,LevelValueID) Select 'Childname1',1
    /********************************SAMPLE TARGET***************************************************************/
    /********************************SAMPLE SOURCE***************************************************************/
    Use Sample
    create table TableA(LevelValueId int identity(1,1) primary key, name varchar(100))
    Insert into TableA(name) Select 'C1'
    Insert into TableA(name) Select 'C2'
    create Table TableB(ChildId int identity(100,1),name varchar(100), LevelValueID int references TableA(LevelValueId))
    Insert into TableB(name,LevelValueID) Select 'Kidname1',1
    /********************************SAMPLE SOURCE***************************************************************/
    USe MSDNSamples
    /********************************MIGRATION INTERMEDIATE TABLE***************************************************************/
    --Migration table
    Create table Mg_TableA(LevelValueId int, NewValueId int)
    /********************************MIGRATION INTERMEDIATE TABLE***************************************************************/
    /********************************ACTUAL MIGRATION FOR MASTER TABLE***************************************************************/
    MERGE INTO TableA
    USING sample.dbo.TableA AS tv
    ON 1 = 0
    WHEN NOT MATCHED THEN
    INSERT(name) Values(tv.name)
    Output tv.levelValueId ,inserted.LevelValueid INTO
    Mg_TableA;
    /********************************ACTUAL MIGRATION FOR MASTER TABLE***************************************************************/
    /********************************ACTUAL MIGRATION FOR CHILD TABLE***************************************************************/
    Insert into TableB (name,LevelValueID)
    Select A.name,B.NewValueId From sample.dbo.TableB A
    Inner join Mg_TableA B on A.LevelValueID = B.LevelValueId
    /********************************ACTUAL MIGRATION FOR CHILD TABLE***************************************************************/
    /********************************TEST THE VALUES***************************************************************/
    Select * From TableA
    Select * From Mg_TableA
    Select * From TableB
    /********************************TEST THE VALUES***************************************************************/
    Drop table TableB,Tablea,Mg_TableA
    Use Sample
    Drop Table TableB,Tablea

  • Error message by periodic weekly: No output from the 1 file processed

    Hi there,
    since four weeks, I got a problem with the maintenance script periodic weekly. Up to December 22nd, the script did, what it should do: rebuilding the database of locate and whatis, rotating log-files. Since one week later, I got the error message: No output from the 1 file processed.
    Normally, I use Anacron to do the job. When I noticed the problem, I tried to start the script with Tinker Tool System getting the same result. Another try using the Terminal (sudo periodic weekly) also failed. The commands locate and whatis are working, locate.updatedb and makewhatis also. I'm running 10.4.8; in the past, I did not have such problems. Anyone with an idea or solution?
    Thanks
    Klaus
    MacBook Pro   Mac OS X (10.4.8)  

    Hi Gary,
    here is the output you were asking for:
    Last login: Thu Jan 25 20:03:55 on console
    Welcome to Darwin!
    DeepThought:~ dirk$ sudo /private/etc/periodic/weekly/500.weekly; echo $?
    Password:
    Sorry, try again.
    Password:
    Rebuilding locate database:
    Rebuilding whatis database:
    find: /usr/local/man: No such file or directory
    makewhatis: /usr/share/man/man1/fetchmailconf.1.gz: No such file or directory
    Rotating log files: ftp.log lpr.log mail.log netinfo.log ipfw.log ppp.log secure.log
    access_log error_log
    Running weekly.local:
    Rotating psync log files:/etc/weekly.local: line 17: syntax error near unexpected token `)'
    /etc/weekly.local: line 17: `if [ -f /var/run/syslog.pid ]; then kill -HUP 0 80 79 81 0cat /var/run/syslog.pid | head -1); fi'
    2
    DeepThought:~ dirk$ ls -loe /private/etc/periodic/weekly/500.weekly
    -r-xr-xr-x 1 root wheel - 2532 Jan 13 2006 /private/etc/periodic/weekly/500.weekly
    DeepThought:~ dirk$
    It seems, Rogers idea, PsynX respectively the deficient uninstalling by me is responsible for my problems, is correct. Should I remove the whole file weekly.local or should I only remove the content? I prefer removing the whole file, because it was created while installing PsyncX. The date of creation is the same as the date of installing the app (December 25).
    Klaus
    By the way: it seems to me, the solution of my problem is in sight. So I want to thank you all for the amazing aid I got from you!

  • Extracting Values of a Field from a Database Table in SAP ECC System

    Hi,
    I downloaded Extracting Values of a Field from a Database Table in SAP ECC System Using MII 12.0
    senario from sdn. I'm trying to do that senario in MII 12.05. But I have problem with section 6 in page 7 (you can supply senario from sdn)
    "6- Under the loop of Repeater, use action u2018Rowu2019 to append just the string part of the WA which will display only values for field u2018Batchu2019"
    I did not find WA elemen in Output element of Repeater_0
    How can I create WA element?
    Thanks.

    Cemil,
    Set up a SAP JCo Interface action block.  Use the RFC name RFC_READ_TABLE.
    In the link editor map the table to "MARA", set RowCount to something small (20 is good sample size) and create an xml transaction property named FIELDS and copy the following into it:
    <?xml version="1.0" encoding="UTF-8"?><FIELDS>
          <item>
            <FIELDNAME>MATNR</FIELDNAME>
            <OFFSET/>
            <LENGTH/>
            <TYPE/>
            <FIELDTEXT/>
          </item>
          <item>
            <FIELDNAME>MTART</FIELDNAME>
            <OFFSET/>
            <LENGTH/>
            <TYPE/>
            <FIELDTEXT/>
          </item>
          <item>
            <FIELDNAME>BSTME</FIELDNAME>
            <OFFSET/>
            <LENGTH/>
            <TYPE/>
            <FIELDTEXT/>
          </item>
          <item>
            <FIELDNAME>XCHPF</FIELDNAME>
            <OFFSET/>
            <LENGTH/>
            <TYPE/>
            <FIELDTEXT/>
          </item>
          <item>
            <FIELDNAME>DATAB</FIELDNAME>
            <OFFSET/>
            <LENGTH/>
            <TYPE/>
            <FIELDTEXT/>
          </item>
        </FIELDS>
    Then link the Transaction.FIELDS to SAP_JCo_Interface_0.Request{/RFC_READ_TABLE/TABLES/FIELDS}.  You may run into problems with two other fields and optionally they can be removed (set link type to remove xml).  I usually remove them initially for testing.  The two fields are:
    SAP_JCo_Interface_0.Request{/RFC_READ_TABLE/INPUT/NO_DATA}
    SAP_JCo_Interface_0.Request{/RFC_READ_TABLE/INPUT/DELIMITER} (or you can set this to something like a semicolon,";" or tilda,"~".  I find it easier to caclulate position by length, but that is my own idiosyncrasy.)
    Once you get this one working, we can explore how to do filtering on the dataset.  Your output should be something like this:
    <?xml version="1.0" encoding="utf-8"?>
    <RFC_READ_TABLE>
      <INPUT>
        <DELIMITER />
        <NO_DATA />
        <QUERY_TABLE>MARA</QUERY_TABLE>
        <ROWCOUNT>20</ROWCOUNT>
        <ROWSKIPS>0</ROWSKIPS>
      </INPUT>
      <TABLES>
        <DATA>
          <item>
            <WA>000000000000000023ROH 00000000</WA>
          </item>
          <item>
            <WA>000000000000000038HALB 00000000</WA>
          </item>
          <item>
            <WA>000000000000000043HAWA 00000000</WA>
          </item>
          <item>
            <WA>000000000000000058HIBE 00000000</WA>
          </item>
          <item>
            <WA>000000000000000059HIBE 00000000</WA>
          </item>
          <item>
            <WA>000000000000000068FHMI 00000000</WA>
          </item>
          <item>
            <WA>000000000000000078DIEN 00000000</WA>
          </item>
          <item>
            <WA>000000000000000088FERT 00000000</WA>
          </item>
          <item>
            <WA>000000000000000089FERT 00000000</WA>
          </item>
          <item>
            <WA>000000000000000098HALB 00000000</WA>
          </item>
          <item>
            <WA>000000000000000170NLAG 00000000</WA>
          </item>
          <item>
            <WA>000000000000000178NLAG 00000000</WA>
          </item>
          <item>
            <WA>000000000000000188NLAG 00000000</WA>
          </item>
          <item>
            <WA>000000000000000288HALB 00000000</WA>
          </item>
          <item>
            <WA>000000000000000358HAWA 00000000</WA>
          </item>
          <item>
            <WA>000000000000000359HAWA 00000000</WA>
          </item>
          <item>
            <WA>000000000000000521HAWA 00000000</WA>
          </item>
          <item>
            <WA>000000000000000578FERT 00000000</WA>
          </item>
          <item>
            <WA>000000000000000597HAWA 00000000</WA>
          </item>
          <item>
            <WA>000000000000000598VERP 00000000</WA>
          </item>
        </DATA>
        <FIELDS>
          <item>
            <FIELDNAME>MATNR</FIELDNAME>
            <OFFSET>000000</OFFSET>
            <LENGTH>000018</LENGTH>
            <TYPE>C</TYPE>
            <FIELDTEXT>Material Number</FIELDTEXT>
          </item>
          <item>
            <FIELDNAME>MTART</FIELDNAME>
            <OFFSET>000018</OFFSET>
            <LENGTH>000004</LENGTH>
            <TYPE>C</TYPE>
            <FIELDTEXT>Material Type</FIELDTEXT>
          </item>
          <item>
            <FIELDNAME>BSTME</FIELDNAME>
            <OFFSET>000022</OFFSET>
            <LENGTH>000003</LENGTH>
            <TYPE>C</TYPE>
            <FIELDTEXT>Purchase Order Unit of Measure</FIELDTEXT>
          </item>
          <item>
            <FIELDNAME>XCHPF</FIELDNAME>
            <OFFSET>000025</OFFSET>
            <LENGTH>000001</LENGTH>
            <TYPE>C</TYPE>
            <FIELDTEXT>Batch management requirement indicator</FIELDTEXT>
          </item>
          <item>
            <FIELDNAME>DATAB</FIELDNAME>
            <OFFSET>000026</OFFSET>
            <LENGTH>000008</LENGTH>
            <TYPE>D</TYPE>
            <FIELDTEXT>Valid-From Date</FIELDTEXT>
          </item>
        </FIELDS>
        <OPTIONS />
      </TABLES>
    </RFC_READ_TABLE>
    Add a repeater sourced on:
    SAP_JCo_Interface_0.Response{/RFC_READ_TABLE/TABLES/DATA/item}
    Link your repeater output to a tracer with this:
    Repeater_0.Output{/item/WA}
    What you will see in each tracer message is a single line of data with all the fields contents concatenated together.  You can look up what each field in the string represents by the length of the field as returned in the Response segment of the RFC_READ_TABLE rfc.  Then you can parse out the data you are interested in.
    Give this a try and let me know how you succeeded.
    By the way, I could not find the scenario you referred to.  Can you post a link?
    Regards,
    Mike
    Edited by: Michael Appleby on Jan 12, 2009 5:16 PM

  • What's the best way to create XML file with a schema from a database table?

    Hi,
    I want to create an XML file from a database table (which has over 600 columns) using XML schema (.xsd file). I want to know the best way to do this.
    The output XML file is NOT a direct data dump from the DB table, there�re some logic around it, such as the XML file has some hierarchy with repeating tags.
    I have done this using JAXB by creating Java classes form XML schema, but I don�t want to map 600 DB columns to these Java classes manually, and loop through the record set to create repeating tags.
    I know there are few tools around now like MapForce (Altova), how do people do these now?
    Thanks,
    Chandi

    Can you use a schema when we compose XML doc from Database tables?
    Actually, I'm using SQL Server (sorry, wrong forum). But, I thought a Java tool would have a solution for me.

  • Export an XML file from oracle database

    plz help me its urgent requirement....could u pls tell me the step by step procedure for following questions...?how to export a data as an XML file from oracle database? is it possible..?
    thanks in advance,
    Bala. is it possible?
    Edited by: user3523292 on Nov 14, 2008 5:45 AM

    Here's the quick and dirty method using SQL*Plus...
    SQL> select * from emp where deptno = 10;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
    SQL> set markup html on
    SQL&gt; select * from emp where deptno = 10;
    <br>
    <p>
    <table border='1' width='90%' align='center' summary='Script output'>
    <tr>
    <th scope="col">
    EMPNO
    </th>
    <th scope="col">
    ENAME
    </th>
    <th scope="col">
    JOB
    </th>
    <th scope="col">
    MGR
    </th>
    <th scope="col">
    HIREDATE
    </th>
    <th scope="col">
    SAL
    </th>
    <th scope="col">
    COMM
    </th>
    <th scope="col">
    DEPTNO
    </th>
    </tr>
    <tr>
    <td align="right">
          7782
    </td>
    <td>
    CLARK
    </td>
    <td>
    MANAGER
    </td>
    <td align="right">
          7839
    </td>
    <td>
    09-JUN-81
    </td>
    <td align="right">
          2450
    </td>
    <td align="right">
    </td>
    <td align="right">
            10
    </td>
    </tr>
    <tr>
    <td align="right">
          7839
    </td>
    <td>
    KING
    </td>
    <td>
    PRESIDENT
    </td>
    <td align="right">
    </td>
    <td>
    17-NOV-81
    </td>
    <td align="right">
          5000
    </td>
    <td align="right">
    </td>
    <td align="right">
            10
    </td>
    </tr>
    <tr>
    <td align="right">
          7934
    </td>
    <td>
    MILLER
    </td>
    <td>
    CLERK
    </td>
    <td align="right">
          7782
    </td>
    <td>
    23-JAN-82
    </td>
    <td align="right">
          1300
    </td>
    <td align="right">
    </td>
    <td align="right">
            10
    </td>
    </tr>
    </table>
    <p>
    SQL&gt;which you can spool to a file.

  • Error during "duplicate target ... from active database"

    hi:
    RMAN duplicate failure after the auxiliary instance mounted,we want to create a physical standby database .
    Platform: solaris10 spark 64bit
    Version: 11.2.0.1.5 (both primary and standby)
    thank you..
    RMAN log:
    rman target sys/password@his_primary auxiliary sys/password@his_standby_tt
    Recovery Manager: Release 11.2.0.1.0 - Production on Thu Aug 30 15:40:06 2012
    Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
    connected to target database: HIS (DBID=3271178181)
    connected to auxiliary database: HIS (not mounted)
    RMAN> duplicate target database for standby from active database;
    Starting Duplicate Db at 30-AUG-12
    using target database control file instead of recovery catalog
    allocated channel: ORA_AUX_DISK_1
    channel ORA_AUX_DISK_1: SID=2833 device type=DISK
    allocated channel: ORA_AUX_DISK_2
    channel ORA_AUX_DISK_2: SID=3399 device type=DISK
    allocated channel: ORA_AUX_DISK_3
    channel ORA_AUX_DISK_3: SID=3966 device type=DISK
    allocated channel: ORA_AUX_DISK_4
    channel ORA_AUX_DISK_4: SID=3 device type=DISK
    contents of Memory Script:
    backup as copy reuse
    targetfile '/u01/oracle/product/11.2.0/db_1/dbs/orapwhis' auxiliary format
    '/u01/app/oracle/product/11.2.0/db_1/dbs/orapwhis' ;
    executing Memory Script
    Starting backup at 30-AUG-12
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=1570 device type=DISK
    allocated channel: ORA_DISK_2
    channel ORA_DISK_2: SID=1708 device type=DISK
    allocated channel: ORA_DISK_3
    channel ORA_DISK_3: SID=1851 device type=DISK
    allocated channel: ORA_DISK_4
    channel ORA_DISK_4: SID=1995 device type=DISK
    Finished backup at 30-AUG-12
    contents of Memory Script:
    backup as copy current controlfile for standby auxiliary format '/u01/app/oradata/his/control01.ctl';
    restore clone controlfile to '/u01/app/oradata/his/control02.ctl' from
    '/u01/app/oradata/his/control01.ctl';
    restore clone controlfile to '/u01/app/oradata/his/control03.ctl' from
    '/u01/app/oradata/his/control01.ctl';
    executing Memory Script
    Starting backup at 30-AUG-12
    using channel ORA_DISK_1
    using channel ORA_DISK_2
    using channel ORA_DISK_3
    using channel ORA_DISK_4
    channel ORA_DISK_1: starting datafile copy
    copying standby control file
    output file name=/export/home/oracle/snap.f tag=TAG20120830T154059 RECID=9 STAMP=792690060
    channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
    Finished backup at 30-AUG-12
    Starting restore at 30-AUG-12
    using channel ORA_AUX_DISK_1
    using channel ORA_AUX_DISK_2
    using channel ORA_AUX_DISK_3
    using channel ORA_AUX_DISK_4
    channel ORA_AUX_DISK_2: skipped, AUTOBACKUP already found
    channel ORA_AUX_DISK_3: skipped, AUTOBACKUP already found
    channel ORA_AUX_DISK_4: skipped, AUTOBACKUP already found
    channel ORA_AUX_DISK_1: copied control file copy
    Finished restore at 30-AUG-12
    Starting restore at 30-AUG-12
    using channel ORA_AUX_DISK_1
    using channel ORA_AUX_DISK_2
    using channel ORA_AUX_DISK_3
    using channel ORA_AUX_DISK_4
    channel ORA_AUX_DISK_2: skipped, AUTOBACKUP already found
    channel ORA_AUX_DISK_3: skipped, AUTOBACKUP already found
    channel ORA_AUX_DISK_4: skipped, AUTOBACKUP already found
    channel ORA_AUX_DISK_1: copied control file copy
    Finished restore at 30-AUG-12
    contents of Memory Script:
    sql clone 'alter database mount standby database';
    executing Memory Script
    sql statement: alter database mount standby database
    contents of Memory Script:
    set newname for tempfile 1 to
    "/u01/app/oradata/his/temp.266.750421813";
    set newname for tempfile 2 to
    "/u01/app/oradata/his/ts_temp_patrol.298.750425277";
    set newname for tempfile 3 to
    "/u01/app/oradata/his/ts_his_temp.296.750427905";
    set newname for tempfile 4 to
    "/u01/app/oradata/his/ts_tjjk_temp.282.750427917";
    set newname for tempfile 5 to
    "/u01/app/oradata/his/ts_temp_shuhao.595.782919539";
    switch clone tempfile all;
    set newname for datafile 1 to
    "/u01/app/oradata/his/system.256.750421615";
    set newname for datafile 2 to
    "/u01/app/oradata/his/sysaux.257.750421615";
    set newname for datafile 3 to
    "/u01/app/oradata/his/undotbs1.258.750421615";
    set newname for datafile 4 to
    "/u01/app/oradata/his/users.259.750421615";
    set newname for datafile 5 to
    "/u01/app/oradata/his/ts_his.280.750425023";
    set newname for datafile 6 to
    "/u01/app/oradata/his/ts_his_index.281.750425025";
    set newname for datafile 7 to
    "/u01/app/oradata/his/system.569.754307341";
    set newname for datafile 8 to
    "/u01/app/oradata/his/ts_bj.283.750425027";
    set newname for datafile 9 to
    "/u01/app/oradata/his/ts_gt.284.750425027";
    set newname for datafile 10 to
    "/u01/app/oradata/his/ts_fx.285.750425027";
    set newname for datafile 11 to
    "/u01/app/oradata/his/ts_uap.286.750425029";
    set newname for datafile 12 to
    "/u01/app/oradata/his/ts_gkxj.287.750425029";
    set newname for datafile 13 to
    "/u01/app/oradata/his/ts_xejj.288.750425031";
    set newname for datafile 14 to
    "/u01/app/oradata/his/ts_zdzyrz.289.750425031";
    set newname for datafile 15 to
    "/u01/app/oradata/his/ts_zj.290.750425033";
    set newname for datafile 16 to
    "/u01/app/oradata/his/ts_jgcp.291.750425033";
    set newname for datafile 17 to
    "/u01/app/oradata/his/ts_gtbj.292.750425033";
    set newname for datafile 18 to
    "/u01/app/oradata/his/ts_base.293.750425035";
    set newname for datafile 19 to
    "/u01/app/oradata/his/ts_exdata.294.750425035";
    set newname for datafile 20 to
    "/u01/app/oradata/his/ts_tjjk.295.750425037";
    set newname for datafile 21 to
    "/u01/app/oradata/his/ts_shuhao.594.782919537";
    set newname for datafile 22 to
    "/u01/app/oradata/his/ts_patrol.297.750425037";
    backup as copy reuse
    datafile 1 auxiliary format
    "/u01/app/oradata/his/system.256.750421615" datafile
    2 auxiliary format
    "/u01/app/oradata/his/sysaux.257.750421615" datafile
    3 auxiliary format
    "/u01/app/oradata/his/undotbs1.258.750421615" datafile
    4 auxiliary format
    "/u01/app/oradata/his/users.259.750421615" datafile
    5 auxiliary format
    "/u01/app/oradata/his/ts_his.280.750425023" datafile
    6 auxiliary format
    "/u01/app/oradata/his/ts_his_index.281.750425025" datafile
    7 auxiliary format
    "/u01/app/oradata/his/system.569.754307341" datafile
    8 auxiliary format
    "/u01/app/oradata/his/ts_bj.283.750425027" datafile
    9 auxiliary format
    "/u01/app/oradata/his/ts_gt.284.750425027" datafile
    10 auxiliary format
    "/u01/app/oradata/his/ts_fx.285.750425027" datafile
    11 auxiliary format
    "/u01/app/oradata/his/ts_uap.286.750425029" datafile
    12 auxiliary format
    "/u01/app/oradata/his/ts_gkxj.287.750425029" datafile
    13 auxiliary format
    "/u01/app/oradata/his/ts_xejj.288.750425031" datafile
    14 auxiliary format
    "/u01/app/oradata/his/ts_zdzyrz.289.750425031" datafile
    15 auxiliary format
    "/u01/app/oradata/his/ts_zj.290.750425033" datafile
    16 auxiliary format
    "/u01/app/oradata/his/ts_jgcp.291.750425033" datafile
    17 auxiliary format
    "/u01/app/oradata/his/ts_gtbj.292.750425033" datafile
    18 auxiliary format
    "/u01/app/oradata/his/ts_base.293.750425035" datafile
    19 auxiliary format
    "/u01/app/oradata/his/ts_exdata.294.750425035" datafile
    20 auxiliary format
    "/u01/app/oradata/his/ts_tjjk.295.750425037" datafile
    21 auxiliary format
    "/u01/app/oradata/his/ts_shuhao.594.782919537" datafile
    22 auxiliary format
    "/u01/app/oradata/his/ts_patrol.297.750425037" ;
    sql 'alter system archive log current';
    executing Memory Script
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    renamed tempfile 1 to /u01/app/oradata/his/temp.266.750421813 in control file
    renamed tempfile 2 to /u01/app/oradata/his/ts_temp_patrol.298.750425277 in control file
    renamed tempfile 3 to /u01/app/oradata/his/ts_his_temp.296.750427905 in control file
    renamed tempfile 4 to /u01/app/oradata/his/ts_tjjk_temp.282.750427917 in control file
    renamed tempfile 5 to /u01/app/oradata/his/ts_temp_shuhao.595.782919539 in control file
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    Starting backup at 30-AUG-12
    using channel ORA_DISK_1
    using channel ORA_DISK_2
    using channel ORA_DISK_3
    using channel ORA_DISK_4
    channel ORA_DISK_1: starting datafile copy
    input datafile file number=00008 name=+DATA/his/datafile/ts_bj.283.750425027
    channel ORA_DISK_2: starting datafile copy
    input datafile file number=00009 name=+DATA/his/datafile/ts_gt.284.750425027
    channel ORA_DISK_3: starting datafile copy
    input datafile file number=00005 name=+DATA/his/datafile/ts_his.280.750425023
    channel ORA_DISK_4: starting datafile copy
    input datafile file number=00015 name=+DATA/his/datafile/ts_zj.290.750425033
    RMAN-03009: failure of backup command on ORA_DISK_3 channel at 08/30/2012 16:10:23
    ORA-19558: error de-allocating device
    ORA-19557: device error, device type: DISK, device name:
    ORA-17627: ORA-01041: internal error. hostdef extension doesn't exist
    ORA-17627: ORA-01041: internal error. hostdef extension doesn't exist
    ORA-03135: connection lost contact
    channel ORA_DISK_3 disabled, job failed on it will be run on another channel
    RMAN-03009: failure of backup command on ORA_DISK_4 channel at 08/30/2012 16:42:19
    ORA-19558: error de-allocating device
    ORA-19557: device error, device type: DISK, device name:
    ORA-17627: ORA-01041: internal error. hostdef extension doesn't exist
    ORA-17627: ORA-01041: internal error. hostdef extension doesn't exist
    ORA-03135: connection lost contact
    channel ORA_DISK_4 disabled, job failed on it will be run on another channel
    RMAN-03009: failure of backup command on ORA_DISK_2 channel at 08/30/2012 16:51:58
    ORA-19558: error de-allocating device
    ORA-19557: device error, device type: DISK, device name:
    ORA-17627: ORA-01041: internal error. hostdef extension doesn't exist
    ORA-17627: ORA-01041: internal error. hostdef extension doesn't exist
    ORA-03135: connection lost contact
    channel ORA_DISK_2 disabled, job failed on it will be run on another channel
    RMAN-03009: failure of backup command on ORA_DISK_1 channel at 08/30/2012 17:49:09
    ORA-19558: error de-allocating device
    ORA-19557: device error, device type: DISK, device name:
    ORA-17627: ORA-01041: internal error. hostdef extension doesn't exist
    ORA-17627: ORA-01041: internal error. hostdef extension doesn't exist
    ORA-03135: connection lost contact
    channel ORA_DISK_1 disabled, job failed on it will be run on another channel
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of Duplicate Db command at 08/30/2012 17:49:09
    RMAN-03015: error occurred in stored script Memory Script
    RMAN-03009: failure of backup command on ORA_DISK_4 channel at 08/30/2012 16:42:19
    ORA-19558: error de-allocating device
    ORA-19557: device error, device type: DISK, device name:
    ORA-17627: ORA-01041: internal error. hostdef extension doesn't exist
    ORA-17627: ORA-01041: internal error. hostdef extension doesn't exist
    ORA-03135: connection lost contact
    RMAN-03009: failure of backup command on ORA_DISK_2 channel at 08/30/2012 16:51:58
    ORA-19558: error de-allocating device
    ORA-19557: device error, device type: DISK, device name:
    ORA-17627: ORA-01041: internal error. hostdef extension doesn't exist
    ORA-17627: ORA-01041: internal error. hostdef extension doesn't exist
    ORA-03135: connection lost contact
    RMAN-03009: failure of backup command on ORA_DISK_1 channel at 08/30/2012 17:49:09
    ORA-19558: error de-allocating device
    ORA-19557: device error, device type: DISK, device name:
    ORA-17627: ORA-01041: internal error. hostdef extension doesn't exist
    ORA-17627: ORA-01041: internal error. hostdef extension doesn't exist
    ORA-03135: connection lost contact
    RMAN-03009: failure of backup command on ORA_DISK_3 channel at 08/30/2012 16:10:23
    ORA-19558: error de-allocating device
    ORA-19557: device error, device type: DISK, device name:
    ORA-17627: ORA-01041: internal error. hostdef extension doesn't exist
    ORA-17627: ORA-01041: internal error. hostdef extension doesn't exist
    ORA-03135: connection lost contact
    RMAN>
    Primary database alert log:
    Thu Aug 30 15:41:00 2012
    Clearing standby activation ID 3277937203 (0xc3615a33)
    The primary database controlfile was created using the
    'MAXLOGFILES 16' clause.
    There is space for up to 11 standby redo logfiles
    Use the following SQL commands on the standby database to create
    standby redo logfiles that match the primary database:
    ALTER DATABASE ADD STANDBY LOGFILE 'srl1.f' SIZE 536870912;
    ALTER DATABASE ADD STANDBY LOGFILE 'srl2.f' SIZE 536870912;
    ALTER DATABASE ADD STANDBY LOGFILE 'srl3.f' SIZE 536870912;
    ALTER DATABASE ADD STANDBY LOGFILE 'srl4.f' SIZE 536870912;
    ALTER DATABASE ADD STANDBY LOGFILE 'srl5.f' SIZE 536870912;
    ALTER DATABASE ADD STANDBY LOGFILE 'srl6.f' SIZE 536870912;
    WARNING: OMF is enabled on this database. Creating a physical
    standby controlfile, when OMF is enabled on the primary
    database, requires manual RMAN intervention to resolve OMF
    datafile pathnames.
    NOTE: Please refer to the RMAN documentation for procedures
    describing how to manually resolve OMF datafile pathnames.
    Thu Aug 30 16:10:13 2012
    Errors in file /u01/oracle/diag/rdbms/his_primary/his/trace/his_ora_25860.trc (incident=72361):
    ORA-00600: internal error code, arguments: [1868], [0xFFFFFFFF7BBD4988], [], [], [], [], [], [], [], [], [], []
    Incident details in: /u01/oracle/diag/rdbms/his_primary/his/incident/incdir_72361/his_ora_25860_i72361.trc
    Thu Aug 30 16:10:20 2012
    Trace dumping is performing id=[cdmp_20120830161020]
    Thu Aug 30 16:10:22 2012
    Sweep [inc][72361]: completed
    Sweep [inc2][72361]: completed
    Thu Aug 30 16:40:32 2012
    Thread 1 cannot allocate new log, sequence 3031
    Private strand flush not complete
    Current log# 4 seq# 3030 mem# 0: +DATA/his_primary/onlinelog/group_4.579.759345057
    Current log# 4 seq# 3030 mem# 1: /backup/odsdb/HIS_PRIMARY/onlinelog/o1_mf_4_74nf15rq_.log
    Thread 1 advanced to log sequence 3031 (LGWR switch)
    Current log# 5 seq# 3031 mem# 0: +DATA/his_primary/onlinelog/group_5.261.759345075
    Current log# 5 seq# 3031 mem# 1: /backup/odsdb/HIS_PRIMARY/onlinelog/o1_mf_5_74nf1q2g_.log
    Thu Aug 30 16:40:37 2012
    LNS: Standby redo logfile selected for thread 1 sequence 3031 for destination LOG_ARCHIVE_DEST_2
    Thu Aug 30 16:40:39 2012
    Archived Log entry 5829 added for thread 1 sequence 3030 ID 0xffffffffc3615a33 dest 1:
    Thu Aug 30 16:42:15 2012
    Errors in file /u01/oracle/diag/rdbms/his_primary/his/trace/his_ora_25862.trc (incident=72369):
    ORA-00600: internal error code, arguments: [1868], [0xFFFFFFFF7BBD4988], [], [], [], [], [], [], [], [], [], []
    Incident details in: /u01/oracle/diag/rdbms/his_primary/his/incident/incdir_72369/his_ora_25862_i72369.trc
    Thu Aug 30 16:42:17 2012
    Trace dumping is performing id=[cdmp_20120830164217]
    Thu Aug 30 16:42:17 2012
    Sweep [inc][72369]: completed
    Sweep [inc2][72369]: completed
    Thu Aug 30 16:51:53 2012
    Errors in file /u01/oracle/diag/rdbms/his_primary/his/trace/his_ora_25858.trc (incident=72353):
    ORA-00600: internal error code, arguments: [1868], [0xFFFFFFFF7BBD4988], [], [], [], [], [], [], [], [], [], []
    Incident details in: /u01/oracle/diag/rdbms/his_primary/his/incident/incdir_72353/his_ora_25858_i72353.trc
    Thu Aug 30 16:51:55 2012
    Sweep [inc][72353]: completed
    Sweep [inc2][72353]: completed
    Thu Aug 30 16:51:55 2012
    Trace dumping is performing id=[cdmp_20120830165155]
    Edited by: 960892 on 2012-9-24 上午2:22

    hi:
    this is the initialization parameter file for auxiliary instance:
    *.audit_file_dest='/u01/oracle/admin/his/adump'
    *.audit_trail='db'
    *.compatible='11.2.0.0.0'
    *.control_files='/u01/app/oradata/his/control01.ctl','/u01/app/oradata/his/control02.ctl','/u01/app/oradata/his/control03.ctl'
    *.db_block_size=8192
    *.db_domain='abc.com.cn'
    *.db_file_name_convert='+DATA/his/datafile/','/u01/app/oradata/his/','+DATA/his/tempfile/','/u01/app/oradata/his/','+DATA/his_primary/datafile/','/u01/app/oradata/his/','+DATA/his_primary/tempfile/','/u01/app/oradata/his/'
    *.db_files=1000
    *.db_name='his'
    *.db_recovery_file_dest='/backup/oracle'
    *.db_recovery_file_dest_size=1073741824000
    *.db_unique_name='his_standby_tt'
    *.diagnostic_dest='/u01/oracle'
    *.dispatchers='(PROTOCOL=TCP) (SERVICE=hisXDB)'
    *.fal_client='his_standby_tt'
    *.fal_server='his_primary'
    *.log_archive_config='DG_CONFIG=(his_primary,his_standby_tt)'
    *.log_archive_dest_1='LOCATION=/backup/oracle/HIS_STANDBY_TT/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=his_standby_tt'
    *.log_archive_dest_2='SERVICE=his_primary LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=his_primary'
    *.log_archive_dest_state_1='enable'
    *.log_archive_dest_state_2='enable'
    *.log_file_name_convert='+DATA/his_primary/onlinelog/','/u01/app/oradata/his/','/backup/odsdb/HIS_PRIMARY/onlinelog/','/u01/app/oradata/his/'
    *.memory_target=2181038080
    *.nls_language='SIMPLIFIED CHINESE'
    *.nls_territory='CHINA'
    *.open_cursors=300
    *.processes=3000
    *.remote_login_passwordfile='EXCLUSIVE'
    *.service_names='his.abc.com.cn,his_standby_tt.abc.com.cn'
    *.sessions=3305
    *.standby_file_management='AUTO'
    *.undo_tablespace='UNDOTBS1'
    *.event='10298 trace name context forever, level 32'

  • Creating a duplicated database from active database

    I'm having problem trying to duplicate a database from a target database (PROD) to the auxiliary one (AUX).
    This is what I've configured:
    listener.ora
    SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (GLOBAL_DBNAME = PROD)
          (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1/)
          (SID_NAME = PROD)
        (SID_DESC =
          (GLOBAL_DBNAME = AUX)
          (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1/)
          (SID_NAME = AUX)
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = TCP)(HOST = my_ip)(PORT = 1521))
    ADR_BASE_LISTENER = /u01/app/oracletnsnames.ora
    AUX =
      (DESCRIPTION =
        (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = my_ip)(PORT = 1521)))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = AUX)
    PROD =
      (DESCRIPTION =
        (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = my_ip)(PORT = 1521)))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = PROD)
      )/u01/app/oracle/product/11.2.0/db_1/dbs/initAUX.ora
    db_name='AUX'
    cp /u01/app/oracle/product/11.2.0/db_1/dbs/orapwPROD /u01/app/oracle/product/11.2.0/db_1/dbs/orapwAUX- Started PROD database (open and in archive log mode)
    - Started AUX database (in nomount mode and usinf pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initAUX.ora')
    But when I issue the following command I get connected to auxiliary database (not started) :
    rman target sys/oracle@PROD auxiliary sys/oracle@AUX
    connected to target database: PROD (DBID=196032563)
    connected to auxiliary database (not started)And executing the duplicate command it returns:
    RMAN> duplicate target database to AUX from active database spfile parameter_value_convert '/DATA/PROD/','+DG_DATA_AUX' set db_create_file_dest='+DG_DATA_AUX';
    Starting Duplicate Db at 2010-09-28:13:36:50
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of Duplicate Db command at 09/28/2010 13:36:50
    RMAN-06403: could not obtain a fully authorized session
    RMAN-04006: error from auxiliary database: ORA-01034: ORACLE not available
    ORA-27101: shared memory realm does not exist
    Linux-x86_64 Error: 2: No such file or directorylsnrctl stopped and restarted several times. This is the output of lsnrctl status command:
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 28-SEP-2010 13:45:14
    Copyright (c) 1991, 2009, Oracle.  All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=my_ip)(PORT=1521)))
    STATUS of the LISTENER
    Alias                     LISTENER
    Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
    Start Date                28-SEP-2010 12:44:50
    Uptime                    0 days 0 hr. 1 min. 22 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
    Listener Log File         /u01/app/oracle/diag/tnslsnr/my_ip/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=my_ip)(PORT=1521)))
    Services Summary...
    Service "PROD" has 1 instance(s).
      Instance "PROD", status READY, has 1 handler(s) for this service...
    Service "PRODXDB" has 1 instance(s).
      Instance "PROD", status READY, has 1 handler(s) for this service...
    Service "AUX" has 2 instance(s).
      Instance "AUX", status UNKNOWN, has 1 handler(s) for this service...
      Instance "AUX", status BLOCKED, has 1 handler(s) for this service...
    The command completed successfullyI have already created a duplicated database from a backup of the target one and the configuration was quite the same: the differences are that using active database duplication I needed to use orapw files (and they need to have the same password) and that I needed to connect using Oracle Net service name to connect to the auxiliary instance.. otherwise I got:
    export ORACLE_SID=AUX
    rman target sys/oracle@PROD auxiliary sys/oracle
    connected to target database: PROD (DBID=196032563)
    connected to auxiliary database: AUX (not mounted)
    RMAN> duplicate target database to AUX from active database spfile parameter_value_convert '/DATA/PROD/','+DG_DATA_AUX' set db_create_file_dest='+DG_DATA_AUX';
    Starting Duplicate Db at 2010-09-28:12:27:21
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of Duplicate Db command at 09/28/2010 12:27:21
    RMAN-06217: not connected to auxiliary database with a net service nameWhere am I wrong?

    Thanks for your support. My instance was and is still in nomount mode. But I'm not able to connect this instance as auxiliary and in the right expected mode:
    connected to auxiliary database: AUX (not mounted)
    [oracle@my_ip oracle]$ env|grep SID      
    ORACLE_SID=AUX
    [oracle@my_ip oracle]$ sqlplus / as sysdba
    SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 29 10:28:44 2010
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    idle> shutdown immediate
    ORA-01507: database not mounted
    ORACLE instance shut down.
    idle> startup nomount pfile=/u01/app/oracle/product/11.2.0/db_1/dbs/initAUX.ora
    ORACLE instance started.
    Total System Global Area  217157632 bytes
    Fixed Size                  2211928 bytes
    Variable Size             159387560 bytes
    Database Buffers           50331648 bytes
    Redo Buffers                5226496 bytes

  • Issue with RMAN DUPLICATE FROM ACTIVE DATABASE....

    Hi All,
    Not sure if I should continue from a closed thread, so apologies, opening a new one..
    I ran the following command:
    DUPLICATE TARGET DATABASE TO ' AUX1"
    from ACTIVE DATABASE
    NOFILENAMECHECK:
    So the copy went in fine...so I am confiused now....why when doing a recover, i get the below errors from output:
    archived log for thread 1 with sequence 68346 is already on disk as file H:\ORAC
    LE_ARCHIVE_LOGS\RBS1\ARCHIVELOG\2013_12_08\O1_MF_1_68346_ARCH_D-RBS_ID-295728924
    5_S-68346_T-1_A-780292253_C1OQVOSU_.ARC
    archived log for thread 1 with sequence 68347 is already on disk as file H:\ORAC
    LE_ARCHIVE_LOGS\RBS1\ARCHIVELOG\2013_12_08\O1_MF_1_68347_ARCH_D-RBS_ID-295728924
    5_S-68347_T-1_A-780292253_C3OQVOU1_.ARC
    archived log for thread 1 with sequence 68348 is already on disk as file H:\ORAC
    LE_ARCHIVE_LOGS\RBS1\ARCHIVELOG\2013_12_08\O1_MF_1_68348_ARCH_D-RBS_ID-295728924
    5_S-68348_T-1_A-780292253_C4OQVOU6_.ARC
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of Duplicate Db command at 12/08/2013 07:36:04
    RMAN-03015: error occurred in stored script Memory Script
    RMAN-06053: unable to perform media recovery because of missing log
    RMAN-06025: no backup of archived log for thread 1 with sequence 64713 and start
    ing SCN of 12728145997 found to restore
    RMAN-06025: no backup of archived log for thread 1 with sequence 64712 and start
    ing SCN of 12728133322 found to restore
    RMAN-06025: no backup of archived log for thread 1 with sequence 64711 and start
    ing SCN of 12728121403 found to restore
    RMAN-06025: no backup of archived log for thread 1 with sequence 64709 and start
    ing SCN of 12727730726 found to restore
    RMAN-06025: no backup of archived log for thread 1 with sequence 64708 and start
    ing SCN of 12727717143 found to restore
    RMAN-06025: no backup of archived log for thread 1 with sequence 64707 and start
    ing SCN of 12727701799 found to restore
    RMAN-06025: no backup of archived log for thread 1 with sequence 64704 and start
    ing SCN of 12726617917 found to restore
    RMAN-06025: no backup of archived log for thread 1 with sequence 64703 and start
    ing SCN of 12726605080 found to restore
    RMAN-06025: no backup of archived log for thread 1 with sequence 64702 and start
    No archivelogs were purged or backed up and the current logs were retained....so im somewhat confused....i am not restoring from backup but running active duplicate...
    should I re-run the command with:
    SET UNTIL SEQUENCE 64713 THREAD 1

    This fails saying that "ORA-12528: TNS:listener: all appropriate instances are blocking new connections" which is quite normal given that the listener is havig a handle in BLOCKED state for this AUXDB as it is in NOMOUNT state.
    Could you please help me on how to proceed?
    One option can be to create the controlfile manually and mount the instance before doing the duplicate. I hope Rman can continue from there.
    Another option is to go for backup based duplicate.
    Is there any other way to go?
    Provide static registration on AUXILIARY side for your auxiliary instance and try again.For example change listener.ora file as
    SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (GLOBAL_DBNAME = AUXDB)
          (ORACLE_HOME = <your oracle home>)
          (SID_NAME = AUXDB)
    LISTENER =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = <auxiliary host/ip>)(PORT = 1521))
      )And restart listener on auxiliary host then try again

  • RMAN DUPLICATE FOR STANDBY FROM ACTIVE DATABASE fails

    Hello
    I'm trying to use RMAN DUPLICATE to create a standby database using Oracle 11.2.0.3 with PSU 6 on HP-UX.
    Primary is 2 node RAC. Standby is also 2 node RAC.
    Standby database instance is started in nomount mode.
    I use:
    duplicate target database for standby from active database
      spfile
      <some spfile parameters>
    with PFILE I get:
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of Duplicate Db command at 10/01/2013 12:41:13
    RMAN-05501: aborting duplication of target database
    RMAN-03015: error occurred in stored script Memory Script
    RMAN-03009: failure of sql command on clone_default channel at 10/01/2013 12:41:13
    RMAN-11003: failure during parse/execution of SQL statement: alter system set spfile= '/opt/oracle/db11203/dbs/spfileCU1.ora'
    ORA-02097: parameter cannot be modified because specified value is invalid
    ORA-01565: error in identifying file '/opt/oracle/db11203/dbs/spfileCU1.ora'
    ORA-27037: unable to obtain file status
    HPUX-ia64 Error: 2: No such file or directory
    With SPFILE I get;
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of Duplicate Db command at 10/01/2013 13:06:34
    RMAN-05501: aborting duplication of target database
    RMAN-05537: DUPLICATE without TARGET connection when auxiliary instance is started with spfile cannot use SPFILE clause
    But I do have RMAN connexion to target database.
    Thanks for your help.

    Here is the output beginning of the script which clearly shows that I'm always connected to target database:
    Recovery Manager: Release 11.2.0.3.0 - Production on Tue Oct 1 13:05:47 2013
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    connected to target database: CU (DBID=1143962925)
    connected to auxiliary database: CU (not mounted)
    RMAN> set echo on
    2> run
    3> {
    4>  configure device type disk parallelism 10;
    5>   allocate channel pr1 type disk;
    6>   allocate channel pr2 type disk;
    7>   allocate channel pr3 type disk;
    8>   allocate channel pr4 type disk;
    9>   allocate channel pr5 type disk;
    10>   allocate channel pr6 type disk;
    11>   allocate channel pr7 type disk;
    12>   allocate channel pr8 type disk;
    13>   allocate channel pr9 type disk;
    14>   allocate channel pr10 type disk;
    15>   allocate auxiliary channel st1 type disk;
    16>   allocate auxiliary channel st2 type disk;
    17>   allocate auxiliary channel st3 type disk;
    18>   allocate auxiliary channel st4 type disk;
    19>   allocate auxiliary channel st5 type disk;
    20>   allocate auxiliary channel st6 type disk;
    21>   allocate auxiliary channel st7 type disk;
    22>   allocate auxiliary channel st8 type disk;
    23>   allocate auxiliary channel st9 type disk;
    24>   allocate auxiliary channel st10 type disk;
    25>   duplicate target database for standby from active database
    26>   spfile

  • Displaying Word Document from a Database

    Let me try to explain this.
    I can upload and store a Word Document in an Oracle database
    (BLOB column) but now I need to extract that Word document and
    place a pointer to it on the Web. Can someone explain to me how
    this is done?
    I'm trying to do something like have an image displayed on
    the Web and when you click on it the Word Document is opened.
    Follow me on that? So, if there are 15 Word documents in the
    database, then the web page would have 15 images all pointing to
    each separate Word document.
    Has anyone done this?

    Don't take my word on this, but I think this should work;
    I've done this in the past to send dynamically-generated CSV files
    to the user, which is in a way (at least at the perspective of
    what's being outputted to the user) the same thing.
    First, obviously, you need to retrieve the Word document data
    from the database. We'll say you put that in a variable called
    'wordDoc'.
    <cfset wordDoc = someQuery.wordDataObj />
    Next, we need to set the 'Content-disposition' HTTP header,
    to tell the client's browser that we're sending a file, and that we
    want you to call it somefile.doc by default. We'll do this with the
    <cfheader> tag (note that if you use <cfflush> in the
    application, this tag (and thus, this approach)
    will not work.
    <cfheader name="Content-disposition" value="attachment;
    filename=somefile.doc" />
    Almost there. Now we need to set the Content-type HTTP
    header, to tell the browser what kind of data is coming, and then
    give it the actual file data. We'll use the <cfcontent> tag
    to do both of these things.
    <cfcontent type="application/msword"
    reset="yes">#wordDoc#</cfcontent><cfabort>
    If memory serves, this should be all you need. Note the
    <cfabort> after the closing <cfcontent> tag, I've had
    problems in the past with additional output on the page after these
    tags being appended to what gets sent to the browser, so I use a
    <cfabort> afterwards to make sure nothing more gets sent
    after the data we want. Also, at least with CFMX7, I've noticed
    that debugging output tends to get added in too regardless, so I
    typically put a <cfsetting showdebugoutput="false" /> at the
    top of the file, too.
    I can't guarantee this will work, I haven't tested this
    particular situation, but if it doesn't, it ought to be close. Let
    me know if I'm wrong.
    Attached is what should be the code without my commentary /
    rambling interspersed.

Maybe you are looking for

  • Sony mobile warranty support feedback

    I need to share with you that recently my phone went back from warranty repair. And I need to say I can see a huge upgrade in terms of the service and customer support.  Everything went well and the most important - very fast! As I remember from the

  • Start dowm instance from DOS

    Hi Friends. i use below command based on oracle document Start the Management Repository database instance: ORACLE_HOME/bin/sqlplus /nolog SQL> connect SYS as SYSDBA SQL> startup However, it always ask me to enter a password. But when my sr. dba type

  • Websites open the Appstore - Guide Needed

    I ran across this from 9to5 Mac - http://9to5mac.com/2015/03/18/safari-app-store-redirect/#more-370337 On that post, it shows how many well known sites and ads make it nearly impossible to use the page due to the ads. Yes this is a nuisance and Apple

  • SSL received a record that exceeded the maximum permissible length

    For the past few days ALL of my computers show the following message when I attempt to access ANYTHING to do with google: "Secure Connection Failed An error occurred during a connection to https://www.google.co.uk/firefox SSL received a record that e

  • Oracle BAM part of SOA release?

    Isn't Oracle BAM part of SOA suite? If so, is it part of 10.1.3.1 SOA Preview release? There used to be BPEL Process Analytics with earlier release and there is the Peoplesoft aquired .NET version of BAM. I am not so clear on the BAM road map with re