Startup command in JDBC

How can i execute the startup and recover commands for oracle usingJDBC OCI driver

One way to control a database when the are a 'lot' of attributes is to create a named attribute table. So instead of this
  table X - fields: name, color, width, height, finish, texture, cost
  data X
         bear, brown,       14, 14, shiny, fuzzy, $14
         top,  red and blue, 3,  3, shiny, hard,  $1
.one uses this
  table X - fields: name, id, cost
  table Attr - fields: X_id, name, value
  Data X
         bear, 1, $14
         top,  2, $1
  Data Y
         1,  color, brown
         1,  width, 14
         1,  height, 14
         1,  finish, shiny
         1,  texture, fuzzy
         2,  color, red and blue
         2,  width, 3
         2,  height, 3
         2,  finish, shiny
         2,  texture, hard
     The trade off is ease of use in programming vs more complex logic and possibly more storage space (noting that name in Y could be a number saves on space.)
This might actually result in saving space if the attribute values are sparse - not all of them have values.
This can slow down searches and make queries slower. But that greatly depends on the query. There are cases where this can make it substantially faster. That depends on the nature of the data and the needed queries.
An alternative to this is to make a table for each attribute. Once again there are trade offs there. And it probably isn't applicable for 'attributes for a house'.
Notice in the above that cost is not part of the attribute table. This is a design decision that once again is driven by the needed queries. Presumably cost is an important query item, it will always exist and will always be returned for any query. So it can remain in the main table.
An additional table can be used - an attribute name table. Doing this, and writing code which supports the use of that makes it extremely easy to add new attributes.

