details of the virtual columns and deterministic function

Hello

First time that I post a question after the migration of the Forums. So please excuse me if you see errors in format.

Below, I have created a function as deterministic and a table with a virtual column (column refers to the function)

Here are my questions

(1) if I run SELECT * FROM t whenever Oracle will perform the function add_fn?

(2) what is the advantage of DETERMINISTIC? (Documentation says that if we declare a function as deterministic he will attempt to use previously caluculated results for the same set of values. So, when I ever I run SELECT * FROM t oracle executes add_fn only once and it will use the result for the next time. Is my understanding correct.)

Here's the code.

SQL> create or replace function add_fn ( p_n1 in number
  2                                                   ,p_n2 in number )
  3  return number deterministic
  4  is
  5  begin
  6      return p_n1+p_n2;
  7  end;
  8  /
Function created
SQL> create table t ( n1 number
  2                       ,n2 number
  3         ,n3 number generated always as (add_fn(n1,n2)) virtual
  4         );
Table created
SQL> insert into t (n1,n2) values (10,20);
1 row inserted
SQL> select * from t;
        N1         N2         N3
---------- ---------- ----------
        10         20         30
SQL> select * from t;
        N1         N2         N3
---------- ---------- ----------
        10         20         30
SQL>

Hello

...
(1) if I run SELECT * FROM t whenever Oracle will perform the function add_fn?

(2) what is the advantage of DETERMINISTIC? (Documentation says that if we declare a function as deterministic he will attempt to use previously caluculated results for the same set of values. So, when I ever I run SELECT * FROM t oracle executes add_fn only once and it will use the result for the next time. Is my understanding correct.)

...

(1) oracle will have to evaluate the function.  Because only deterministic functions are allowed, this means that it will not necessarily perform the function again; He can get the value cached from a previous call.

I think that the indexed values are actually stored in the index.  "SELECT * FROM t;" do not use an index, but if you make another request, then you should be able to get the value of the virtual table of the index, without calling the function or obtaining the value of a cache.

(2) If a function is DETERMINISTIC, the optimizer may decide whether to actually call the function each time, or the cache for better performance results.  There is no guarantee that it will always be one or the other.  Replace "will be" in your description "may", and then what you say is correct.

Tags: Database

