Gathering histogram manually in oracle

Hi,
I need to create the histrogram manually in oracle 10g DB. When i execute the following pl/ sql block i was getting the "PLS-00306: wrong number or types of arguments in call to 'PREPARE_COLUMN_VALUES'".
I want to pass the V_arr value from test2 table to DBMS_STATS.prepare_column_values procedure.
It would be grateful if this can resolve it.
SELECT *
FROM test2;
CREATE TABLE test2(num1 NUMBER,num2 NUMBER,num3 NUMBER);
INSERT INTO test2
VALUES (1, 1000, 3);
INSERT INTO test2
VALUES (2, 2000, 3);
INSERT INTO test2
VALUES (3, 3000, 3);
COMMIT ;
SELECT *
FROM test2;
DECLARE
l_rec DBMS_STATS.statrec;
l_array DBMS_STATS.numarray;
TYPE arr IS VARRAY (256) OF test2%ROWTYPE;
v_arr arr := arr ();
ind NUMBER;
v_arr1 NUMBER;
CURSOR cur
IS
SELECT *
FROM test2;
BEGIN
ind := 0;
l_rec.bkvals := DBMS_STATS.numarray (1000, 2000, 3000);
l_rec.epc := 3;
FOR i IN cur
LOOP
ind := ind + 1;
v_arr.EXTEND ();
v_arr (ind).num1 := i.num1;
END LOOP;
DBMS_STATS.prepare_column_values (l_rec, v_arr);
END;

Hi,
You call the PREPARE_COLUMN_VALUES with wrong arguments. Try this one:
DECLARE
   l_rec     DBMS_STATS.statrec;
   l_array   DBMS_STATS.numarray;
--   TYPE arr IS VARRAY (256) OF test2%ROWTYPE;
--   v_arr     arr                 := arr ();
   v_arr   DBMS_STATS.numarray;  
   ind       NUMBER;
   v_arr1    NUMBER;
   CURSOR cur
   IS
      SELECT *
        FROM test2;
BEGIN
   ind := 0;
   l_rec.bkvals := DBMS_STATS.numarray (1000, 2000, 3000);
   v_arr := DBMS_STATS.numarray();
   l_rec.epc := 3;
   FOR i IN cur
   LOOP
      ind := ind + 1;
      v_arr.EXTEND ();
      v_arr (ind)  := i.num1;
   END LOOP;
   DBMS_STATS.prepare_column_values (l_rec, v_arr);
END;Regards
Gokhan

