Duplicates in V$SQL

I am curious about the results of the following query (on 8.1.6):
select count(*) from v$sql group by sql_text;
I would expect all the results to be 1, but I get the occasional 2, 3 or 4. Can anyone explain why this should happen please ?

If you have more than one statement like
select my_field from my_table ;
in v$sql, it means that u should have more than one user who have a table named my_table; so for each sql statement like this one, the explain plan may not be the same for each of your user and so more than one row in v$sql.
check v$sqlarea with the same query and it will return only 1 "select my_field from my_table" cause v$sqlarea is a distinct from v$sql.
Fred

Similar Messages

  • Check for duplicate record in SQL database before doing INSERT

    Hey guys,
           This is part powershell app doing a SQL insert. BUt my question really relates to the SQL insert. I need to do a check of the database PRIOR to doing the insert to check for duplicate records and if it exists then that record needs
    to be overwritten. I'm not sure how to accomplish this task. My back end is a SQL 2000 Server. I'm piping the data into my insert statement from a powershell FileSystemWatcher app. In my scenario here if the file dumped into a directory starts with I it gets
    written to a SQL database otherwise it gets written to an Access Table. I know silly, but thats the environment im in. haha.
    Any help is appreciated.
    Thanks in Advance
    Rich T.
    #### DEFINE WATCH FOLDERS AND DEFAULT FILE EXTENSION TO WATCH FOR ####
                $cofa_folder = '\\cpsfs001\Data_pvs\TestCofA'
                $bulk_folder = '\\cpsfs001\PVS\Subsidiary\Nolwood\McWood\POD'
                $filter = '*.tif'
                $cofa = New-Object IO.FileSystemWatcher $cofa_folder, $filter -Property @{ IncludeSubdirectories = $false; EnableRaisingEvents= $true; NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite' }
                $bulk = New-Object IO.FileSystemWatcher $bulk_folder, $filter -Property @{ IncludeSubdirectories = $false; EnableRaisingEvents= $true; NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite' }
    #### CERTIFICATE OF ANALYSIS AND PACKAGE SHIPPER PROCESSING ####
                Register-ObjectEvent $cofa Created -SourceIdentifier COFA/PACKAGE -Action {
           $name = $Event.SourceEventArgs.Name
           $changeType = $Event.SourceEventArgs.ChangeType
           $timeStamp = $Event.TimeGenerated
    #### CERTIFICATE OF ANALYSIS PROCESS BEGINS ####
                $test=$name.StartsWith("I")
         if ($test -eq $true) {
                $pos = $name.IndexOf(".")
           $left=$name.substring(0,$pos)
           $pos = $left.IndexOf("L")
           $tempItem=$left.substring(0,$pos)
           $lot = $left.Substring($pos + 1)
           $item=$tempItem.Substring(1)
                Write-Host "in_item_key $item in_lot_key $lot imgfilename $name in_cofa_crtdt $timestamp"  -fore green
                Out-File -FilePath c:\OutputLogs\CofA.csv -Append -InputObject "in_item_key $item in_lot_key $lot imgfilename $name in_cofa_crtdt $timestamp"
                start-sleep -s 5
                $conn = New-Object System.Data.SqlClient.SqlConnection("Data Source=PVSNTDB33; Initial Catalog=adagecopy_daily; Integrated Security=TRUE")
                $conn.Open()
                $insert_stmt = "INSERT INTO in_cofa_pvs (in_item_key, in_lot_key, imgfileName, in_cofa_crtdt) VALUES ('$item','$lot','$name','$timestamp')"
                $cmd = $conn.CreateCommand()
                $cmd.CommandText = $insert_stmt
                $cmd.ExecuteNonQuery()
                $conn.Close()
    #### PACKAGE SHIPPER PROCESS BEGINS ####
              elseif ($test -eq $false) {
                $pos = $name.IndexOf(".")
           $left=$name.substring(0,$pos)
           $pos = $left.IndexOf("O")
           $tempItem=$left.substring(0,$pos)
           $order = $left.Substring($pos + 1)
           $shipid=$tempItem.Substring(1)
                Write-Host "so_hdr_key $order so_ship_key $shipid imgfilename $name in_cofa_crtdt $timestamp"  -fore green
                Out-File -FilePath c:\OutputLogs\PackageShipper.csv -Append -InputObject "so_hdr_key $order so_ship_key $shipid imgfilename $name in_cofa_crtdt $timestamp"
    Rich Thompson

    Hi
    Since SQL Server 2000 has been out of support, I recommend you to upgrade the SQL Server 2000 to a higher version, such as SQL Server 2005 or SQL Server 2008.
    According to your description, you can try the following methods to check duplicate record in SQL Server.
    1. You can use
    RAISERROR to check the duplicate record, if exists then RAISERROR unless insert accordingly, code block is given below:
    IF EXISTS (SELECT 1 FROM TableName AS t
    WHERE t.Column1 = @ Column1
    AND t.Column2 = @ Column2)
    BEGIN
    RAISERROR(‘Duplicate records’,18,1)
    END
    ELSE
    BEGIN
    INSERT INTO TableName (Column1, Column2, Column3)
    SELECT @ Column1, @ Column2, @ Column3
    END
    2. Also you can create UNIQUE INDEX or UNIQUE CONSTRAINT on the column of a table, when you try to INSERT a value that conflicts with the INDEX/CONSTRAINT, an exception will be thrown. 
    Add the unique index:
    CREATE UNIQUE INDEX Unique_Index_name ON TableName(ColumnName)
    Add the unique constraint:
    ALTER TABLE TableName
    ADD CONSTRAINT Unique_Contraint_Name
    UNIQUE (ColumnName)
    Thanks
    Lydia Zhang

  • Exclude duplicate values on SQL where clause statement

    Hi!
    Are some posibilities to exclude duplicate values do not using sql aggregate functions in main select statement?
    Priview SQL statement
    SELECT * FROM
    select id,hin_id,name,code,valid_date_from,valid_date_to
    from diaries
    QRSLT
    WHERE (hin_id = (SELECT NVL(historic_id,id)FROM tutions where id=/*???*/ 59615))
    AND NVL(valid_date_to,to_date('22.12.2999','dd.mm.yyyy')) <= (SELECT NVL(valid_date_to,to_date('22.12.2999','dd.mm.yyyy'))FROM tutions where id= /*???*/ 59615)
    AND trunc(valid_date_from) >=(SELECT trunc(valid_date_from)FROM tutions where id= /*???*/ 59615)
    The result
    ID                  HIN_ID    NAME      CODE    VALID_DATE FROM                 VALID_DATE_TO    
    50512
    59564
    RE TU
    01
    07.06.2013 16:32:15
    07.06.2013 16:33:28
    50513
    59564
    TT2 
    02
    07.06.2013 16:33:23
    07.06.2013 16:33:28
    50515
    59564
    TT2 
    02
    07.06.2013 16:33:28
    07.06.2013 16:34:42
    50516
    59564
    ROD 
    03
    07.06.2013 16:34:37
    07.06.2013 16:34:42
    VALID_DATE_TO & AND VALID_DATE_FROM tutions
    07.06.2013 16:34:42
    15.07.2013 10:33:23
    In this case i got duplicate of entry TT2 id 50513  In main select statement cant use agregate functions are even posible to exclude this value from result modifying only the QLRST WHERE clause (TRUNC need to be here)
    THANKS FOR ANY TIP !
    ID.

    Hi, Ok this is working in this case
    SELECT * FROM
    select id,hin_id,name,code,valid_date_from,valid_date_to
    from diaries ahs
    QRSLT
    WHERE (hin_id = (SELECT NVL(historic_id,id)FROM aip_healthcare_tutions where id=/*???*/ 59615))
    AND NVL(valid_date_to,to_date('22.12.2999','dd.mm.yyyy')) <= (SELECT NVL(valid_date_to,to_date('22.12.2999','dd.mm.yyyy'))FROM tutions where id= /*???*/ 59615)
    AND trunc(valid_date_from) >=(SELECT trunc(valid_date_from)FROM tutions where id= /*???*/ 59615)
    AND NOT  EXISTS
    (SELECT null FROM diaries ahs WHERE  ahs.valid_date_from < QRSLT.valid_date_from
        AND QRSLT.hin_id=ahs.hin_id
        AND QRSLT.code=ahs.code);
    Result
    50512
    59564
    RE TU
    01
    07.06.2013 16:32:15
    07.06.2013 16:33:28
    50513
    59564
    TT2 
    02
    07.06.2013 16:33:23
    07.06.2013 16:33:28
    50516
    59564
    ROD 
    03
    07.06.2013 16:34:37
    07.06.2013 16:34:42
    But if the Data in tutions row  are theese(valid_date_to-null)  then NO ROWS are returning and its logical because in full result list Valid_date_from column are logical incorect
    valid_date_from                                 valid_date_to
    15.07.2013 10:33:23
    NULL
    ID                  HIN_ID    NAME      CODE    VALID_DATE FROM                 VALID_DATE_TO 
    50510
    59564
    RE TU
    01
    07.06.2013 16:33:28
    50511
    59564
    TT2 
    02
    07.06.2013 16:34:41
    50514
    59564
    ROD 
    03
    07.06.2013 16:34:41
    50520
    59564
    Params
    04
    03.07.2013 21:01:30
    50512
    59564
    RE TU
    01
    07.06.2013 16:32:15
    07.06.2013 16:33:28
    50513
    59564
    TT2 
    02
    07.06.2013 16:33:23
    07.06.2013 16:33:28
    50515
    59564
    TT2 
    02
    07.06.2013 16:33:28
    07.06.2013 16:34:42
    50516
    59564
    ROD 
    03
    07.06.2013 16:34:37
    07.06.2013 16:34:42
    Are that posible modifying where statement  if the valid_date_to in tutions are null then theese records where in diary valid_date_to is null is correct to, but need to stay previos logic
    D                  HIN_ID    NAME      CODE    VALID_DATE FROM                 VALID_DATE_TO 
    50510
    59564
    RE TU
    01
    07.06.2013 16:33:28
    null
    50511
    59564
    TT2 
    02
    07.06.2013 16:34:41
    null
    50514
    59564
    ROD 
    03
    07.06.2013 16:34:41
    null
    50520
    59564
    Params
    04
    03.07.2013 21:01:30
    null
    Thanks !
    ID.

  • How to find duplicate row in sql query?

    Hi All,
    Please solve my query, find duplicate row and how to count its. your suggestion would be greatly appreciated.

    You can use group by and having.
    SQL> WITH t
      2       AS (SELECT       LEVEL id
      3                 FROM   DUAL
      4           CONNECT BY   LEVEL <= 5
      5           UNION ALL
      6           SELECT       LEVEL + 2
      7                 FROM   DUAL
      8           CONNECT BY   LEVEL <= 3)
      9  SELECT   *
    10    FROM   t;
            ID
             1
             2
             3
             4
             5
             3
             4
             5
    8 rows selected.
    SQL> WITH t
      2       AS (SELECT       LEVEL id
      3                 FROM   DUAL
      4           CONNECT BY   LEVEL <= 5
      5           UNION ALL
      6           SELECT       LEVEL + 2
      7                 FROM   DUAL
      8           CONNECT BY   LEVEL <= 3)
      9  SELECT     id, COUNT (*)
    10      FROM   t
    11  GROUP BY   id
    12    HAVING   COUNT (*) > 1;
            ID   COUNT(*)
             3          2
             4          2
             5          2
    SQL>

  • Loading a flat table with duplicate rows in SQL server

    Hi,
    I'm trying to load a flat table with different levels that has duplicate rows. When I'm loading it from my source SQL server enviornment to target SQL server environment.. I can only load 63 rows out of the 1225 rows.. This is happenning because i had to define a primary key on the couple of columns..
    When I just try to load it without a primary key, I get an error that PK needs to be defined for load to happen..
    My table structure looks as follows -
    Lvl1 Lvl2 Lvl3 Lvl4 AccountID AccountDesc
    How do i load all rows of data in my target table using ODI?\
    Please help

    whirlpool wrote:
    Hi,
    I'm trying to load a flat table What is a flat table ? Are you talking about FACT table ?
    When I'm loading it from my source SQL server enviornment to target SQL server environment.. I can only load 63 rows out of the 1225 rows.. This is happenning because i had to define a primary key on the couple of columns..
    When I just try to load it without a primary key, I get an error that PK needs to be defined for load to happen..
    Which IKM is in use ? I can not remember an IKM which needs a PK . Incremental Update IKM needs a Update key which can be a PK or UK at database level or ODI level.
    My table structure looks as follows -
    Lvl1 Lvl2 Lvl3 Lvl4 AccountID AccountDesc
    How do i load all rows of data in my target table using ODI?\
    If you not bother about PK at target then you can go for SQL Control Append to load your target table.
    Thanks,
    Sutirtha

  • Duplicate tables in sql server

    i have sql server 2005 environment and have arounds 10-12 DBs.
    i have scramble data and duplicacy issue in terms of tables. when i talk about table m talking about table with the same name.
    there are tables with same name exists on server in multiple database. some having two duplicates, some having 3, 4, 5 and more...
    Also till now this server was working on God's will and i have just transitioned.
    i need few help as i work as DBA not developer so what can be done from DBA aspects.
    1. any tool or way which can let me know which table is primary n required as modify date of table is also not helpful.
    2. how can i move to know which DB table is needed on prod. and rest i can rename for some time before removing.
    3. as server also lacks refertial integrity, is there any automated tool or process which can suggest me possible relationship.
    any help would be appreciated.

    there are tables with same name exists on server in
    multiple database
    Whats the issue with that? Its perfectly normal to have tables with same name in multiple dbs
    I didnt understand why you're concerned with it
    1 and 2 you alone can determine as we dont know anything about your system and also on the tables
    3 you can use ALTER TABLE ADD CONSTRAINT statement to add foreign keys to create the relationships
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
    issue is you dnt know if you insert a record from website you don't know which DB table would get populated.
    system required restructuring so I was hoping if there is any way we can determine tables which are required and constraint it can suggests.

  • How to remove duplicates from PL-SQL table?

    Hi Gurus,
    I have a PL-SQL table with following structure
    Authors (SR_NO, Auth_Code, Change_Date, Cost)
    This tables is being populated using a cursor. But, this table may have some duplicate rows (for Auth_Code column)
    e.g
    SR_NO      Auth_Code       Change_Date                       Cost
    1               A1             14-FEB-09 08.18.47 AM          11.00
    2               A2             14-FEB-09 08.18.56 AM       2839.00
    3               A1             15-FEB-09 08.00.02 AM      1299.00
    4               A1             15-FEB-09 07.00.00 AM        789.00
    5               A3             14-FEB-09 08.18.56 AM        312.00
    6               A4             14-FEB-09 08.19.02 AM        233.00Out of the above result set I need to select the distinct Auth_Code rows for which the Change_Date is maximum (and store it into some other PL-SQL table for further processing or even deleting from this table itself will also do!)
    i.e. Out of above data A1 is duplicated and has maximum Change_Date = 15-FEB-09 08.00.02 AM.
    Hence my resultant PL-SQL Table should have below data
    SR_NO      Auth_Code       Change_Date                       Cost
    2               A2             14-FEB-09 08.18.56 AM       2839.00
    3               A1             15-FEB-09 08.00.02 AM      1299.00
    5               A3             14-FEB-09 08.18.56 AM        312.00
    6               A4             14-FEB-09 08.19.02 AM        233.00I am not that much aware of PL-SQL tables and there is no any chance of modifying the existing cursor which populates the data into this PL-SQL table.
    I guess this I need to compare each record of PL-SQL table with others, but not sure how to do that.
    Could you please help?

    HI,
    Like this?:
    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    SQL>
    SQL> with data as(
      2  select 1 as SR_NO, 'A1' as Auth_Code, to_date('14-FEB-09 08.18.47', 'dd-mon-yy hh24:mi:ss') as change_date,    11.00 as cost from dual union all
      3  select 2 as SR_NO, 'A2' as Auth_Code, to_date('14-FEB-09 08.18.56', 'dd-mon-yy hh24:mi:ss') as change_date,  2839.00 as cost from dual union all
      4  select 3 as SR_NO, 'A1' as Auth_Code, to_date('15-FEB-09 08.00.02', 'dd-mon-yy hh24:mi:ss') as change_date,  1299.00 as cost from dual union all
      5  select 4 as SR_NO, 'A1' as Auth_Code, to_date('15-FEB-09 07.00.00', 'dd-mon-yy hh24:mi:ss') as change_date,   789.00 as cost from dual union all
      6  select 5 as SR_NO, 'A3' as Auth_Code, to_date('14-FEB-09 08.18.56', 'dd-mon-yy hh24:mi:ss') as change_date,   312.00 as cost from dual union all
      7  select 6 as SR_NO, 'A4' as Auth_Code, to_date('14-FEB-09 08.19.02', 'dd-mon-yy hh24:mi:ss') as change_date,   233.00 as cost from dual)
      8  select * from data d where change_date = (select max(change_date) from data d2 where d.auth_code = d2.auth_code);
         SR_NO AUTH_CODE CHANGE_DATE       COST
             2 A2        14/02/2009        2839
             3 A1        15/02/2009        1299
             5 A3        14/02/2009         312
             6 A4        14/02/2009         233
    SQL>Regards,

  • Duplicate names..sql help?

    Hi,
    I am facing s problem hope you would help
    I am running a query that shows me name of employees from a table with their
    employee_ids
    select emp_id, emp_name from t
    EMP_ID     EMP_NAME 
    1820       Waugh 
    1920       King 
    1936       Ric 
    1940       Taylor 
    2036       Smith 
    2123       Paul 
    2157       ALi 
    2181       Smith 
    2189       Joe 
    2332       Bichel 
    2333       Usman  I want that if there are more than ONE same EMP_NAMES returned by the query,
    then query should not show the emp_name but instead should show 'duplicate
    name' for matching names
    so in my above data the name SMITH has come twice
    so my desired output is
    EMP_ID     EMP_NAME 
    1820       Waugh 
    1920       King 
    1936       Ric 
    1940       Taylor 
    2036       DUPLICATE NAME 
    2123       Paul 
    2157       ALi 
    2181       DUPLICATE NAME 
    2189       Joe 
    2332       Bichel 
    2333       Usman  hope this will clear my requirement, I need the fastest and shortest possible
    query to achieve this
    CREATE TABLE T
    (EMP_ID NUMBER(4),
    EMP_NAME VARCHAR2(25))
    INSERT INTO T VALUES (1820,'Waugh');
    INSERT INTO T VALUES (1920,'King');
    INSERT INTO T VALUES (1936,'Ric');
    INSERT INTO T VALUES (1940,'Taylor');
    INSERT INTO T VALUES (2036,'Smith');
    INSERT INTO T VALUES (2123,'Paul');
    INSERT INTO T VALUES (2157,'ALi');
    INSERT INTO T VALUES (2181,'Smith');
    INSERT INTO T VALUES (2189,'Joe');
    INSERT INTO T VALUES (2332,'Bichel');
    INSERT INTO T VALUES (2333,'Usman');
    regards,

    SQL> select emp_id
      2        ,decode((select count(*)
      3                from   t t2
      4                where  t2.emp_name = t1.emp_name)
      5               ,1, t1.emp_name
      6               ,0, '(name not found)'
      7               ,'DUPLICATE NAME'
      8               ) empname
      9  from t t1;
                  EMP_ID EMPNAME
                    1820 Waugh
                    1920 King
                    1936 Ric
                    1940 Taylor
                    2036 DUPLICATE NAME
                    2123 Paul
                    2157 ALi
                    2181 DUPLICATE NAME
                    2189 Joe
                    2332 Bichel
                    2333 Usman
    11 rows selected.

  • Remove Duplicates in string sql AND TAKE THE CORRECT ONE

    Good Evening how can i perform this task with ssis  OR TRANSACT SQL? 
    I HAVE THESE ROWS WITH THE NEXT DATA, I want to take just the valid one, BUT I HAVE A LOT OF COMBINATIONS AS following names, it can be animals, things or personal names
    GABRIEL OBANDO --CORRECT
    GABRIEL OVANDO
    Gavriel OVANDO
    gAbriel OBANDO
    GABRIE OBANDO
    Gabri OBONDA
    MANAGUA --CORRECT
    NANAGUA
    NAMAGUA
    Thanks for the reply.

    Well it is not practically possible to identify the correct Name until you have a reference table or you have or knowledge base in
    Data Quality services.
    The only code which I can provide you is
    SELECT DISTINCT NAME
    FROM dbo.Test
    WHERE NAME = UPPER(NAME) COLLATE SQL_Latin1_General_CP1_CS_AS
    This code will check for the upper case name and select them. But it doesn't guarantee finding correct name when spelling is wrong. 
    If you have any table from where we can validate data then you can use below code
    SELECT DISTINCT Name
    FROM dbo.NameTable
    WHERE Name IN (SELECT Name FROM dbo.OtherNameTable)

  • Avoid duplicate inserts using SQL statement?

    I have primary key on three columns and I want to write a sql statement to insert a row only if the matching three columns doesn't exist in the database.
    This is the condition I wrote but doesn't work. Could someone suggest me a query which meets this criteria.
    INSERT INTO JAVA_SERVICES (SERVICE_PAGE, SERVICE_TYPE, SERVICE_NAME,
      ROOT_PATH)
      VALUES ('AAAA', 'BBBB', 'CCCC', 'njdex') WHERE SERVICE_PAGE != 'AAAA' AND SERVICE_TYPE != 'BBBB' AND SERVICE_NAME != 'CCCC'Edited by: user626618 on Jun 12, 2009 2:39 PM

    you need to provide us more details such as what table name and column names are you using. using an insert into statement an example would be like:
    insert into java_services
    (service_page, service_type, service_name, root_path)
    select [column name], [column name], [column name]
      from [table name]
    where ([column name], [column name], [column name]) not in (select SERVICE_PAGE, SERVICE_TYPE, SERVICE_NAME
                                                                   from JAVA_SERVICES);
    begin
      for i in (select [column name] col1, [column name] col2, [column name] col3
                  from [table name]
                 where ([column name], [column name], [column name]) not in (select SERVICE_PAGE, SERVICE_TYPE, SERVICE_NAME
                                                                    from JAVA_SERVICES)) loop
        insert into java_services
          (service_page, service_type, service_name, root_path)
        values
          (i.col1, i.col2, i.col3);
      end loop;
    end;
    /

  • Error while duplicate database from one server to another server

    Hi there,
    I am practicing duplicate database from one single database server to another server. Hardware and driver path on 2 machines is the same. Here are my steps:
    --------------------- Clone site:
    1. modify listener.ora with content:
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
    ADR_BASE_LISTENER = /u01/app/oracle
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (GLOBAL_DBNAME = orcl)
    (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
    (SID_NAME= orcl)
    ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON
    2. stop and start listener again, message show like :
    Service “orcl” has 1 instance(s).
    Instance “orcl”, status UNKNOWN, has 1 handler(s) for this service…
    The command completed successfully
    3. create pfile from spfile.
    4. shutdown and startup nomount with pfile is new pfile create from step 3.
    --------------------------------------- Source site
    1. modify tnsnames.ora with content like:
    VVCOREDB =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = vvcoredb)
    ORCL =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP) (HOST = 10.254.1.235) (PORT=1521))
    (CONNECT_DATA =
         (SERVER = DEDICATED)
         (SERVICE_NAME = orcl)
    2. run command from rman like these:
    rman> connect target sys@vvcoredb
    rman> target database Password:
    rman> connect auxiliary sys@orcl
    rman> auxiliary database Password:
    rman> DUPLICATE TARGET DATABASE to orcl from active database spfile nofilenamecheck;
    Then the result show below:
    Starting Duplicate Db at 24-SEP-12
    using target database control file instead of recovery catalog
    allocated channel: ORA_AUX_DISK_1
    channel ORA_AUX_DISK_1: SID=63 device type=DISK
    contents of Memory Script:
    backup as copy reuse
    targetfile '/u01/app/oracle/product/11.2.0/db_1/dbs/spfilevvcoredb.ora' auxiliary format
    '/u01/app/oracle/product/11.2.0/db_1/dbs/spfileorcl.ora' ;
    sql clone "alter system set spfile= ''/u01/app/oracle/product/11.2.0/db_1/dbs/spfileorcl.ora''";
    executing Memory Script
    Starting backup at 24-SEP-12
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=74 device type=DISK
    Finished backup at 24-SEP-12
    sql statement: alter system set spfile= ''/u01/app/oracle/product/11.2.0/db_1/dbs/spfileorcl.ora''
    contents of Memory Script:
    sql clone "alter system set db_name =
    ''ORCL'' comment=
    ''duplicate'' scope=spfile";
    shutdown clone immediate;
    startup clone nomount;
    executing Memory Script
    sql statement: alter system set db_name = ''ORCL'' comment= ''duplicate'' scope=spfile
    Oracle instance shut down
    connected to auxiliary database (not started)
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of Duplicate Db command at 09/24/2012 17:44:12
    RMAN-03015: error occurred in stored script Memory Script
    RMAN-04014: startup failed: ORA-01261: Parameter db_recovery_file_dest destination string cannot be translated
    ORA-01262: Stat failed on a file destination directory
    Linux-x86_64 Error: 2: No such file or directory
    I don't know what wrong with my pfile? I specify correct my pfile on clone site like this:
    orcl.__db_cache_size=1476395008
    orcl.__java_pool_size=16777216
    orcl.__large_pool_size=16777216
    orcl.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
    orcl.__pga_aggregate_target=1342177280
    orcl.__sga_target=1979711488
    orcl.__shared_io_pool_size=0
    orcl.__shared_pool_size=436207616
    orcl.__streams_pool_size=0
    *.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
    *.audit_trail='db'
    *.compatible='11.2.0.0.0'
    *.control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/flash_recovery_area/orcl/control02.ctl'
    *.db_block_size=8192
    *.db_domain=''
    *.db_name='orcl'
    *.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area/vvcoredb'
    *.db_recovery_file_dest_size=4070572032
    *.diagnostic_dest='/u01/app/oracle'
    *.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
    *.memory_target=3313500160
    *.open_cursors=300
    *.processes=150
    *.remote_login_passwordfile='EXCLUSIVE'
    *.undo_tablespace='UNDOTBS1'
    Please suggest me do i miss some steps when try to duplicate database?
    Any suggestions are welcome.
    Thanks in advance!
    P/s: Sorry for my bad English.

    Oh god, it worked. Thank you. But i got another problem like this:
    duplicate target database to orcl from active database spfile set "db_recovery_file_dest" = "/u01/app/oracle/flash_recovery_area/vvcoredb" nofilenamecheck;
    Starting Duplicate Db at 24-SEP-12
    using target database control file instead of recovery catalog
    allocated channel: ORA_AUX_DISK_1
    channel ORA_AUX_DISK_1: SID=63 device type=DISK
    contents of Memory Script:
    backup as copy reuse
    targetfile '/u01/app/oracle/product/11.2.0/db_1/dbs/spfilevvcoredb.ora' auxiliary format
    '/u01/app/oracle/product/11.2.0/db_1/dbs/spfileorcl.ora' ;
    sql clone "alter system set spfile= ''/u01/app/oracle/product/11.2.0/db_1/dbs/spfileorcl.ora''";
    executing Memory Script
    Starting backup at 24-SEP-12
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=74 device type=DISK
    Finished backup at 24-SEP-12
    sql statement: alter system set spfile= ''/u01/app/oracle/product/11.2.0/db_1/dbs/spfileorcl.ora''
    contents of Memory Script:
    sql clone "alter system set db_name =
    ''ORCL'' comment=
    ''duplicate'' scope=spfile";
    sql clone "alter system set db_recovery_file_dest =
    ''/u01/app/oracle/flash_recovery_area/vvcoredb'' comment=
    '''' scope=spfile";
    shutdown clone immediate;
    startup clone nomount;
    executing Memory Script
    sql statement: alter system set db_name = ''ORCL'' comment= ''duplicate'' scope=spfile
    sql statement: alter system set db_recovery_file_dest = ''/u01/app/oracle/flash_recovery_area/vvcoredb'' comment= '''' scope=spfile
    Oracle instance shut down
    connected to auxiliary database (not started)
    Oracle instance started
    Total System Global Area 3307048960 bytes
    Fixed Size 2217872 bytes
    Variable Size 1811941488 bytes
    Database Buffers 1476395008 bytes
    Redo Buffers 16494592 bytes
    contents of Memory Script:
    sql clone "alter system set db_name =
    ''VVCOREDB'' comment=
    ''Modified by RMAN duplicate'' scope=spfile";
    sql clone "alter system set db_unique_name =
    ''ORCL'' comment=
    ''Modified by RMAN duplicate'' scope=spfile";
    shutdown clone immediate;
    startup clone force nomount
    backup as copy current controlfile auxiliary format '/u01/app/oracle/oradata/vvcoredb/control01.ctl';
    restore clone controlfile to '/u01/app/oracle/recovery_area/vvcoredb/control02.ctl' from
    '/u01/app/oracle/oradata/vvcoredb/control01.ctl';
    alter clone database mount;
    executing Memory Script
    sql statement: alter system set db_name = ''VVCOREDB'' comment= ''Modified by RMAN duplicate'' scope=spfile
    sql statement: alter system set db_unique_name = ''ORCL'' comment= ''Modified by RMAN duplicate'' scope=spfile
    Oracle instance shut down
    Oracle instance started
    Total System Global Area 3307048960 bytes
    Fixed Size 2217872 bytes
    Variable Size 1811941488 bytes
    Database Buffers 1476395008 bytes
    Redo Buffers 16494592 bytes
    Starting backup at 24-SEP-12
    using channel ORA_DISK_1
    channel ORA_DISK_1: starting datafile copy
    copying current control file
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of Duplicate Db command at 09/24/2012 18:42:09
    RMAN-03015: error occurred in stored script Memory Script
    RMAN-03009: failure of backup command on ORA_DISK_1 channel at 09/24/2012 18:42:09
    ORA-17628: Oracle error 19505 returned by remote Oracle server
    I have a comment that source site doesn't have flash_recovery_area, instead it's name is recovery_area, is it problem?
    Edited by: 788420 on Sep 24, 2012 4:44 AM

  • To avoid duplicate rows in oracle 8i

    Can you suggest how to prevent duplicate rows while in situations where multiple refreshes from a single export file using Oracle 8.1.7?
    Do i need to specify Commit=Y, Constraints= N and IGNORE=N while importing data?
    Your suggestion would be appreciated.
    Thanks in advance.

    PK or not pk, if you set ignore=n, the import will be abort in case of table already exists, so you won't have any duplicate rows.
    SQL> create table mytable as select * from all_users union all select * from all_users;
    Table created.
    SQL> select count(*) from mytable;
      COUNT(*)
            14
    SQL> quit
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> exp P97RPPRD/P97RPPRD tables=mytable log=test.log file=test.dmp
    Export: Release 9.2.0.4.0 - Production on Tue Nov 14 13:32:40 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    Export done in UTF8 character set and AL16UTF16 NCHAR character set
    About to export specified tables via Conventional Path ...
    . . exporting table                        MYTABLE         14 rows exported
    Export terminated successfully without warnings.
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> sqlplus P97RPPRD/P97RPPRD                                     
    SQL*Plus: Release 9.2.0.4.0 - Production on Tue Nov 14 13:32:48 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    SQL> drop table mytable;
    Table dropped.
    SQL> quit
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> imp P97RPPRD/P97RPPRD tables=mytable log=test.log file=test.dmp
    Import: Release 9.2.0.4.0 - Production on Tue Nov 14 13:33:07 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    Export file created by EXPORT:V09.02.00 via conventional path
    import done in UTF8 character set and AL16UTF16 NCHAR character set
    . importing P97RPPRD's objects into P97RPPRD
    . . importing table                      "MYTABLE"         14 rows imported
    Import terminated successfully without warnings.
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> imp P97RPPRD/P97RPPRD tables=mytable log=test.log file=test.dmp
    Import: Release 9.2.0.4.0 - Production on Tue Nov 14 13:33:46 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    Export file created by EXPORT:V09.02.00 via conventional path
    import done in UTF8 character set and AL16UTF16 NCHAR character set
    . importing P97RPPRD's objects into P97RPPRD
    IMP-00015: following statement failed because the object already exists:
    "CREATE TABLE "MYTABLE" ("USERNAME" VARCHAR2(30), "USER_ID" NUMBER, "CREATED"
    "" DATE)  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 6553"
    "6 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 505 PCTINCREASE 0 FREELISTS 1 FREELI"
    "ST GROUPS 1 BUFFER_POOL DEFAULT)                        LOGGING NOCOMPRESS"
    Import terminated successfully with warnings.
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> sqlplus P97RPPRD/P97RPPRD                                     
    SQL*Plus: Release 9.2.0.4.0 - Production on Tue Nov 14 13:34:13 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    SQL> select count(*) from mytable;
      COUNT(*)
            14
    SQL>Now, if you haven't pk and set ignore=y, you will have duplicate lines, for sure :
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> imp P97RPPRD/P97RPPRD tables=mytable log=test.log file=test.dmp ignore=y
    Import: Release 9.2.0.4.0 - Production on Tue Nov 14 13:37:33 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    Export file created by EXPORT:V09.02.00 via conventional path
    import done in UTF8 character set and AL16UTF16 NCHAR character set
    . importing P97RPPRD's objects into P97RPPRD
    . . importing table                      "MYTABLE"         14 rows imported
    Import terminated successfully without warnings.
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> sqlplus P97RPPRD/P97RPPRD                                              
    SQL*Plus: Release 9.2.0.4.0 - Production on Tue Nov 14 13:37:57 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    SQL> select count(*) from mytable;
      COUNT(*)
            28
    SQL> Now, test with pk and ignore=y, import doesn't insert the duplicate key, so you won't have any duplicate rows :
    SQL> drop table mytable;
    Table dropped.
    SQL> create table mytable as select * from all_users;
    Table created.
    SQL> alter table mytable add (primary key (username));
    Table altered.
    SQL> insert into mytable select * from all_users;
    insert into mytable select * from all_users
    ERROR at line 1:
    ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
    SQL> quit
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> exp P97RPPRD/P97RPPRD tables=mytable log=test.log file=test.dmp        
    Export: Release 9.2.0.4.0 - Production on Tue Nov 14 13:41:39 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    Export done in UTF8 character set and AL16UTF16 NCHAR character set
    About to export specified tables via Conventional Path ...
    . . exporting table                        MYTABLE          7 rows exported
    Export terminated successfully without warnings.
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> imp P97RPPRD/P97RPPRD tables=mytable log=test.log file=test.dmp ignore=y
    Import: Release 9.2.0.4.0 - Production on Tue Nov 14 13:41:49 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    Export file created by EXPORT:V09.02.00 via conventional path
    import done in UTF8 character set and AL16UTF16 NCHAR character set
    . importing P97RPPRD's objects into P97RPPRD
    . . importing table                      "MYTABLE"
    IMP-00019: row rejected due to ORACLE error 1
    IMP-00003: ORACLE error 1 encountered
    ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
    Column 1 SYS
    Column 2 0
    Column 3 14-NOV-2005:16:14:52
    IMP-00019: row rejected due to ORACLE error 1
    IMP-00003: ORACLE error 1 encountered
    ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
    Column 1 SYSTEM
    Column 2 5
    Column 3 14-NOV-2005:16:14:52
    IMP-00019: row rejected due to ORACLE error 1
    IMP-00003: ORACLE error 1 encountered
    ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
    Column 1 OUTLN
    Column 2 11
    Column 3 14-NOV-2005:16:15:05
    IMP-00019: row rejected due to ORACLE error 1
    IMP-00003: ORACLE error 1 encountered
    ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
    Column 1 DBSNMP
    Column 2 19
    Column 3 14-NOV-2005:16:24:23
    IMP-00019: row rejected due to ORACLE error 1
    IMP-00003: ORACLE error 1 encountered
    ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
    Column 1 PS
    Column 2 21
    Column 3 14-NOV-2005:16:36:41
    IMP-00019: row rejected due to ORACLE error 1
    IMP-00003: ORACLE error 1 encountered
    ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
    Column 1 P97RPPRD
    Column 2 24
    Column 3 14-NOV-2005:16:53:41
    IMP-00019: row rejected due to ORACLE error 1
    IMP-00003: ORACLE error 1 encountered
    ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
    Column 1 PEOPLE
    Column 2 25
    Column 3 14-NOV-2005:16:57:09          0 rows imported
    Import terminated successfully with warnings.
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> HTH,
    Nicolas.

  • PDK pl/sql add_item function and documents table

    When we use the add_item function to add an item and upload its content, does the add_item function uploads document content to the document table in the repository?(like the upload_blob() function)
    If yes, can I remove the uploaded document from the filesystem after having uploaded it in the documents table?
    The PDK API says that there is no supported view for querying the document table. Is there any other way to query the documents in the document table? Or any additional information about how the documents are stored in the document table or how the documents table works?

    Duplicate thread ->
    PL/SQL add procedure with nested table
    Please remove it & marked it as duplicate.
    Regards.
    Satyaki De.

  • How do you configure a WCF-SQL adapter to write data from a SQL2012 "always on" database?

    Hi All,
    I have a BizTalk environment. I have to write the data from BizTalk to the database which is configured using ALWAYS ON availability group.
    I use WCF-SQL adapter to write the data. My question is this setup a supported?

    The answer is NO.
    Refer: Can
    I use a BizTalk WCF-SQL send adapter with a SQL 2012 Always on Database?
    A snippet quoted below.
    In summary (in order of preference):
    Disable AlwaysOn Availability Groups / Mirroring on SQL server if you need to connect to this SQL server which has this enabled
    Disable transactions and implement logic to be able to handle duplicates .
    Disable transactions and handle the duplicates or lost messages with custom logic (e.g. Send twice and compare and implement error handling). You need to write your own DTC handling this which
    is probably very complicated.
    Disable transactions and live with risk of duplicates or lost messages without handling duplicates.
    Refer: SQL Server AlwaysOn feature does not support MSDTC transactions.
    Rachit
    Please mark as answer or vote as helpful if my reply does

  • Oracle streams sql query

    hello all,
    I had setup a table level replication(one directional) on DML operations, and I've some queries which only tells me that DML transactions happened.
    But, Is there any query to check- what were the DML transations/changes happened(sqlid,sqltext,user,time,date) on source db table and that are replicated to target db table.
    Grid control doesn't have much information on what exactly the queries that were ran, it just shows DML opertaion.
    thanks,
    Vinay
    Edited by: Vinay Mummadi on Apr 26, 2013 11:04 AM

    Pl do not post duplicates - query for sql's applied

Maybe you are looking for