Similar Questions

  • table col name get the details of the table column and inserting of values depending on the data type of the column

    Hello

    I am train to write a procedure where I would spend the table as a parameter name and then the code would determine it is column names, and then he would insert records in each column depending on the data type. could someone help me with this.

    Thank you

    SM

    Hello

    Perhaps you need to dummy data just for the table.

    Here is my exercise

    create or replace
    procedure generate_rows(p_table_name varchar2, p_count number)
    is
      --
      function insert_statement(p_table_name varchar2) return clob
      is
        l_columns clob;
        l_expressions clob;
        l_sql clob default
          'insert into p_table_name (l_columns) select l_expressions from dual connect by level <= :p_count';
      begin
        select
          -- l_columns
          listagg(lower(column_name), ',') within group (order by column_id),
          -- l_expressions
          listagg(
            case
            when data_type = 'DATE'
              then  'sysdate'
            when data_type like 'TIMESTAMP%'
              then  'systimestamp'
            when data_type = 'NUMBER'
              then  replace('dbms_random.value(1,max)',
                      'max', nvl(data_precision - data_scale, data_length)
                    )
            when data_type = 'VARCHAR2'
              then  replace(q'|dbms_random.string('a',data_length)|',
                      'data_length', data_length
                    )
            else
                    'NULL'
            end, ',') within group (order by column_id)
        into
          l_columns,
          l_expressions
        from user_tab_columns
        where table_name = upper(p_table_name);
        --
        l_sql := replace(replace(replace(l_sql,
          'p_table_name', p_table_name),
          'l_columns', l_columns),
          'l_expressions', l_expressions);
        -- debug
        dbms_output.put_line(l_sql);
        --
        return l_sql;
      end;
    begin
      execute immediate insert_statement(p_table_name) using p_count;
    end;
    /
    
    -- test
    create table mytable(
      id number(4,0),
      txt varchar2(10),
      tstz timestamp with time zone,
      dt date,
      xml clob
    )
    ;
    set serveroutput on
    exec generate_rows('mytable', 10);
    select id, txt from mytable
    ;
    drop procedure generate_rows
    ;
    drop table mytable purge
    ;
    
    Procedure GENERATE_ROWS compiled
    Table MYTABLE created.
    PL/SQL procedure successfully completed.
    
    insert into mytable (id,txt,tstz,dt,xml) select dbms_random.value(1,4),dbms_random.string('a',10),systimestamp,sysdate,NULL from dual connect by level <= :p_count
            ID TXT
    ---------- ----------
             3 WnSbyiZRkC
             2 UddzkhktLf
             1 zwfWigHxUp
             2 VlUMPHHotN
             3 adGCKDeokj
             3 CKAHGfuHAY
             2 pqsHrVeHwF
             3 FypZMVshxs
             3 WtbsJPHMDC
             3 TlxYoKbuWp
    
    10 rows selected
    
    Procedure GENERATE_ROWS dropped.
    Table MYTABLE dropped.
    

    and here is the vision of Tom Kyte for the same https://asktom.oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:2151576678914

    Edit: to improve my code, it must use p_count as bind as Tom.

  • an alphabet by typing in a cell gives drop down suggestions from previous hits on the same column. But how the drop down to choose the suggestions of the other columns and other sheets.

    an alphabet by typing in a cell gives drop down suggestions from previous hits on the same column. But how the drop down to choose the suggestions of the other columns and other sheets.

    Hi mdsavol,

    Your observations are accurate. The 'suggestions' are previous entries in the same column that correspond to what has been entered so far in the active cell. The only direct user control is to activate the function turn on or off in numbers preferences > general.

    There are other ways to include or exclude items of suggestions:

    • To remove typos in the suggestions list, the user must correct the typos in the cell above the active cell. If they are more in the list, they won't be presented as suggestions.
    • To include selections added to the list, the user must enter these suggestions in the individual cells above the active cell and column where they are wanted as suggestions.

    There was a request here a while there is a list of suggestion 'live' similar to those of some websites, which offers a descending list of possible entries as a type in an input box.

    The only way I see to reach a solution similar to what you have asked is to use as many lines at the top of the non-en-tete of the table section to list the items likely to repeat in your table, and then hide the lines. You'll need a list for each column where you want to use this feature with a list previously planted. Existing items will then require a likely hit up to three, then a click to choose from a list small enough to enter a value into a cell. News he will need to enter in full the first time, but after that it will be put on the list and answer the same thing as the terms preseeded.

    While your setting upward (or decide not to do), consider going on the menu of number (in numbers), choosing to provide feedback from numbers and writing a feature in Apple request. Describe what you want. Explain how he could help the average user numbers, and then hope for the best.

    Kind regards

    Barry

  • Interval partitioning using the key of the virtual column

    Hi guys

    I have a series of tables that I propose to the partition.

    Each table has a year and a period (equivalent to a month) and I intend using those as my partition keys - year as the partition and the period as the subpartition.

    The distribution will be actually:

    2015

    001

    002

    ...

    012

    2016

    001

    002

    ...

    012

    etc...

    I would use range partitioning for the year, because it would make the maintenance of the partition a breeze.  Only one problem - the field is of type varchar, and is not modifiable as its legacy applications that have become bigger than Ben Hurr and more tangled than a Ben Hurr size flat spaghetti.

    It is hence the idea of virtual column between in game - I could create a virtual column in these tables to convert the field to digital and then partition on it instead.

    My question-if the year of origin varchar column is included in the where clause of a query, is the optimizer based on CSSTidy smart enough to realize that the virtual column used for the partition key is based on this column and use pruning of partition to improve performance?  Or queries must refer to the virtual column to make it work?  Also, the virtual column should be indexed to make it work?

    Thanks in advance.


    Simon

    orclz >

    orclz > create table pt (v1 varchar2 (1) c1 as (to_number (v1)), number of c2)

    2 partition by range (c1) interval (1)

    subpartition by hash (c2) subpartitions 4 3

    4 (partition p1 values less than (1))

    5.

    Table created.

    orclz > set autot on explain

    orclz > select * PT where v1 = '0';

    no selected line

    Execution plan

    ----------------------------------------------------------

    Hash value of plan: 711571056

    --------------------------------------------------------------------------------------------

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time | Pstart. Pstop |

    --------------------------------------------------------------------------------------------

    |  0 | SELECT STATEMENT |      |    82.  2296 |    29 (0) | 00:00:01 |      |      |

    |  1.  RANGE OF PARTITION ALL THE |      |    82.  2296 |    29 (0) | 00:00:01 |    1. 1048575.

    |  2.  HASH PARTITION ALL |      |    82.  2296 |    29 (0) | 00:00:01 |    1.    4.

    |*  3 |    TABLE ACCESS FULL | PT |    82.  2296 |    29 (0) | 00:00:01 |    1. 1048575.

    --------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    3 - filter ("V1" = '0')

    orclz > select * PT where c1 = 0;

    no selected line

    Execution plan

    ----------------------------------------------------------

    Hash value of plan: 1726115854

    -----------------------------------------------------------------------------------------------

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time | Pstart. Pstop |

    -----------------------------------------------------------------------------------------------

    |  0 | SELECT STATEMENT |      |    82.  2296 |    29 (0) | 00:00:01 |      |      |

    |  1.  RANGE OF SINGLE PARTITION |      |    82.  2296 |    29 (0) | 00:00:01 |    1.    1.

    |  2.  HASH PARTITION ALL |      |    82.  2296 |    29 (0) | 00:00:01 |    1.    4.

    |*  3 |    TABLE ACCESS FULL | PT |    82.  2296 |    29 (0) | 00:00:01 |    1.    4.

    -----------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    3 - filter ("C1" = 0)

    --

    John Watson

    Oracle Certified Master s/n

  • NVL and deterministic function

    Hi all
    I recently found a note on deterministic function and its use. As usual check and validate with various relevant articles on the same topic. I decided to check the importance of it with an example below.

      
     create table rnd_all_objects as select * from all_objects;
       
     create or replace function RND_check_null_var(p_var in varchar)
        return varchar2
      deterministic
        as
        begin
           if p_var is null then
              return 'X';
           else
              return p_var;
          end if;
     end;
    
     create index rnd_DET on rnd_all_objects (rnd_check_null_var(status));
    
     select COUNT('X') from rnd_all_objects 
     --where status is null  
      where RND_check_null_var(status) = 'X'
    
     /*
      One can check the plan of the query by commenting the 3rd line of query and uncommenting 2nd line to compare the performance.
     */
    The example given, it seems if we happen to use deterministic functions and replace NVL in where clause if appropriate and possible its picking the index created and the query is very effective. We have tested with more records too. This is to say that the index is selected, even when records are questioned are even more than 90% of all of the data in the table for the given condition, is not happens on a normal basis.

    I pray the pros discuss and get rid of my doubts.

    Thanks in advance.

    Here's what I mean:

    After doing this:

     create index rnd_1 on rnd_all_objects (rnd_check_null_var(status));
     create index rnd_2 on rnd_all_objects (nvl(status,'X'));
     create index rnd_3 on rnd_all_objects (status,'X');
    

    And then what follows, I see no difference between NVL and deterministic function.

    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL> set lines 120
    SQL> set pages 999
    SQL> SELECT *
      2  FROM   rnd_all_objects
      3  WHERE  rnd_check_null_var(status) = 'X';
    
    no rows selected
    
    SQL>
    SQL> select * from table(dbms_xplan.display_cursor);
    
    PLAN_TABLE_OUTPUT
    ----------------------------------------------------------------------------------------------------
    SQL_ID  24rfj6nz0haks, child number 0
    -------------------------------------
    SELECT * FROM   rnd_all_objects WHERE  rnd_check_null_var(status) = 'X'
    
    Plan hash value: 3930105948
    
    -----------------------------------------------------------------------------------------------
    | Id  | Operation                   | Name            | Rows  | Bytes | Cost (%CPU)| Time     |
    -----------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT            |                 |       |       |   117 (100)|          |
    |   1 |  TABLE ACCESS BY INDEX ROWID| RND_ALL_OBJECTS |   428 |   902K|   117   (0)| 00:00:02 |
    |*  2 |   INDEX RANGE SCAN          | RND_1           |   171 |       |   114   (0)| 00:00:02 |
    -----------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("RND_ALL_OBJECTS"."SYS_NC00016$"='X')
    
    Note
    -----
       - dynamic sampling used for this statement (level=2)
    
    23 rows selected.
    
    SQL>
    SQL> SELECT COUNT(*)
      2  FROM   rnd_all_objects
      3  WHERE  rnd_check_null_var(status) = 'X';
    
      COUNT(*)
    ----------
             0
    
    SQL>
    SQL> select * from table(dbms_xplan.display_cursor);
    
    PLAN_TABLE_OUTPUT
    ----------------------------------------------------------------------------------------------------
    SQL_ID  9pkp2u9xyfd5f, child number 0
    -------------------------------------
    SELECT COUNT(*) FROM   rnd_all_objects WHERE
    rnd_check_null_var(status) = 'X'
    
    Plan hash value: 2866958763
    
    ---------------------------------------------------------------------------
    | Id  | Operation         | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |       |       |       |     1 (100)|          |
    |   1 |  SORT AGGREGATE   |       |     1 |     6 |            |          |
    |*  2 |   INDEX RANGE SCAN| RND_1 |     1 |     6 |     1   (0)| 00:00:01 |
    ---------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("RND_ALL_OBJECTS"."SYS_NC00016$"='X')
    
    20 rows selected.
    
    SQL>
    SQL> SELECT *
      2  FROM   rnd_all_objects
      3  WHERE  nvl(status,'X') = 'X';
    
    no rows selected
    
    SQL>
    SQL> select * from table(dbms_xplan.display_cursor);
    
    PLAN_TABLE_OUTPUT
    ----------------------------------------------------------------------------------------------------
    SQL_ID  762n8j14mpqk1, child number 1
    -------------------------------------
    SELECT * FROM   rnd_all_objects WHERE  nvl(status,'X') = 'X'
    
    Plan hash value: 2211738098
    
    -----------------------------------------------------------------------------------------------
    | Id  | Operation                   | Name            | Rows  | Bytes | Cost (%CPU)| Time     |
    -----------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT            |                 |       |       |   117 (100)|          |
    |   1 |  TABLE ACCESS BY INDEX ROWID| RND_ALL_OBJECTS |   428 | 69764 |   117   (0)| 00:00:02 |
    |*  2 |   INDEX RANGE SCAN          | RND_2           |   171 |       |   114   (0)| 00:00:02 |
    -----------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("RND_ALL_OBJECTS"."SYS_NC00017$"='X')
    
    Note
    -----
       - dynamic sampling used for this statement (level=2)
    
    23 rows selected.
    
    SQL>
    SQL> SELECT COUNT(*)
      2  FROM   rnd_all_objects
      3  WHERE  nvl(status,'X') = 'X';
    
      COUNT(*)
    ----------
             0
    
    SQL>
    SQL> select * from table(dbms_xplan.display_cursor);
    
    PLAN_TABLE_OUTPUT
    ----------------------------------------------------------------------------------------------------
    SQL_ID  0bhwd0rc3g7pp, child number 0
    -------------------------------------
    SELECT COUNT(*) FROM   rnd_all_objects WHERE  nvl(status,'X') = 'X'
    
    Plan hash value: 1668065865
    
    ---------------------------------------------------------------------------
    | Id  | Operation         | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |       |       |       |     1 (100)|          |
    |   1 |  SORT AGGREGATE   |       |     1 |     6 |            |          |
    |*  2 |   INDEX RANGE SCAN| RND_2 |     1 |     6 |     1   (0)| 00:00:01 |
    ---------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("RND_ALL_OBJECTS"."SYS_NC00017$"='X')
    
    19 rows selected.
    
    SQL>
    SQL> SELECT *
      2  FROM   rnd_all_objects
      3  WHERE  status is null;
    
    no rows selected
    
    SQL>
    SQL> select * from table(dbms_xplan.display_cursor);
    
    PLAN_TABLE_OUTPUT
    ----------------------------------------------------------------------------------------------------
    SQL_ID  b2zw36qjc8nxq, child number 0
    -------------------------------------
    SELECT * FROM   rnd_all_objects WHERE  status is null
    
    Plan hash value: 2472515261
    
    -----------------------------------------------------------------------------------------------
    | Id  | Operation                   | Name            | Rows  | Bytes | Cost (%CPU)| Time     |
    -----------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT            |                 |       |       |    43 (100)|          |
    |   1 |  TABLE ACCESS BY INDEX ROWID| RND_ALL_OBJECTS |  2399 |   264K|    43   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | RND_3           |  2399 |       |     8   (0)| 00:00:01 |
    -----------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("STATUS" IS NULL)
    
    19 rows selected.
    
    SQL>
    SQL> SELECT COUNT('X')
      2  FROM   rnd_all_objects
      3  WHERE  status is null;
    
    COUNT('X')
    ----------
             0
    
    SQL>
    SQL> select * from table(dbms_xplan.display_cursor);
    
    PLAN_TABLE_OUTPUT
    ----------------------------------------------------------------------------------------------------
    SQL_ID  03gbx96m8a4hp, child number 0
    -------------------------------------
    SELECT COUNT('X') FROM   rnd_all_objects WHERE  status is null
    
    Plan hash value: 1659481815
    
    ---------------------------------------------------------------------------
    | Id  | Operation         | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |       |       |       |     9 (100)|          |
    |   1 |  SORT AGGREGATE   |       |     1 |     5 |            |          |
    |*  2 |   INDEX RANGE SCAN| RND_3 |     8 |    40 |     9   (0)| 00:00:01 |
    ---------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("STATUS" IS NULL)
    
    Note
    -----
       - dynamic sampling used for this statement (level=2)
    
    23 rows selected.
    

    Published by: DomBrooks on November 24, 2010 11:46

  • I get an error "the disk hard virtual parent is in a saved state. Discard the saved state or stop the virtual machine and try again. "during the installation of XP mode.

    I have Win7 Pro SP1 x 64.  I downloaded WindowsXPMode_en - us.exe (from Microsoft downloads) and run it.  The installation seems to work OK (I've specified a different location for the parent virtual hard disk file).  Then, installation happening and I provide the information requested (name of user and password for the XP Mode), updates Windows and OK to the issue of sharing.  The installation program then reports the following error:

    The disk hard virtual parent is in a saved state.  Discard the saved state or stop the virtual machine and try again.

    I get the error even if I try manually configure XP Mode (use the Setup Wizard).  I downloaded the installer XPMode (3 times) and reinstalled several times, always with the same result.  If it helps, I can't locate anywhere .vsv file.

    Any idea what's going on?

    Original title: XP Mode Setup error

    Hi smithnr10,

     

     

    You must post your question in the TechNet forums because it caters to an audience of it professionals.

    To do this, you must consult the link-

    http://social.technet.Microsoft.com/forums/en-us/w7itprovirt/threads

     

    Hope this helps!

  • I want to manage my payment details as the credit card in detail, but there is no button 'Edit payment details' in the tab 'Plans and products", can I do?

    I want to manage my payment details as the credit card in detail, but there is no button 'Edit payment details' in the tab 'Plans and products", can I do?

    A few changes/Verify account https://forums.adobe.com/thread/1465499 links that can help

    -Credit card https://helpx.adobe.com/x-productkb/policy-pricing/membership-subscription-troubleshooting-cr creative - cloud.html

  • Get the IP of the virtual machine and MAC

    Hello

    I'm trying to get the IP of the virtual machine and the MAC one of my data centers.

    When I run that the following script two things happen:

    1. I don't see a vm in the output of the csv file.

    2. when I send the output to the quick PowrCLI I see only a mac and one IP address for virtual machines with network cards.

    Script

    ---------

    $MV = Get-Data Center $DC | Get-vmhost | Get - VM

    {foreach ($VM to $VMs)

    $VMx = get-view $VM.ID

    $HW = $VMx.guest.net

    foreach ($dev to $HW)

    {

    foreach ($ip in $dev.ipaddress)

    {

    $dev | Select

    @{Name = 'Name'; {Expression = {$vm.name}}.

    @{Name = 'IP address'; Expression is {$ip}},

    @{Name = 'MAC'; {Expression = {$dev.macaddress}} |

    Export-CSV VM - IP - Info.csv - NoTypeInfo

    }

    }

    }

    My console output, tested on a virtual machine with two external network cards and an internal interface "dummy".

    Name                               IP                                  MAC

    ----                                   --                                    ---

    VM1 192.168.1.1 00:50:56:xx:xx:xx

    VM1 192.168.2.1 00:50:56:xx:xx:xx

    VM1 192.x.x.xxx xx

    You see the addresses expected in summary using vSphere Client VM?

    Oh sorry, I forgot the PS 3.0 requirement.

    You can put all the entries in a table and export all at the end of the script.

    $out = @)
    $VMs = get-data center $DC | Get-vmhost | Get - VM
    {foreach ($VM to $VMs)
    $VMx = get-view $VM.ID
    $HW = $VMx.guest.net
    foreach ($dev to $HW)
    {
    foreach ($ip in $dev.ipaddress)
    {
    $out += $dev. Select @{Name = 'Name'; {Expression = {$vm.name}}, @{Name = 'IP address'; Expression = {$ip}}, @{Name = 'MAC'; {Expression = {$dev.macaddress}}
    }
    }
    }

    $out | Export-Csv - NoTypeInformation-Path ' VM - IP - Info.csv.

    Concerning

    Emanuel

  • I had the teacher edition, but never received an email with the details of the product, etc. and the products are not installed (they ask for product key, etc)... What are you doing?

    I had the teacher edition, but never received an email with the details of the product, etc. and the products are not installed (they ask for product key, etc)... What are you doing?

    Hello

    did you purchase your product of these companies like Amazon? If Yes, this isn't a serial number, only a code with which you can request a serial number from Adobe. Please take a look at http://helpx.adobe.com/x-productkb/global/find-serial-number.html. (Start here: How did you purchase your product?)

    The next part, so I don't see at the very least, ceased to exist on my Adobe website, everything happens in the link above. I leave as an info yet, he could still fit for you. For this purpose, please click your way through your Adobe Store and find the button "get serial number". Fill in the form and after awhile, you will get the real serial number.

    Hans-Günter

  • Connect physical hard disks to the virtual machine (and leave the data intact)

    Hello

    I'm looking to virtualize a SOHO headless server, that I use mainly for secure file storage.

    Currently, the system runs Linux installed on a small disc and has two drives 1.5 TB, used exclusively for data, in a cluster of ZFS mirroring. (I use the ZFS-fuse Linux-based application).

    I want virtualization for two reasons. One is to make administration easier and safer - avoid having to connect a keyboard and the physical monitor to the box from time to time. The other is that the machine is a bit more powerful to handle the load, and I'm hoping to make it work on other, more challenging tasks.

    Now, there is a catch. These discs are as highly important. I mean the data on them. What I need is to convert the current Linux system to a virtual machine, or re - install Linux on a virtual machine (don't like that), then connect the physical disks to the virtual machine as if they were actually connected.

    I certainly don't want to vmware touches those disks somehow.

    I've read the documentation, but I'm a noob when it comes to server virtualization and system engineering and don't quite understand if this is possible or not. These discs are not a SAN, they are physically connected to the server, I want to install vSphere on. (Of course, I'll log out when I run the setup of vSphere. But I need plug them again later, and they need to be sure that vmware will leave them alone and pass them to the virtual machine transparent.)

    Sigmoid wrote:

    Oh yes, the cluster mirrored ZFS. It is essentially a software RAID type thingie.

    http://en.Wikipedia.org/wiki/ZFS

    A material, or the point of view of virtualization, it appears two hard drives with a single huge partition on each that is not transparent to anyone, except the implementation of ZFS.

    OK, means that you can break the RAID, connect the drives to different host and configure RAID once again, right?

    Let's do it this way

    1. We will need a disc player more for VM, cause on flash, we install ESXi
    2. I will share ZFS :-), all you need to do with that before you install ESXi
    3. make the BACKUP!
    4. Disconnect the data host drives
    5. install ESXi 4.1 U1 free version on flash
    6. Download the site VMware vSphere client
    7. Connect the VM disk to ESXi
    8. customer help create the virtual machine and install the OS on it
    9. stop the virtual machine and esxi
    10. connect DATA drives to the ESXi host
    11. begin to ESXi
    12. See how to add RDM on youtube, after client use, change first hardware VM--> add a new hard disk--> choose Raw Device Mapping--> (physical or virtual) mode--> store it with folder VM - FACT
    13. Start the virtual machine, now your VM should see both drives, with good data course :-)

    I have just made this procedure (add ROW with data in Linux VM) on ubuntu VM, works well

  • What is the right way to expand the virtual disk and then the OS partition?

    I have a Windows XP operating system in a virtual machine VMware.  I have

    you want to increase the size of the hard drive.  It currently has a 50 GB

    partition on a 50 GB VHD.  I increase the size of the

    50 GB to 100 GB in VMware virtual hard drive.  Then, can I use

    Windows disk management to increase the size of my partition of the

    side OS to use all the 100GB he sees now?  Or will

    corrupt my data or cause a problem as I really need to

    use a third party tool like EAUSUS inside Windows to extend Windows

    on the size of the virtual hard disk?

    In fact the way you describe, resize the virtual disk and then developing the partition are the way to go. But there are some things that you should be

    aware of.

    -If the VHD is on an IDE controller, you may not be able to resize the virtual disk. In this case use the converter. With the converter, you can resize the disk including the partition and - if desired - replace the IDE controller by a SCSI controller.

    -If you have only one partition under XP (that is, drive c :)) you cannot extend the partition with the diskmanager/diskpart. In this case, start your virtual machine from a CD/DVD Vista/Windows 7 in Repair Mode, open a command line and use "diskpart" from there to "extend" your partition.

    André

  • Query with join optimization research and details of the extra column

    I have the following SQL used for a report that comes out some stats (with some research of names). There is a good chance it is probably possible to optimize with better SQL, but I also hope to add an additional column, which I'm not sure.

    I want the extra column at one percent, which is total % of the lines of the value of the units, for the combination of category/group.

    Oracle SQL is v11.2.0

    Here's the SQL code, as it is currently:

    select a.date_adjusted, 
           a.task_name,
           sum(case when a.units_adjusted is not null then a.units_adjusted else a.units_original end) Units, 
           b.group_name, 
           b.category_name
    from   actuals_intake a
    left join
    -- lookups to obtain group and category names from their ID's in the groupings table
           (select c.task_id, 
                   d.group_name, 
                   e.category_name, 
                   c.business_unit_id
            from   task_groupings c,
                   task_groups d,
                   task_categories e
            where  c.group_id = d.id
            and    c.business_unit_id = d.business_unit_id
            and    c.category_id = e.id
            and    c.business_unit_id = e.business_unit_id
    ) b
    on    a.task_id = b.task_id
    and   a.business_unit_id = b.business_unit_id
    where a.business_unit_id = :P10_SELECT_BUSINESS_UNIT
    and   a.date_adjusted between to_date(:P10_DATE_START, 'dd-mon-yyyy') and to_date(:P10_DATE_END, 'dd-mon-yyyy')
    group by a.date_adjusted, a.task_name, b.group_name, b.category_name
    order by a.date_adjusted, b.category_name, b.group_name
     

    This will set up the tables and data:

    CREATE TABLE ACTUALS_INTAKE (
    ID NUMBER,
    DATE_ORIGINAL DATE,
    TASK_NAME VARCHAR2(500 CHAR),
    TASK_ID NUMBER,
    UNITS_ORIGINAL NUMBER,
    BUSINESS_UNIT_ID NUMBER,
    SUB_UNIT_ID NUMBER,
    DATE_ADJUSTED DATE,
    UNITS_ADJUSTED NUMBER
    );
    CREATE TABLE TASK_CATEGORIES (
    ID NUMBER, 
    CATEGORY_NAME VARCHAR2(100 CHAR), 
    BUSINESS_UNIT_ID NUMBER
    );
    CREATE TABLE TASK_GROUPS (
    ID NUMBER, 
    GROUP_NAME VARCHAR2(100 CHAR), 
    BUSINESS_UNIT_ID NUMBER
    );
    CREATE TABLE TASK_GROUPINGS (
    TASK_ID NUMBER, 
    GROUP_ID NUMBER, 
    CATEGORY_ID NUMBER, 
    BUSINESS_UNIT_ID NUMBER
    );
     
     
    INSERT ALL
    INTO ACTUALS_INTAKE (ID, DATE_ORIGINAL, TASK_NAME, TASK_ID, UNITS_ORIGINAL, BUSINESS_UNIT_ID, SUB_UNIT_ID, DATE_ADJUSTED, UNITS_ADJUSTED)
    VALUES (1, '03/15/2014', 'Task One', 1, 200, 10, null, '03/15/2014', null)
    INTO ACTUALS_INTAKE (ID, DATE_ORIGINAL, TASK_NAME, TASK_ID, UNITS_ORIGINAL, BUSINESS_UNIT_ID, SUB_UNIT_ID, DATE_ADJUSTED, UNITS_ADJUSTED)
    VALUES (2, '03/15/2014', 'Task Two', 2, 30, 10, null, '03/15/2014', null)
    INTO ACTUALS_INTAKE (ID, DATE_ORIGINAL, TASK_NAME, TASK_ID, UNITS_ORIGINAL, BUSINESS_UNIT_ID, SUB_UNIT_ID, DATE_ADJUSTED, UNITS_ADJUSTED)
    VALUES (3, '03/15/2014', 'Task Three', 3, 650, 10, null, '03/15/2014', null)
    INTO ACTUALS_INTAKE (ID, DATE_ORIGINAL, TASK_NAME, TASK_ID, UNITS_ORIGINAL, BUSINESS_UNIT_ID, SUB_UNIT_ID, DATE_ADJUSTED, UNITS_ADJUSTED)
    VALUES (4, '03/15/2014', 'Task Four', 4, 340, 10, null, '03/15/2014', null)
    INTO ACTUALS_INTAKE (ID, DATE_ORIGINAL, TASK_NAME, TASK_ID, UNITS_ORIGINAL, BUSINESS_UNIT_ID, SUB_UNIT_ID, DATE_ADJUSTED, UNITS_ADJUSTED)
    VALUES (5, '03/14/2014', 'Task Four', 4, 60, 10, null, '03/15/2014', null)
    INTO ACTUALS_INTAKE (ID, DATE_ORIGINAL, TASK_NAME, TASK_ID, UNITS_ORIGINAL, BUSINESS_UNIT_ID, SUB_UNIT_ID, DATE_ADJUSTED, UNITS_ADJUSTED)
    VALUES (6, '03/15/2014', 'Task Five', 5, 15, 10, null, '03/15/2014', null)
    INTO ACTUALS_INTAKE (ID, DATE_ORIGINAL, TASK_NAME, TASK_ID, UNITS_ORIGINAL, BUSINESS_UNIT_ID, SUB_UNIT_ID, DATE_ADJUSTED, UNITS_ADJUSTED)
    VALUES (7, '03/15/2014', 'Task Six', 6, 40, 10, null, '03/15/2014', null)
    SELECT 1 FROM DUAL;
     
     
    INSERT ALL
    INTO TASK_GROUPS (ID, GROUP_NAME, BUSINESS_UNIT_ID)
    VALUES (1, 'Group One', 10)
    INTO TASK_GROUPS (ID, GROUP_NAME, BUSINESS_UNIT_ID)
    VALUES (2, 'Group Two', 10)
    INTO TASK_GROUPS (ID, GROUP_NAME, BUSINESS_UNIT_ID)
    VALUES (3, 'Group Three', 10)
    select 1 from dual;
    
     
    INSERT ALL
    INTO TASK_CATEGORIES (ID, CATEGORY_NAME, BUSINESS_UNIT_ID)
    VALUES (1, 'Category A', 10)
    INTO TASK_CATEGORIES (ID, CATEGORY_NAME, BUSINESS_UNIT_ID)
    VALUES (2, 'Category A', 10)
    INTO TASK_CATEGORIES (ID, CATEGORY_NAME, BUSINESS_UNIT_ID)
    VALUES (3, 'Category B', 10)
    select 1 from dual;
    
     
    INSERT ALL
    INTO TASK_GROUPINGS (TASK_ID, GROUP_ID, CATEGORY_ID, BUSINESS_UNIT_ID)
    VALUES (1, 1, 1, 10)
    INTO TASK_GROUPINGS (TASK_ID, GROUP_ID, CATEGORY_ID, BUSINESS_UNIT_ID)
    VALUES (2, 1, 1, 10)
    INTO TASK_GROUPINGS (TASK_ID, GROUP_ID, CATEGORY_ID, BUSINESS_UNIT_ID)
    VALUES (3, 2, 2, 10)
    INTO TASK_GROUPINGS (TASK_ID, GROUP_ID, CATEGORY_ID, BUSINESS_UNIT_ID)
    VALUES (4, 2, 3, 10)
    INTO TASK_GROUPINGS (TASK_ID, GROUP_ID, CATEGORY_ID, BUSINESS_UNIT_ID)
    VALUES (5, 3, 3, 10)
    INTO TASK_GROUPINGS (TASK_ID, GROUP_ID, CATEGORY_ID, BUSINESS_UNIT_ID)
    VALUES (6, 3, 3, 10)
    select 1 from dual;
     

    Results will look like this. The last column is what I want the extra column to look like:

    Date_Adjusted TaskName Units of GroupName Category_Name Units %
    15/03/2014A task200Group 1Category A87
    15/03/2014Task 230Group 1Category A13
    15/03/2014Task 3650Group twoCategory A100
    15/03/2014Task 515Group threeCategory B27
    15/03/2014Task 640Group threeCategory B73
    15/03/2014Task 4400Group twoCategory B100

    Hope all that makes sense... Anyone able to help me do this effectively?

    Hello

    Use the analytical RATIO_TO_REPORT function to calculate the % of units column.

    If you're serious about performance, please refer to the Forum:

    Re: 3. how to improve the performance of my query? / My query is slow.

    Do you really need an outer join?  Inner joins are faster.  With the given sample data, they produce the same results.

    COALESCE may be a little faster than the CASE.

    Try this:

    WITH got_units AS

    (

    SELECT a.date_adjusted,

    a.Task_Name,

    sum of units (COALESCE (a.units_adjusted, a.units_original));

    b.group_name,

    b.category_name

    of actuals_intake one

    the left join - or just JOINED

    -research for the group names and category of their ID in the table of groupings

    (select c.task_id,

    d.group_name,

    e.category_name,

    c.business_unit_id

    of task_groupings c,.

    task_groups d,

    e task_categories

    where d.id = c.group_id

    and c.business_unit_id = d.business_unit_id

    and c.category_id = e.id

    and c.business_unit_id = e.business_unit_id

    ) b

    On a.task_id = b.task_id

    and a.business_unit_id = b.business_unit_id

    -where a.business_unit_id =: P10_SELECT_BUSINESS_UNIT - if necessary

    - and a.date_adjusted between to_date (: P10_DATE_START, 'Mon-dd-yyyy') and to_date (: P10_DATE_END, ' mon-dd-yyyy "")

    Group of a.date_adjusted, a.task_name, b.group_name, b.category_name

    )

    SELECT u.*

    ROUND (100 * RATIO_TO_REPORT (units) OVER (PARTITION BY groupname)

    category_name

    )

    ) AS units_pct

    OF got_units u

    ORDER BY date_adjusted, category_name, GroupName

    ;

    Thanks for the display of the data of the sample; It is very useful.  Don't try to insert strings, for example, March 15, 2014", in DATE columns.  TO_DATE allows to convert strings to DATEs.

  • json_list to varchar/string to use in the virtual column

    Hello Experts,

    Environment:

    Database Oracle 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit Production

    PL/SQL Release 12.1.0.2.0 - Production

    I have the following function that returns JSON_LIST.

    {code}

    CREATE OR REPLACE FUNCTION GENERATE_JSON (STRING2CONVERT IN VARCHAR2)

    RETURN JSON_LIST

    DETERMINISTIC

    IS

    RET json_list;

    V_ERROR VARCHAR2 (31000);

    BEGIN

    RET: = json_dyn.executeList (STRING2CONVERT);

    RET. Print;

    RETURN RET;

    EXCEPTION WHEN OTHERS THEN

    V_ERROR: = SQLERRM;

    RETURNS A NULL VALUE.

    END;

    -test the query see the output in the output of DBMS

    SELECT GENERATE_JSON (' select ' |) Chr (39) | ' AJ' | Chr (39) |' like c_name,' | Chr (39) | ' BOY ' | Chr (39): ' c_type, like '

    || Chr (39) | ' HUMAN '. Chr (39): ' as c_category,' | Chr (39) | ' TEST SUBJECT ' | Chr (39) | 'as c_desc from dual')

    FROM DUAL;


    {code}


    The SQL query above in the DBMS output output

    [{

    "C_NAME": "AJ."

    "C_TYPE": "BOY."

    "C_CATEGORY": "HUMAN."

    'C_DESC': 'GUINEA PIG '.

    }]


    Question: How can I have it return the same structure of String (varchar).


    Why would I want to convert JSON_LIST to string?

    So that I can use this call to service as part of a virtual column in a table to store Json and have a constraint to enforce structureof Json.


    If this is not the right way?

    Kindly share how I can take a few columns in the same table, convert to json format and store in a virtual column in the same table and enforce the Json structure?


    Thank you

    AJ



    with

    data in the form of

    (select q'~ select "AJ" as c_name, 'BOY' as c_type, 'HUMAN' as c_category, 'SUBJECT of TEST' as the double c_desc ~' source)

    of the double

    ),

    Converter (SRC, res, Step) as

    (select regexp_replace (ltrim (upper (substr (source, 1, instr (upper (source), "FROM") - 1)), "SELECT"), '\s+AS\s+',': ') |) ',', null, 1

    from the data

    Union of all the

    Select substr (src, instr(src,',') + 1)

    '"' || substr (substr (SRC, 1, InStr (CBC, ',') - 1), instr (substr (src, 1, instr (CBC, ',') - 1),': ') + 1) | '" : ' ||

    Replace (substr (substr (SRC, 1, InStr (CBC, ',') - 1), 1, instr (substr (src, 1, instr (CBC, ',') - 1),': ')-1), "','" ' "),

    Step + 1

    converter

    where the CBC is not null

    )

    Select the source'[{' | listagg(res,',') Group (order by step) |}] '] "converted

    data converter

    SOURCE CONVERTED
    Select "AJ" as c_name, 'BOY' as c_type, 'HUMAN' as c_category, 'SUBJECT of TEST' as double c_desc [{'C_NAME': 'AJ', 'C_TYPE': 'BOY', 'C_CATEGORY': 'HUMAN', 'C_DESC': 'GUINEA PIG'}]

    Concerning

    Etbin

  • Start the virtual machine and wait for WF, does not connect to the computer virtual for Vds (Windows 2008 R2)

    Hello

    See a strange problem with only a Windows 2008 R2 model. When you use the built-in function "Start VM and wait" workflow to start a virtual machine (after conversion from a template either manually, or through workflow) NIC of the virtual machine (I tried VMXNET3 and e1000 times) does not connect to the problem. Vds can be replicated in a different VCenter, so spreading the vds. I also created several models of Windows 2008 r2 and all have this problem.

    If the model is converted and started outside VRO, it gets an IP from and is connected to the VDS immediately

    Tried add/remove the NIC of the model

    Tried to move the comments on different hosts

    Tried to create a new template from scratch

    NOTE: Windows 2012 R2 doesn't have this problem in the same circles, the only constant is the Windows 2008 R2 being started by VRO.

    Anyone seen this before?

    I found this article and it fixed my problem VMware KB: registration or the deployment of a virtual computer model fails apparently a fix a problem in ESX 5.1, 5.5 (I used the option to get around and things are good)

  • I want to change the table with the expression of dangerousness of the virtual columns with her, need advice

    Hi all

    Here is the structure of the table with two expression of virtual columns associated highlighted, now I want to delete these expressions with virtual columns (but must keep my VIRTUAL columns as it is).

    Is it possible the alter or I need to raise the table, make a new structure and copy content back to newly structured table... Pleae help!

    CREATE TABLE TEST_COL)

    SAGE_TRADE_TYPE VARCHAR2 (50 BYTE),

    LOCAL_TZ VARCHAR2 (20 BYTE),

    ACE GMT_CONV_ENTERED_DT_TS (SAGEDBO. FN_CONVERT_TIMEZONE (LOCAL_TZ, ENTERED_DT_TS)) VIRTUAL,.

    ACE GMT_CONV_EXECUTION_DT_TS (SAGEDBO. FN_CONVERT_TIMEZONE (LOCAL_TZ, UPSTREAM_EXECUTION_TS)) VIRTUAL,.

    EOD_IND VARCHAR2 (10 BYTE)

    );

    Thank you very much

    Arpit

    Try this

    ALTER table test_col change gmt_conv_entered_dt_ts (0) virtual;

    ALTER table test_col change gmt_conv_execution_dt_ts (1) virtual;

Maybe you are looking for