Similar Messages

  • Startup OracleDB with JDBC

    Hello,
    I'm trying to shutdown/startup the database server using JDBC, following the the steps from here http://download.oracle.com/docs/cd/B28359_01/java.111/b31224/dbmgmnt.htm
    Shutting down works perfectly, but if I try the startup after it, it won't work
    Error: Exception in thread "main" java.sql.SQLException: Listener refused the connection with the following error:
    ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
    After the shutdown, if I run a "lsnrctl status", there is no service listed, so I guess is normal to get this error.
    The DB version that i'm using: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
    The jdbc jar file: ojdbc6.jar
    The java code:
    public class DbStart { static final String DB_URL =                         "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))" + "(CONNECT_DATA=(SERVICE_NAME=ORCL)))"; // static final String DB_URL = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=" + // "(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=ORCL)))"; public static void main(String[] argv) throws Exception { shutdown(); start(); mount(); } private static void mount() throws SQLException { // Mounting and opening the database OracleDataSource ds1 = new OracleDataSource(); Properties prop1 = getConnProp(); ds1.setConnectionProperties(prop1); ds1.setURL(DB_URL); OracleConnection conn1 = (OracleConnection) ds1.getConnection(); Statement stmt = conn1.createStatement(); stmt.executeUpdate("ALTER DATABASE MOUNT"); stmt.executeUpdate("ALTER DATABASE OPEN"); stmt.close(); conn1.close(); } private static void start() throws SQLException { // Starting up the database: OracleDataSource ds = new OracleDataSource(); Properties prop = getConnProp(); prop.setProperty("prelim_auth", "true"); ds.setConnectionProperties(prop); ds.setURL(DB_URL); OracleConnection conn = (OracleConnection) ds.getConnection(); conn.startup(OracleConnection.DatabaseStartupMode.NO_RESTRICTION); conn.close(); } private static void shutdown() throws SQLException { // Shutting down the database OracleDataSource ds2 = new OracleDataSource(); Properties prop3 = getConnProp(); ds2.setConnectionProperties(prop3); ds2.setURL(DB_URL); OracleConnection conn2 = (OracleConnection) ds2.getConnection(); conn2.shutdown(OracleConnection.DatabaseShutdownMode.IMMEDIATE); Statement stmt1 = conn2.createStatement(); stmt1.executeUpdate("ALTER DATABASE CLOSE NORMAL"); stmt1.executeUpdate("ALTER DATABASE DISMOUNT"); stmt1.close(); conn2.shutdown(OracleConnection.DatabaseShutdownMode.FINAL); conn2.close(); } private static Properties getConnProp() { Properties prop = new Properties(); prop.setProperty("user", "system"); prop.setProperty("password", "manager"); prop.setProperty("internal_logon", "sysdba"); return prop; } }
    Do you have any suggestion on how to change this code in order to work?

    864811 wrote:
    I love your comparison, but still, do you think Oracle was joking arround when they've inserted the OracleConnection.startup() method? See the link to the article from my first post.
    After I shutdown the database using the code below, when i connect from the command line with "sqlplus / as sysdba" i get a "Connected to an idle instance." With the sqlplus "startup" command I can get the db switched back on.
    I was thinking that maybe my shutdown code needs some changes, or maybe i miss some configuration on the server.Depends on what one means by "shut down the database" but in general what you are suggesting is impossible.
    For me to 'start' any application on any server using any programming language I must in fact run something on that server. And that is only possible if something else is already running on that server which accepts my remote commands and acts on them.
    Thus for example I can use ssh to log in to a server and run all the admin commands I like associated with Oracle (and other stuff.) That works because there is a ssh server running on the target box. If the ssh server wasn't running then there would be no way for me to start it.

  • Startup command not picking correct pfile

    Hi Guys,
    I am facing a problem. Whenever I try to start oracle on my Linux machine I get the foillowing error:
    ORA-01078: failure in processing system parameters
    LRM-00109: could not open parameter file '/home/oracle/oracle/product/10.2.0/db_1/dbs/initARIES.ora'
    Actually the pfile mentioned is not the correct one. I do not know where it is taking the path from. I had to start using the following command:
    startup pfile=/home/oracle/oracle/product/10.2.0/db_1/admin/aries/pfile/init.ora.110200612140
    Please provide me some way that I need not to mention the full path of pfile everytime.
    Thanks

    You can also create the initARIES.ora file in the dbs directory (the database is searching there by default) and use the IFILE parameter to point to the file you actually want to use.
    It seems the file you currently using is the one created during installation. Doesn't you have an SPFILE??? Using an SPFILE has some advantages (faster startup, change parameter using alter statement). You can create one via create SPFILE xxx from PFILE. If you place it in the dbs directory oracle should find it automatically. Again no need to pfile in the startup command.

  • Operating System Command in JDBC Sender

    Hello everybody,
    I'm trying to find some syntax to execute an operating system command on Windows Server 2003, but the commands don't seem to work I'm actually trying to generate a directory, now the problem is that I can't find syntax examples on how to do this I tried something like MKDIR TEST, now is the syntax of the command lines as you write them in Command Prompt, or maybe there is my error, thanks in advance.
    Regards,

    Confirmed.
    JDBC sender also support OS command.
    Refer to note 841704 if you face any issue while executing OS command in JDBC adapter.
    Note: OS Command execute when processing in database executed successfully. It is even independent on OS command Errors.
    Thanks
    Farooq
    Edited by: Farooq Farooqui on Jan 16, 2009 11:36 AM

  • Problem with delete command through JDBC

    hi all,
    I have the following code in a Java program
    try
    DriverManager.registerDriver
    (new oracle.jdbc.driver.OracleDriver());
    conn = DriverManager.getConnection(
    "jdbc:oracle:thin:@localhost:1521:orcl", "airport", "airport");
    catch (SQLException ex)
    ex.printStackTrace();
    Every statement works fine except the delete command. When i try to execute this statement:
    stmt = conn.createStatement();
    stmt.executeUpdate("DELETE FROM distances");
    the program stalls. The table "distances" is owned by the user airport and this sql command works fine when I execute it in SQL+. The problem occurs when I try to execute a delete command through JDBC.
    Can anyone help me?
    Thanks...

    It seems that the problem ocuurs only when there are pending transactions.Correct. There are uncommitted INSERT/UPDATE/DELETEs on the table. Readers never block writers, thus having opened SELECT cursors on the table is not a problem. You writer process must be blocked by another writer process. (assuming of course no JDBC thin driver error - of which I've heard rumours there are or were quite a few - not using thin JDBC myself, thus cannot comment on whether these rumours are valid or not)
    What I would think a bit concerning is that one application trashing a table (deleting all the data) while other applications/users are busy changing data in that table. Why are they changing data that will be immediately trashed after they have committed their transactions? Surely they are wasting time and resources all around (user-side and server-side) by doing work that will be immediately invalidated? This kind of points to me to a database or application design problem.

  • Srvctl vs startup command in RAC

    Hi,
    pls clarify some doubts about srvctl /startup?
    1,What is the difference between startup and srvctl in rac.what is the advantage of srvctl over startup.
    2,How to start the database( From CRS to DB instance) in rac by traditional method ( startup command).
    3,I read the oracledocumentation "http://download.oracle.com/docs/cd/B19306_01/rac.102/b14197/srvctladmin.htm"
    which says only command descriptions.but i need what actually happening while executing the command?
    4,The executions are same compare with traditional method or not?
    Thanks & Regards,

    Hi,
    1,What is the difference between startup and srvctl in rac.what is the advantage of srvctl over startup.
    - SRVCTL is cluster aware so you can control database instances for any node in the cluster, which is something you can not do manually. Consider policy based cluster databases in 11gR2, managing databases manually will not be easy.
    2,How to start the database( From CRS to DB instance) in rac by traditional method ( startup command).
    - Can you elaborate on your question? If your question is to start database manually then its exactly same as of single instance database OR do you want to start the database using cluster control utility (CRSCTL)?
    3,I read the oracledocumentation "http://download.oracle.com/docs/cd/B19306_01/rac.102/b14197/srvctladmin.htm"
    which says only command descriptions.but i need what actually happening while executing the command?
    - SRVCTL pass on request to Oracle Cluster ware, which checks for the dependencies and start the corresponding database resources. I guess internally it use the same OCI calls that SQL*Plus use to start the database.
    4,The executions are same compare with traditional method or not?
    - With SRVCTL, it checks for the dependencies such as asm and listener resources and start them where as manual method will fail startup and throw some relevant errors.
    Thanks & Regards,
    http://oraxperts.com.au

  • Startup command starts database but alter database open read only gives error

    Hi,
    I'm having some strange behavior. I've 10.2.0.3 database on windows 2003.
    The startup command starts database without any issues.
    But if I try following it gives error.
    startup mount (successful no errors)
    alter database open read only; gives error that file Mnnnnnn is missing.
    Why this is happening and how to fix it?
    Thanks.

    You really need to show us exactly what Oracle is telling you, using copy and paste, so we can have some clue.  You can hide details like instance and host names if they show up.
    I'm wondering if you had some messed up offline datafile in a tablespace, where Oracle handles it with startup, but gets upset when you try to open read-only.  It's some bizarro sequence of events like: add a datafile to a tablespace, decide that was a mistake, alter it offline, then remove it from the OS without telling Oracle any more about it.  I've come back from vacation to find scenarios like this, it winds up being a time-bomb trying to recreate a standby later.  Or something like that, I could be unremembering some details.

  • My Mac mini won't respond to startup commands

    Hi, first of all I'd like to say that I tried to find a solution not only in this forum but all over google could offer me and still no success in finding a solution to this problem I'm having, so you guys are my last hope before taking my computer to maintenance.
    Well, the thing is, I have a Mac mini Intel Core Duo 1.66GHz that, while trying to install Windows XP through bootcamp I accidentally deleted the Mac OS X disk partition, no harm there as I have a time machine backup, but now I'm trying to boot my OS X 10.6 disk to reinstall the OS but only Windows XP is starting up. I tried to startup with the keys option pressed but no menu to select the source it should boot. I also tried start it up with C pressed, I could hear the DVD spinning and the laser doing its job but only Windows XP boot up.
    During my journey trying to make my OS X disk to boot, I realize that almost no startup command was working as its suppose to be, I tried to ZAP PRAM using CMDOPT+PR but no double chime, tried then CMDOPT+NV to clear NV RAM and nothing. My keyboard is the original Apple aluminum wired keyboard that came with my iMac and it's working perfectly.
    I also tried to reset PMU, SMC and still no success.
    Message was edited by: Carlos Grossi

    Found out what's going on on this very same forum, during my research I actually wasn't using the right words on the search box to find what I need, but who'd know that the official Apple keyboard was the source of the problem, anyway for those who came here with the same problem as mine, turns out that my iMac Aluminum Keyboard isn't "compatible" with startup commands although it works for pretty much everything else, I just used an old PC USB keyboard to give the boot options using Alt as the Option key and Windows Logo as Command key.
    And that's it!

  • Terminal Startup Commands

    So I was reading online about how to make Terminal run a command on startup. When entering the commands to make it run a command on the start of Terminal I guess I messed up, now whenever I start Terminal it says [Process Completed] and wont let me enter any more commands. It also does this when I open a new shell. I want to know if there is a way to delete this startup command so Terminal opens as it does out of the box.

    Or this shell script->
    #!/bin/sh
    #showallfiles
    # Description and usage message
    usage () {
    echo "
    Description:
    A simple shell script to reveal/conceal files
    hidden in Mac OS X Finder application.
    showallfiles excepts one option.
    Usage: ${0##*/} [-h|--help] to show this help
    ${0##*/} [on|ON] to show hidden files
    ${0##*/} [off|OFF] to set the default hidden files
    Example: ${0##*/} on
    # Test for more than one option
    if [ $# -gt 1 ]
    then echo "${0##*/} -h to access help"; exit
    fi
    # Get the AppleShowAllFiles status in the domain com.apple.finder.plist or create the default off setting
    STATUS=`defaults read com.apple.finder AppleShowAllFiles 2>/dev/null` || STATUS=`defaults write com.apple.finder AppleShowAllFiles OFF`
    # Function to check AppleShowAllFiles status and change the status if necessary
    finderfilesstatus () {
    if [ "$STATUS" = "$SAF_OPT" ]
    then
    echo "AppleShowAllFiles is set to $SAF_OPT"
    else
    defaults write com.apple.finder AppleShowAllFiles $SAF_OPT
    osascript -e 'tell application "Finder" to quit' -e 'delay 1' -e 'tell application "Finder" to launch'
    fi
    # Parse the command option
    case "$1" in
    '-h'|'--help') usage; exit;;
    'on'|'ON') SAF_OPT="ON"; finderfilesstatus;;
    'off'|'OFF') SAF_OPT="OFF"; finderfilesstatus;;
    *) echo "${0##*/} -h to access help"; exit;;
    esac

  • Adding SAP CCMS startup command to SAP Start Profile

    Hi All,
    We need to add SAP CCMS startup command in our SAP start profile.
    We use command sapccm4x -DCCMS pf=<> to start SAP CCMS agent .
    I expect we need to add this command (sapccm4x -DCCMS pf=<> ) with same protocol to execute it with SAP start profile.
    Please let me know how can we add this with SAP start profile.
    Shivam Mittal

    Hi Eric,
    I have added command and CCMS agent is also getting start with SAP startup.
    But when I execute command startsap ....like it shows message "database started";;"Instance Started", I am not getting any SAPCCMS agent startup message.
    Please suggest how can I get in startsap script SAPCCMS startup confirmation messge also. Does it require change in startsap script or we should some command protocol in startup profie for it.
    Please suggest.
    Shivam Mittal

  • List of Keyboard Startup commands?

    Hello,
    Is there a list of the different Startup commands anywhere? I can't seem to find any with various searches on the mac.com support sites.
    I've learned that holding "shift" at Startup will turn all extensions off. Is there a command for turning all extensions ON at Startup, regardless if some were disabled during an earlier brain-freeze moment?
    Thanks so much!
    Patterson
    Power Mac G4 Quicksilver 867   Mac OS 9.2.x   17" Studio Display, 512MB RAM

    Hi, Patterson -
    Is there a command for turning all extensions ON at Startup, regardless if some were disabled during an earlier brain-freeze moment?
    Not directly. However, if you hold down the Spacebar from the beginning of startup, Extensions Manager will open just before extensions and control panels will start to load. You can make any adjustments to the choice of Selected Set or to the on-off status of individual extensions and control panels at that time, then resume startup.

  • SQL * Plus commands using JDBC

    Hi,
    Is it possible to run SQL * Plus commands using JDBC?
    Like Describe mytable , @mysql.sql etc....
    Pl. let me know any hints or way to handle it..
    Regards,
    Kavi

    like masuda1967 said, and you have MetaData objects for ResultSets as well.
    @something.sql you can call using CallableStatement objects, look it up in jdbc docs....

  • Regarding Oracle Startup command

    Hello All,
    Whenever we execute the startup command in sqlplus ::
    SQL> startup
    ORACLE instance started.
    Total System Global Area 252776588 bytes
    Fixed Size 450700 bytes
    Variable Size 218103808 bytes
    Database Buffers 33554432 bytes
    Redo Buffers 667648 bytes
    Database mounted.
    Database opened.
    SQL>
    Please elaborate what Fixed Size and Variable size contains??
    I mean what components come under Fixed and Variable size?
    Thanks !!
    Regards,
    Avadhut

    Fixed portion
    The size of the fixed portion is constant for a release and a plattform of Oracle, that is, it cannot be changed through any means such as altering the initialization parameters
    Variable portion
    The variable portion is called variable because its size (measured in bytes) can be changed. The variable portion consists of:
    large pool (optional)
    Provides working space for rman (although rman will also work without large pool).
    Shared pool The shared pool is used for objects that are shared among all users. For example: table definitions, PL/SQL definitions, cursors and so on.
    reference:http://www.adp-gmbh.ch/ora/concepts/sga.html

  • How to echo the SQL command in JDBC?

    When we use a PreparedStatement and execute query, is there a way to get the exact SQL command
    sent to the server without any '?' marks? That would be an aid in debugging. Or is such a facility server-pecific? I am using MySQL with JDBC.
    Thank you.

    Why I want to see the SQL command now is that I am getting a nagging SQLException in the following
    code. Would someone tell me why this code fails?
    //Database connection successful.
    //conn and pstmt are successfully created.
    //variables 'pid' and 'subfolder' are already evaluated, and confirmed that they have valid values
    int sub_id = 0;
    String myquery = null;
    ResultSet rs1 = null;
    try{
    myquery = "SELECT j15c_directory_id FROM j15t_directory WHERE (j15c_parent_id = ? AND j15c_name = ?)";
    pstmt = conn.prepareStatement(myquery);
    pstmt.setInt(1,pid);
    pstmt.setString(2,subfolder);
    rs1 = pstmt.executeQuery();
    rs1.next();
    sub_id =rs1.getInt("j15c_directory_id");
    catch(java.sql.SQLException e1){
    System.err.println("SQLException: " + e1.getMessage());
    The error message I'm getting is "Before start of result set ".

  • First Time "STARTUP" command

    I just installed 8i Enterprise successfully on a Sun Ultra 5 box with Solaris 8.
    After I log into the box as the "oracle" user, I issue the "sqlplus" command. It then asks me for user name, I type: "sys/oracle as sysdba" and it comes back with "connected to an idle instance".
    Finally, at the "SQL>" prompt, I type "STARTUP OPEN PFILE=$ORACLE_HOME/dbs/mypfile.ora" and it returns:
    ORA-24323 value not allowed
    ORA-03113 end-of-file on communication channel
    I have verified that I do have the correct pfile, for the Installer made it during installation.
    Please HELP!!!

    Hi fractals
    Before we go any further we need to find out which version of Java is causing the problem. In the Terminal program, type "java -version" (without the quotes) and observe the behaviour. Hopefully, you'll get the long delay you mentioned earlier, but it will eventually print out the java version. This should serve to identify exactly which Java version has the problem. If you don't get the long delay, or it hangs without ever printing out the version then you need to follow these steps. In Terminal type:
    cd /System/Library/Frameworks/JavaVM.framework/Versions/1.3/Commands
    ./java -version
    cd /System/Library/Frameworks/JavaVM.framework/Versions/1.4/Commands
    ./java -version
    cd /System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands
    ./java -version
    (you can cut and paste these commands from here)
    With any luck this will identify the faulty Java version. Come back when you know which one it is.
    Bob

Maybe you are looking for

  • Iphone 3g call quality

    when I am talking to someone on my iphone 3g, if they speak up loud or a syllable is pronounced louder there voice distorts/crackles on my end. This happens no matter what the volume level is on the iphone and it happens in both handset and heaphones

  • With HP6500A Windows Visa Cable hookup, how to connect printer to network

    With HP6500A all in one Windows Visa cable hookup, how to connect printer to network

  • Database crashes when placed in Archivelog mode

    My production database continues to crash when I place it in Archivelog mode. This happen especially during the period most of the heavy jobs is running. On the other hand, I created a clone of this very same database on another server in Archivelog

  • Internal Error when creating Capture Process

    Hi, I get the following when trying to create my capture process: BEGIN DBMS_STREAMS_ADM.SET_UP_QUEUE( 2 3 queue_table => 'capture_queue_table', queue_name => 'capture_queue'); DBMS_STREAMS_ADM.SET_UP_QUEUE( queue_table => 'apply_queue_table', queue_

  • Finder not respond

    finder not respond and i can't open all my files in finder ,,can anyone help me please ?