Similar Messages

  • How to take a backup manually in oracle 11g express edition?

    how to take a backup manually in oracle 11g express edition? i want to take backup of a database and want to restore later on on a different computer .

    Stop database, and copy all files to another machine.That sounds to me to be the closest answer to the question posted. And perhaps the easiest solution.
    Install XE on the "another machine", shut it down. Shutdown the source database. Copy the datafiles to the new host. Startup your "new" database, it will be an exact clone of the original.
    To find out what files need to be copied, as system (or sysdba) run:
    select name from v$datafile;
    ... file1, file2 ...
    show parameter control
    ... control_files ... file1 ...
    alter database backup controlfile to trace [reset logs];
    show parameter diag;
    ... diagnostic_dest ... <drive:>|/diag_pathTo do a proper database clone its better to recreate the controlfile and reset the archive sequence number- leave out the controlfile copy part. In the diag_path location find the trace file under diag/rdbms/$ORACLE_SID/<db_name>/trace it should be the latest ora*.trc file.
    The trace file has the commands to recreate the controlfile, which includes the datafiles and putting the tempfile back in place. If the datafiles are in a different location, i.e. in Windows going to a different drive, or you want do put datafiles in a different folder location, the create controlfile statement is the easiest time to get the file directories right.
    If you add the "reset logs" qualifier (don't use the brackets!) you'll get just the reset logs version of the create controlfile statement, otherwise you'll get both NORESETLOGS and RESETLOGS versions of a create controlfile statement, run one or the other. Not both. Not the entire trace file, just the create controlfile, alter database open [reset logs], alter tablespace temp add tempfile ... bits. No recovery is needed for a database that is shutdown when datafiles get copied to a new location/host.

  • Howto Force Garbage Collection manually in Oracle Application Server

    Hi,
    I have a Oracle SOA suite installed on Oracle 10g Application Server. The heap memory for the SOA oc4j container is 2G with a permgen space of 256M. But it looks like there is some memory leak somewhere and the Heap area is getting filled frequently and this causes an *[libopmnoc4j] OC4J ping attempt timed out* and as a result of this the SOA oc4j container gets restarted automatically.
    Is there any means by which we can force a Garbage Collection manually so that this automatic restart does not happen.
    Kindly let me know if it is possible to trigger a Garbage Collection manually in Oracle Application Server.
    Thanks,
    Vijay.

    We had a similar situation where the oc4j instance will throw OutOfMemoryException and opmn will restart a new instance every 10-12 hours. The JDBC 10.2.0.3 driver has a memory leak in the XA Resource classes. There is a fix available in metalink.

  • How to start manually an oracle 8i database with a bat file?

    Hi all,
    I know it's not the place but it is a really common question: how can i start manually an oracle 8i database on windows 2000 without using a service? I don't remember the command. I tried: oracle start SID without success...
    Thanks
    JMi

    Dear JMD,
    If you would like to startup the Oracle instance using a batch file then first create a SQL file (say ABC.SQL) wherein enter the following two lines:
    connect internal/<INTERNAL_PASSWORD>
    STARTUP
    <INTERNAL_PASSWORD> above is the password for the INTERNAL user account (default password is "oracle")
    Then create a batch file (say START.BAT) and enter the following single line:
    <ORACLE_HOME>\bin\svrmgrl @<ABC_DIR>\ABC.SQL
    where <ORACLE_HOME>\bin\svrmgrl is the full path of the SVRMGRL.EXE executable and <ABC_DIR> is the directory in which you have placed the ABC.SQL file.
    Now you can startup the Oracle database by simply double-clicking on the START.BAT batch file.
    Ciao!
    null

  • Manuals of Oracle BPM 11g

    Guys:
    I would like know if you have manuals of Oracle BPM 11g.
    I hope you can give me some pages and pdf.
    Thanks a lot
    PS:If you have manuals in spanish, it will be great!!!.

    Manuals are here:
    http://download.oracle.com/docs/cd/E21764_01/soa.htm
    Follow then open in pdf, ex:
    http://download.oracle.com/docs/cd/E21764_01/user.1111/e15175.pdf
    Jon petter

  • Gathering statistics manually in 10g !!

    Hi, all.
    The database is 2 node RAC 10.2.0.2.0.
    By default, 'GATHER_STATS_JOB' job is enabled and it takes statistics of
    "ALL objects in a database" every 22:00 on a daily basis.
    (objects that have changes more than 10% of the rows).
    I found that the default job is causing library cache lock wait event by
    invalidating objects too frequently in the shared pool
    ( especially in a RAC environment).
    Therefore, I am considering taking statistics only for application schema
    on a weekly basis by using "DBMS_STATS.GATHER_SCHEMA_STATS" procedure.
    "EXECUTE DBMS_STATS.GATHER_SCHEMA_STATS('NMSUSER',DBMS_STATS.AUTO_SAMPLE_SIZE);"
    takes statistics of all objects of NMSUSER schema.
    I would like to take statistics for objects that have more than "10% changes"
    of rows.
    What is the option for that??
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_stats.htm#sthref8115
    Thanks and Regards.
    Message was edited by:
    user507290

    Be very careful taking statistics with default setting of method_opt => 'FOR ALL COLUMNS SIZE AUTO' in 10g.
    Check the number of histograms you have (dba_tab_columns and dba_tab_histograms).
    The results may not be what you expect ...
    And they may be playing a part in your latch issues.
    Cheers
    Richard Foote

  • Manual standby Oracle 11.1 standard edition

    I have set up a standby DB for Oracle 11.1 standard edition.
    Everything is done manually by using batchfiles and scripts.
    Logiles are copied from the primary server to the standby server but when I try to register those I get an error ORA-00439: featue not enabled : managed standby
    Do I need enterprise edition for this ? I thoguht it was possible to set up a physical standby if you do the logshipping yourself without using data guard.

    Yes I know data guard is only available in Enterprise edition.
    Hence I scripted the whole process and copy the archive logs myself.
    So this means that doing this manually also won't work since it won't let me register the logfiles. I have done this in Oracle 10 standard edition. Guess my customer will need Enterprise version as from V11 then...

  • How to Start/Stop manually an oracle 9i database with a bat file?

    Hi;
    I have a manual Start/Stop of the db.
    How can i Start/Stop the 9i database all services with a batch file (windows 2000) ?
    All in one batch files ( One for Start & one for Stop)(Including listener)
    thanks for your answer !

    Save the scripts below in a batch file and use the first one to start your services, and the second one to shutdown.
    This script will shutdown your database first using SQL*Plus and stop the service later. This way you will avoid the timeout.
    Also will ask you for confirmation if you are sure to start Oracle services and database. press Y for yes and N for No.
    @echo off
    %systemdrive%
    REM #
    echo.
    echo You are about to start Oracle Services and Database
    echo.
    set /p Input=Do you want to continue? (Y=Yes N=No) =
    IF /i "%Input%"=="Y" (goto Proceed)
    exit /b
    :Proceed
    echo Oracle Instance and Services Startup in progress
    echo.
    Net start OracleOraHome92Agent
    Net start OracleOraHome92HTTPServer
    Net Start OracleOraHome92TNSListener
    Net Start OracleMTSRecoveryService
    Net Start OracleServiceORCL
    echo.
    echo Oracle ORCL Instance and Services Startup completed Successfully
    echo Good Bye
    echo on
    EXIT /BSave this one in a seperate batch, again it will ask for confirmation, and shutdown the database using SQL to avoid timeout
    Just replace the connect string with your own and the {SID} with your Database name
    @echo off
    %systemdrive%
    echo.
    echo You are about to shutdown Oracle Instance and Services
    echo.
    set /p Input=Do you want to continue? (Y=Yes N=No) =
    if /i "%Input%"=="y" (goto Proceed)
    exit /b
    :Proceed
    echo.
    echo Closing and Dismounting ORCL Database
    echo.
    echo shutdown immediate | sqlplus "/ @ORCL as sysdba"
    echo.
    echo Shutting down Oracle system services
    echo.
    Net Stop OracleService{SID}
    Net Stop OracleOraHome92HTTPServer
    Net Stop OracleOraHome92TNSListener
    Net Stop OracleMTSRecoveryService
    Net Stop OracleOraHome92Agent
    echo.
    echo Oracle Instance and Services Shutdown completed successfully
    echo Good Bye
    echo on
    EXIT /bTony Garabedian

  • Creating of the word-frequency histogram from the Oracle Text

    I need make from the Oracle Text index of the "word-frequency histogram", this is list of the tokens in this index, where each token contains the list of documents that contain that token and frequency this token in the every document. Don´t anybody know how to get this data from Oracle Text index so that result will save to the table or to the text file?

    You can use ctx_report.token_info to decipher the token_info column, but I don't think the report format that it produces is what you want. You can use a query template and specify algorithm=count to obtain the number of times a token appears in the indexed column. You can do that for every token by using the dr$...$i table, as shown below. Formatting is preserved by prefacing the code with pre enclosed in square brackets on the line above all of the code and /pre in square brackets on the line below all of the code.
    SCOTT@10gXE> create table otntest
      2    (doc_id       number primary key,
      3       document  varchar2(100))
      4  /
    Table created.
    SCOTT@10gXE> insert all
      2  into otntest values (1, 'This is a test for generating a histogram')
      3  into otntest values (2, 'Histogram shows the list of documents that contain that token and frequency')
      4  into otntest values (3, 'frequency histogram frequency histogram frequency')
      5  select * from dual
      6  /
    3 rows created.
    SCOTT@10gXE> create index otntest_ctx_idx
      2  on otntest(document)
      3  indextype is ctxsys.context
      4  /
    Index created.
    SCOTT@10gXE> column token_text format a30
    SCOTT@10gXE> select t.doc_id, i.token_text, score (1) as token_count
      2  from   otntest t,
      3           (select distinct token_text
      4            from   dr$otntest_ctx_idx$i) i
      5            where  contains
      6                  (document,
      7                   '<query>
      8                   <textquery grammar="CONTEXT">'
      9                   || i.token_text ||
    10                   '</textquery>
    11                   <score datatype="INTEGER" algorithm="COUNT"/>
    12                   </query>',
    13                   1) > 0
    14  order  by doc_id, token_text
    15  /
        DOC_ID TOKEN_TEXT                     TOKEN_COUNT
             1 GENERATING                               1
             1 HISTOGRAM                                1
             1 TEST                                     1
             2 CONTAIN                                  1
             2 DOCUMENTS                                1
             2 FREQUENCY                                1
             2 HISTOGRAM                                1
             2 LIST                                     1
             2 SHOWS                                    1
             2 TOKEN                                    1
             3 FREQUENCY                                3
             3 HISTOGRAM                                2
    12 rows selected.
    SCOTT@10gXE>

  • How to Manually Start Oracle Components

    Developer new to RAC/ASM/Clustering
    I have existing install of VMware Worksation 5.5.1 (Host: XP)
    Installed the data center VM
    and manually configured VM Networking per instruction.
    VM loads fine but Oracle/RAC NOT running.
    (Reverting to original snapshot does not help)
    Can someone please list out (manual) steps to starting all the necessary pieces ?
    thanks

    figured out the easiest way to restart 11g grid control OMS is
    $MIDDLEWARE_HOME/oms11g/install/unix/scripts/omsstup start/stop
    This will also take care of the weblogic domains...

  • Manually start Oracle system processes?

    I don't use Oracle all the time, so I usually end the processes
    it runs in the background of my Windows XP session (Apache.exe,
    Java.exe, etc etc).. Does anyone know if there's a way to re-
    start these processes w/o rebooting my computer? I'd like to
    be able to manually start/stop all these processes for when I'm
    actively using/not using Oracle. Any ideas?

    I don't use Oracle all the time, so I usually end the processes
    it runs in the background of my Windows XP session (Apache.exe,
    Java.exe, etc etc).. Does anyone know if there's a way to re-
    start these processes w/o rebooting my computer? I'd like to
    be able to manually start/stop all these processes for when I'm
    actively using/not using Oracle. Any ideas? First off, you don't want to stop the processes that way at
    all. Right click on "My Computer" and select Manage. From
    there you want to expand the "Services and Applications" node,
    and then select "Services". In that list you should see the
    different Oracle services for whatever product you're running.
    They will all start with the name Oracle. If you tell me what
    product you're actually running, I can give you more info to
    keep them from starting upon boot, so that you truly on start
    them when you need to.
    Note: This forum is for the E-Business Suite, not general DB,
    assuming that the DB software is what you're running.

  • Manually Download Oracle Linux 6 Repo

    Hello,
    Is there a site or method in which I can manually download the entire oracle linux 6 repo and its updates from http://public-yum.oracle.com/repo/OracleLinux/OL6/
    I want to be able to burn the updates to a dvd. I do not want the servers I have to connect to the internet outside of my company's intranet.
    Any ideas?
    Thanks

    This works very well for me: https://github.com/kikitux/public-yum-downloader
    It creates your own local repository rather than DVDs.

  • How to generate sessions manually in Oracle

    Guys can anybody tell me how I can automatically generate sessions by using some codes rather manually triggering sessions.
    See I'm going to implement a multithreading tool by running the tool on different sessions but on a single instant. So I have to run the scripts manually. So I'm unable to run it at the same time. So can anybody tell me how I can generate multiple sessions at the same time & I can run my tool at same time on different sessions(bt in single instant) so that multiple threads(cursors) in multiple sessions can start at same time. So I can check my multithreading tool's performance?

    A new feature in Oracle8i called autonomous transactions allows you to make and
    save (or roll back) changes within a single PL/SQL block—without affecting the outer or main transaction.
    To make a PL/SQL block an autonomous transaction, simply include this statement in the declaration section of the block:
    PRAGMA AUTONOMOUS_TRANSACTION;
    You can use this statement in any procedure and function and in any non-nested
    anonymous block.
    Example
    create table audit_tab (uname varchar2(30), dt date, msg varchar2(4000));
    create or replace trigger emp_trigger
    before update of SAL on emp
    for each row
    declare
         -- this pragma will allow our trigger to commit and
         -- capture an audit trail record. We can then fail
         -- the triggering statement, preventing the update from
         -- occurring
         pragma autonomous_transaction;
         l_cnt     number;
    begin
         -- this query just makes sure the empno being updated
         -- is a person who reports to the employee doing the update.
         -- connect by is a nice way to build this hierarchy.
         -- since the where clause is processed after the hierarchy
         -- is built, we can easily use exists on this
         select count(*)
         into l_cnt
         from dual
    where exists ( select empno
                   from emp
                   where empno = :new.empno
                   start with mgr =
                   (select empno from emp where ename=USER)
                   connect by prior empno = mgr );
         -- If the exists returns no rows, we have attempted
         -- to update someone who does not work for us. We
         -- will audit the attempt as well as fail the attempt.
         -- the employee salary will not be updated and we will
         -- have a record of the attempt
         if ( l_cnt = 0 )
         then
         insert into audit_tab values ( user, sysdate,
              'Attempt to update salary of ' ||
              :new.ename || '-' || :new.empno);
         commit;
         raise_application_error( -20001,
              'You have tried to do something you should '||
              'not have and we know it');
         end if;
    end;
    Trigger created.
    Benefits
    With autonomous transactions, you can write and save messages in an database log without affecting the main transaction.
    You can execute from SQL PL/SQL functions that change the database.
    You can write PL/SQL components or cartridges that behave nicely in a distributed
    computing environment.
    Khurram Siddiqui

  • Oracle Graphics Developr's guide/manual

    Hi,
    I'm looking for a documentation for Oracle Graphics. It's a dessuporrted tool now but we are currently on a platform that is still compatible with the Graphics Builder, and we have a current requirement to include a chart on an existing report (created using Report Builder 6i)
    I managed to located a document which contains what I'm looking for on link http://www.oracle.com/technology/documentation/forms.html ; document A32482–2.PDF- Graphics 2.5 Developer's Guide but it has some formatting issues within the pages, please have a look (eg. page175-176, 239-240, 33-34-38 just to name a few) - especially those with graphics are the main concern.
    I've logged an SR to Oracle; they said it is a documentation bug and at present there is no other available alternative. They've suggested a workaround of copy-pasting the entire document to Word and manually removing the extra spaces, but it is still is not quite that workable after I tried it. They've also suggested that I try my luck here on the forums, I hope get more lucky here.
    if anybody has another (properly formatted) copy or another document/developer's guide/manual for Oracle Graphics, at least 2.5 version, I would much greatly appreciate it. Thanks in advance.
    Eleonor

    Hi Srini,
    Wow! Thanks for your quick reply. Yes, I have previously seen the document you have mentioned (A73075_01.PDF) but it is more of a library of the built-in subprograms, properties, attributes etc., available on the graphics builder. What I am looking looking for is a guide or tutorial of how-to's in Graphics builder. I've had experience on how to use Graphics builder but it before but it has been way way back in the past (goodness when!) I just need a guide/refresher on how to use it. Thanks!
    Kind regards
    Eleonor

  • Where are the manuals (Oracle Developer 2.1)

    Where are the manuals of Oracle Developer 2.1, like the manuals
    of Developer/2000.
    I've searched for it on the CD's and in the documentation sets
    on technet, but nothing found.
    This is very usefull reference material!! So why didn't someone
    ask this question???
    GTNX /\/\ichel.
    null

    Thanx
    Monika (guest) wrote:
    : Michel,
    : There are none! I have been looking for good material
    : since Forms 5.0 first came out. The best thing I have
    : found are the Oracle Education Forms 5.0 Student Guides.
    : Get your company to send you to a training class. The
    : two books are worth more than what you are paying
    : for the class. They are perfect!
    : Monika
    : Michel Eeken (guest) wrote:
    : : Where are the manuals of Oracle Developer 2.1, like the
    : manuals
    : : of Developer/2000.
    : : I've searched for it on the CD's and in the documentation
    sets
    : : on technet, but nothing found.
    : : This is very usefull reference material!! So why didn't
    : someone
    : : ask this question???
    : : GTNX /\/\ichel.
    null

Maybe you are looking for

  • Error while Activating DC

    Hi, After creating an external library dc and the corresponding usage dc, when I am check-in and Activate the activity, I get the following erro. Please help. Regards, Shubham Build number assigned: 9 Change request state from QUEUED to PROCESSING AC

  • When using external-scheme what is still stored on-heap?

    Hi all, If I have a scheme like this... <distributed-scheme>     <scheme-name>distributed-scheme</scheme-name>     <service-name>TestDistributedService</service-name>     <backing-map-scheme>       <external-scheme>         <lh-file-manager>         

  • [Performance Tuning] Select from QMEL

    Hi experts, I have a problem with regards with the select from QMEL table, it takes too long to execute. Your input is very much appreciated.   IF i_sales_orders[] IS NOT INITIAL.     SELECT qmnum            vbeln       FROM viqmel       INTO TABLE i

  • IPad Air Included Apps

    I just received my new iPad Air. I had understood that it came with several apps including: Pages, Numbers and Keynote, but it doesn't seem to be the case. Did I misunderstand the promos? I use a Dell XPS desktop running Windows 7.

  • Tolerences in invoice

    Hi, We had an issue where the total value in the purchase order is $110.But system is allowing us to post the invoice amount more than this. I want to know where we can restrict this. Thanks, Kumar